From 23d4769a24f4b348e012a65a4ff68cd37ba9a497 Mon Sep 17 00:00:00 2001 From: James Daugherty Date: Wed, 30 Oct 2024 09:20:00 -0400 Subject: [PATCH 1/3] Update for H2 reserved keywords, Add .sdkmanrc, Update to ContainerGebSpec, Remove @Ignore on tests fixed by classpath scanning fixes --- .sdkmanrc | 1 + .../HibernateGormAutoConfigurationSpec.groovy | 1 - .../src/test/groovy/example/ProxySpec.groovy | 1 - .../example/DatabasePerTenantSpec.groovy | 6 +-- examples/grails3-hibernate5/build.gradle | 28 +------------ .../tests/BookControllerSpec.groovy | 6 +-- .../tests/CascadeValidationSpec.groovy | 1 - .../resources/GebConfig.groovy | 41 ------------------- .../tests/BookControllerUnitSpec.groovy | 5 --- .../grails3-multiple-datasources/build.gradle | 27 +----------- .../resources/GebConfig.groovy | 41 ------------------- .../PartitionedMultiTenancySpec.groovy | 3 -- .../grails3-schema-per-tenant/build.gradle | 29 +------------ .../resources/GebConfig.groovy | 41 ------------------- .../groovy/example/SchemaPerTenantSpec.groovy | 2 - gradle.properties | 3 -- .../grails/gorm/tests/SqlQuerySpec.groovy | 6 --- .../TablePerSubClassAndEmbeddedSpec.groovy | 2 - .../dirtychecking/PropertyFieldSpec.groovy | 1 - .../tests/hasmany/ListCollectionSpec.groovy | 1 - .../TwoUnidirectionalHasManySpec.groovy | 4 ++ ...iTenancyBidirectionalManyToManySpec.groovy | 5 ++- ...iTenancyUnidirectionalOneToManySpec.groovy | 2 +- .../tests/services/DataServiceSpec.groovy | 17 -------- .../tests/softdelete/SoftDeleteSpec.groovy | 1 - .../tests/traits/TraitPropertySpec.groovy | 1 - .../gorm/tests/uuid/UuidInsertSpec.groovy | 1 - .../validation/CascadeValidationSpec.groovy | 1 - .../SaveWithInvalidEntitySpec.groovy | 2 +- .../validation/UniqueWithHasOneSpec.groovy | 3 -- .../validation/UniqueWithinGroupSpec.groovy | 4 -- 31 files changed, 19 insertions(+), 268 deletions(-) create mode 100644 .sdkmanrc delete mode 100644 examples/grails3-hibernate5/src/integration-test/resources/GebConfig.groovy delete mode 100644 examples/grails3-multiple-datasources/src/integration-test/resources/GebConfig.groovy delete mode 100644 examples/grails3-schema-per-tenant/src/integration-test/resources/GebConfig.groovy diff --git a/.sdkmanrc b/.sdkmanrc new file mode 100644 index 00000000..cb8d5cb2 --- /dev/null +++ b/.sdkmanrc @@ -0,0 +1 @@ +java=17.0.12-librca \ No newline at end of file diff --git a/boot-plugin/src/test/groovy/org/grails/datastore/gorm/boot/autoconfigure/HibernateGormAutoConfigurationSpec.groovy b/boot-plugin/src/test/groovy/org/grails/datastore/gorm/boot/autoconfigure/HibernateGormAutoConfigurationSpec.groovy index 7afc32d2..c1998d38 100644 --- a/boot-plugin/src/test/groovy/org/grails/datastore/gorm/boot/autoconfigure/HibernateGormAutoConfigurationSpec.groovy +++ b/boot-plugin/src/test/groovy/org/grails/datastore/gorm/boot/autoconfigure/HibernateGormAutoConfigurationSpec.groovy @@ -35,7 +35,6 @@ class HibernateGormAutoConfigurationSpec extends Specification{ PropertyPlaceholderAutoConfiguration.class); } - @Ignore("java.lang.IllegalStateException: Either class [org.grails.datastore.gorm.boot.autoconfigure.Person] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void 'Test that GORM is correctly configured'() { when:"The context is refreshed" context.refresh() diff --git a/examples/grails-hibernate-groovy-proxy/src/test/groovy/example/ProxySpec.groovy b/examples/grails-hibernate-groovy-proxy/src/test/groovy/example/ProxySpec.groovy index 61d650b0..73c50c9b 100644 --- a/examples/grails-hibernate-groovy-proxy/src/test/groovy/example/ProxySpec.groovy +++ b/examples/grails-hibernate-groovy-proxy/src/test/groovy/example/ProxySpec.groovy @@ -13,7 +13,6 @@ import spock.lang.Ignore class ProxySpec extends HibernateSpec { @Rollback - @Ignore("java.lang.IllegalStateException: Either class [example.Customer] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "Test Proxy"() { when: new Customer(1, "Bob").save(failOnError: true, flush: true) diff --git a/examples/grails3-database-per-tenant/src/test/groovy/example/DatabasePerTenantSpec.groovy b/examples/grails3-database-per-tenant/src/test/groovy/example/DatabasePerTenantSpec.groovy index 11b8cf02..2f40a910 100644 --- a/examples/grails3-database-per-tenant/src/test/groovy/example/DatabasePerTenantSpec.groovy +++ b/examples/grails3-database-per-tenant/src/test/groovy/example/DatabasePerTenantSpec.groovy @@ -27,8 +27,7 @@ class DatabasePerTenantSpec extends HibernateSpec { System.setProperty(SystemPropertyTenantResolver.PROPERTY_NAME, "") } - //@Rollback("moreBooks") - @Ignore("java.lang.IllegalStateException: Either class [example.Book] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") + @Rollback("moreBooks") void "Test should rollback changes in a previous test"() { when:"When there is no tenant" Book.count() @@ -45,8 +44,7 @@ class DatabasePerTenantSpec extends HibernateSpec { bookDataService.countBooks() == 1 } - @Ignore("java.lang.IllegalStateException: Either class [example.Book] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") - void 'Test database per tenant'() { + void 'Test database per tenant'() { when:"When there is no tenant" Book.count() diff --git a/examples/grails3-hibernate5/build.gradle b/examples/grails3-hibernate5/build.gradle index 7657e3e8..ba0862d7 100644 --- a/examples/grails3-hibernate5/build.gradle +++ b/examples/grails3-hibernate5/build.gradle @@ -31,33 +31,7 @@ dependencies { exclude group: "org.spockframework", module: "spock-core" } - integrationTestImplementation "org.gebish:geb-spock:$gebVersion" - integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion" - integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion" - integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-safari-driver:$seleniumSafariDriverVersion" - - integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-remote-driver:$seleniumVersion" - integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-api:$seleniumVersion" - integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-support:$seleniumVersion" -} - -tasks.withType(Test) { - systemProperty "geb.env", System.getProperty('geb.env') - systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest") - if (!System.getenv().containsKey('CI')) { - systemProperty 'webdriver.chrome.driver', System.getProperty('webdriver.chrome.driver') - systemProperty 'webdriver.gecko.driver', System.getProperty('webdriver.gecko.driver') - } else { - systemProperty 'webdriver.chrome.driver', "${System.getenv('CHROMEWEBDRIVER')}/chromedriver" - systemProperty 'webdriver.gecko.driver', "${System.getenv('GECKOWEBDRIVER')}/geckodriver" - } -} - -webdriverBinaries { - if (!System.getenv().containsKey('CI')) { - chromedriver "$chromeDriverVersion" - geckodriver "$geckodriverVersion" - } + integrationTestImplementation testFixtures("org.grails.plugins:geb:$gebPluginVersion") } diff --git a/examples/grails3-hibernate5/src/integration-test/groovy/functional/tests/BookControllerSpec.groovy b/examples/grails3-hibernate5/src/integration-test/groovy/functional/tests/BookControllerSpec.groovy index ee023939..2f54fee7 100644 --- a/examples/grails3-hibernate5/src/integration-test/groovy/functional/tests/BookControllerSpec.groovy +++ b/examples/grails3-hibernate5/src/integration-test/groovy/functional/tests/BookControllerSpec.groovy @@ -1,12 +1,10 @@ package functional.tests +import grails.plugin.geb.ContainerGebSpec import grails.testing.mixin.integration.Integration -import geb.spock.GebSpec -import spock.lang.Ignore @Integration(applicationClass = Application) -@Ignore //FAILING downloading the firefox driver -class BookControllerSpec extends GebSpec { +class BookControllerSpec extends ContainerGebSpec { void "Test list books"() { when:"The home page is visited" diff --git a/examples/grails3-hibernate5/src/integration-test/groovy/functional/tests/CascadeValidationSpec.groovy b/examples/grails3-hibernate5/src/integration-test/groovy/functional/tests/CascadeValidationSpec.groovy index d385a0f4..8cf89d28 100644 --- a/examples/grails3-hibernate5/src/integration-test/groovy/functional/tests/CascadeValidationSpec.groovy +++ b/examples/grails3-hibernate5/src/integration-test/groovy/functional/tests/CascadeValidationSpec.groovy @@ -10,7 +10,6 @@ import spock.lang.Specification @Integration(applicationClass = Application) class CascadeValidationSpec extends Specification { - @Ignore("org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'functional.tests.Employee : (unsaved)' with class 'functional.tests.Employee' to class 'functional.tests.Person'") void "validation cascades correctly"() { given: "an invalid business" Business b = new Business(name: null) diff --git a/examples/grails3-hibernate5/src/integration-test/resources/GebConfig.groovy b/examples/grails3-hibernate5/src/integration-test/resources/GebConfig.groovy deleted file mode 100644 index adb480e3..00000000 --- a/examples/grails3-hibernate5/src/integration-test/resources/GebConfig.groovy +++ /dev/null @@ -1,41 +0,0 @@ -import org.openqa.selenium.chrome.ChromeDriver -import org.openqa.selenium.chrome.ChromeOptions -import org.openqa.selenium.firefox.FirefoxDriver -import org.openqa.selenium.firefox.FirefoxOptions -import org.openqa.selenium.safari.SafariDriver - -environments { - - // You need to configure in Safari -> Develop -> Allowed Remote Automation - safari { - driver = { new SafariDriver() } - } - - // run via “./gradlew -Dgeb.env=chrome iT” - chrome { - driver = { new ChromeDriver() } - } - - // run via “./gradlew -Dgeb.env=chromeHeadless iT” - chromeHeadless { - driver = { - ChromeOptions o = new ChromeOptions() - o.addArguments('headless') - new ChromeDriver(o) - } - } - - // run via “./gradlew -Dgeb.env=firefoxHeadless iT” - firefoxHeadless { - driver = { - FirefoxOptions o = new FirefoxOptions() - o.addArguments('-headless') - new FirefoxDriver(o) - } - } - - // run via “./gradlew -Dgeb.env=firefox iT” - firefox { - driver = { new FirefoxDriver() } - } -} \ No newline at end of file diff --git a/examples/grails3-hibernate5/src/test/groovy/functional/tests/BookControllerUnitSpec.groovy b/examples/grails3-hibernate5/src/test/groovy/functional/tests/BookControllerUnitSpec.groovy index 1b8d0fb4..5867e1d6 100644 --- a/examples/grails3-hibernate5/src/test/groovy/functional/tests/BookControllerUnitSpec.groovy +++ b/examples/grails3-hibernate5/src/test/groovy/functional/tests/BookControllerUnitSpec.groovy @@ -31,7 +31,6 @@ class BookControllerUnitSpec extends HibernateSpec implements ControllerUnitTest params["title"] = 'The Stand' } - @Ignore("java.lang.IllegalStateException: Either class [functional.tests.Book] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "Test the index action returns the correct model"() { when:"The index action is executed" @@ -50,7 +49,6 @@ class BookControllerUnitSpec extends HibernateSpec implements ControllerUnitTest model.book!= null } - @Ignore("java.lang.IllegalStateException: Either class [functional.tests.Book] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "Test the save action correctly persists an instance"() { when:"The save action is executed with an invalid instance" @@ -77,7 +75,6 @@ class BookControllerUnitSpec extends HibernateSpec implements ControllerUnitTest Book.count() == 1 } - @Ignore("java.lang.IllegalStateException: Either class [functional.tests.Book] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "Test that the show action returns the correct model"() { when:"The show action is executed with a null domain" controller.show(null) @@ -111,7 +108,6 @@ class BookControllerUnitSpec extends HibernateSpec implements ControllerUnitTest model.book == book } - @Ignore("java.lang.IllegalStateException: Either class [functional.tests.Book] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "Test the update action performs an update on a valid domain instance"() { when:"Update is called for a domain instance that doesn't exist" request.contentType = FORM_CONTENT_TYPE @@ -144,7 +140,6 @@ class BookControllerUnitSpec extends HibernateSpec implements ControllerUnitTest flash.message != null } - @Ignore("java.lang.IllegalStateException: Either class [functional.tests.Book] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "Test that the delete action deletes an instance if it exists"() { when:"The delete action is called for a null instance" request.contentType = FORM_CONTENT_TYPE diff --git a/examples/grails3-multiple-datasources/build.gradle b/examples/grails3-multiple-datasources/build.gradle index e6e448c8..ee7ee4ef 100644 --- a/examples/grails3-multiple-datasources/build.gradle +++ b/examples/grails3-multiple-datasources/build.gradle @@ -24,32 +24,7 @@ dependencies { testImplementation "org.grails:grails-gorm-testing-support:$testingSupportVersion" - integrationTestImplementation "org.gebish:geb-spock:$gebVersion" - integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion" - integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion" - integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-safari-driver:$seleniumSafariDriverVersion" - - integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-remote-driver:$seleniumVersion" - integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-api:$seleniumVersion" - integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-support:$seleniumVersion" -} -tasks.withType(Test) { - systemProperty "geb.env", System.getProperty('geb.env') - systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest") - if (!System.getenv().containsKey('CI')) { - systemProperty 'webdriver.chrome.driver', System.getProperty('webdriver.chrome.driver') - systemProperty 'webdriver.gecko.driver', System.getProperty('webdriver.gecko.driver') - } else { - systemProperty 'webdriver.chrome.driver', "${System.getenv('CHROMEWEBDRIVER')}/chromedriver" - systemProperty 'webdriver.gecko.driver', "${System.getenv('GECKOWEBDRIVER')}/geckodriver" - } -} - -webdriverBinaries { - if (!System.getenv().containsKey('CI')) { - chromedriver "$chromeDriverVersion" - geckodriver "$geckodriverVersion" - } + integrationTestImplementation testFixtures("org.grails.plugins:geb:$gebPluginVersion") } diff --git a/examples/grails3-multiple-datasources/src/integration-test/resources/GebConfig.groovy b/examples/grails3-multiple-datasources/src/integration-test/resources/GebConfig.groovy deleted file mode 100644 index adb480e3..00000000 --- a/examples/grails3-multiple-datasources/src/integration-test/resources/GebConfig.groovy +++ /dev/null @@ -1,41 +0,0 @@ -import org.openqa.selenium.chrome.ChromeDriver -import org.openqa.selenium.chrome.ChromeOptions -import org.openqa.selenium.firefox.FirefoxDriver -import org.openqa.selenium.firefox.FirefoxOptions -import org.openqa.selenium.safari.SafariDriver - -environments { - - // You need to configure in Safari -> Develop -> Allowed Remote Automation - safari { - driver = { new SafariDriver() } - } - - // run via “./gradlew -Dgeb.env=chrome iT” - chrome { - driver = { new ChromeDriver() } - } - - // run via “./gradlew -Dgeb.env=chromeHeadless iT” - chromeHeadless { - driver = { - ChromeOptions o = new ChromeOptions() - o.addArguments('headless') - new ChromeDriver(o) - } - } - - // run via “./gradlew -Dgeb.env=firefoxHeadless iT” - firefoxHeadless { - driver = { - FirefoxOptions o = new FirefoxOptions() - o.addArguments('-headless') - new FirefoxDriver(o) - } - } - - // run via “./gradlew -Dgeb.env=firefox iT” - firefox { - driver = { new FirefoxDriver() } - } -} \ No newline at end of file diff --git a/examples/grails3-partitioned-multi-tenancy/src/test/groovy/example/PartitionedMultiTenancySpec.groovy b/examples/grails3-partitioned-multi-tenancy/src/test/groovy/example/PartitionedMultiTenancySpec.groovy index 4994a153..ac1aee1c 100644 --- a/examples/grails3-partitioned-multi-tenancy/src/test/groovy/example/PartitionedMultiTenancySpec.groovy +++ b/examples/grails3-partitioned-multi-tenancy/src/test/groovy/example/PartitionedMultiTenancySpec.groovy @@ -26,8 +26,6 @@ class PartitionedMultiTenancySpec extends HibernateSpec { System.setProperty(SystemPropertyTenantResolver.PROPERTY_NAME, "") } - - @Ignore("java.lang.IllegalStateException: Either class [example.Book] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "Test should rollback changes in a previous test"() { when: "When there is no tenant" Book.count() @@ -44,7 +42,6 @@ class PartitionedMultiTenancySpec extends HibernateSpec { bookDataService.countBooks() == 1 } - @Ignore("java.lang.IllegalStateException: Either class [example.Book] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void 'Test database per tenant'() { when: "When there is no tenant" Book.count() diff --git a/examples/grails3-schema-per-tenant/build.gradle b/examples/grails3-schema-per-tenant/build.gradle index 40d059a7..395b37da 100644 --- a/examples/grails3-schema-per-tenant/build.gradle +++ b/examples/grails3-schema-per-tenant/build.gradle @@ -23,31 +23,6 @@ dependencies { runtimeOnly "org.grails.plugins:scaffolding:$scaffoldingVersion" testImplementation "org.grails:grails-gorm-testing-support:$testingSupportVersion" - integrationTestImplementation "org.gebish:geb-spock:$gebVersion" - integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion" - integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion" - integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-safari-driver:$seleniumSafariDriverVersion" - integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-remote-driver:$seleniumVersion" - integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-api:$seleniumVersion" - integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-support:$seleniumVersion" -} - -tasks.withType(Test) { - systemProperty "geb.env", System.getProperty('geb.env') - systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest") - if (!System.getenv().containsKey('CI')) { - systemProperty 'webdriver.chrome.driver', System.getProperty('webdriver.chrome.driver') - systemProperty 'webdriver.gecko.driver', System.getProperty('webdriver.gecko.driver') - } else { - systemProperty 'webdriver.chrome.driver', "${System.getenv('CHROMEWEBDRIVER')}/chromedriver" - systemProperty 'webdriver.gecko.driver', "${System.getenv('GECKOWEBDRIVER')}/geckodriver" - } -} - -webdriverBinaries { - if (!System.getenv().containsKey('CI')) { - chromedriver "$chromeDriverVersion" - geckodriver "$geckodriverVersion" - } -} + integrationTestImplementation testFixtures("org.grails.plugins:geb:$gebPluginVersion") +} \ No newline at end of file diff --git a/examples/grails3-schema-per-tenant/src/integration-test/resources/GebConfig.groovy b/examples/grails3-schema-per-tenant/src/integration-test/resources/GebConfig.groovy deleted file mode 100644 index adb480e3..00000000 --- a/examples/grails3-schema-per-tenant/src/integration-test/resources/GebConfig.groovy +++ /dev/null @@ -1,41 +0,0 @@ -import org.openqa.selenium.chrome.ChromeDriver -import org.openqa.selenium.chrome.ChromeOptions -import org.openqa.selenium.firefox.FirefoxDriver -import org.openqa.selenium.firefox.FirefoxOptions -import org.openqa.selenium.safari.SafariDriver - -environments { - - // You need to configure in Safari -> Develop -> Allowed Remote Automation - safari { - driver = { new SafariDriver() } - } - - // run via “./gradlew -Dgeb.env=chrome iT” - chrome { - driver = { new ChromeDriver() } - } - - // run via “./gradlew -Dgeb.env=chromeHeadless iT” - chromeHeadless { - driver = { - ChromeOptions o = new ChromeOptions() - o.addArguments('headless') - new ChromeDriver(o) - } - } - - // run via “./gradlew -Dgeb.env=firefoxHeadless iT” - firefoxHeadless { - driver = { - FirefoxOptions o = new FirefoxOptions() - o.addArguments('-headless') - new FirefoxDriver(o) - } - } - - // run via “./gradlew -Dgeb.env=firefox iT” - firefox { - driver = { new FirefoxDriver() } - } -} \ No newline at end of file diff --git a/examples/grails3-schema-per-tenant/src/test/groovy/example/SchemaPerTenantSpec.groovy b/examples/grails3-schema-per-tenant/src/test/groovy/example/SchemaPerTenantSpec.groovy index 46b03799..58f2c63e 100644 --- a/examples/grails3-schema-per-tenant/src/test/groovy/example/SchemaPerTenantSpec.groovy +++ b/examples/grails3-schema-per-tenant/src/test/groovy/example/SchemaPerTenantSpec.groovy @@ -38,7 +38,6 @@ class SchemaPerTenantSpec extends HibernateSpec implements GrailsUnitTest{ } @Rollback("moreBooks") - @Ignore("java.lang.IllegalStateException: Either class [example.Book] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "Test should rollback changes in a previous test"() { when:"When there is no tenant" Book.count() @@ -55,7 +54,6 @@ class SchemaPerTenantSpec extends HibernateSpec implements GrailsUnitTest{ bookDataService.countBooks() == 1 } - @Ignore("java.lang.IllegalStateException: Either class [example.Book] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void 'Test database per tenant'() { when:"When there is no tenant" Book.count() diff --git a/gradle.properties b/gradle.properties index 5934758d..d9131077 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,6 @@ projectVersion=9.0.0-SNAPSHOT asciidoctorGradleVersion=4.0.1 assetPipelineVersion=5.0.1 fieldsVersion=6.0.0-SNAPSHOT -gebVersion=7.0 gebPluginVersion=5.0.0-SNAPSHOT grolifantVersion=4.0.0 gormVersion=9.0.0-SNAPSHOT @@ -28,8 +27,6 @@ junitJupiterPlatformVersion=1.11.3 picocliVersion=4.7.6 projectReactorVersion=3.6.10 scaffoldingVersion=6.0.0-SNAPSHOT -seleniumSafariDriverVersion=4.23.1 -seleniumVersion=4.23.1 servletApiVersion=6.0.0 snakeYamlVersion=2.3 slf4jVersion=2.0.16 diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/SqlQuerySpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/SqlQuerySpec.groovy index 81cdfa18..948208e6 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/SqlQuerySpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/SqlQuerySpec.groovy @@ -17,8 +17,6 @@ class SqlQuerySpec extends Specification { @Shared @AutoCleanup HibernateDatastore datastore = new HibernateDatastore(Club) @Shared PlatformTransactionManager transactionManager = datastore.getTransactionManager() - // bug in JDK 11 results in IllegalArgumentException: Comparison method violates its general contract! - @IgnoreIf({System.getProperty('java.version').startsWith('11')}) void "test simple query returns a single result"() { given: setupTestData() @@ -33,8 +31,6 @@ class SqlQuerySpec extends Specification { } - // bug in JDK 11 results in IllegalArgumentException: Comparison method violates its general contract! - @IgnoreIf({System.getProperty('java.version').startsWith('11')}) void "test simple sql query"() { given: @@ -49,8 +45,6 @@ class SqlQuerySpec extends Specification { results[0].name == 'Arsenal' } - // bug in JDK 11 results in IllegalArgumentException: Comparison method violates its general contract! - @IgnoreIf({System.getProperty('java.version').startsWith('11')}) void "test sql query with gstring parameters"() { given: setupTestData() diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/TablePerSubClassAndEmbeddedSpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/TablePerSubClassAndEmbeddedSpec.groovy index edabeff4..f1f1e9d6 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/TablePerSubClassAndEmbeddedSpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/TablePerSubClassAndEmbeddedSpec.groovy @@ -22,7 +22,6 @@ class TablePerSubClassAndEmbeddedSpec extends Specification { @Shared PlatformTransactionManager transactionManager = hibernateDatastore.getTransactionManager() @Rollback - @Ignore("groovy.lang.MissingPropertyException: No such property: zip for class: org.grails.datastore.gorm.query.criteria.AbstractDetachedCriteria") void 'test table per subclass with embedded entity'() { given:"some test data" Vendor vendor = new Vendor(name: "Blah") @@ -39,7 +38,6 @@ class TablePerSubClassAndEmbeddedSpec extends Specification { results.size() == 1 } - @Ignore("groovy.lang.MissingPropertyException: No such property: zip for class: org.grails.datastore.gorm.query.criteria.AbstractDetachedCriteria") void "test transform query with embedded entity"() { when:"A query is parsed that queries the embedded entity" def gcl = new GroovyClassLoader() diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/dirtychecking/PropertyFieldSpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/dirtychecking/PropertyFieldSpec.groovy index 2f4b96c5..9e358c0f 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/dirtychecking/PropertyFieldSpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/dirtychecking/PropertyFieldSpec.groovy @@ -17,7 +17,6 @@ class PropertyFieldSpec extends Specification { @Rollback @Issue('https://github.com/grails/grails-data-mapping/issues/934') - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.dirtychecking.Book] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test domain class with property named 'property'"() { expect: Book book = new Book(title: 'book', property: new Property(name: 'p1')) diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/hasmany/ListCollectionSpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/hasmany/ListCollectionSpec.groovy index 4c570989..ef8f6da3 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/hasmany/ListCollectionSpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/hasmany/ListCollectionSpec.groovy @@ -15,7 +15,6 @@ class ListCollectionSpec extends Specification { @Shared @AutoCleanup HibernateDatastore datastore = new HibernateDatastore(getClass().getPackage()) @Rollback - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.hasmany.Animal] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test legs are not loaded eagerly"() { given: new Animal(name: "Chloe") diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/hasmany/TwoUnidirectionalHasManySpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/hasmany/TwoUnidirectionalHasManySpec.groovy index a66d06ef..9db5984b 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/hasmany/TwoUnidirectionalHasManySpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/hasmany/TwoUnidirectionalHasManySpec.groovy @@ -123,4 +123,8 @@ class EcmMask { @Entity class User { String name + + static mapping = { + table '`user`' + } } diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/multitenancy/MultiTenancyBidirectionalManyToManySpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/multitenancy/MultiTenancyBidirectionalManyToManySpec.groovy index 222180ba..4544b014 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/multitenancy/MultiTenancyBidirectionalManyToManySpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/multitenancy/MultiTenancyBidirectionalManyToManySpec.groovy @@ -48,7 +48,6 @@ class MultiTenancyBidirectionalManyToManySpec extends Specification { @Rollback @Issue("https://github.com/grails/gorm-hibernate5/issues/58") - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.multitenancy.Department] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test hasMany and 'in' query with multi-tenancy" () { given: createSomeUsers() @@ -79,6 +78,10 @@ class User implements MultiTenant { static belongsTo = [Department] static hasMany = [departments: Department] + + static mapping = { + table '`user`' + } } @Entity diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/multitenancy/MultiTenancyUnidirectionalOneToManySpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/multitenancy/MultiTenancyUnidirectionalOneToManySpec.groovy index 81d0394f..91fb0469 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/multitenancy/MultiTenancyUnidirectionalOneToManySpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/multitenancy/MultiTenancyUnidirectionalOneToManySpec.groovy @@ -19,7 +19,6 @@ import spock.lang.Specification class MultiTenancyUnidirectionalOneToManySpec extends Specification { @Issue('https://github.com/grails/grails-data-mapping/issues/954') - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.multitenancy.Vehicle] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test multi-tenancy with unidirectional one-to-many"() { given:"A configuration for schema based multi-tenancy" System.setProperty(SystemPropertyTenantResolver.PROPERTY_NAME, "") @@ -110,5 +109,6 @@ class Vehicle implements MultiTenant { static mapping = { tenantId name:'manufacturer' + year column: 'vehicleYear' } } diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/services/DataServiceSpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/services/DataServiceSpec.groovy index 999d7356..4c91657a 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/services/DataServiceSpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/services/DataServiceSpec.groovy @@ -28,7 +28,6 @@ class DataServiceSpec extends Specification { @Shared @AutoCleanup HibernateDatastore datastore = new HibernateDatastore(getClass().getPackage()) - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.services.Product] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test inter service interaction"() { given: Product p1 = new Product(name: "Apple", type:"Fruit").save(flush:true) @@ -40,7 +39,6 @@ class DataServiceSpec extends Specification { } - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.services.Product] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test list products"() { given: Product p1 = new Product(name: "Apple", type:"Fruit").save(flush:true) @@ -69,7 +67,6 @@ class DataServiceSpec extends Specification { productService.find("Apple", "Device") == null } - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.services.Product] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test delete by id implementation"() { given: Product p1 = new Product(name: "Apple", type:"Fruit").save(flush:true) @@ -91,7 +88,6 @@ class DataServiceSpec extends Specification { } - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.services.Product] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test delete by parameter query implementation"() { given: Product p1 = new Product(name: "Apple", type:"Fruit").save(flush:true) @@ -114,7 +110,6 @@ class DataServiceSpec extends Specification { } - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.services.Product] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test delete all implementation"() { given: Product p1 = new Product(name: "Apple", type:"Fruit").save(flush:true) @@ -137,7 +132,6 @@ class DataServiceSpec extends Specification { } - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.services.Product] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test delete with void return type"() { given: Product p1 = new Product(name: "Apple", type:"Fruit").save(flush:true) @@ -158,7 +152,6 @@ class DataServiceSpec extends Specification { productService.get(p1.id) == null } - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.services.Product] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test save entity"() { given: ProductService productService = datastore.getService(ProductService) @@ -170,7 +163,6 @@ class DataServiceSpec extends Specification { productService.find("Pineapple", "Fruit") != null } - @Ignore("java.lang.NullPointerException: Cannot invoke \"org.grails.datastore.mapping.model.PersistentEntity.getJavaClass()\" because \"entity\" is null") void "test save invalid entity"() { given: def mappingContext = datastore.mappingContext @@ -190,7 +182,6 @@ class DataServiceSpec extends Specification { thrown(ValidationException) } - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.services.Product] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test abstract class service impl"() { given: AnotherProductService productService = (AnotherProductService)datastore.getService(AnotherProductInterface) @@ -212,7 +203,6 @@ class DataServiceSpec extends Specification { } - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.services.Product] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test update one method"() { given: ProductService productService = datastore.getService(ProductService) @@ -234,7 +224,6 @@ class DataServiceSpec extends Specification { } - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.services.Product] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void 'test property projection'() { given: ProductService productService = datastore.getService(ProductService) @@ -246,7 +235,6 @@ class DataServiceSpec extends Specification { productService.findProductType(p.id) == "Vegetable" } - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.services.Product] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void 'test property projection return all types'() { given: ProductService productService = datastore.getService(ProductService) @@ -263,7 +251,6 @@ class DataServiceSpec extends Specification { productService.countByType("Vegetable") == 2 } - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.services.Product] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test @where annotation"() { given: ProductService productService = datastore.getService(ProductService) @@ -284,7 +271,6 @@ class DataServiceSpec extends Specification { } - @Ignore(" java.lang.IllegalStateException: Either class [grails.gorm.tests.services.Product] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test @query annotation"() { given: ProductService productService = datastore.getService(ProductService) @@ -317,7 +303,6 @@ class DataServiceSpec extends Specification { } - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.services.Product] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test interface projection"() { given: ProductService productService = datastore.getService(ProductService) @@ -358,7 +343,6 @@ class DataServiceSpec extends Specification { } - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.services.Product] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test join query on attributes with @Query"() { given: ProductService productService = datastore.getService(ProductService) @@ -378,7 +362,6 @@ class DataServiceSpec extends Specification { } @Issue('https://github.com/grails/grails-data-mapping/issues/960') - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.services.Product] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test findBy dynamic finder with @Join doesn't return proxies"() { given: ProductService productService = datastore.getService(ProductService) diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/softdelete/SoftDeleteSpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/softdelete/SoftDeleteSpec.groovy index 6d76c041..1858d05d 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/softdelete/SoftDeleteSpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/softdelete/SoftDeleteSpec.groovy @@ -34,7 +34,6 @@ class SoftDeleteSpec extends Specification { @Rollback - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.softdelete.Person] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void 'test soft delete'() { given: new Person(name: "Fred").save(flush:true) diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/traits/TraitPropertySpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/traits/TraitPropertySpec.groovy index 2e4f2f87..35fab9df 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/traits/TraitPropertySpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/traits/TraitPropertySpec.groovy @@ -16,7 +16,6 @@ class TraitPropertySpec extends Specification { @Shared @AutoCleanup HibernateDatastore datastore = new HibernateDatastore(getClass().getPackage()) @Rollback - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.traits.EntityWithTrait] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test entity with trait property"() { when: new EntityWithTrait(name: "test", bar: "test2").save(flush:true) diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/uuid/UuidInsertSpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/uuid/UuidInsertSpec.groovy index d80ac3b4..3fe80a12 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/uuid/UuidInsertSpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/uuid/UuidInsertSpec.groovy @@ -18,7 +18,6 @@ class UuidInsertSpec extends Specification { @Rollback @Issue('https://github.com/grails/grails-data-mapping/issues/902') - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.uuid.Person] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "Test UUID insert"() { when:"A UUID is used" Person p = new Person(name: "test").save(flush:true) diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/CascadeValidationSpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/CascadeValidationSpec.groovy index 640b2bc9..b78c846f 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/CascadeValidationSpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/CascadeValidationSpec.groovy @@ -18,7 +18,6 @@ class CascadeValidationSpec extends Specification { @Rollback @Issue('https://github.com/grails/grails-data-mapping/issues/926') - @Ignore("groovy.lang.MissingPropertyException: No such property: business for class: grails.gorm.tests.validation.Employee") void "validation cascades correctly"() { given: "an invalid business" Business b = new Business(name: null) diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/SaveWithInvalidEntitySpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/SaveWithInvalidEntitySpec.groovy index 5185f37f..ca8a2a54 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/SaveWithInvalidEntitySpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/SaveWithInvalidEntitySpec.groovy @@ -14,7 +14,7 @@ import spock.lang.Specification */ class SaveWithInvalidEntitySpec extends Specification { - @Shared @AutoCleanup HibernateDatastore hibernateDatastore = new HibernateDatastore(getClass().getPackage()) + @Shared @AutoCleanup HibernateDatastore hibernateDatastore = new HibernateDatastore(A, B) /** * This currently fails with a NPE. See explanation https://github.com/grails/grails-core/issues/10604#issuecomment-298943022 diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/UniqueWithHasOneSpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/UniqueWithHasOneSpec.groovy index 74101102..62b58256 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/UniqueWithHasOneSpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/UniqueWithHasOneSpec.groovy @@ -35,10 +35,7 @@ class UniqueWithHasOneSpec extends Specification { @AutoCleanup @Shared HibernateDatastore hibernateDatastore = new HibernateDatastore(getClass().getPackage()) @Shared SessionFactory sessionFactory = hibernateDatastore.sessionFactory - - @Rollback - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.validation.Foo] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test unique constraint with hasOne"() { when: Foo foo = new Foo(name: "foo") diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/UniqueWithinGroupSpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/UniqueWithinGroupSpec.groovy index 532f7769..2b0543ac 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/UniqueWithinGroupSpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/validation/UniqueWithinGroupSpec.groovy @@ -17,14 +17,12 @@ import spock.lang.Specification * Created by graemerocher on 29/05/2017. */ @Issue('https://github.com/grails/gorm-hibernate5/issues/36') -@Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.validation.Thing] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") class UniqueWithinGroupSpec extends Specification { @AutoCleanup @Shared HibernateDatastore hibernateDatastore = new HibernateDatastore(getClass().getPackage()) @Shared SessionFactory sessionFactory = hibernateDatastore.sessionFactory @Rollback - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.validation.Thing] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test insert"() { when: Thing thing1 = new Thing(hello: 1, world: 2) @@ -41,7 +39,6 @@ class UniqueWithinGroupSpec extends Specification { } @Rollback - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.validation.Thing] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test save"() { when: Thing thing1 = new Thing(hello: 1, world: 2) @@ -58,7 +55,6 @@ class UniqueWithinGroupSpec extends Specification { } @Rollback - @Ignore("java.lang.IllegalStateException: Either class [grails.gorm.tests.validation.Thing] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.") void "test validate"() { when: Thing thing1 = new Thing(hello: 1, world: 2).save(insert: true, flush: true) From 6cdf90b3dba3fe884bd62649070ca40ed13e1025 Mon Sep 17 00:00:00 2001 From: James Daugherty Date: Wed, 30 Oct 2024 12:46:03 -0400 Subject: [PATCH 2/3] Add workaround for GROOVY-11512 --- .../orm/hibernate/access/TraitPropertyAccessStrategy.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/access/TraitPropertyAccessStrategy.java b/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/access/TraitPropertyAccessStrategy.java index 588f2f50..36d47230 100644 --- a/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/access/TraitPropertyAccessStrategy.java +++ b/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/access/TraitPropertyAccessStrategy.java @@ -18,6 +18,14 @@ public class TraitPropertyAccessStrategy implements PropertyAccessStrategy { @Override public PropertyAccess buildPropertyAccess(Class containerJavaType, String propertyName) { Method readMethod = ReflectionUtils.findMethod(containerJavaType, NameUtils.getGetterName(propertyName)); + if(readMethod == null) { + // See https://issues.apache.org/jira/browse/GROOVY-11512 + readMethod = ReflectionUtils.findMethod(containerJavaType, NameUtils.getGetterName(propertyName, true)); + if(readMethod != null && readMethod.getReturnType() != Boolean.class && readMethod.getReturnType() != boolean.class) { + readMethod = null; + } + } + if(readMethod == null) { throw new IllegalStateException("TraitPropertyAccessStrategy used on property ["+propertyName+"] of class ["+containerJavaType.getName()+"] that is not provided by a trait!"); } From ee37c0a7acec18638bbcad84638d3e3ea883979f Mon Sep 17 00:00:00 2001 From: James Daugherty Date: Wed, 30 Oct 2024 13:11:31 -0400 Subject: [PATCH 3/3] Add workaround for json $target fields. --- .../grails/gorm/tests/services/DataServiceSpec.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/services/DataServiceSpec.groovy b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/services/DataServiceSpec.groovy index 4c91657a..795a3f44 100644 --- a/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/services/DataServiceSpec.groovy +++ b/grails-datastore-gorm-hibernate5/src/test/groovy/grails/gorm/tests/services/DataServiceSpec.groovy @@ -8,13 +8,13 @@ import grails.gorm.services.Where import grails.gorm.transactions.Rollback import grails.gorm.validation.PersistentEntityValidator import grails.validation.ValidationException -import groovy.json.JsonOutput +import groovy.json.DefaultJsonGenerator +import groovy.json.JsonGenerator import org.grails.datastore.gorm.validation.constraints.eval.DefaultConstraintEvaluator import org.grails.datastore.gorm.validation.constraints.registry.DefaultConstraintRegistry import org.grails.orm.hibernate.HibernateDatastore import org.springframework.context.support.StaticMessageSource import spock.lang.AutoCleanup -import spock.lang.Ignore import spock.lang.Issue import spock.lang.Shared import spock.lang.Specification @@ -314,7 +314,7 @@ class DataServiceSpec extends Specification { ProductInfo info = productService.findProductInfo("Pumpkin", "Vegetable") List infos = productService.findProductInfos( "Vegetable") - def result = JsonOutput.toJson(info) + def result = new DefaultJsonGenerator(new JsonGenerator.Options().excludeFieldsByName("\$target")).toJson(info) then: infos.size() == 2 infos.first().name == "Carrot"