-
-
Notifications
You must be signed in to change notification settings - Fork 962
Support for Gorm Entities with same name, but different packages #15036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 7.0.x
Are you sure you want to change the base?
Support for Gorm Entities with same name, but different packages #15036
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add tests for this to merge it.
@jdaugherty the scaffolding plugin doesn't have any tests? Do you know of any? This is a fix. If there are no existing tests, it is better to merge than to leave broken, no? |
@codeconsole We should add a functional test project. DomainServiceLocator appears more complex than it should be. How do we know an existing workflow didn't break without a test? |
I've simplified it to its original intent. It now just only uses services of type GormService
RestfulServiceController is a new class that is just an example of the Service Layer pattern. There are no existing workflows and it would be silly to just add 1 test to the entire plugin that only tests this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added this to Wednesday's developer meeting to see where people stand on this. I tried to point out in the review some possible problem points. I'm not 100% sure if it would cause compilation issues - but if it does we have to agree to do another RC.
grails-scaffolding/src/main/groovy/grails/plugin/scaffolding/DomainServiceLocator.java
Show resolved
Hide resolved
grails-scaffolding/src/main/groovy/grails/plugin/scaffolding/DomainServiceLocator.java
Show resolved
Hide resolved
grails-scaffolding/src/main/groovy/grails/plugin/scaffolding/RestfulServiceController.groovy
Show resolved
Hide resolved
* | ||
* Keeps a single shared cache for the whole app. | ||
*/ | ||
public final class DomainServiceLocator { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a functional test for scaffolding - we should be able to easily add 2 examples of this scenario to prove this works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdaugherty Are there existing functional tests for scaffolding? if so, do you have an explanation how they work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
our functional test apps are under grails-test-examples/*
. We do not have an existing app. We only want you to generate one and test the 2 scenarios. We do not think we need to test all of scaffolding, but as we add more features we need to start enhancing the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example:
Add a subproject: grails-test-examples/scaffolding
(can copy gsp or sitemesh if you want as a basis, the only thing that needs updated is settings.gradle & adding the files from grails-test-examples/scaffolding). Then just add your domain scenario & a geb test that calls the screen / makes sure it doesn't error.
We're not asking you to test every functionality of scaffolding. Just to grow the test coverage in this area as we make enhancements.
For the scaffolding functional tests, the following existing test projects are a good place to copy as a quick starting point. These all use Geb w/ TestContainers. https://github.com/apache/grails-core/tree/7.0.x/grails-test-examples/geb |
@jamesfredley are there already functional tests for the scaffolding plugin in those examples? Where exactly are you saying to put it? |
Currently RestfulServiceController will not work for situations where you have domain objects with the same name.
This scenario is more likely for complex websites that use plugins with domain objects.
For instance:
This introduces a fix that will resolve the appropriate service class for the respective GormService