Skip to content

Commit 637da9c

Browse files
committed
test(hibernate7): register domain classes in the two specs the TCK API now requires
Completes the PR-C mirror. The merged GrailsDataTckManager makes domainClasses a private set with an empty default, so every spec must register the classes it uses via registerDomainClasses(...). The earlier mirror migrated the 27 specs using manager.domainClasses.addAll([...]), but two specs used other patterns and were missed - the full pre-PR test run surfaced them: - HibernateOptimisticLockingSpec had no setupSpec (it relied on the old manager's non-empty default set). Added setupSpec registering OptLockVersioned and OptLockNotVersioned, matching Hibernate5OptimisticLockingSpec. - HibernateValidationSpec used `manager.domainClasses += [...]` (compound-assign, now a ReadOnlyPropertyException). Switched to registerDomainClasses(...) with the full class list (TestEntity, ChildEntity included, since the default is empty), matching the hibernate5 HibernateValidationSpec. Verified: ./gradlew :grails-data-hibernate7-core:test now passes (571 tests, 0 failures, 26 skipped); all four violation reports are clean. Assisted-by: claude-code:claude-opus-4-8
1 parent 7931bc7 commit 637da9c

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

grails-data-hibernate7/core/src/test/groovy/grails/gorm/tests/HibernateOptimisticLockingSpec.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ import org.grails.orm.hibernate.support.hibernate7.HibernateOptimisticLockingFai
2929
*/
3030
class HibernateOptimisticLockingSpec extends GrailsDataTckSpec<GrailsDataHibernate7TckManager> {
3131

32+
void setupSpec() {
33+
manager.registerDomainClasses(OptLockVersioned, OptLockNotVersioned)
34+
}
35+
3236
void "Test optimistic locking"() {
3337

3438
given:

grails-data-hibernate7/core/src/test/groovy/grails/gorm/tests/HibernateValidationSpec.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
3232
*/
3333
class HibernateValidationSpec extends GrailsDataTckSpec<GrailsDataHibernate7TckManager> {
3434
void setupSpec() {
35-
manager.domainClasses += [ClassWithListArgBeforeValidate, ClassWithNoArgBeforeValidate,
36-
ClassWithOverloadedBeforeValidate]
35+
manager.registerDomainClasses(ClassWithListArgBeforeValidate, ClassWithNoArgBeforeValidate,
36+
ClassWithOverloadedBeforeValidate, TestEntity, ChildEntity)
3737
}
3838

3939
void "Test that validate works without a bound Session"() {

0 commit comments

Comments
 (0)