borinquenkid opened a new pull request, #16147:
URL: https://github.com/apache/grails-core/pull/16147
## Summary
- Adds unit coverage for `AbstractDatastoreInitializer` via a new shared
`TestDatastoreInitializer` test double.
- Closes test coverage gaps in the three production subclasses (Hibernate5,
Hibernate7, MongoDB). `grails-data-neo4j` was excluded: it's not part of the
root build, its README says it hasn't been updated for the current release, and
its own standalone build is broken.
- Fixes four real bugs found while writing that coverage, all following the
same pattern - a customizable field silently ignored because a
bean-registration/config-lookup site hardcoded a literal instead:
- `MongoDbDataStoreSpringInitializer.mongoBeanName` ignored when building
a new `MongoClient` from scratch.
- `MongoDbDataStoreSpringInitializer.databaseName` ignored entirely -
actively broken for real Grails+MongoDB apps via `MongodbGrailsPlugin`, which
sets it expecting a default database name.
- `HibernateDatastoreSpringInitializer.defaultDataSourceBeanName`
hardcoded around instead of used, in both Hibernate5 and Hibernate7.
- `HibernateDatastoreSpringInitializer.enableReload` ignored entirely -
`HibernateGrailsPlugin` sets it to enable dev-mode reload by default, but it
never reached `HibernateConnectionSourceSettings`.
- Removes dead code identified via git archaeology (properties set by real
plugin code but never read anywhere, with no surviving mechanism to restore):
`registerApplicationIfNotPresent` (base class, dead since a 2018 simplification
commit) and `grailsPlugin` (Hibernate initializers, dead since a January 2017
refactor). Also removes `getTestDbUrl()`, `defaultSessionFactoryBeanName`, and
`SESSION_FACTORY_BEAN_NAME` from both Hibernate initializers - confirmed unused
anywhere in the reachable codebase.
## Test plan
- [x] `grails-datamapping-core` full test suite + codeStyle
(Checkstyle/CodeNarc)
- [x] `grails-data-hibernate7` full test suite + codeStyle
- [x] `grails-data-hibernate5` full test suite + codeStyle
- [x] `grails-data-mongodb-core` full test suite (real MongoDB via
Testcontainers) + codeStyle
- [x] `grails-data-mongodb` (grails-plugin) compiles clean
- [x] Every bug fix has a dedicated regression test, including two verified
end-to-end against a live H2-backed `HibernateDatastore`/live MongoDB
container, not just unit-level
Co-Authored-By: Claude Sonnet 5 <[email protected]>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]