borinquenkid commented on code in PR #15568:
URL: https://github.com/apache/grails-core/pull/15568#discussion_r3440347284


##########
grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/RLikeSpec.groovy:
##########
@@ -0,0 +1,52 @@
+/*
+ *  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 grails.gorm.annotation.Entity
+import org.apache.grails.data.testing.tck.base.GrailsDataTckSpec
+import spock.lang.IgnoreIf
+
+@IgnoreIf({ System.getProperty('hibernate7.gorm.suite') == 'true' })
+class RLikeSpec extends GrailsDataTckSpec {
+
+    void setupSpec() {
+        manager.addAllDomainClasses([RlikeFoo])
+    }
+
+    @spock.lang.Requires({ System.getProperty('hibernate5.gorm.suite') == 
'true' || System.getProperty('hibernate7.gorm.suite') == 'true' || 
System.getProperty('mongodb.gorm.suite') == 'true' })

Review Comment:
   The class-level `@IgnoreIf` was removed in the current revision — neither 
the TCK `RLikeSpec` nor the H5/H7 versions carry one any more. The TCK spec 
runs on any datastore that registers it in its suite; there are no annotation 
barriers. If GraphQL (or any other datastore) supports rlike, it can include 
this spec in its TCK suite without modification.



##########
grails-data-hibernate7/core/src/test/groovy/org/apache/grails/data/testing/tck/tests/PagedResultSpecHibernate.groovy:
##########
@@ -0,0 +1,132 @@
+/*
+ * 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 spock.lang.IgnoreIf
+
+import org.apache.grails.data.testing.tck.domains.Person
+import org.apache.grails.data.testing.tck.base.GrailsDataTckSpec
+
+@IgnoreIf({
+        System.getProperty('mongodb.gorm.suite') == 'true' ||
+                System.getProperty('hibernate5.gorm.suite') == 'true' ||
+                System.getProperty('core.gorm.suite') == 'true'
+})
+class PagedResultSpecHibernate extends GrailsDataTckSpec {

Review Comment:
   The H7-specific placement is intentional: `PagedResultSpecHibernate` tests 
the count-via-subquery path in H7's `AbstractHibernateQuery.countResults()` 
override. The generic TCK `PagedResultSpec` covers basic paging; this spec 
covers the H7 optimised derived-table subquery count that only exists in the H7 
implementation. It lives in `grails-data-hibernate7/core/src/test/` because it 
exercises H7-specific internal behaviour.



##########
grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/Hibernate5OptimisticLockingSpec.groovy:
##########
@@ -44,29 +69,36 @@ class Hibernate5OptimisticLockingSpec extends 
GrailsDataTckSpec<GrailsDataHibern
 
         when:
         OptLockVersioned.withTransaction {
-            o = OptLockVersioned.get(o.id)
+            try {
+                o = OptLockVersioned.get(o.id)
+
+                Thread.start {
+                    OptLockVersioned.withTransaction { s ->
+                        def reloaded = OptLockVersioned.get(o.id)
+                        assert reloaded
+                        assert reloaded != o
+                        reloaded.name += ' in new session'
+                        reloaded.save(flush: true)
+                        assert reloaded.version == 1
+                        assert o.version == 0
+                    }
+
+                }.join()
+
+                o.name += ' in main session'
+                o.save(flush: true)
 
-            Thread.start {
-                OptLockVersioned.withTransaction { s ->
-                    def reloaded = OptLockVersioned.get(o.id)
-                    assert reloaded
-                    assert reloaded != o
-                    reloaded.name += ' in new session'
-                    reloaded.save(flush: true)
-                    assert reloaded.version == 1
-                    assert o.version == 0
+                manager.session.clear()
+                o = OptLockVersioned.get(o.id)
+            } catch (Throwable e) {
+                System.getProperties().each { key, value ->
+                    println "${key}: ${value}"
                 }
-
-            }.join()
-
-            o.name += ' in main session'
-            o.save(flush: true)
-
-            manager.session.clear()
-            o = OptLockVersioned.get(o.id)
+                throw e
+            }
         }
         then:
-        thrown HibernateOptimisticLockingFailureException
+        thrown OptimisticLockingFailureException

Review Comment:
   `HibernateOptimisticLockingFailureException` is a subclass of 
`OptimisticLockingFailureException`. The assertion was relaxed to the parent 
class to be resilient across Hibernate versions and JPA provider configurations 
that may throw different concrete subtypes. The try/catch wrapper was added 
purely for debugging (it prints system properties before re-throwing), so the 
exception assertion itself is unchanged in intent.



-- 
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]

Reply via email to