You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by bo...@apache.org on 2026/10/04 00:28:29 UTC
(grails-core) 08/08: test: run NullValueEqualSpec and PagedResultSpec from the TCK on Hibernate 7
This is an automated email from the ASF dual-hosted git repository.
borinquenkid pushed a commit to branch 9.0.x-h7-improvement-phase1
in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 7761f6b850d95b643673d78f873a0138609dcc30
Author: Walter Duque de Estrada <wb...@mac.com>
AuthorDate: Sat Oct 3 19:22:03 2026 -0500
test: run NullValueEqualSpec and PagedResultSpec from the TCK on Hibernate 7
NullValueEqualSpec skipped its 'not equal' feature on Hibernate 7 although it
passes, and PagedResultSpec was skipped on Hibernate 7 only because it asserted
the exact class name PagedResultList while Hibernate subtypes it. Lift the first
skip and make the second assertion match any *PagedResultList; the exact
HibernatePagedResultList type stays covered by HibernateGormStaticApiSpec.
The two Hibernate 7 forks that existed to work around those gates
(NullValueEqualSpec and PagedResultSpecHibernate) were verbatim copies and are
removed.
Co-Authored-By: Claude Sonnet 5.5 <no...@anthropic.com>
---
.../grails/gorm/tests/NullValueEqualSpec.groovy | 56 ---------
.../tck/tests/PagedResultSpecHibernate.groovy | 125 ---------------------
.../testing/tck/tests/NullValueEqualSpec.groovy | 2 +-
.../data/testing/tck/tests/PagedResultSpec.groovy | 10 +-
4 files changed, 5 insertions(+), 188 deletions(-)
diff --git a/grails-data-hibernate7/core/src/test/groovy/grails/gorm/tests/NullValueEqualSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/grails/gorm/tests/NullValueEqualSpec.groovy
deleted file mode 100644
index 75201a0912..0000000000
--- a/grails-data-hibernate7/core/src/test/groovy/grails/gorm/tests/NullValueEqualSpec.groovy
+++ /dev/null
@@ -1,56 +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.
- */
-
-package grails.gorm.tests
-
-import org.apache.grails.data.testing.tck.domains.ChildEntity
-import org.apache.grails.data.testing.tck.domains.TestEntity
-import spock.lang.IgnoreIf
-
-class NullValueEqualSpec extends HibernateGormDatastoreSpec {
-
- void setupSpec() {
- manager.registerDomainClasses(TestEntity)
- }
-
- void "test null value in equal"() {
- when:
- new TestEntity(name: "Fred", age: null).save(failOnError: true)
- new TestEntity(name: "Bob", age: 11).save(failOnError: true)
- new TestEntity(name: "Jack", age: null).save(flush: true, failOnError: true)
-
- then:
- TestEntity.countByAge(11) == 1
- TestEntity.findAllByAge(null).size() == 2
- TestEntity.countByAge(null) == 2
- }
-
- void "test null value in not equal"() {
- when:
- new TestEntity(name: "Fred", age: null).save(failOnError: true)
- new TestEntity(name: "Bob", age: 11).save(failOnError: true)
- new TestEntity(name: "Jack", age: null).save(flush: true, failOnError: true)
- def count = TestEntity.countByAgeNotEqual(11)
-
- then:
- TestEntity.list().size() == 3
- TestEntity.countByAgeNotEqual(null) == 1
- TestEntity.countByAgeNotEqual(11) == 2
- }
-}
diff --git a/grails-data-hibernate7/core/src/test/groovy/org/apache/grails/data/testing/tck/tests/PagedResultSpecHibernate.groovy b/grails-data-hibernate7/core/src/test/groovy/org/apache/grails/data/testing/tck/tests/PagedResultSpecHibernate.groovy
deleted file mode 100644
index 2cb6c18078..0000000000
--- a/grails-data-hibernate7/core/src/test/groovy/org/apache/grails/data/testing/tck/tests/PagedResultSpecHibernate.groovy
+++ /dev/null
@@ -1,125 +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.
- */
-package org.apache.grails.data.testing.tck.tests
-
-import org.apache.grails.data.testing.tck.base.GrailsDataTckSpec
-import org.apache.grails.data.testing.tck.domains.Person
-
-class PagedResultSpecHibernate extends GrailsDataTckSpec {
-
- void setupSpec() {
- manager.registerDomainClasses(Person)
- }
-
- void "Test that a getTotalCount will return 0 on empty result from the list() method"() {
- when: 'A query is executed that returns no results'
- def results = Person.list(max: 1)
-
- then:
- results.size() == 0
- results.totalCount == 0
- }
-
- void "Test that a paged result list is returned from the list() method with pagination params"() {
- given: 'Some people'
- createPeople()
-
- when: 'The list method is used with pagination params'
- def results = Person.list(offset: 2, max: 2)
-
- then: 'You get a paged result list back'
- results.getClass().simpleName == 'HibernatePagedResultList' // Grails/Hibernate has a custom class in different package
- results.size() == 2
- results[0].firstName == 'Bart'
- results[1].firstName == 'Lisa'
- results.totalCount == 6
- }
-
- void "Test that a paged result list is returned from the list() method with pagination and sorting params"() {
- given: 'Some people'
- createPeople()
-
- when: 'The list method is used with pagination params'
- def results = Person.list(offset: 2, max: 2, sort: 'firstName', order: 'DESC')
-
- then: 'You get a paged result list back'
- results.getClass().simpleName == 'HibernatePagedResultList' // Grails/Hibernate has a custom class in different package
- results.size() == 2
- results[0].firstName == 'Homer'
- results[1].firstName == 'Fred'
- results.totalCount == 6
- }
-
- void "Test that a getTotalCount will return 0 on empty result from the criteria"() {
- given: 'Some people'
- createPeople()
-
- when: 'A query is executed that returns no results'
- def results = Person.createCriteria().list(max: 1) {
- eq 'lastName', 'NotFound'
- }
-
- then:
- results.size() == 0
- results.totalCount == 0
- }
-
- void "Test that a paged result list is returned from the critera with pagination params"() {
- given: 'Some people'
- createPeople()
-
- when: 'The list method is used with pagination params'
- def results = Person.createCriteria().list(offset: 1, max: 2) {
- eq 'lastName', 'Simpson'
- }
-
- then: 'You get a paged result list back'
- results.getClass().simpleName == 'HibernatePagedResultList' // Grails/Hibernate has a custom class in different package
- results.size() == 2
- results[0].firstName == 'Marge'
- results[1].firstName == 'Bart'
- results.totalCount == 4
- }
-
- void "Test that a paged result list is returned from the critera with pagination and sorting params"() {
- given: 'Some people'
- createPeople()
-
- when: 'The list method is used with pagination params'
- def results = Person.createCriteria().list(offset: 1, max: 2, sort: 'firstName', order: 'DESC') {
- eq 'lastName', 'Simpson'
- }
-
- then: 'You get a paged result list back'
- results.getClass().simpleName == 'HibernatePagedResultList' // Grails/Hibernate has a custom class in different package
- results.size() == 2
- results[0].firstName == 'Lisa'
- results[1].firstName == 'Homer'
- results.totalCount == 4
- }
-
- protected void createPeople() {
- new Person(firstName: 'Homer', lastName: 'Simpson', age: 45).save()
- new Person(firstName: 'Marge', lastName: 'Simpson', age: 40).save()
- new Person(firstName: 'Bart', lastName: 'Simpson', age: 9).save()
- new Person(firstName: 'Lisa', lastName: 'Simpson', age: 7).save()
- new Person(firstName: 'Barney', lastName: 'Rubble', age: 35).save()
- new Person(firstName: 'Fred', lastName: 'Flinstone', age: 41).save()
- }
-}
diff --git a/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/NullValueEqualSpec.groovy b/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/NullValueEqualSpec.groovy
index c6fcb55472..b4a8264bee 100644
--- a/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/NullValueEqualSpec.groovy
+++ b/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/NullValueEqualSpec.groovy
@@ -42,7 +42,7 @@ class NullValueEqualSpec extends GrailsDataTckSpec {
TestEntity.countByAge(null) == 2
}
- @IgnoreIf({ System.getProperty('hibernate5.gorm.suite') || System.getProperty('hibernate7.gorm.suite') })
+ @IgnoreIf({ System.getProperty('hibernate5.gorm.suite') })
void 'test null value in not equal'() {
when:
new TestEntity(name: 'Fred', age: null).save(failOnError: true)
diff --git a/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/PagedResultSpec.groovy b/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/PagedResultSpec.groovy
index 34cf001825..f3552416dd 100644
--- a/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/PagedResultSpec.groovy
+++ b/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/PagedResultSpec.groovy
@@ -23,8 +23,6 @@ import spock.lang.IgnoreIf
import org.apache.grails.data.testing.tck.base.GrailsDataTckSpec
import org.apache.grails.data.testing.tck.domains.Person
-// Hibernate 7 has its own test because it subtypes the paged list
-@IgnoreIf({ System.getProperty('hibernate7.gorm.suite') })
class PagedResultSpec extends GrailsDataTckSpec {
@Override
@@ -49,7 +47,7 @@ class PagedResultSpec extends GrailsDataTckSpec {
def results = Person.list(offset: 2, max: 2)
then: 'You get a paged result list back'
- results.getClass().simpleName == 'PagedResultList' // Grails/Hibernate has a custom class in different package
+ results.getClass().simpleName.endsWith('PagedResultList') // Hibernate subtypes it (HibernatePagedResultList), in a different package
results.size() == 2
results[0].firstName == 'Bart'
results[1].firstName == 'Lisa'
@@ -64,7 +62,7 @@ class PagedResultSpec extends GrailsDataTckSpec {
def results = Person.list(offset: 2, max: 2, sort: 'firstName', order: 'DESC')
then: 'You get a paged result list back'
- results.getClass().simpleName == 'PagedResultList' // Grails/Hibernate has a custom class in different package
+ results.getClass().simpleName.endsWith('PagedResultList') // Hibernate subtypes it (HibernatePagedResultList), in a different package
results.size() == 2
results[0].firstName == 'Homer'
results[1].firstName == 'Fred'
@@ -102,7 +100,7 @@ class PagedResultSpec extends GrailsDataTckSpec {
}
then: 'You get a paged result list back'
- results.getClass().simpleName == 'PagedResultList' // Grails/Hibernate has a custom class in different package
+ results.getClass().simpleName.endsWith('PagedResultList') // Hibernate subtypes it (HibernatePagedResultList), in a different package
results.size() == 2
results[0].firstName == 'Marge'
results[1].firstName == 'Bart'
@@ -119,7 +117,7 @@ class PagedResultSpec extends GrailsDataTckSpec {
}
then: 'You get a paged result list back'
- results.getClass().simpleName == 'PagedResultList' // Grails/Hibernate has a custom class in different package
+ results.getClass().simpleName.endsWith('PagedResultList') // Hibernate subtypes it (HibernatePagedResultList), in a different package
results.size() == 2
results[0].firstName == 'Lisa'
results[1].firstName == 'Homer'