jdaugherty commented on code in PR #15568:
URL: https://github.com/apache/grails-core/pull/15568#discussion_r3254985528
##########
grails-test-examples/hibernate7/grails-multitenant-multi-datasource/src/integration-test/groovy/functionaltests/MultiTenantMultiDataSourceSpec.groovy:
##########
@@ -46,14 +46,17 @@ import org.grails.orm.hibernate.HibernateDatastore
* @see example.MetricService
*/
@Integration
-@RestoreSystemProperties
class MultiTenantMultiDataSourceSpec extends Specification {
@Autowired
HibernateDatastore hibernateDatastore
MetricService metricService
+ void cleanup() {
Review Comment:
`@RestoreSystemProperties` adopted.
##########
grails-test-examples/hibernate7/grails-database-per-tenant/src/test/groovy/example/DatabasePerTenantSpec.groovy:
##########
@@ -42,6 +43,10 @@ class DatabasePerTenantSpec extends HibernateSpec {
)
}
+ def cleanup() {
+ System.setProperty(SystemPropertyTenantResolver.PROPERTY_NAME, "")
Review Comment:
`@RestoreSystemProperties` adopted.
##########
grails-test-examples/hibernate7/grails-partitioned-multi-tenancy/grails-app/controllers/example/BookController.groovy:
##########
@@ -54,8 +49,7 @@ class BookController {
}
def create() {
- def book = new Book(params.subMap(bindParams))
- respond book
+ respond new Book(params)
Review Comment:
Reverted — `create()` is back to `params.subMap(bindParams)`.
##########
grails-test-examples/hibernate7/grails-hibernate/grails-app/controllers/functional/tests/BookController.groovy:
##########
@@ -43,8 +38,7 @@ class BookController {
}
def create() {
- def book = new Book(params.subMap(bindParams))
- respond book
+ respond new Book(params)
Review Comment:
Reverted — `create()` is back to `params.subMap(bindParams)`.
##########
grails-test-examples/hibernate7/grails-database-per-tenant/grails-app/controllers/example/BookController.groovy:
##########
@@ -54,8 +49,7 @@ class BookController {
}
def create() {
- def book = new Book(params.subMap(bindParams))
- respond book
+ respond new Book(params)
Review Comment:
Reverted — `create()` is back to `params.subMap(bindParams)`.
##########
grails-test-examples/hibernate7/grails-hibernate/src/test/groovy/functional/tests/BookControllerUnitSpec.groovy:
##########
@@ -97,7 +100,7 @@ class BookControllerUnitSpec extends HibernateSpec
implements ControllerUnitTest
when:"A domain instance is passed to the show action"
populateValidParams(params)
- def book = new Book(params.subMap(['title']))
+ def book = new Book(params)
Review Comment:
Tests are back to binding specific fields via `params.subMap(['title'])`.
##########
grails-test-examples/hibernate7/grails-hibernate/src/integration-test/groovy/functional/tests/BookControllerSpec.groovy:
##########
@@ -24,7 +24,7 @@ import functional.tests.pages.BookShowPage
import grails.plugin.geb.ContainerGebSpec
import grails.testing.mixin.integration.Integration
-@Integration
+@Integration(applicationClass = Application)
Review Comment:
Reverted — `applicationClass` removed, back to plain `@Integration`.
##########
grails-test-examples/gorm/src/integration-test/groovy/gorm/GormCriteriaQueriesSpec.groovy:
##########
@@ -24,21 +24,20 @@ import spock.lang.Unroll
import grails.gorm.DetachedCriteria
import grails.gorm.transactions.Rollback
import grails.testing.mixin.integration.Integration
-
/**
* Tests for GORM Criteria Queries - both createCriteria() and
DetachedCriteria.
*
* Criteria queries provide a type-safe, programmatic way to build
* complex queries without writing HQL strings.
*/
@Rollback
-@Integration
+@Integration(applicationClass = Application)
Review Comment:
`applicationClass` removed.
##########
grails-datamapping-core/src/main/groovy/org/grails/datastore/gorm/GormStaticApi.groovy:
##########
@@ -1012,32 +1002,31 @@ class GormStaticApi<D> extends AbstractGormApi<D>
implements GormAllOperations<D
/**
* Creates and binds a new session for the scope of the given closure
*/
- <T> T withNewSession(Closure<T> callable) {
+ public <T> T withNewSession(Closure<T> callable) {
def session = datastore.connect()
try {
- DatastoreUtils.bindNewSession(session)
+ DatastoreUtils.bindNewSession session
return callable?.call(session)
}
finally {
- DatastoreUtils.unbindSession(session)
+ DatastoreUtils.unbindSession session
}
}
/**
* Creates and binds a new session for the scope of the given closure
*/
- <T> T withStatelessSession(Closure<T> callable) {
+ public <T> T withStatelessSession(Closure<T> callable) {
if (datastore instanceof StatelessDatastore) {
def session = datastore.connectStateless()
try {
- DatastoreUtils.bindNewSession(session)
+ DatastoreUtils.bindNewSession session
Review Comment:
Parens restored on all method calls.
##########
grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/SizeQuerySpecHibernate.groovy:
##########
@@ -0,0 +1,193 @@
+/*
+ * 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.base.GrailsDataTckSpec
+import org.apache.grails.data.testing.tck.domains.Child_BT_Default_P
+import org.apache.grails.data.testing.tck.domains.Owner_Default_Bi_P
+import spock.lang.Unroll
+
+/**
+ * Tests for querying the size of collections etc.
+ */
+@IgnoreIf({ System.getProperty('mongodb.gorm.suite') == 'true' })
Review Comment:
`@IgnoreIf` is correct here — this is a permanent Mongo limitation, not a
pending feature, so `@PendingFeatureIf` would be misleading.
--
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]