This is an automated email from the ASF dual-hosted git repository.

borinquenkid pushed a commit to branch 9.0.x-h7-improvement-phase3
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit 3ad3e575ffec470adb29d229c49f1bce224283e8
Author: Walter Duque de Estrada <[email protected]>
AuthorDate: Thu Oct 8 22:11:35 2026 -0500

    test(hibernate7): run the suite natively by default and the classic binder 
on demand
    
    With native binding the default, the core suite boots every manager-built
    datastore natively unless -Pgrails.test.classicDomainBinding=true sets the
    inverted JVM property, which the TCK manager and the settings default read.
    
    generated-mode-exclusions.txt becomes classic-only-specs.txt with the
    opposite meaning: the default run excludes the listed specs, the classic
    run runs everything. Every binder-internals spec on the old list was run
    against a natively bound datastore; ten pass (the generator differential
    among them, so it now runs in the default mode) and are no longer listed.
    The six that remain assert facts of the classic boot model or pin classic
    defects with @PendingFeature.
    
    Co-Authored-By: Claude Fable 5.1 <[email protected]>
---
 gradle/hibernate7-test-config.gradle               | 20 +++++-----
 grails-data-hibernate7/core/classic-only-specs.txt | 40 ++++++++++++++++++++
 .../core/generated-mode-exclusions.txt             | 43 ----------------------
 .../gorm/tests/HibernateGormDatastoreSpec.groovy   |  6 ++-
 .../core/GrailsDataHibernate7TckManager.groovy     | 21 +++++------
 5 files changed, 65 insertions(+), 65 deletions(-)

diff --git a/gradle/hibernate7-test-config.gradle 
b/gradle/hibernate7-test-config.gradle
index c43f56e8dc..25ea89a0b2 100644
--- a/gradle/hibernate7-test-config.gradle
+++ b/gradle/hibernate7-test-config.gradle
@@ -46,15 +46,17 @@ tasks.withType(Test).configureEach {
 
     useJUnitPlatform()
 
-    // Opt-in: -Pgrails.test.generatedDomainClasses=true runs the suite with 
every manager-built datastore booted through the
-    // generated-domain-class path (hibernate.generatedDomainClasses). Binder 
mode stays the default. Specs that exercise the
-    // domain binder's internals do not apply to that path and are listed, one 
class name per line, in the module's
-    // generated-mode-exclusions.txt.
-    if (providers.gradleProperty('grails.test.generatedDomainClasses').map { 
it.toBoolean() }.getOrElse(false)) {
-        systemProperty('grails.hibernate.generatedDomainClasses', 'true')
-        File exclusions = project.file('generated-mode-exclusions.txt')
-        if (exclusions.exists()) {
-            exclusions.readLines().collect { it.trim() }.findAll { it && 
!it.startsWith('#') }.each { String pattern ->
+    // Native domain binding (hibernate.generatedDomainClasses, on by default) 
is what the suite runs by default.
+    // -Pgrails.test.classicDomainBinding=true boots every datastore that does 
not set the key itself through the classic
+    // domain binder instead (system property 
grails.hibernate.classicDomainBinding, read by the settings default and by the
+    // TCK manager). Specs that exercise the classic binder's internals only 
make sense in that run and are listed, one
+    // class name per line, in the module's classic-only-specs.txt: the 
default run excludes them, the classic run runs them.
+    if (providers.gradleProperty('grails.test.classicDomainBinding').map { 
it.toBoolean() }.getOrElse(false)) {
+        systemProperty('grails.hibernate.classicDomainBinding', 'true')
+    } else {
+        File classicOnly = project.file('classic-only-specs.txt')
+        if (classicOnly.exists()) {
+            classicOnly.readLines().collect { it.trim() }.findAll { it && 
!it.startsWith('#') }.each { String pattern ->
                 filter.excludeTestsMatching(pattern)
             }
         }
diff --git a/grails-data-hibernate7/core/classic-only-specs.txt 
b/grails-data-hibernate7/core/classic-only-specs.txt
new file mode 100644
index 0000000000..f2b041d674
--- /dev/null
+++ b/grails-data-hibernate7/core/classic-only-specs.txt
@@ -0,0 +1,40 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Specs that run only when the whole suite boots through the classic domain 
binder:
+#   ./gradlew -Pgrails.test.classicDomainBinding=true 
:grails-data-hibernate7-core:test
+#
+# The default run boots every manager-built datastore through native domain 
binding (hibernate.generatedDomainClasses,
+# on by default) and EXCLUDES the specs listed here; the classic run runs 
every spec and does not read this file.
+#
+# They exercise the classic domain binder or the generator themselves against 
the classic datastore of the base spec
+# (they build binder objects by hand, bind through createPersistentEntity / 
hibernateFirstPass, or compare the binder
+# with the generator), so they need the classic binder to be the one that 
booted the datastore. A spec is a "binder
+# internals" spec when its source lives under cfg/domainbinding or mentions 
GrailsDomainBinder, GrailsDomainGenerator,
+# GeneratedDomainClassBinder, hibernateFirstPass, createPersistentEntity, 
getGrailsDomainBinder, getCollector(,
+# InFlightMetadataCollector or MetadataBuildingContext. Only those that FAIL 
with a natively bound datastore are listed,
+# one fully qualified class name per line; the others run and pass in both 
modes (every other binder-internals spec,
+# the generator differential included, was run against a natively bound 
datastore before being left out of this list).
+# The six listed assert facts of the classic boot model (a collection table 
the classic binder creates, a unique key it
+# drops, the type parameters it sets) or pin classic defects with 
@PendingFeature, which native binding does not have,
+# so they only hold against a classic datastore. The list goes away with the 
classic binder.
+#
+org.grails.orm.hibernate.cfg.domainbinding.hibernate.HibernateBasicPropertySpec
+org.grails.orm.hibernate.cfg.domainbinding.jpa.EntityCollectionKeyDefectSpec
+org.grails.orm.hibernate.cfg.domainbinding.jpa.GrailsDomainBinderEmbeddedCollectionDefectSpec
+org.grails.orm.hibernate.cfg.domainbinding.jpa.GrailsDomainBinderOptionDefectSpec
+org.grails.orm.hibernate.cfg.domainbinding.jpa.GrailsDomainGeneratorSpec
+org.grails.orm.hibernate.cfg.domainbinding.jpa.GrailsDomainGeneratorUniqueGroupSpec
diff --git a/grails-data-hibernate7/core/generated-mode-exclusions.txt 
b/grails-data-hibernate7/core/generated-mode-exclusions.txt
deleted file mode 100644
index 47bf461ab5..0000000000
--- a/grails-data-hibernate7/core/generated-mode-exclusions.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Specs that do not apply when the whole suite runs through the generated 
domain classes:
-#   ./gradlew -Pgrails.test.generatedDomainClasses=true 
:grails-data-hibernate7-core:test
-#
-# They exercise the domain binder or the generator themselves (they build 
binder objects by hand, bind through
-# createPersistentEntity / hibernateFirstPass, or compare the binder with the 
generator), so their subject is not the path
-# the switch selects. A spec is a "binder internals" spec when its source 
lives under cfg/domainbinding or mentions
-# GrailsDomainBinder, GrailsDomainGenerator, GeneratedDomainClassBinder, 
hibernateFirstPass, createPersistentEntity,
-# getGrailsDomainBinder, getCollector(, InFlightMetadataCollector or 
MetadataBuildingContext (145 source files today).
-# Only those that FAIL in generated mode are listed, one fully qualified class 
name per line; the others run and pass.
-# Binder mode (the default) runs every spec and does not read this file.
-#
-org.grails.orm.hibernate.cfg.domainbinding.GrailsPropertyBinderSpec
-org.grails.orm.hibernate.cfg.domainbinding.hibernate.HibernateBasicPropertySpec
-org.grails.orm.hibernate.cfg.domainbinding.jpa.EntityCollectionKeyDefectSpec
-org.grails.orm.hibernate.cfg.domainbinding.jpa.GrailsDomainBinderEmbeddedCollectionDefectSpec
-org.grails.orm.hibernate.cfg.domainbinding.jpa.GrailsDomainBinderOptionDefectSpec
-org.grails.orm.hibernate.cfg.domainbinding.jpa.GrailsDomainGeneratorDifferentialSpec
-org.grails.orm.hibernate.cfg.domainbinding.jpa.GrailsDomainGeneratorIndexSpec
-org.grails.orm.hibernate.cfg.domainbinding.jpa.GrailsDomainGeneratorNaturalIdSpec
-org.grails.orm.hibernate.cfg.domainbinding.jpa.GrailsDomainGeneratorSpec
-org.grails.orm.hibernate.cfg.domainbinding.jpa.GrailsDomainGeneratorTenantSpec
-org.grails.orm.hibernate.cfg.domainbinding.jpa.GrailsDomainGeneratorUniqueGroupSpec
-org.grails.orm.hibernate.cfg.domainbinding.jpa.ManyToManyOwnershipDefectSpec
-org.grails.orm.hibernate.cfg.domainbinding.secondpass.CollectionKeyBinderSpec
-org.grails.orm.hibernate.cfg.domainbinding.secondpass.ManyToOneElementBinderSpec
-org.grails.orm.hibernate.cfg.domainbinding.secondpass.MapSecondPassBinderSpec
-org.grails.orm.hibernate.cfg.domainbinding.secondpass.ToManyEntityMultiTenantFilterBinderSpec
diff --git 
a/grails-data-hibernate7/core/src/test/groovy/grails/gorm/tests/HibernateGormDatastoreSpec.groovy
 
b/grails-data-hibernate7/core/src/test/groovy/grails/gorm/tests/HibernateGormDatastoreSpec.groovy
index 8710185103..382f2257dd 100644
--- 
a/grails-data-hibernate7/core/src/test/groovy/grails/gorm/tests/HibernateGormDatastoreSpec.groovy
+++ 
b/grails-data-hibernate7/core/src/test/groovy/grails/gorm/tests/HibernateGormDatastoreSpec.groovy
@@ -72,8 +72,10 @@ class HibernateGormDatastoreSpec extends 
GrailsDataTckSpec<GrailsDataHibernate7T
 
     /**
      * Registers the domain classes like {@code 
manager.registerDomainClasses(...)}, and boots the datastore through the
-     * generated-domain-class path ({@code hibernate.generatedDomainClasses}): 
Hibernate's annotation binder binds classes
-     * generated from the GORM mapping while sessions keep persisting and 
loading the real domain classes.
+     * generated-domain-class path ({@code hibernate.generatedDomainClasses}) 
whatever mode the suite runs in: Hibernate's
+     * annotation binder binds classes generated from the GORM mapping while 
sessions keep persisting and loading the real
+     * domain classes. {@code registerDomainClasses} boots through the mode of 
the suite, native by default and the classic
+     * domain binder with {@code -Pgrails.test.classicDomainBinding=true}.
      */
     void registerGeneratedDomainClasses(Class... classes) {
         manager.registerGeneratedDomainClasses(classes)
diff --git 
a/grails-data-hibernate7/core/src/test/groovy/org/apache/grails/data/hibernate7/core/GrailsDataHibernate7TckManager.groovy
 
b/grails-data-hibernate7/core/src/test/groovy/org/apache/grails/data/hibernate7/core/GrailsDataHibernate7TckManager.groovy
index b8912d7c25..6edf0bda0c 100644
--- 
a/grails-data-hibernate7/core/src/test/groovy/org/apache/grails/data/hibernate7/core/GrailsDataHibernate7TckManager.groovy
+++ 
b/grails-data-hibernate7/core/src/test/groovy/org/apache/grails/data/hibernate7/core/GrailsDataHibernate7TckManager.groovy
@@ -57,21 +57,22 @@ class GrailsDataHibernate7TckManager extends 
GrailsDataTckManager {
     boolean isTransactional = true
 
     /**
-     * System property that boots every datastore through the 
generated-domain-class path
-     * ({@code hibernate.generatedDomainClasses}). It is off by default; the 
Gradle property
-     * {@code -Pgrails.test.generatedDomainClasses=true} sets it on the test 
JVM, which runs the whole module suite in
-     * generated mode. The datastores this manager builds read it, and so does 
the default of
+     * System property that boots every datastore through the classic domain 
binder
+     * ({@code hibernate.generatedDomainClasses: false}). Native domain 
binding is the default; the Gradle property
+     * {@code -Pgrails.test.classicDomainBinding=true} sets this property on 
the test JVM, which runs the whole module suite
+     * in classic mode. The datastores this manager builds read it, and so 
does the default of
      * {@code HibernateConnectionSourceSettings}, which covers the specs that 
build their own {@code HibernateDatastore}
      * without setting {@code hibernate.generatedDomainClasses} themselves.
      */
-    static final String GENERATED_MODE_PROPERTY = 
'grails.hibernate.generatedDomainClasses'
+    static final String CLASSIC_MODE_PROPERTY = 
'grails.hibernate.classicDomainBinding'
 
-    boolean generatedDomainClasses = 
Boolean.getBoolean(GENERATED_MODE_PROPERTY)
+    boolean generatedDomainClasses = !Boolean.getBoolean(CLASSIC_MODE_PROPERTY)
 
     /**
      * Registers the classes like {@link #registerDomainClasses} and boots the 
datastore through the generated-domain-class
-     * path: Hibernate's annotation binder binds classes generated from the 
GORM mapping, and the real domain classes are what
-     * sessions persist and load. {@code registerDomainClasses} is unchanged 
and keeps booting through the domain binder.
+     * path whatever mode the suite runs in: Hibernate's annotation binder 
binds classes generated from the GORM mapping,
+     * and the real domain classes are what sessions persist and load. {@code 
registerDomainClasses} boots through the
+     * mode of the suite: native by default, the classic domain binder with 
{@link #CLASSIC_MODE_PROPERTY}.
      */
     void registerGeneratedDomainClasses(Class... classes) {
         generatedDomainClasses = true
@@ -89,9 +90,7 @@ class GrailsDataHibernate7TckManager extends 
GrailsDataTckManager {
         grailsApplication = new DefaultGrailsApplication(domainClasses as 
Class[], new GroovyClassLoader(GrailsDataHibernate7TckManager.getClassLoader()))
         grailsConfig.dataSource.dbCreate = "create-drop"
         grailsConfig.hibernate.proxy_factory_class = 
"org.grails.orm.hibernate.proxy.ByteBuddyGroovyProxyFactory"
-        if (generatedDomainClasses) {
-            grailsConfig.hibernate.generatedDomainClasses = true
-        }
+        grailsConfig.hibernate.generatedDomainClasses = generatedDomainClasses
         grailsConfig.'grails.gorm.default.mapping' = {
             id generator: 'identity'
         }

Reply via email to