From 8d7b9837ea7a42ecb16e6ec8c8c267bac403c2c9 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Sun, 12 Dec 2021 02:53:37 +0530 Subject: [PATCH 1/6] Revert back to Grails 5.0.2 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 854b42036..663a92813 100644 --- a/gradle.properties +++ b/gradle.properties @@ -29,7 +29,7 @@ webdriverBinariesVersion=1.4 # Following are used only for example projects fieldsVersion=3.0.0.RC1 -grailsVersion=5.1.0-SNAPSHOT +grailsVersion=5.0.2 micrometer.version=1.8.0 scaffoldingVersion=4.0.0.RC1 testingSupportVersion=2.2.1-SNAPSHOT From 682ed144561ff716edb822254b768634087eb987 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Mon, 13 Dec 2021 16:11:24 +0530 Subject: [PATCH 2/6] Renamed example test-data-service to grails-data-service --- .../{test-data-service => grails-data-service}/build.gradle | 0 .../grails-app/conf/application.groovy | 0 .../grails-app/conf/application.yml | 0 .../grails-app/conf/logback.groovy | 0 .../grails-app/conf/spring/resources.groovy | 0 .../controllers/example/ApplicationController.groovy | 0 .../grails-app/controllers/example/UrlMappings.groovy | 0 .../grails-app/domain/example/Book.groovy | 0 .../grails-app/domain/example/Person.groovy | 0 .../grails-app/domain/example/Student.groovy | 0 .../grails-app/i18n/messages.properties | 0 .../grails-app/init/example/Application.groovy | 0 .../grails-app/init/example/BootStrap.groovy | 0 .../grails-app/services/example/BookService.groovy | 0 .../grails-app/services/example/LibraryService.groovy | 0 .../grails-app/services/example/PersonService.groovy | 0 .../grails-app/services/example/StudentService.groovy | 0 .../grails-app/services/example/TestService.groovy | 0 .../grails-app/views/application/index.gson | 0 .../grails-app/views/error.gson | 0 .../grails-app/views/errors/_errors.gson | 0 .../grails-app/views/notFound.gson | 0 .../grails-app/views/object/_object.gson | 0 .../integration-test/groovy/example/StudentServiceSpec.groovy | 0 .../integration-test/groovy/example/TestServiceSpec.groovy | 0 .../groovy/example/LoginAuthenticationSucessHandler.groovy | 0 .../src/main/groovy/example/TestBean.groovy | 0 settings.gradle | 4 ++-- 28 files changed, 2 insertions(+), 2 deletions(-) rename examples/{test-data-service => grails-data-service}/build.gradle (100%) rename examples/{test-data-service => grails-data-service}/grails-app/conf/application.groovy (100%) rename examples/{test-data-service => grails-data-service}/grails-app/conf/application.yml (100%) rename examples/{test-data-service => grails-data-service}/grails-app/conf/logback.groovy (100%) rename examples/{test-data-service => grails-data-service}/grails-app/conf/spring/resources.groovy (100%) rename examples/{test-data-service => grails-data-service}/grails-app/controllers/example/ApplicationController.groovy (100%) rename examples/{test-data-service => grails-data-service}/grails-app/controllers/example/UrlMappings.groovy (100%) rename examples/{test-data-service => grails-data-service}/grails-app/domain/example/Book.groovy (100%) rename examples/{test-data-service => grails-data-service}/grails-app/domain/example/Person.groovy (100%) rename examples/{test-data-service => grails-data-service}/grails-app/domain/example/Student.groovy (100%) rename examples/{test-data-service => grails-data-service}/grails-app/i18n/messages.properties (100%) rename examples/{test-data-service => grails-data-service}/grails-app/init/example/Application.groovy (100%) rename examples/{test-data-service => grails-data-service}/grails-app/init/example/BootStrap.groovy (100%) rename examples/{test-data-service => grails-data-service}/grails-app/services/example/BookService.groovy (100%) rename examples/{test-data-service => grails-data-service}/grails-app/services/example/LibraryService.groovy (100%) rename examples/{test-data-service => grails-data-service}/grails-app/services/example/PersonService.groovy (100%) rename examples/{test-data-service => grails-data-service}/grails-app/services/example/StudentService.groovy (100%) rename examples/{test-data-service => grails-data-service}/grails-app/services/example/TestService.groovy (100%) rename examples/{test-data-service => grails-data-service}/grails-app/views/application/index.gson (100%) rename examples/{test-data-service => grails-data-service}/grails-app/views/error.gson (100%) rename examples/{test-data-service => grails-data-service}/grails-app/views/errors/_errors.gson (100%) rename examples/{test-data-service => grails-data-service}/grails-app/views/notFound.gson (100%) rename examples/{test-data-service => grails-data-service}/grails-app/views/object/_object.gson (100%) rename examples/{test-data-service => grails-data-service}/src/integration-test/groovy/example/StudentServiceSpec.groovy (100%) rename examples/{test-data-service => grails-data-service}/src/integration-test/groovy/example/TestServiceSpec.groovy (100%) rename examples/{test-data-service => grails-data-service}/src/main/groovy/example/LoginAuthenticationSucessHandler.groovy (100%) rename examples/{test-data-service => grails-data-service}/src/main/groovy/example/TestBean.groovy (100%) diff --git a/examples/test-data-service/build.gradle b/examples/grails-data-service/build.gradle similarity index 100% rename from examples/test-data-service/build.gradle rename to examples/grails-data-service/build.gradle diff --git a/examples/test-data-service/grails-app/conf/application.groovy b/examples/grails-data-service/grails-app/conf/application.groovy similarity index 100% rename from examples/test-data-service/grails-app/conf/application.groovy rename to examples/grails-data-service/grails-app/conf/application.groovy diff --git a/examples/test-data-service/grails-app/conf/application.yml b/examples/grails-data-service/grails-app/conf/application.yml similarity index 100% rename from examples/test-data-service/grails-app/conf/application.yml rename to examples/grails-data-service/grails-app/conf/application.yml diff --git a/examples/test-data-service/grails-app/conf/logback.groovy b/examples/grails-data-service/grails-app/conf/logback.groovy similarity index 100% rename from examples/test-data-service/grails-app/conf/logback.groovy rename to examples/grails-data-service/grails-app/conf/logback.groovy diff --git a/examples/test-data-service/grails-app/conf/spring/resources.groovy b/examples/grails-data-service/grails-app/conf/spring/resources.groovy similarity index 100% rename from examples/test-data-service/grails-app/conf/spring/resources.groovy rename to examples/grails-data-service/grails-app/conf/spring/resources.groovy diff --git a/examples/test-data-service/grails-app/controllers/example/ApplicationController.groovy b/examples/grails-data-service/grails-app/controllers/example/ApplicationController.groovy similarity index 100% rename from examples/test-data-service/grails-app/controllers/example/ApplicationController.groovy rename to examples/grails-data-service/grails-app/controllers/example/ApplicationController.groovy diff --git a/examples/test-data-service/grails-app/controllers/example/UrlMappings.groovy b/examples/grails-data-service/grails-app/controllers/example/UrlMappings.groovy similarity index 100% rename from examples/test-data-service/grails-app/controllers/example/UrlMappings.groovy rename to examples/grails-data-service/grails-app/controllers/example/UrlMappings.groovy diff --git a/examples/test-data-service/grails-app/domain/example/Book.groovy b/examples/grails-data-service/grails-app/domain/example/Book.groovy similarity index 100% rename from examples/test-data-service/grails-app/domain/example/Book.groovy rename to examples/grails-data-service/grails-app/domain/example/Book.groovy diff --git a/examples/test-data-service/grails-app/domain/example/Person.groovy b/examples/grails-data-service/grails-app/domain/example/Person.groovy similarity index 100% rename from examples/test-data-service/grails-app/domain/example/Person.groovy rename to examples/grails-data-service/grails-app/domain/example/Person.groovy diff --git a/examples/test-data-service/grails-app/domain/example/Student.groovy b/examples/grails-data-service/grails-app/domain/example/Student.groovy similarity index 100% rename from examples/test-data-service/grails-app/domain/example/Student.groovy rename to examples/grails-data-service/grails-app/domain/example/Student.groovy diff --git a/examples/test-data-service/grails-app/i18n/messages.properties b/examples/grails-data-service/grails-app/i18n/messages.properties similarity index 100% rename from examples/test-data-service/grails-app/i18n/messages.properties rename to examples/grails-data-service/grails-app/i18n/messages.properties diff --git a/examples/test-data-service/grails-app/init/example/Application.groovy b/examples/grails-data-service/grails-app/init/example/Application.groovy similarity index 100% rename from examples/test-data-service/grails-app/init/example/Application.groovy rename to examples/grails-data-service/grails-app/init/example/Application.groovy diff --git a/examples/test-data-service/grails-app/init/example/BootStrap.groovy b/examples/grails-data-service/grails-app/init/example/BootStrap.groovy similarity index 100% rename from examples/test-data-service/grails-app/init/example/BootStrap.groovy rename to examples/grails-data-service/grails-app/init/example/BootStrap.groovy diff --git a/examples/test-data-service/grails-app/services/example/BookService.groovy b/examples/grails-data-service/grails-app/services/example/BookService.groovy similarity index 100% rename from examples/test-data-service/grails-app/services/example/BookService.groovy rename to examples/grails-data-service/grails-app/services/example/BookService.groovy diff --git a/examples/test-data-service/grails-app/services/example/LibraryService.groovy b/examples/grails-data-service/grails-app/services/example/LibraryService.groovy similarity index 100% rename from examples/test-data-service/grails-app/services/example/LibraryService.groovy rename to examples/grails-data-service/grails-app/services/example/LibraryService.groovy diff --git a/examples/test-data-service/grails-app/services/example/PersonService.groovy b/examples/grails-data-service/grails-app/services/example/PersonService.groovy similarity index 100% rename from examples/test-data-service/grails-app/services/example/PersonService.groovy rename to examples/grails-data-service/grails-app/services/example/PersonService.groovy diff --git a/examples/test-data-service/grails-app/services/example/StudentService.groovy b/examples/grails-data-service/grails-app/services/example/StudentService.groovy similarity index 100% rename from examples/test-data-service/grails-app/services/example/StudentService.groovy rename to examples/grails-data-service/grails-app/services/example/StudentService.groovy diff --git a/examples/test-data-service/grails-app/services/example/TestService.groovy b/examples/grails-data-service/grails-app/services/example/TestService.groovy similarity index 100% rename from examples/test-data-service/grails-app/services/example/TestService.groovy rename to examples/grails-data-service/grails-app/services/example/TestService.groovy diff --git a/examples/test-data-service/grails-app/views/application/index.gson b/examples/grails-data-service/grails-app/views/application/index.gson similarity index 100% rename from examples/test-data-service/grails-app/views/application/index.gson rename to examples/grails-data-service/grails-app/views/application/index.gson diff --git a/examples/test-data-service/grails-app/views/error.gson b/examples/grails-data-service/grails-app/views/error.gson similarity index 100% rename from examples/test-data-service/grails-app/views/error.gson rename to examples/grails-data-service/grails-app/views/error.gson diff --git a/examples/test-data-service/grails-app/views/errors/_errors.gson b/examples/grails-data-service/grails-app/views/errors/_errors.gson similarity index 100% rename from examples/test-data-service/grails-app/views/errors/_errors.gson rename to examples/grails-data-service/grails-app/views/errors/_errors.gson diff --git a/examples/test-data-service/grails-app/views/notFound.gson b/examples/grails-data-service/grails-app/views/notFound.gson similarity index 100% rename from examples/test-data-service/grails-app/views/notFound.gson rename to examples/grails-data-service/grails-app/views/notFound.gson diff --git a/examples/test-data-service/grails-app/views/object/_object.gson b/examples/grails-data-service/grails-app/views/object/_object.gson similarity index 100% rename from examples/test-data-service/grails-app/views/object/_object.gson rename to examples/grails-data-service/grails-app/views/object/_object.gson diff --git a/examples/test-data-service/src/integration-test/groovy/example/StudentServiceSpec.groovy b/examples/grails-data-service/src/integration-test/groovy/example/StudentServiceSpec.groovy similarity index 100% rename from examples/test-data-service/src/integration-test/groovy/example/StudentServiceSpec.groovy rename to examples/grails-data-service/src/integration-test/groovy/example/StudentServiceSpec.groovy diff --git a/examples/test-data-service/src/integration-test/groovy/example/TestServiceSpec.groovy b/examples/grails-data-service/src/integration-test/groovy/example/TestServiceSpec.groovy similarity index 100% rename from examples/test-data-service/src/integration-test/groovy/example/TestServiceSpec.groovy rename to examples/grails-data-service/src/integration-test/groovy/example/TestServiceSpec.groovy diff --git a/examples/test-data-service/src/main/groovy/example/LoginAuthenticationSucessHandler.groovy b/examples/grails-data-service/src/main/groovy/example/LoginAuthenticationSucessHandler.groovy similarity index 100% rename from examples/test-data-service/src/main/groovy/example/LoginAuthenticationSucessHandler.groovy rename to examples/grails-data-service/src/main/groovy/example/LoginAuthenticationSucessHandler.groovy diff --git a/examples/test-data-service/src/main/groovy/example/TestBean.groovy b/examples/grails-data-service/src/main/groovy/example/TestBean.groovy similarity index 100% rename from examples/test-data-service/src/main/groovy/example/TestBean.groovy rename to examples/grails-data-service/src/main/groovy/example/TestBean.groovy diff --git a/settings.gradle b/settings.gradle index b1138db51..828ba838f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -46,8 +46,8 @@ project(":examples-standalone-hibernate5").projectDir = new File(settingsDir, "e include "examples-spring-boot-hibernate5" project(":examples-spring-boot-hibernate5").projectDir = new File(settingsDir, "examples/spring-boot-hibernate5") -include "examples-test-data-service" -project(":examples-test-data-service").projectDir = new File(settingsDir, "examples/test-data-service") +include "examples-grails-data-service" +project(":examples-grails-data-service").projectDir = new File(settingsDir, "examples/grails-data-service") findProject(':boot-plugin').name = 'gorm-hibernate5-spring-boot' From d959f6ec1c0832f9545d2ae6d543420569036c47 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Mon, 13 Dec 2021 16:13:00 +0530 Subject: [PATCH 3/6] Use Grails 5.0.3-SNAPSHOT and force Micronaut version --- build.gradle | 34 ++++++++++++++++------------------ gradle.properties | 4 +++- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/build.gradle b/build.gradle index 598ec6f61..5833389b3 100644 --- a/build.gradle +++ b/build.gradle @@ -51,7 +51,7 @@ if (isReleaseVersion) { } } -subprojects { subproject -> +subprojects { Project subproject -> repositories { maven { url "https://repo.grails.org/grails/core" } @@ -82,11 +82,15 @@ subprojects { subproject -> ext['gorm.version'] = gormVersion if(subproject.name.startsWith("examples-grails")) { - apply plugin:"org.grails.grails-web" - apply plugin:"org.grails.grails-gsp" + + if (subproject.name != "examples-grails-data-service") { + apply plugin:"org.grails.grails-web" + apply plugin:"org.grails.grails-gsp" + apply plugin:"com.energizedwork.webdriver-binaries" + } } - configurations.all { - resolutionStrategy.eachDependency { DependencyResolveDetails details -> + configurations.all { Configuration configuration-> + configuration.resolutionStrategy.eachDependency { DependencyResolveDetails details -> if(details.requested.group == 'org.codehaus.groovy' && details.requested.name.startsWith('groovy')) { details.useVersion(groovyVersion) } @@ -104,12 +108,14 @@ subprojects { subproject -> details.requested.name != 'grails-datastore-gorm-hibernate5') { details.useVersion(gormVersion) } + if (details.requested.group == "io.micronaut") { + details.useVersion(micronautVersion) + } + if (details.requested.group == "io.micronaut.spring") { + details.useVersion(micronautSpringVersion) + } } } - boolean usesGeb = subproject.name.contains('examples-grails') - if (usesGeb) { - apply plugin:"com.energizedwork.webdriver-binaries" - } dependencies { testImplementation "io.projectreactor:reactor-test:3.4.12" @@ -170,14 +176,6 @@ subprojects { subproject -> documentation.extendsFrom(compileClasspath) } - // Uncomment below code to force refresh dependencies - /*configurations.all { - resolutionStrategy { - cacheDynamicVersionsFor 0, 'hours' - cacheChangingModulesFor 0, 'hours' - } - }*/ - if(isPluginProject) { group "org.grails.plugins" version project.rootProject.version @@ -226,7 +224,7 @@ subprojects { subproject -> apply from: "${rootProject.projectDir}/gradle/testVerbose.gradle" - groovydoc.classpath += configurations.documentation + groovydoc.classpath = configurations.documentation publishing { diff --git a/gradle.properties b/gradle.properties index 663a92813..37670fbf8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,6 +12,8 @@ jansiVersion=2.4.0 javaParserCoreVersion=3.23.0 jaxbVersion=2.3.1 junitJupiterVersion=5.8.2 +micronautVersion=3.2.0 +micronautSpringVersion=4.0.1 picocliVersion=4.6.2 projectVersion=7.1.1-SNAPSHOT pluginGrailsVersion=5.0.0 @@ -29,7 +31,7 @@ webdriverBinariesVersion=1.4 # Following are used only for example projects fieldsVersion=3.0.0.RC1 -grailsVersion=5.0.2 +grailsVersion=5.0.3-SNAPSHOT micrometer.version=1.8.0 scaffoldingVersion=4.0.0.RC1 testingSupportVersion=2.2.1-SNAPSHOT From 1574fe53381ddbad11caa3b23e88ff6a5bebcd36 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Mon, 13 Dec 2021 21:38:04 +0530 Subject: [PATCH 4/6] Define Gradle jvmArgs meta-space --- gradle.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/gradle.properties b/gradle.properties index 37670fbf8..0037b9931 100644 --- a/gradle.properties +++ b/gradle.properties @@ -38,3 +38,4 @@ testingSupportVersion=2.2.1-SNAPSHOT org.gradle.caching=true org.gradle.parallel=true org.gradle.daemon=true +org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1536M -XX:MaxMetaspaceSize=512M From cdcb7152cdf35bd05582324c377972ac79613eed Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Mon, 13 Dec 2021 19:40:39 +0530 Subject: [PATCH 5/6] Configure Gradle Test Retry plugin --- build.gradle | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/build.gradle b/build.gradle index 5833389b3..aea573f03 100644 --- a/build.gradle +++ b/build.gradle @@ -12,6 +12,7 @@ buildscript { classpath "org.grails.plugins:views-gradle:2.1.1" classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.6.1' classpath "gradle.plugin.com.energizedwork.webdriver-binaries:webdriver-binaries-gradle-plugin:$webdriverBinariesVersion" + classpath "org.gradle:test-retry-gradle-plugin:1.3.1" } } @@ -89,6 +90,7 @@ subprojects { Project subproject -> apply plugin:"com.energizedwork.webdriver-binaries" } } + configurations.all { Configuration configuration-> configuration.resolutionStrategy.eachDependency { DependencyResolveDetails details -> if(details.requested.group == 'org.codehaus.groovy' && details.requested.name.startsWith('groovy')) { @@ -204,6 +206,7 @@ subprojects { Project subproject -> apply plugin: 'java-library' apply plugin: 'maven-publish' apply plugin: 'signing' + apply plugin: "org.gradle.test-retry" sourceCompatibility = "1.8" targetCompatibility = "1.8" @@ -224,6 +227,19 @@ subprojects { Project subproject -> apply from: "${rootProject.projectDir}/gradle/testVerbose.gradle" + tasks.withType(Test) { + configure { + retry { + maxRetries = 2 + maxFailures = 20 + failOnPassedAfterRetry = true + filter { + excludeClasses.add("*GroovyChangeLogSpec") + } + } + } + } + groovydoc.classpath = configurations.documentation publishing { From 85819b7ccde205b7d092b08987980f6c9078e558 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Tue, 14 Dec 2021 12:25:42 +0530 Subject: [PATCH 6/6] Fix tests --- .../example/DatabasePerTenantIntegrationSpec.groovy | 6 ++++++ .../PartitionedMultiTenancyIntegrationSpec.groovy | 6 ++++++ .../groovy/example/SchemaPerTenantIntegrationSpec.groovy | 6 ++++++ .../src/test/groovy/example/SchemaPerTenantSpec.groovy | 9 ++++++++- gradle.properties | 2 +- 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/examples/grails3-database-per-tenant/src/integration-test/groovy/example/DatabasePerTenantIntegrationSpec.groovy b/examples/grails3-database-per-tenant/src/integration-test/groovy/example/DatabasePerTenantIntegrationSpec.groovy index c4f8379ac..4500a3557 100644 --- a/examples/grails3-database-per-tenant/src/integration-test/groovy/example/DatabasePerTenantIntegrationSpec.groovy +++ b/examples/grails3-database-per-tenant/src/integration-test/groovy/example/DatabasePerTenantIntegrationSpec.groovy @@ -1,6 +1,7 @@ package example import datasources.Application +import grails.core.GrailsApplication import grails.gorm.transactions.Rollback import grails.testing.mixin.integration.Integration import grails.util.GrailsWebMockUtil @@ -18,8 +19,13 @@ class DatabasePerTenantIntegrationSpec extends Specification { BookService bookService AnotherBookService anotherBookService GrailsWebRequest webRequest + GrailsApplication grailsApplication def setup() { + //To register MimeTypes + if (grailsApplication.mainContext.parent) { + grailsApplication.mainContext.getBean("mimeTypesHolder") + } webRequest = GrailsWebMockUtil.bindMockWebRequest() } diff --git a/examples/grails3-partitioned-multi-tenancy/src/integration-test/groovy/example/PartitionedMultiTenancyIntegrationSpec.groovy b/examples/grails3-partitioned-multi-tenancy/src/integration-test/groovy/example/PartitionedMultiTenancyIntegrationSpec.groovy index cf10b66e3..f35cf1f5b 100644 --- a/examples/grails3-partitioned-multi-tenancy/src/integration-test/groovy/example/PartitionedMultiTenancyIntegrationSpec.groovy +++ b/examples/grails3-partitioned-multi-tenancy/src/integration-test/groovy/example/PartitionedMultiTenancyIntegrationSpec.groovy @@ -1,6 +1,7 @@ package example import datasources.Application +import grails.core.GrailsApplication import grails.gorm.transactions.Rollback import grails.testing.mixin.integration.Integration import grails.util.GrailsWebMockUtil @@ -18,8 +19,13 @@ class PartitionedMultiTenancyIntegrationSpec extends Specification { BookService bookService AnotherBookService anotherBookService GrailsWebRequest webRequest + GrailsApplication grailsApplication def setup() { + //To register MimeTypes + if (grailsApplication.mainContext.parent) { + grailsApplication.mainContext.getBean("mimeTypesHolder") + } webRequest = GrailsWebMockUtil.bindMockWebRequest() } diff --git a/examples/grails3-schema-per-tenant/src/integration-test/groovy/example/SchemaPerTenantIntegrationSpec.groovy b/examples/grails3-schema-per-tenant/src/integration-test/groovy/example/SchemaPerTenantIntegrationSpec.groovy index 21e2fd92c..875fbba5b 100644 --- a/examples/grails3-schema-per-tenant/src/integration-test/groovy/example/SchemaPerTenantIntegrationSpec.groovy +++ b/examples/grails3-schema-per-tenant/src/integration-test/groovy/example/SchemaPerTenantIntegrationSpec.groovy @@ -1,6 +1,7 @@ package example import datasources.Application +import grails.core.GrailsApplication import grails.gorm.transactions.Rollback import grails.testing.mixin.integration.Integration import grails.util.GrailsWebMockUtil @@ -20,8 +21,13 @@ class SchemaPerTenantIntegrationSpec extends Specification { AnotherBookService anotherBookService GrailsWebRequest webRequest HibernateDatastore hibernateDatastore + GrailsApplication grailsApplication def setup() { + //To register MimeTypes + if (grailsApplication.mainContext.parent) { + grailsApplication.mainContext.getBean("mimeTypesHolder") + } hibernateDatastore.addTenantForSchema("moreBooks") hibernateDatastore.addTenantForSchema("evenMoreBooks") webRequest = GrailsWebMockUtil.bindMockWebRequest() 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 ea05c3065..1261da243 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 @@ -1,15 +1,18 @@ package example + +import grails.core.GrailsApplication import grails.gorm.transactions.Rollback import grails.test.hibernate.HibernateSpec import org.grails.datastore.mapping.config.Settings import org.grails.datastore.mapping.multitenancy.exceptions.TenantNotFoundException import org.grails.datastore.mapping.multitenancy.resolvers.SystemPropertyTenantResolver +import org.grails.testing.GrailsUnitTest /** * Created by graemerocher on 06/04/2017. */ -class SchemaPerTenantSpec extends HibernateSpec { +class SchemaPerTenantSpec extends HibernateSpec implements GrailsUnitTest{ BookService bookDataService = hibernateDatastore.getService(BookService) @@ -22,6 +25,10 @@ class SchemaPerTenantSpec extends HibernateSpec { } def setup() { + //To register MimeTypes + if (grailsApplication.mainContext.parent) { + grailsApplication.mainContext.getBean("mimeTypesHolder") + } hibernateDatastore.addTenantForSchema("moreBooks") hibernateDatastore.addTenantForSchema("evenMoreBooks") } diff --git a/gradle.properties b/gradle.properties index 0037b9931..86b99fafc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -34,7 +34,7 @@ fieldsVersion=3.0.0.RC1 grailsVersion=5.0.3-SNAPSHOT micrometer.version=1.8.0 scaffoldingVersion=4.0.0.RC1 -testingSupportVersion=2.2.1-SNAPSHOT +testingSupportVersion=2.3.0-SNAPSHOT org.gradle.caching=true org.gradle.parallel=true org.gradle.daemon=true