diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index b25567c9..27976453 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -2,49 +2,25 @@ name: Java CI on: push: branches: - - master - '[2-9]+.[0-9]+.x' pull_request: branches: - - master - '[2-9]+.[0-9]+.x' workflow_dispatch: - inputs: - message: - description: 'Snapshot information (e.g. New Core Snapshot Tue Dec 15 00:07:18 UTC 2020 f212f54)' - required: true jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - java: ['8'] env: WORKSPACE: ${{ github.workspace }} GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8 steps: - - name: Print Dispatch Information - if: github.event_name == 'workflow_dispatch' - env: - DISPATCH_INFORMATION: ${{ github.event.inputs.message }} - run: echo $DISPATCH_INFORMATION - uses: actions/checkout@v3 - name: Set up JDK uses: actions/setup-java@v3 with: distribution: 'adopt' - java-version: ${{ matrix.java }} - - name: Run Tests - if: github.event_name == 'pull_request' - id: tests - uses: gradle/gradle-build-action@v2 - with: - arguments: check -Dgeb.env=chromeHeadless - env: - GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} - GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} + java-version: '8' - name: Run Build - if: github.event_name == 'push' id: build uses: gradle/gradle-build-action@v2 env: @@ -53,36 +29,45 @@ jobs: GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} with: arguments: build -Dgeb.env=chromeHeadless - - name: Publish Test Report - if: steps.build.outcome == 'failure' || steps.tests.outcome == 'failure' - uses: scacap/action-surefire-report@v1 + publish: + if: github.event_name == 'push' + needs: ['build'] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - report_paths: '**/build/test-results/test/TEST-*.xml' - - name: Publish to repo.grails.org + distribution: 'adopt' + java-version: '8' + - name: Publish Artifacts (repo.grails.org) id: publish uses: gradle/gradle-build-action@v2 - if: steps.build.outcome == 'success' && github.event_name == 'push' && matrix.java == '8' env: ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} + GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} with: arguments: -Dorg.gradle.internal.publish.checksums.insecure=true publish - name: Build Docs - id: docs - if: steps.build.outcome == 'success' && github.event_name == 'push' && matrix.java == '8' + if: success() uses: gradle/gradle-build-action@v2 with: arguments: docs:docs + env: + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} + GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} - name: Publish to Github Pages - if: steps.docs.outcome == 'success' && github.event_name == 'push' && matrix.java == '8' - uses: micronaut-projects/github-pages-deploy-action@master + if: success() + uses: micronaut-projects/github-pages-deploy-action@grails env: TARGET_REPOSITORY: ${{ github.repository }} GH_TOKEN: ${{ secrets.GH_TOKEN }} BRANCH: gh-pages FOLDER: docs/build/docs - DOC_SUB_FOLDER: hibernate DOC_FOLDER: gh-pages COMMIT_EMAIL: behlp@objectcomputing.com - COMMIT_NAME: Puneet Behl + COMMIT_NAME: Puneet Behl \ No newline at end of file diff --git a/.gitignore b/.gitignore index 78dbde08..5a50d27e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ **/.gradle/ **/build **/out +*.sdkmanrc \ No newline at end of file diff --git a/build.gradle b/build.gradle index 163cf949..1c7abd52 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,9 @@ buildscript { maven { url "https://repo.grails.org/grails/core" } } dependencies { - classpath "org.grails:grails-gradle-plugin:$grailsVersion" + classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion" + classpath "org.grails.plugins:views-gradle:$viewGradleVersion" + classpath "org.grails.plugins:views-json:$viewsJsonVersion" classpath "org.grails:grails-docs:${project.ext.properties.grailsDocsVersion ?: grailsVersion}" classpath "io.github.gradle-nexus:publish-plugin:1.1.0" } @@ -17,7 +19,7 @@ repositories { version project.projectVersion ext { - commonBuild = 'https://raw.githubusercontent.com/grails/grails-common-build/master' + commonBuild = 'https://raw.githubusercontent.com/grails/grails-common-build/v2.0.0' } subprojects { @@ -62,13 +64,21 @@ subprojects { } if (isGrailsPlugin) { + apply plugin: 'groovy' + apply plugin: 'eclipse' + apply plugin: 'idea' + apply plugin: 'java-library' apply plugin: "org.grails.grails-plugin" } else { apply from: "${commonBuild}/common-project.gradle" } dependencies { - testCompile "org.codehaus.groovy:groovy-test:$groovyVersion" + implementation "com.graphql-java:graphql-java:$graphqlJavaVersion" + testImplementation "org.codehaus.groovy:groovy-test:$groovyVersion" + testImplementation "io.projectreactor:reactor-test:3.5.5" + testImplementation("org.spockframework:spock-core:$spockVersion") + implementation 'org.grails:grails-datastore-gorm:7.3.4' } } diff --git a/core/build.gradle b/core/build.gradle index 6ebdb381..4cf74e79 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,21 +1,28 @@ +repositories { + mavenCentral() + maven { url "https://repo.grails.org/grails/core" } +} apply plugin: 'codenarc' dependencies { documentation "org.codehaus.groovy:groovy-cli-picocli:$groovyVersion" - compile "org.grails:grails-datastore-gorm:${gormVersion}" - compile "com.graphql-java:graphql-java:$graphqlJavaVersion" - compile "com.graphql-java:graphql-java-extended-scalars:$graphqlJavaScalarExtVersion" + api "org.grails:grails-datastore-gorm:${gormVersion}" + api "com.graphql-java:graphql-java:$graphqlJavaVersion" + api "com.graphql-java:graphql-java-extended-scalars:$graphqlJavaScalarExtVersion" + api 'com.github.javaparser:javaparser-core:3.25.5' + api "org.grails.plugins:views-json:2.3.2" + api 'org.javassist:javassist:3.29.2-GA' codenarc "org.codenarc:CodeNarc:$codenarcVersion" - testCompile "org.grails:grails-datastore-gorm-hibernate5:${gormHibernateVersion}" - testCompile "org.grails:grails-datastore-gorm-mongodb:${gormMongoDbVersion}" - testCompile 'com.github.fakemongo:fongo:2.1.1' - testRuntime "com.h2database:h2:1.4.192" - testRuntime "org.apache.tomcat:tomcat-jdbc:8.5.85" - testRuntime "org.apache.tomcat.embed:tomcat-embed-logging-log4j:8.5.2" - testRuntime "org.slf4j:slf4j-api:$slf4jVersion" + testImplementation "org.grails:grails-datastore-gorm-hibernate5:${gormHibernateVersion}" + testImplementation "org.grails:grails-datastore-gorm-mongodb:${gormMongoDbVersion}" + testImplementation 'com.github.fakemongo:fongo:2.1.1' + testImplementation 'com.h2database:h2:2.2.224' + testImplementation "org.apache.tomcat:tomcat-jdbc:8.5.85" + testImplementation "org.apache.tomcat.embed:tomcat-embed-logging-log4j:8.5.2" + testImplementation "org.slf4j:slf4j-api:$slf4jVersion" } targetCompatibility = 1.8 diff --git a/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/GraphQLMapping.groovy b/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/GraphQLMapping.groovy index 69f1fc4d..c6238e35 100644 --- a/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/GraphQLMapping.groovy +++ b/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/GraphQLMapping.groovy @@ -246,7 +246,7 @@ class GraphQLMapping implements Describable, Deprecatable, Deprecatable, Named, ExecutesClosures { /** diff --git a/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/helpers/Arguable.groovy b/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/helpers/Arguable.groovy index c3d4a7ef..fd3188da 100644 --- a/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/helpers/Arguable.groovy +++ b/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/helpers/Arguable.groovy @@ -20,7 +20,7 @@ trait Arguable extends ExecutesClosures { List arguments = [] - private void handleArgumentClosure(CustomArgument argument, Closure closure) { + private void handleArgumentClosure(CustomArgument argument, @DelegatesTo(strategy = Closure.DELEGATE_ONLY)Closure closure) { withDelegate(closure, (Object)argument) argument.validate() arguments.add(argument) diff --git a/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/helpers/ComplexTyped.groovy b/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/helpers/ComplexTyped.groovy index 638b6ac5..5c4fab38 100644 --- a/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/helpers/ComplexTyped.groovy +++ b/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/helpers/ComplexTyped.groovy @@ -105,7 +105,7 @@ trait ComplexTyped extends ExecutesClosures { customInputType } - private void handleField(Closure closure, Field field) { + private void handleField(@DelegatesTo(strategy = Closure.DELEGATE_ONLY)Closure closure, Field field) { field.nullable(defaultNull) withDelegate(closure, (Object)field) handleField(field) diff --git a/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/helpers/ExecutesClosures.groovy b/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/helpers/ExecutesClosures.groovy index 339dc06c..be94b8e4 100644 --- a/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/helpers/ExecutesClosures.groovy +++ b/core/src/main/groovy/org/grails/gorm/graphql/entity/dsl/helpers/ExecutesClosures.groovy @@ -12,7 +12,7 @@ import groovy.transform.CompileStatic @CompileStatic trait ExecutesClosures { - static void withDelegate(Closure closure, Object delegate) { + static void withDelegate(@DelegatesTo(strategy = Closure.DELEGATE_ONLY)Closure closure, Object delegate) { if (closure != null) { closure.resolveStrategy = Closure.DELEGATE_ONLY closure.delegate = delegate @@ -25,3 +25,4 @@ trait ExecutesClosures { } } } + diff --git a/core/src/main/groovy/org/grails/gorm/graphql/entity/operations/ComplexOperation.groovy b/core/src/main/groovy/org/grails/gorm/graphql/entity/operations/ComplexOperation.groovy index c32da2e0..f8b74b82 100644 --- a/core/src/main/groovy/org/grails/gorm/graphql/entity/operations/ComplexOperation.groovy +++ b/core/src/main/groovy/org/grails/gorm/graphql/entity/operations/ComplexOperation.groovy @@ -13,6 +13,7 @@ import org.grails.gorm.graphql.types.GraphQLTypeManager * @author James Kleeh * @since 1.0.0 */ + @CompileStatic class ComplexOperation extends CustomOperation implements ExecutesClosures { diff --git a/core/src/main/groovy/org/grails/gorm/graphql/entity/property/impl/PersistentGraphQLProperty.groovy b/core/src/main/groovy/org/grails/gorm/graphql/entity/property/impl/PersistentGraphQLProperty.groovy index ae1b2c93..4591d827 100644 --- a/core/src/main/groovy/org/grails/gorm/graphql/entity/property/impl/PersistentGraphQLProperty.groovy +++ b/core/src/main/groovy/org/grails/gorm/graphql/entity/property/impl/PersistentGraphQLProperty.groovy @@ -5,6 +5,7 @@ import grails.gorm.validation.PersistentEntityValidator import graphql.schema.DataFetcher import graphql.schema.GraphQLType import groovy.transform.CompileStatic +import org.grails.datastore.mapping.config.Property import org.grails.datastore.mapping.model.MappingContext import org.grails.datastore.mapping.model.PersistentEntity import org.grails.datastore.mapping.model.PersistentProperty @@ -63,7 +64,7 @@ class PersistentGraphQLProperty extends OrderedGraphQLProperty { this.nullable = mapping.nullable } else { - this.nullable = property.mapping.mappedForm.nullable + this.nullable = ((Property) property.mapping.mappedForm).nullable } this.output = mapping.output this.input = mapping.input diff --git a/examples/grails-docs-app/build.gradle b/examples/grails-docs-app/build.gradle index 78fa7f10..68578d76 100644 --- a/examples/grails-docs-app/build.gradle +++ b/examples/grails-docs-app/build.gradle @@ -1,37 +1,41 @@ dependencies { - compile "org.springframework.boot:spring-boot-starter-logging" - compile "org.springframework.boot:spring-boot-autoconfigure" - compile "org.grails:grails-core" - compile "org.springframework.boot:spring-boot-starter-actuator" - compile "org.springframework.boot:spring-boot-starter-tomcat" - compile "org.grails:grails-plugin-url-mappings" - compile "org.grails:grails-plugin-rest" - compile "org.grails:grails-plugin-codecs" - compile "org.grails:grails-plugin-interceptors" - compile "org.grails:grails-plugin-services" - compile "org.grails:grails-plugin-datasource" - compile "org.grails:grails-plugin-databinding" - compile "org.grails:grails-web-boot" - compile "org.grails:grails-logging" - compile "org.grails.plugins:cache" - compile "org.grails.plugins:async" - compile "org.grails.plugins:events" - compile "org.grails.plugins:hibernate5" - compile "org.hibernate:hibernate-core:$hibernateCoreVersion" - compile "org.grails.plugins:views-json" - compile "org.grails.plugins:views-json-templates" + implementation "org.springframework.boot:spring-boot-starter-logging" + implementation "org.springframework.boot:spring-boot-autoconfigure" + implementation "org.grails:grails-core" + implementation "org.springframework.boot:spring-boot-starter-actuator" + implementation "org.springframework.boot:spring-boot-starter-tomcat" + implementation "org.grails:grails-plugin-url-mappings" + implementation "org.grails:grails-plugin-rest" + implementation "org.grails:grails-plugin-codecs" + implementation "org.grails:grails-plugin-interceptors" + implementation "org.grails:grails-plugin-services" + implementation "org.grails:grails-plugin-datasource" + implementation "org.grails:grails-plugin-databinding" + implementation "org.grails:grails-web-boot" + implementation "org.grails:grails-logging" + implementation "org.grails.plugins:cache" + implementation "org.grails.plugins:async" + implementation "org.grails.plugins:events" + implementation "org.grails.plugins:hibernate5" + implementation "org.hibernate:hibernate-core:$hibernateCoreVersion" + implementation "org.grails.plugins:views-json" + implementation "org.grails.plugins:views-json-templates" + implementation 'io.micronaut.rxjava2:micronaut-rxjava2-http-client:1.2.0' console "org.grails:grails-console" profile "org.grails.profiles:rest-api" - runtime "org.glassfish.web:el-impl:2.1.2-b03" - runtime "com.h2database:h2" - runtime "org.apache.tomcat:tomcat-jdbc" - testCompile "org.grails:grails-gorm-testing-support" - testCompile "org.grails:grails-web-testing-support" + runtimeOnly "org.glassfish.web:el-impl:2.1.2-b03" + runtimeOnly "com.h2database:h2" + runtimeOnly "org.apache.tomcat:tomcat-jdbc" + testImplementation "org.grails:grails-gorm-testing-support" + testImplementation "org.grails:grails-web-testing-support" - compile project(":grails-plugin-gorm-graphql-plugin") + implementation project(":grails-plugin-gorm-graphql-plugin") } bootRun { jvmArgs('-Dspring.output.ansi.enabled=always') sourceResources sourceSets.main } +tasks.withType(Test) { + useJUnitPlatform() +} \ No newline at end of file diff --git a/examples/grails-docs-app/grails-app/conf/application.yml b/examples/grails-docs-app/grails-app/conf/application.yml index 78d0ea87..24d0847c 100644 --- a/examples/grails-docs-app/grails-app/conf/application.yml +++ b/examples/grails-docs-app/grails-app/conf/application.yml @@ -21,6 +21,8 @@ spring: groovy: template: check-template-location: false + + management: endpoints: enabled-by-default: false @@ -67,6 +69,7 @@ hibernate: queries: false use_second_level_cache: false use_query_cache: false + dataSource: pooled: true jmxExport: true @@ -78,15 +81,15 @@ environments: development: dataSource: dbCreate: create-drop - url: jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + url: jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE test: dataSource: dbCreate: update - url: jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + url: jdbc:h2:mem:testDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE production: dataSource: dbCreate: none - url: jdbc:h2:./prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + url: jdbc:h2:./prodDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE properties: jmxEnabled: true initialSize: 5 @@ -105,3 +108,4 @@ environments: testOnReturn: false jdbcInterceptors: ConnectionState defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED + diff --git a/examples/grails-docs-app/grails-app/conf/logback.groovy b/examples/grails-docs-app/grails-app/conf/logback.groovy deleted file mode 100644 index 20f85e19..00000000 --- a/examples/grails-docs-app/grails-app/conf/logback.groovy +++ /dev/null @@ -1,36 +0,0 @@ -import grails.util.BuildSettings -import grails.util.Environment -import org.springframework.boot.logging.logback.ColorConverter -import org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter - -import java.nio.charset.Charset - -conversionRule 'clr', ColorConverter -conversionRule 'wex', WhitespaceThrowableProxyConverter - -// See http://logback.qos.ch/manual/groovy.html for details on configuration -appender('STDOUT', ConsoleAppender) { - encoder(PatternLayoutEncoder) { - charset = Charset.forName('UTF-8') - - pattern = - '%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} ' + // Date - '%clr(%5p) ' + // Log level - '%clr(---){faint} %clr([%15.15t]){faint} ' + // Thread - '%clr(%-40.40logger{39}){cyan} %clr(:){faint} ' + // Logger - '%m%n%wex' // Message - } -} - -def targetDir = BuildSettings.TARGET_DIR -if (Environment.isDevelopmentMode() && targetDir != null) { - appender("FULL_STACKTRACE", FileAppender) { - file = "${targetDir}/stacktrace.log" - append = true - encoder(PatternLayoutEncoder) { - pattern = "%level %logger - %msg%n" - } - } - logger("StackTrace", ERROR, ['FULL_STACKTRACE'], false) -} -root(ERROR, ['STDOUT']) diff --git a/examples/grails-docs-app/grails-app/conf/logback.xml b/examples/grails-docs-app/grails-app/conf/logback.xml new file mode 100644 index 00000000..f4e77836 --- /dev/null +++ b/examples/grails-docs-app/grails-app/conf/logback.xml @@ -0,0 +1,17 @@ + + + + + + + + + UTF-8 + '%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex' + + + + + + + \ No newline at end of file diff --git a/examples/grails-multi-datastore-app/build.gradle b/examples/grails-multi-datastore-app/build.gradle index 0fc582a3..6c5e5a37 100755 --- a/examples/grails-multi-datastore-app/build.gradle +++ b/examples/grails-multi-datastore-app/build.gradle @@ -1,42 +1,53 @@ +repositories { + mavenCentral() +} + dependencies { - compile "org.springframework.boot:spring-boot-starter-logging" - compile "org.springframework.boot:spring-boot-autoconfigure" - compile "org.grails:grails-core" - compile "org.springframework.boot:spring-boot-starter-actuator" - compile "org.springframework.boot:spring-boot-starter-tomcat" - compile "org.grails:grails-plugin-url-mappings" - compile "org.grails:grails-plugin-rest" - compile "org.grails:grails-plugin-codecs" - compile "org.grails:grails-plugin-interceptors" - compile "org.grails:grails-plugin-services" - compile "org.grails:grails-plugin-datasource" - compile "org.grails:grails-plugin-databinding" - compile "org.grails:grails-web-boot" - compile "org.grails:grails-logging" - compile "org.grails.plugins:cache" - compile "org.grails.plugins:async" - compile "org.grails.plugins:hibernate5" - compile "org.hibernate:hibernate-core:$hibernateCoreVersion" - compile "org.grails.plugins:mongodb" - compile "org.grails.plugins:views-json" - compile "org.grails.plugins:views-json-templates" + implementation "org.springframework.boot:spring-boot-starter-logging" + implementation "org.springframework.boot:spring-boot-autoconfigure" + implementation "org.grails:grails-core:5.3.2" + implementation "org.springframework.boot:spring-boot-starter-actuator" + implementation "org.springframework.boot:spring-boot-starter-tomcat" + implementation "org.grails:grails-plugin-url-mappings" + implementation "org.grails:grails-plugin-rest" + implementation "org.grails:grails-plugin-codecs" + implementation "org.grails:grails-plugin-interceptors" + implementation "org.grails:grails-plugin-services" + implementation "org.grails:grails-plugin-datasource" + implementation "org.grails:grails-plugin-databinding" + implementation "org.grails:grails-web-boot" + implementation "org.grails:grails-logging" + implementation "org.grails.plugins:cache" + implementation "org.grails.plugins:async" + implementation "org.grails.plugins:hibernate5" + implementation "org.hibernate:hibernate-core:$hibernateCoreVersion" + implementation "org.grails.plugins:mongodb" + implementation "org.grails.plugins:views-json" + implementation 'io.micronaut.rxjava2:micronaut-rxjava2-http-client:1.2.0' + implementation "org.grails.plugins:views-json-templates" + implementation "com.graphql-java:graphql-java:$graphqlJavaVersion" console "org.grails:grails-console" profile "org.grails.profiles:rest-api" - provided "org.grails.plugins:embedded-mongodb:1.0.2" - compile "org.apache.commons:commons-compress:1.10" - runtime "org.glassfish.web:el-impl:2.1.2-b03" - runtime "com.h2database:h2" - runtime "org.apache.tomcat:tomcat-jdbc" - testCompile "org.grails:grails-gorm-testing-support" - testCompile "org.grails.plugins:geb" - testCompile "org.grails:grails-web-testing-support" - testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1" - testRuntime "net.sourceforge.htmlunit:htmlunit:2.18" - - compile project(":grails-plugin-gorm-graphql-plugin") + compileOnly 'org.grails.plugins:embedded-mongodb:2.0.1' + implementation "org.apache.commons:commons-compress:1.10" + implementation "org.glassfish.web:el-impl:2.1.2-b03" + implementation "com.h2database:h2" + implementation "org.apache.tomcat:tomcat-jdbc" + compileOnly "org.grails:grails-gorm-testing-support" + compileOnly "org.grails.plugins:geb" + compileOnly "org.grails:grails-web-testing-support" + testRuntimeOnly "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1" + testRuntimeOnly "net.sourceforge.htmlunit:htmlunit:2.18" + testImplementation "org.grails:grails-test-mixins:3.3.0" + testImplementation "org.grails:grails-gorm-testing-support" + implementation project(":grails-plugin-gorm-graphql-plugin") } bootRun { jvmArgs('-Dspring.output.ansi.enabled=always') sourceResources sourceSets.main } + +tasks.withType(Test) { + useJUnitPlatform() +} diff --git a/examples/grails-multi-datastore-app/grails-app/conf/application.yml b/examples/grails-multi-datastore-app/grails-app/conf/application.yml index 3a1e0c1d..240dd231 100755 --- a/examples/grails-multi-datastore-app/grails-app/conf/application.yml +++ b/examples/grails-multi-datastore-app/grails-app/conf/application.yml @@ -72,6 +72,7 @@ dataSource: driverClassName: org.h2.Driver username: sa password: '' + url: jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE environments: development: diff --git a/examples/grails-multi-datastore-app/src/integration-test/groovy/myapp/BarIntegrationSpec.groovy b/examples/grails-multi-datastore-app/src/integration-test/groovy/myapp/BarIntegrationSpec.groovy index d4bb7cf3..5a3824ff 100644 --- a/examples/grails-multi-datastore-app/src/integration-test/groovy/myapp/BarIntegrationSpec.groovy +++ b/examples/grails-multi-datastore-app/src/integration-test/groovy/myapp/BarIntegrationSpec.groovy @@ -1,15 +1,14 @@ package myapp -import grails.testing.mixin.integration.Integration +import grails.test.mixin.integration.Integration import org.bson.types.ObjectId import org.grails.datastore.gorm.GormEnhancer import org.grails.datastore.mapping.mongo.MongoDatastore import org.grails.gorm.graphql.plugin.testing.GraphQLSpec -import org.grails.web.json.JSONObject -import spock.lang.Specification + @Integration -class BarIntegrationSpec extends Specification implements GraphQLSpec { +class BarIntegrationSpec implements GraphQLSpec { void "test a bar can be created"() { when: diff --git a/examples/grails-multi-datastore-app/src/integration-test/groovy/myapp/FooIntegrationSpec.groovy b/examples/grails-multi-datastore-app/src/integration-test/groovy/myapp/FooIntegrationSpec.groovy index e53d06d7..a6ae2bda 100644 --- a/examples/grails-multi-datastore-app/src/integration-test/groovy/myapp/FooIntegrationSpec.groovy +++ b/examples/grails-multi-datastore-app/src/integration-test/groovy/myapp/FooIntegrationSpec.groovy @@ -1,14 +1,12 @@ package myapp -import grails.testing.mixin.integration.Integration +import grails.test.mixin.integration.Integration import org.grails.datastore.gorm.GormEnhancer import org.grails.gorm.graphql.plugin.testing.GraphQLSpec import org.grails.orm.hibernate.HibernateDatastore -import org.grails.web.json.JSONObject -import spock.lang.Specification @Integration -class FooIntegrationSpec extends Specification implements GraphQLSpec { +class FooIntegrationSpec implements GraphQLSpec { void "test a foo can be created"() { when: diff --git a/examples/grails-tenant-app/build.gradle b/examples/grails-tenant-app/build.gradle index 9f374eea..7b554038 100644 --- a/examples/grails-tenant-app/build.gradle +++ b/examples/grails-tenant-app/build.gradle @@ -1,40 +1,47 @@ dependencies { - compile "org.springframework.boot:spring-boot-starter-logging" - compile "org.springframework.boot:spring-boot-autoconfigure" - compile "org.grails:grails-core" - compile "org.springframework.boot:spring-boot-starter-actuator" - compile "org.springframework.boot:spring-boot-starter-tomcat" - compile "org.grails:grails-plugin-url-mappings" - compile "org.grails:grails-plugin-rest" - compile "org.grails:grails-plugin-codecs" - compile "org.grails:grails-plugin-interceptors" - compile "org.grails:grails-plugin-services" - compile "org.grails:grails-plugin-datasource" - compile "org.grails:grails-plugin-databinding" - compile "org.grails:grails-web-boot" - compile "org.grails:grails-logging" - compile "org.grails.plugins:cache" - compile "org.grails.plugins:async" - compile "org.grails.plugins:events" - compile "org.grails.plugins:hibernate5" - compile "org.hibernate:hibernate-core:$hibernateCoreVersion" - compile "org.grails.plugins:views-json" - compile "org.grails.plugins:views-json-templates" + implementation "org.springframework.boot:spring-boot-starter-logging" + implementation "org.springframework.boot:spring-boot-autoconfigure" + implementation "org.grails:grails-core" + implementation "org.springframework.boot:spring-boot-starter-actuator" + implementation "org.springframework.boot:spring-boot-starter-tomcat" + implementation "org.grails:grails-plugin-url-mappings" + implementation "org.grails:grails-plugin-rest" + implementation "org.grails:grails-plugin-codecs" + implementation "org.grails:grails-plugin-interceptors" + implementation "org.grails:grails-plugin-services" + implementation "org.grails:grails-plugin-datasource" + implementation "org.grails:grails-plugin-databinding" + implementation "org.grails:grails-web-boot" + implementation "org.grails:grails-logging" + implementation "org.grails.plugins:cache" + implementation "org.grails.plugins:async" + implementation "org.grails.plugins:events" + implementation "org.grails.plugins:hibernate5" + implementation "org.hibernate:hibernate-core:$hibernateCoreVersion" + implementation "org.grails.plugins:views-json" + implementation "org.grails.plugins:views-json-templates" + implementation 'io.micronaut.rxjava2:micronaut-rxjava2-http-client:1.2.0' console "org.grails:grails-console" profile "org.grails.profiles:rest-api" - runtime "org.glassfish.web:el-impl:2.1.2-b03" - runtime "com.h2database:h2" - runtime "org.apache.tomcat:tomcat-jdbc" - testCompile "org.grails:grails-gorm-testing-support" - testCompile "org.grails.plugins:geb" - testCompile "org.grails:grails-web-testing-support" - testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1" - testRuntime "net.sourceforge.htmlunit:htmlunit:2.18" + runtimeOnly "org.glassfish.web:el-impl:2.1.2-b03" + runtimeOnly "com.h2database:h2" + runtimeOnly "org.apache.tomcat:tomcat-jdbc" + testImplementation "org.grails:grails-gorm-testing-support" + testImplementation "org.grails.plugins:geb" + testImplementation "org.grails:grails-web-testing-support" + testRuntimeOnly "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1" + testRuntimeOnly "net.sourceforge.htmlunit:htmlunit:2.18" + testImplementation "org.grails:grails-test-mixins:3.3.0" - compile project(":grails-plugin-gorm-graphql-plugin") + + implementation project(":grails-plugin-gorm-graphql-plugin") } bootRun { jvmArgs('-Dspring.output.ansi.enabled=always') sourceResources sourceSets.main } + +tasks.withType(Test) { + useJUnitPlatform() +} \ No newline at end of file diff --git a/examples/grails-tenant-app/grails-app/conf/application.yml b/examples/grails-tenant-app/grails-app/conf/application.yml index 3aef57c6..823b2c80 100644 --- a/examples/grails-tenant-app/grails-app/conf/application.yml +++ b/examples/grails-tenant-app/grails-app/conf/application.yml @@ -83,15 +83,15 @@ environments: development: dataSource: dbCreate: create-drop - url: jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + url: jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE test: dataSource: dbCreate: update - url: jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + url: jdbc:h2:mem:testDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE production: dataSource: dbCreate: none - url: jdbc:h2:./prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + url: jdbc:h2:./prodDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE properties: jmxEnabled: true initialSize: 5 diff --git a/examples/grails-tenant-app/grails-app/conf/logback.groovy b/examples/grails-tenant-app/grails-app/conf/logback.groovy deleted file mode 100644 index 20f85e19..00000000 --- a/examples/grails-tenant-app/grails-app/conf/logback.groovy +++ /dev/null @@ -1,36 +0,0 @@ -import grails.util.BuildSettings -import grails.util.Environment -import org.springframework.boot.logging.logback.ColorConverter -import org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter - -import java.nio.charset.Charset - -conversionRule 'clr', ColorConverter -conversionRule 'wex', WhitespaceThrowableProxyConverter - -// See http://logback.qos.ch/manual/groovy.html for details on configuration -appender('STDOUT', ConsoleAppender) { - encoder(PatternLayoutEncoder) { - charset = Charset.forName('UTF-8') - - pattern = - '%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} ' + // Date - '%clr(%5p) ' + // Log level - '%clr(---){faint} %clr([%15.15t]){faint} ' + // Thread - '%clr(%-40.40logger{39}){cyan} %clr(:){faint} ' + // Logger - '%m%n%wex' // Message - } -} - -def targetDir = BuildSettings.TARGET_DIR -if (Environment.isDevelopmentMode() && targetDir != null) { - appender("FULL_STACKTRACE", FileAppender) { - file = "${targetDir}/stacktrace.log" - append = true - encoder(PatternLayoutEncoder) { - pattern = "%level %logger - %msg%n" - } - } - logger("StackTrace", ERROR, ['FULL_STACKTRACE'], false) -} -root(ERROR, ['STDOUT']) diff --git a/examples/grails-tenant-app/grails-app/conf/logback.xml b/examples/grails-tenant-app/grails-app/conf/logback.xml new file mode 100644 index 00000000..f4e77836 --- /dev/null +++ b/examples/grails-tenant-app/grails-app/conf/logback.xml @@ -0,0 +1,17 @@ + + + + + + + + + UTF-8 + '%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex' + + + + + + + \ No newline at end of file diff --git a/examples/grails-tenant-app/src/integration-test/groovy/grails/tenant/app/UserIntegrationSpec.groovy b/examples/grails-tenant-app/src/integration-test/groovy/grails/tenant/app/UserIntegrationSpec.groovy index 84822325..1487d846 100644 --- a/examples/grails-tenant-app/src/integration-test/groovy/grails/tenant/app/UserIntegrationSpec.groovy +++ b/examples/grails-tenant-app/src/integration-test/groovy/grails/tenant/app/UserIntegrationSpec.groovy @@ -3,8 +3,6 @@ package grails.tenant.app import grails.testing.mixin.integration.Integration import org.grails.datastore.mapping.multitenancy.resolvers.SystemPropertyTenantResolver import org.grails.gorm.graphql.plugin.testing.GraphQLSpec -import org.grails.web.json.JSONArray -import org.grails.web.json.JSONObject import spock.lang.Specification import spock.lang.Stepwise diff --git a/examples/grails-test-app/build.gradle b/examples/grails-test-app/build.gradle index 78fa7f10..6a285b25 100644 --- a/examples/grails-test-app/build.gradle +++ b/examples/grails-test-app/build.gradle @@ -1,37 +1,44 @@ dependencies { - compile "org.springframework.boot:spring-boot-starter-logging" - compile "org.springframework.boot:spring-boot-autoconfigure" - compile "org.grails:grails-core" - compile "org.springframework.boot:spring-boot-starter-actuator" - compile "org.springframework.boot:spring-boot-starter-tomcat" - compile "org.grails:grails-plugin-url-mappings" - compile "org.grails:grails-plugin-rest" - compile "org.grails:grails-plugin-codecs" - compile "org.grails:grails-plugin-interceptors" - compile "org.grails:grails-plugin-services" - compile "org.grails:grails-plugin-datasource" - compile "org.grails:grails-plugin-databinding" - compile "org.grails:grails-web-boot" - compile "org.grails:grails-logging" - compile "org.grails.plugins:cache" - compile "org.grails.plugins:async" - compile "org.grails.plugins:events" - compile "org.grails.plugins:hibernate5" - compile "org.hibernate:hibernate-core:$hibernateCoreVersion" - compile "org.grails.plugins:views-json" - compile "org.grails.plugins:views-json-templates" + implementation "org.springframework.boot:spring-boot-starter-logging" + implementation "org.springframework.boot:spring-boot-autoconfigure" + implementation "org.grails:grails-core" + implementation "org.springframework.boot:spring-boot-starter-actuator" + implementation "org.springframework.boot:spring-boot-starter-tomcat" + implementation "org.grails:grails-plugin-url-mappings" + implementation "org.grails:grails-plugin-rest" + implementation "org.grails:grails-plugin-codecs" + implementation "org.grails:grails-plugin-interceptors" + implementation "org.grails:grails-plugin-services" + implementation "org.grails:grails-plugin-datasource" + implementation "org.grails:grails-plugin-databinding" + implementation "org.grails:grails-web-boot" + implementation "org.grails:grails-logging" + implementation "org.grails.plugins:cache" + implementation "org.grails.plugins:async" + implementation "org.grails.plugins:events" + implementation "org.grails.plugins:hibernate5" + implementation "org.hibernate:hibernate-core:$hibernateCoreVersion" + implementation "org.grails.plugins:views-json" + implementation "org.grails.plugins:views-json-templates" + implementation "com.graphql-java:graphql-java:$graphqlJavaVersion" + implementation 'io.micronaut.rxjava2:micronaut-rxjava2-http-client:1.2.0' console "org.grails:grails-console" profile "org.grails.profiles:rest-api" - runtime "org.glassfish.web:el-impl:2.1.2-b03" - runtime "com.h2database:h2" - runtime "org.apache.tomcat:tomcat-jdbc" - testCompile "org.grails:grails-gorm-testing-support" - testCompile "org.grails:grails-web-testing-support" + runtimeOnly "org.glassfish.web:el-impl:2.1.2-b03" + runtimeOnly "com.h2database:h2" + runtimeOnly "org.apache.tomcat:tomcat-jdbc" + testImplementation "org.grails:grails-gorm-testing-support" + testImplementation "org.grails:grails-web-testing-support" + testImplementation "org.grails:grails-test-mixins:3.3.0" - compile project(":grails-plugin-gorm-graphql-plugin") + implementation project(":grails-plugin-gorm-graphql-plugin") } bootRun { jvmArgs('-Dspring.output.ansi.enabled=always') sourceResources sourceSets.main } + +tasks.withType(Test) { + useJUnitPlatform() +} \ No newline at end of file diff --git a/examples/grails-test-app/grails-app/conf/application.yml b/examples/grails-test-app/grails-app/conf/application.yml index b1be5516..21c4bc0f 100644 --- a/examples/grails-test-app/grails-app/conf/application.yml +++ b/examples/grails-test-app/grails-app/conf/application.yml @@ -84,15 +84,15 @@ environments: development: dataSource: dbCreate: create-drop - url: jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + url: jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE test: dataSource: dbCreate: update - url: jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + url: jdbc:h2:mem:testDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE production: dataSource: dbCreate: none - url: jdbc:h2:./prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + url: jdbc:h2:./prodDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE properties: jmxEnabled: true initialSize: 5 @@ -111,3 +111,8 @@ environments: testOnReturn: false jdbcInterceptors: ConnectionState defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED +spring: + jpa: + properties: + hibernate: + dialect: sql diff --git a/examples/grails-test-app/grails-app/conf/logback.groovy b/examples/grails-test-app/grails-app/conf/logback.groovy deleted file mode 100644 index e782932a..00000000 --- a/examples/grails-test-app/grails-app/conf/logback.groovy +++ /dev/null @@ -1,39 +0,0 @@ -import grails.util.BuildSettings -import grails.util.Environment -import org.springframework.boot.logging.logback.ColorConverter -import org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter - -import java.nio.charset.Charset - -conversionRule 'clr', ColorConverter -conversionRule 'wex', WhitespaceThrowableProxyConverter - -// See http://logback.qos.ch/manual/groovy.html for details on configuration -appender('STDOUT', ConsoleAppender) { - encoder(PatternLayoutEncoder) { - charset = Charset.forName('UTF-8') - - pattern = - '%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} ' + // Date - '%clr(%5p) ' + // Log level - '%clr(---){faint} %clr([%15.15t]){faint} ' + // Thread - '%clr(%-40.40logger{39}){cyan} %clr(:){faint} ' + // Logger - '%m%n%wex' // Message - } -} - -def targetDir = BuildSettings.TARGET_DIR -if (Environment.isDevelopmentMode() && targetDir != null) { - appender('FULL_STACKTRACE', FileAppender) { - file = "${targetDir}/stacktrace.log" - append = true - encoder(PatternLayoutEncoder) { - pattern = '%level %logger - %msg%n' - } - } - logger('StackTrace', ERROR, ['FULL_STACKTRACE'], false) -} - -logger('graphql.execution', WARN, ['STDOUT'], false) - -root(ERROR, ['STDOUT']) diff --git a/examples/grails-test-app/grails-app/conf/logback.xml b/examples/grails-test-app/grails-app/conf/logback.xml new file mode 100644 index 00000000..f4e77836 --- /dev/null +++ b/examples/grails-test-app/grails-app/conf/logback.xml @@ -0,0 +1,17 @@ + + + + + + + + + UTF-8 + '%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex' + + + + + + + \ No newline at end of file diff --git a/examples/grails-test-app/grails-app/domain/grails/test/app/ArguedField.groovy b/examples/grails-test-app/grails-app/domain/grails/test/app/ArguedField.groovy index da3430de..5d2f73da 100644 --- a/examples/grails-test-app/grails-app/domain/grails/test/app/ArguedField.groovy +++ b/examples/grails-test-app/grails-app/domain/grails/test/app/ArguedField.groovy @@ -4,7 +4,6 @@ import grails.compiler.GrailsCompileStatic import org.grails.gorm.graphql.entity.dsl.GraphQLMapping import org.grails.gorm.graphql.fetcher.impl.ClosureDataFetchingEnvironment -@GrailsCompileStatic class ArguedField { String name diff --git a/examples/grails-test-app/grails-app/domain/grails/test/app/Artist.groovy b/examples/grails-test-app/grails-app/domain/grails/test/app/Artist.groovy index 607240a7..65a463a0 100644 --- a/examples/grails-test-app/grails-app/domain/grails/test/app/Artist.groovy +++ b/examples/grails-test-app/grails-app/domain/grails/test/app/Artist.groovy @@ -9,6 +9,7 @@ class Artist { static graphql = GraphQLMapping.build { add('paintings', [Painting]) { + input(false) dataFetcher { return [new Painting(name: 'test', artistName: 'Picasso', heightCm: 60, widthCm: 120)] } diff --git a/examples/grails-test-app/src/integration-test/groovy/grails/test/app/BookIntegrationSpec.groovy b/examples/grails-test-app/src/integration-test/groovy/grails/test/app/BookIntegrationSpec.groovy index 3a60094f..85e6d569 100644 --- a/examples/grails-test-app/src/integration-test/groovy/grails/test/app/BookIntegrationSpec.groovy +++ b/examples/grails-test-app/src/integration-test/groovy/grails/test/app/BookIntegrationSpec.groovy @@ -21,7 +21,7 @@ class BookIntegrationSpec extends Specification implements GraphQLSpec { then: result.errors.size() == 1 - result.errors[0].message == "Validation error of type FieldUndefined: Field 'bookList' in type 'Query' is undefined @ 'bookList'" + result.errors[0].message == "Validation error (FieldUndefined@[bookList]) : Field 'bookList' in type 'Query' is undefined" } } diff --git a/examples/grails-test-app/src/integration-test/groovy/grails/test/app/PaymentIntegrationSpec.groovy b/examples/grails-test-app/src/integration-test/groovy/grails/test/app/PaymentIntegrationSpec.groovy index 3d8a4f1e..885b6f40 100644 --- a/examples/grails-test-app/src/integration-test/groovy/grails/test/app/PaymentIntegrationSpec.groovy +++ b/examples/grails-test-app/src/integration-test/groovy/grails/test/app/PaymentIntegrationSpec.groovy @@ -25,7 +25,7 @@ class PaymentIntegrationSpec extends Specification implements GraphQLSpec { then: result.errors.size() == 1 - result.errors[0].message == "Validation error of type FieldUndefined: Field 'paymentCreate' in type 'Mutation' is undefined @ 'paymentCreate'" + result.errors[0].message == "Validation error (FieldUndefined@[paymentCreate]) : Field 'paymentCreate' in type 'Mutation' is undefined" } void "test creating a credit card payment"() { @@ -108,7 +108,7 @@ class PaymentIntegrationSpec extends Specification implements GraphQLSpec { then: 'An error is returned' obj.data == null obj.errors.size() == 1 - obj.errors[0].message == "Validation error of type FieldUndefined: Field 'cardNumber' in type 'Payment' is undefined @ 'payment/cardNumber'" + obj.errors[0].message == "Validation error (FieldUndefined@[payment/cardNumber]) : Field 'cardNumber' in type 'Payment' is undefined" } void "test querying a list of credit card payments"() { @@ -196,7 +196,8 @@ class PaymentIntegrationSpec extends Specification implements GraphQLSpec { then: 'An error is thrown' obj.data == null obj.errors.size() == 1 - obj.errors[0].message.startsWith('Validation error of type WrongType') + obj.errors[0].message.startsWith('Validation error (WrongType@[paymentUpdate])') + obj.errors[0].message.endsWith("contains a field not in 'PaymentUpdate': 'cardNumber'") when: resp = graphQL.graphql(""" diff --git a/examples/grails-test-app/src/integration-test/groovy/grails/test/app/UserIntegrationSpec.groovy b/examples/grails-test-app/src/integration-test/groovy/grails/test/app/UserIntegrationSpec.groovy index 1bc71df8..7e2fb959 100644 --- a/examples/grails-test-app/src/integration-test/groovy/grails/test/app/UserIntegrationSpec.groovy +++ b/examples/grails-test-app/src/integration-test/groovy/grails/test/app/UserIntegrationSpec.groovy @@ -36,7 +36,8 @@ class UserIntegrationSpec extends Specification implements GraphQLSpec { then: obj.data == null obj.errors.size() == 1 - obj.errors[0].message.startsWith('Validation error of type WrongType') + obj.errors[0].message.startsWith('Validation error (WrongType@[userCreate])') + obj.errors[0].message.endsWith("is missing required fields '[profile]'") when: 'The profile is provided, but missing a required field' resp = graphQL.graphql(""" @@ -63,7 +64,8 @@ class UserIntegrationSpec extends Specification implements GraphQLSpec { then: obj.data == null obj.errors.size() == 1 - obj.errors[0].message.startsWith('Validation error of type WrongType') + obj.errors[0].message.startsWith('Validation error (WrongType@[userCreate])') + obj.errors[0].message.endsWith("is missing required fields '[lastName]'") } void "test creating a user without an address"() { @@ -88,7 +90,8 @@ class UserIntegrationSpec extends Specification implements GraphQLSpec { then: obj.data == null obj.errors.size() == 1 - obj.errors[0].message.startsWith('Validation error of type WrongType') + obj.errors[0].message.startsWith('Validation error (WrongType@[userCreate])') + obj.errors[0].message.endsWith("is missing required fields '[address]'") when: 'The address is provided, but missing a required field' resp = graphQL.graphql(""" @@ -115,7 +118,8 @@ class UserIntegrationSpec extends Specification implements GraphQLSpec { then: obj.data == null obj.errors.size() == 1 - obj.errors[0].message.startsWith('Validation error of type WrongType') + obj.errors[0].message.startsWith('Validation error (WrongType@[userCreate])') + obj.errors[0].message.endsWith("is missing required fields '[zip]'") } void "test creating the top level manager"() { diff --git a/examples/grails-test-app/src/integration-test/groovy/grails/test/app/UserRoleIntegrationSpec.groovy b/examples/grails-test-app/src/integration-test/groovy/grails/test/app/UserRoleIntegrationSpec.groovy index a876f45b..5af670e7 100644 --- a/examples/grails-test-app/src/integration-test/groovy/grails/test/app/UserRoleIntegrationSpec.groovy +++ b/examples/grails-test-app/src/integration-test/groovy/grails/test/app/UserRoleIntegrationSpec.groovy @@ -165,7 +165,7 @@ class UserRoleIntegrationSpec extends Specification implements GraphQLSpec { then: result.errors.size() == 1 - result.errors[0].message == "Validation error of type FieldUndefined: Field 'userRoleUpdate' in type 'Mutation' is undefined @ 'userRoleUpdate'" + result.errors[0].message == "Validation error (FieldUndefined@[userRoleUpdate]) : Field 'userRoleUpdate' in type 'Mutation' is undefined" } void "test listing entities with a complex composite id"() { diff --git a/examples/grails-test-app/src/main/groovy/grails/test/app/GraphQLCustomizer.groovy b/examples/grails-test-app/src/main/groovy/grails/test/app/GraphQLCustomizer.groovy index aff8fa4e..246b4f2e 100644 --- a/examples/grails-test-app/src/main/groovy/grails/test/app/GraphQLCustomizer.groovy +++ b/examples/grails-test-app/src/main/groovy/grails/test/app/GraphQLCustomizer.groovy @@ -1,7 +1,6 @@ package grails.test.app import grails.test.app.pogo.Painting -import grails.test.app.pogo.Profile import graphql.schema.GraphQLObjectType import graphql.schema.GraphQLOutputType import org.grails.gorm.graphql.binding.manager.GraphQLDataBinderManager diff --git a/examples/grails-test-app/src/test/groovy/grails/test/app/manyToMany/StudentSchemaSpec.groovy b/examples/grails-test-app/src/test/groovy/grails/test/app/manyToMany/StudentSchemaSpec.groovy index 217f5931..ebd0fddb 100644 --- a/examples/grails-test-app/src/test/groovy/grails/test/app/manyToMany/StudentSchemaSpec.groovy +++ b/examples/grails-test-app/src/test/groovy/grails/test/app/manyToMany/StudentSchemaSpec.groovy @@ -2,6 +2,8 @@ package grails.test.app.manyToMany import grails.test.hibernate.HibernateSpec import org.grails.gorm.graphql.Schema +import org.junit.Test + class StudentSchemaSpec extends HibernateSpec { diff --git a/examples/spring-boot-app/build.gradle b/examples/spring-boot-app/build.gradle index fef94690..720f2c54 100644 --- a/examples/spring-boot-app/build.gradle +++ b/examples/spring-boot-app/build.gradle @@ -16,23 +16,39 @@ apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' dependencies { - compile 'org.springframework.boot:spring-boot-starter' - compile "org.springframework.boot:spring-boot-starter-web" - compile 'org.codehaus.groovy:groovy' - compile "org.grails:gorm-hibernate5-spring-boot:${gormHibernateVersion}" - compile "org.hibernate:hibernate-core:$hibernateCoreVersion" - compile "org.hibernate:hibernate-ehcache:$hibernateEcacheVersion" - compile "org.grails:grails-core:$grailsVersion" - compile project(":gorm-graphql") + implementation 'org.springframework.boot:spring-boot-starter' + implementation "org.springframework.boot:spring-boot-starter-web" + implementation "org.grails:gorm-hibernate5-spring-boot:7.3.1" + implementation "org.hibernate:hibernate-core:$hibernateCoreVersion" + implementation "org.hibernate:hibernate-ehcache:5.6.15.Final" + implementation "org.grails:grails-core:5.3.2" + implementation project(":gorm-graphql") + implementation 'org.codehaus.groovy:groovy-astbuilder:3.0.19' + implementation 'jakarta.transaction:jakarta.transaction-api:2.0.1' + implementation 'com.github.javaparser:javaparser-core:3.25.5' + implementation "com.graphql-java:graphql-java:$graphqlJavaVersion" + implementation 'junit:junit:4.13.1' + runtimeOnly 'com.h2database:h2:2.1.214' + runtimeOnly 'org.apache.tomcat:tomcat-jdbc:10.1.9' + runtimeOnly "org.apache.tomcat.embed:tomcat-embed-logging-log4j:8.5.0" + implementation 'jakarta.persistence:jakarta.persistence-api:3.1.0' + + runtimeOnly "javax.el:javax.el-api:3.0.0" + runtimeOnly "org.glassfish:javax.el:3.0.0" + + testImplementation 'org.springframework.boot:spring-boot-starter-test' + testImplementation 'org.spockframework:spock-core:2.3-groovy-3.0' + testImplementation 'junit:junit:4.13.2' - runtime "com.h2database:h2:1.4.192" - runtime "org.apache.tomcat:tomcat-jdbc:8.5.0" - runtime "org.apache.tomcat.embed:tomcat-embed-logging-log4j:8.5.0" - runtime "javax.el:javax.el-api:3.0.0" - runtime "org.glassfish:javax.el:3.0.0" - testCompile 'org.springframework.boot:spring-boot-starter-test' - testCompile "org.spockframework:spock-spring:$spockVersion" } + +repositories { + mavenCentral() +} + +tasks.withType(Test) { + useJUnitPlatform() +} \ No newline at end of file diff --git a/examples/spring-boot-app/src/test/groovy/com/example/demo/AuthorIntegrationTests.groovy b/examples/spring-boot-app/src/test/groovy/com/example/demo/AuthorIntegrationTests.groovy index b6324b6a..1b818942 100644 --- a/examples/spring-boot-app/src/test/groovy/com/example/demo/AuthorIntegrationTests.groovy +++ b/examples/spring-boot-app/src/test/groovy/com/example/demo/AuthorIntegrationTests.groovy @@ -1,13 +1,15 @@ package com.example.demo +import org.junit.runner.RunWith import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest import org.springframework.boot.test.web.client.TestRestTemplate import org.springframework.http.ResponseEntity -import spock.lang.Specification +import org.springframework.test.context.junit4.SpringRunner +@RunWith(SpringRunner) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -class AuthorIntegrationTests extends Specification { +class AuthorIntegrationTests { @Autowired private TestRestTemplate restTemplate diff --git a/gradle.properties b/gradle.properties index 31038136..542fd968 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,27 +6,30 @@ projectUrl=https://github.com/grails/gorm-graphql githubSlug=grails/gorm-graphql githubBranch=2.0.x developers=James Kleeh -gormVersion=7.0.5.RELEASE -gormHibernateVersion=7.0.3.RELEASE +gormVersion=7.3.1 +gormHibernateVersion=7.3.1 gormMongoDbVersion=7.0.0.RELEASE -grailsVersion=4.1.2 +grailsVersion=5.3.3 +grailsGradlePluginVersion=5.3.0 grailsDocsVersion=3.3.2 -groovyVersion=2.5.14 +groovyVersion=3.0.11 +junitJupiterVersion=5.9.3 slf4jVersion=1.7.36 -spockVersion=1.3-groovy-2.5 -micronautVersion=1.0.3 -graphqlJavaVersion=17.3 -graphqlJavaScalarExtVersion=17.0 +spockVersion=2.1-groovy-3.0 +micronautVersion=3.8.5 +graphqlJavaVersion=20.6 +graphqlJavaScalarExtVersion=20.2 codenarcVersion=1.6.1 -viewGradleVersion=2.0.0 -viewsJsonVersion=2.0.0 +viewGradleVersion=2.3.2 +viewsJsonVersion=2.3.2 servletApiVersion=4.0.1 cglibNodepVersion=3.2.9 -objenesisVersion=2.6 -jansiVersion=1.17.1 -hibernateEcacheVersion=5.3.7.Final -hibernateCoreVersion=5.3.7.Final +objenesisVersion=3.3 +jansiVersion=1.18 +hibernateEcacheVersion=5.6.7.Final +hibernateCoreVersion=5.6.11.Final org.gradle.daemon=true org.gradle.parallel=true org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1024M + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c0..7454180f 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d355f4c4..53b9e380 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/plugin/build.gradle b/plugin/build.gradle index db05b476..cb68c2e9 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -1,34 +1,34 @@ -buildscript { - repositories { - maven { url "https://repo.grails.org/grails/core" } - } - dependencies { - classpath "org.grails:grails-gradle-plugin:$grailsVersion" - classpath "org.grails.plugins:views-gradle:$viewGradleVersion" - } -} -apply plugin:"org.grails.grails-plugin" -apply plugin:"org.grails.plugins.views-json" +plugins { + id "org.grails.grails-plugin" + id "org.grails.plugins.views-json" +} dependencies { - compile "org.grails:grails-plugin-controllers" - compile "org.grails:grails-plugin-databinding" - compile("org.grails:grails-plugin-rest") { + api "org.grails:grails-plugin-controllers" + api "org.grails:grails-plugin-databinding" + api("org.grails:grails-plugin-rest") { exclude group: 'org.grails.plugins', module: 'converters' } - compile "org.grails:grails-plugin-url-mappings" - compile "org.grails.plugins:views-json:$viewsJsonVersion" - compile "javax.servlet:javax.servlet-api:$servletApiVersion" - compile "io.micronaut:micronaut-http-client:$micronautVersion" - compileOnly "org.grails.plugins:converters:3.3.1" - testCompile "org.grails:grails-web-testing-support" - testCompile "cglib:cglib-nodep:3.3.0" + api "org.grails:grails-plugin-url-mappings" + api "org.grails.plugins:views-json:$viewsJsonVersion" + api 'io.micronaut.rxjava2:micronaut-rxjava2-http-client:1.2.0' + api "javax.servlet:javax.servlet-api:$servletApiVersion" + api "io.micronaut:micronaut-http-client:$micronautVersion" + api "org.grails.plugins:converters:3.3.1" + api 'com.github.javaparser:javaparser-core:3.25.5' + api "com.graphql-java:graphql-java:$graphqlJavaVersion" + testImplementation "org.grails:grails-web-testing-support" + testImplementation "cglib:cglib-nodep:3.3.0" profile "org.grails.profiles:web-plugin" - compile project(":gorm-graphql") + api project(":gorm-graphql") } compileGsonViews { packageName = "gorm-graphql" +} + +tasks.withType(Test) { + useJUnitPlatform() } \ No newline at end of file diff --git a/plugin/src/main/groovy/org/grails/gorm/graphql/plugin/testing/GraphQLSpec.groovy b/plugin/src/main/groovy/org/grails/gorm/graphql/plugin/testing/GraphQLSpec.groovy index 93b70009..ee715582 100644 --- a/plugin/src/main/groovy/org/grails/gorm/graphql/plugin/testing/GraphQLSpec.groovy +++ b/plugin/src/main/groovy/org/grails/gorm/graphql/plugin/testing/GraphQLSpec.groovy @@ -4,8 +4,8 @@ import groovy.json.StreamingJsonBuilder import groovy.transform.TupleConstructor import io.micronaut.http.HttpRequest import io.micronaut.http.HttpResponse -import io.micronaut.http.client.RxHttpClient import io.micronaut.http.uri.UriBuilder +import io.micronaut.rxjava2.http.client.RxHttpClient import org.springframework.beans.factory.annotation.Value trait GraphQLSpec { diff --git a/settings.gradle b/settings.gradle index 4721f14f..cbe3ad70 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,32 @@ +plugins { + id "com.gradle.enterprise" version "3.15.1" + id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.11.3' +} + +gradleEnterprise { + server = 'https://ge.grails.org' + buildScan { + publishAlwaysIf(System.getenv('CI') == 'true') + publishIfAuthenticated() + uploadInBackground = System.getenv("CI") == null + capture { + taskInputFiles = true + } + } +} + +buildCache { + local { enabled = System.getenv('CI') != 'true' } + remote(HttpBuildCache) { + push = System.getenv('CI') == 'true' + enabled = true + url = 'https://ge.grails.org/cache/' + credentials { + username = System.getenv('GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER') + password = System.getenv('GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY') + } + }} + include 'core' include 'plugin' include 'docs'