diff --git a/docs/pom.xml b/docs/pom.xml index 1139dc4e22..644d4e4222 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-parent - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-docs @@ -16,7 +16,7 @@ spring-cloud-contract ${basedir}/.. 3.4 - 1.0.x,1.1.x + 1.0.x,1.1.x,2.0.x diff --git a/docs/src/main/asciidoc/migrations.adoc b/docs/src/main/asciidoc/migrations.adoc index 5cd5952f32..d6c77f812a 100644 --- a/docs/src/main/asciidoc/migrations.adoc +++ b/docs/src/main/asciidoc/migrations.adoc @@ -171,4 +171,12 @@ This exception will occur due to the fact that the tests got generated with an old version of plugin and at test execution time you have an incompatible version of the release train (and vice versa). -Done via https://github.com/spring-cloud/spring-cloud-contract/issues/267[issue 267] \ No newline at end of file +Done via https://github.com/spring-cloud/spring-cloud-contract/issues/267[issue 267] + +[[cloud-verifier-1.2-2.0]] +=== 1.2.x -> 2.0.x + +==== No Camel support + +We will add back Apache Camel support only after this https://issues.apache.org/jira/browse/CAMEL-11430[issue] +gets fixed \ No newline at end of file diff --git a/docs/src/main/asciidoc/verifier_stubrunner_msg.adoc b/docs/src/main/asciidoc/verifier_stubrunner_msg.adoc index adfd9f1225..5402d775ec 100644 --- a/docs/src/main/asciidoc/verifier_stubrunner_msg.adoc +++ b/docs/src/main/asciidoc/verifier_stubrunner_msg.adoc @@ -5,7 +5,6 @@ frameworks: * Spring Integration * Spring Cloud Stream -* Apache Camel * Spring AMQP It also provides entry points to integrate with any other solution on the market. @@ -39,14 +38,14 @@ or the other in your tests. [source,groovy] ---- -include::{tests_path}/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=client_trigger,indent=0] +include::{tests_path}/spring-cloud-contract-stub-runner-stream/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/stream/StreamStubRunnerSpec.groovy[tags=client_trigger,indent=0] ---- [[trigger-group-artifact-ids]] ==== Trigger by Group and Artifact Ids [source,groovy] ---- -include::{tests_path}/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=trigger_group_artifact,indent=0] +include::{tests_path}/spring-cloud-contract-stub-runner-stream/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/stream/StreamStubRunnerSpec.groovy[tags=trigger_group_artifact,indent=0] ---- [[trigger-artifact-ids]] @@ -54,7 +53,7 @@ include::{tests_path}/spring-cloud-contract-stub-runner-camel/src/test/groovy/or [source,groovy] ---- -include::{tests_path}/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=trigger_artifact,indent=0] +include::{tests_path}/spring-cloud-contract-stub-runner-stream/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/stream/StreamStubRunnerSpec.groovy[tags=trigger_artifact,indent=0] ---- [[trigger-all-messages]] @@ -62,11 +61,9 @@ include::{tests_path}/spring-cloud-contract-stub-runner-camel/src/test/groovy/or [source,groovy] ---- -include::{tests_path}/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=trigger_all,indent=0] +include::{tests_path}/spring-cloud-contract-stub-runner-stream/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/stream/StreamStubRunnerSpec.groovy[tags=trigger_all,indent=0] ---- -include::{tests_path}/spring-cloud-contract-stub-runner-camel/README.adoc[] - include::{tests_path}/spring-cloud-contract-stub-runner-integration/README.adoc[] include::{tests_path}/spring-cloud-contract-stub-runner-stream/README.adoc[] diff --git a/pom.xml b/pom.xml index 215bfc9d00..ad304aff5f 100644 --- a/pom.xml +++ b/pom.xml @@ -7,13 +7,13 @@ org.springframework.cloud spring-cloud-build - 1.3.6.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT spring-cloud-contract-parent pom - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT Spring Cloud Contract Spring Cloud Contract @@ -23,15 +23,13 @@ 2016 - 5.12.1 - 2.18.3 2.17 - 1.3.6.BUILD-SNAPSHOT - 1.2.0.BUILD-SNAPSHOT - Ditmars.BUILD-SNAPSHOT - 1.4.0.BUILD-SNAPSHOT - 1.2.2.BUILD-SNAPSHOT - 1.3.0.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT + Elmhurst.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT @@ -57,36 +55,6 @@ pom import - - org.apache.camel - camel-spring - ${camel.version} - - - org.apache.camel - camel-spring-boot-starter - ${camel.version} - - - org.apache.camel - camel-jackson - ${camel.version} - - - org.apache.camel - camel-jms - ${camel.version} - - - org.apache.activemq - activemq-camel - ${activemq.version} - - - org.apache.activemq - activemq-pool - ${activemq.version} - net.sf.jopt-simple jopt-simple @@ -115,12 +83,11 @@ org.springframework.amqp spring-rabbit - 1.6.2.RELEASE + 2.0.0.M4 org.mockito mockito-core - 1.10.19 io.specto @@ -149,13 +116,6 @@ pom import - - org.springframework.boot - spring-boot-dependencies - ${spring-boot.version} - pom - import - org.springframework.cloud spring-cloud-netflix-dependencies @@ -271,11 +231,6 @@ gmavenplus-plugin 1.5 - - com.agilejava.docbkx - docbkx-maven-plugin - 2.0.15 - @@ -314,7 +269,7 @@ spring-snapshots Spring Snapshots - https://repo.spring.io/snapshot + https://repo.spring.io/libs-snapshot-local true @@ -325,7 +280,7 @@ spring-milestones Spring Milestones - https://repo.spring.io/milestone + https://repo.spring.io/libs-milestone-local false @@ -343,7 +298,7 @@ spring-snapshots Spring Snapshots - https://repo.spring.io/snapshot + https://repo.spring.io/libs-snapshot-local true @@ -354,7 +309,7 @@ spring-milestones Spring Milestones - https://repo.spring.io/milestone + https://repo.spring.io/libs-milestone-local false @@ -362,7 +317,7 @@ spring-releases Spring Releases - https://repo.spring.io/release + https://repo.spring.io/libs-release-local false diff --git a/samples/pom.xml b/samples/pom.xml index fd8423495f..5593036e94 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -6,13 +6,13 @@ org.springframework.cloud spring-cloud-contract-parent - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-samples pom - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT Spring Cloud Contract Samples Spring Cloud Contract Samples diff --git a/samples/standalone/contracts/com/example/server/pom.xml b/samples/standalone/contracts/com/example/server/pom.xml index 9df3c430cf..4772345cb7 100644 --- a/samples/standalone/contracts/com/example/server/pom.xml +++ b/samples/standalone/contracts/com/example/server/pom.xml @@ -13,15 +13,15 @@ org.springframework.boot spring-boot-starter-parent - 1.5.8.RELEASE + 2.0.0.M6 UTF-8 1.8 - 1.2.2.BUILD-SNAPSHOT - Edgware.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT + Finchley.BUILD-SNAPSHOT true diff --git a/samples/standalone/dsl/http-client/build.gradle b/samples/standalone/dsl/http-client/build.gradle index 8c205cbed3..42575c7858 100644 --- a/samples/standalone/dsl/http-client/build.gradle +++ b/samples/standalone/dsl/http-client/build.gradle @@ -7,7 +7,7 @@ buildscript { maven { url "http://repo.spring.io/release" } } dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE" + classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M6" } } @@ -24,6 +24,7 @@ repositories { apply plugin: 'groovy' apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' apply plugin: 'maven-publish' dependencyManagement { @@ -47,7 +48,7 @@ test { } task wrapper(type: Wrapper) { - gradleVersion = '2.14' + gradleVersion = '4.0.2' } task resolveDependencies { diff --git a/samples/standalone/dsl/http-client/gradle.properties b/samples/standalone/dsl/http-client/gradle.properties index 0c444e9a19..57ed1c5339 100644 --- a/samples/standalone/dsl/http-client/gradle.properties +++ b/samples/standalone/dsl/http-client/gradle.properties @@ -1,2 +1,2 @@ org.gradle.daemon=false -BOM_VERSION=Edgware.BUILD-SNAPSHOT \ No newline at end of file +BOM_VERSION=Finchley.BUILD-SNAPSHOT \ No newline at end of file diff --git a/samples/standalone/dsl/http-client/gradle/wrapper/gradle-wrapper.jar b/samples/standalone/dsl/http-client/gradle/wrapper/gradle-wrapper.jar index 3baa851b28..96d36c23c8 100644 Binary files a/samples/standalone/dsl/http-client/gradle/wrapper/gradle-wrapper.jar and b/samples/standalone/dsl/http-client/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/standalone/dsl/http-client/gradle/wrapper/gradle-wrapper.properties b/samples/standalone/dsl/http-client/gradle/wrapper/gradle-wrapper.properties index ff3de523bd..64ffcab3bf 100644 --- a/samples/standalone/dsl/http-client/gradle/wrapper/gradle-wrapper.properties +++ b/samples/standalone/dsl/http-client/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Aug 19 15:39:05 CEST 2016 +#Mon Jul 31 11:13:36 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip diff --git a/samples/standalone/dsl/http-client/gradlew b/samples/standalone/dsl/http-client/gradlew index 27309d9231..4453ccea33 100755 --- a/samples/standalone/dsl/http-client/gradlew +++ b/samples/standalone/dsl/http-client/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save ( ) { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/samples/standalone/dsl/http-client/gradlew.bat b/samples/standalone/dsl/http-client/gradlew.bat index 832fdb6079..e95643d6a2 100644 --- a/samples/standalone/dsl/http-client/gradlew.bat +++ b/samples/standalone/dsl/http-client/gradlew.bat @@ -1,90 +1,84 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/standalone/dsl/http-client/pom.xml b/samples/standalone/dsl/http-client/pom.xml index 20d4bd48f9..2122992e44 100644 --- a/samples/standalone/dsl/http-client/pom.xml +++ b/samples/standalone/dsl/http-client/pom.xml @@ -13,14 +13,14 @@ org.springframework.boot spring-boot-starter-parent - 1.5.8.RELEASE + 2.0.0.M6 UTF-8 1.8 - Edgware.BUILD-SNAPSHOT + Finchley.BUILD-SNAPSHOT diff --git a/samples/standalone/dsl/http-server/build.gradle b/samples/standalone/dsl/http-server/build.gradle index 708e19075e..67dcae105a 100644 --- a/samples/standalone/dsl/http-server/build.gradle +++ b/samples/standalone/dsl/http-server/build.gradle @@ -9,7 +9,8 @@ buildscript { } // end::repos[] dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE" + classpath 'org.codehaus.groovy:groovy-all:2.5.0-beta-1' + classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M6" classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${findProperty('verifierVersion') ?: verifierVersion}" } } @@ -29,6 +30,7 @@ repositories { apply plugin: 'groovy' apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' apply plugin: 'spring-cloud-contract' apply plugin: 'maven-publish' @@ -57,7 +59,7 @@ test { } task wrapper(type: Wrapper) { - gradleVersion = '2.14' + gradleVersion = '4.0.2' } clean.doFirst { diff --git a/samples/standalone/dsl/http-server/gradle.properties b/samples/standalone/dsl/http-server/gradle.properties index b99fcb4df7..cb360cc45f 100644 --- a/samples/standalone/dsl/http-server/gradle.properties +++ b/samples/standalone/dsl/http-server/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=false -verifierVersion=1.2.2.BUILD-SNAPSHOT -BOM_VERSION=Edgware.BUILD-SNAPSHOT \ No newline at end of file +verifierVersion=2.0.0.BUILD-SNAPSHOT +BOM_VERSION=Finchley.BUILD-SNAPSHOT \ No newline at end of file diff --git a/samples/standalone/dsl/http-server/gradle/wrapper/gradle-wrapper.jar b/samples/standalone/dsl/http-server/gradle/wrapper/gradle-wrapper.jar index 3baa851b28..96d36c23c8 100644 Binary files a/samples/standalone/dsl/http-server/gradle/wrapper/gradle-wrapper.jar and b/samples/standalone/dsl/http-server/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/standalone/dsl/http-server/gradle/wrapper/gradle-wrapper.properties b/samples/standalone/dsl/http-server/gradle/wrapper/gradle-wrapper.properties index 95d7279349..64ffcab3bf 100644 --- a/samples/standalone/dsl/http-server/gradle/wrapper/gradle-wrapper.properties +++ b/samples/standalone/dsl/http-server/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Aug 19 15:38:58 CEST 2016 +#Mon Jul 31 11:13:36 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip diff --git a/samples/standalone/dsl/http-server/gradlew b/samples/standalone/dsl/http-server/gradlew index 27309d9231..4453ccea33 100755 --- a/samples/standalone/dsl/http-server/gradlew +++ b/samples/standalone/dsl/http-server/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save ( ) { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/samples/standalone/dsl/http-server/gradlew.bat b/samples/standalone/dsl/http-server/gradlew.bat index 832fdb6079..e95643d6a2 100644 --- a/samples/standalone/dsl/http-server/gradlew.bat +++ b/samples/standalone/dsl/http-server/gradlew.bat @@ -1,90 +1,84 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/standalone/dsl/http-server/pom.xml b/samples/standalone/dsl/http-server/pom.xml index 222b5b7c73..c25346ef07 100644 --- a/samples/standalone/dsl/http-server/pom.xml +++ b/samples/standalone/dsl/http-server/pom.xml @@ -13,15 +13,15 @@ org.springframework.boot spring-boot-starter-parent - 1.5.8.RELEASE + 2.0.0.M6 UTF-8 1.8 - 1.2.2.BUILD-SNAPSHOT - Edgware.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT + Finchley.BUILD-SNAPSHOT diff --git a/samples/standalone/dsl/pom.xml b/samples/standalone/dsl/pom.xml index c56bd4c79e..0515f233b6 100644 --- a/samples/standalone/dsl/pom.xml +++ b/samples/standalone/dsl/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-contract-samples-standalone - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. @@ -17,7 +17,7 @@ Spring Cloud Contract Standalone Test Samples used for end to end tests - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT diff --git a/samples/standalone/messaging/pom.xml b/samples/standalone/messaging/pom.xml index 3eea667768..bf67ee7ecc 100644 --- a/samples/standalone/messaging/pom.xml +++ b/samples/standalone/messaging/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-contract-samples-standalone - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. @@ -17,7 +17,7 @@ Spring Cloud Contract Standalone Test Samples used for end to end tests - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT diff --git a/samples/standalone/messaging/stream-sink/build.gradle b/samples/standalone/messaging/stream-sink/build.gradle index 804e0a1224..955c84027b 100644 --- a/samples/standalone/messaging/stream-sink/build.gradle +++ b/samples/standalone/messaging/stream-sink/build.gradle @@ -7,7 +7,7 @@ buildscript { maven { url "http://repo.spring.io/release" } } dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE" + classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M6" } } @@ -24,6 +24,7 @@ repositories { apply plugin: 'groovy' apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' apply plugin: 'maven-publish' dependencyManagement { @@ -60,4 +61,8 @@ task resolveDependencies { } } } +} + +task wrapper(type: Wrapper) { + gradleVersion = '4.0.2' } \ No newline at end of file diff --git a/samples/standalone/messaging/stream-sink/gradle.properties b/samples/standalone/messaging/stream-sink/gradle.properties index b99fcb4df7..cb360cc45f 100644 --- a/samples/standalone/messaging/stream-sink/gradle.properties +++ b/samples/standalone/messaging/stream-sink/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=false -verifierVersion=1.2.2.BUILD-SNAPSHOT -BOM_VERSION=Edgware.BUILD-SNAPSHOT \ No newline at end of file +verifierVersion=2.0.0.BUILD-SNAPSHOT +BOM_VERSION=Finchley.BUILD-SNAPSHOT \ No newline at end of file diff --git a/samples/standalone/messaging/stream-sink/gradle/wrapper/gradle-wrapper.jar b/samples/standalone/messaging/stream-sink/gradle/wrapper/gradle-wrapper.jar index 3baa851b28..96d36c23c8 100644 Binary files a/samples/standalone/messaging/stream-sink/gradle/wrapper/gradle-wrapper.jar and b/samples/standalone/messaging/stream-sink/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/standalone/messaging/stream-sink/gradle/wrapper/gradle-wrapper.properties b/samples/standalone/messaging/stream-sink/gradle/wrapper/gradle-wrapper.properties index d7cdc356ad..64ffcab3bf 100644 --- a/samples/standalone/messaging/stream-sink/gradle/wrapper/gradle-wrapper.properties +++ b/samples/standalone/messaging/stream-sink/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Aug 19 15:39:28 CEST 2016 +#Mon Jul 31 11:13:36 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip diff --git a/samples/standalone/messaging/stream-sink/gradlew b/samples/standalone/messaging/stream-sink/gradlew index 27309d9231..4453ccea33 100755 --- a/samples/standalone/messaging/stream-sink/gradlew +++ b/samples/standalone/messaging/stream-sink/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save ( ) { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/samples/standalone/messaging/stream-sink/gradlew.bat b/samples/standalone/messaging/stream-sink/gradlew.bat index 832fdb6079..e95643d6a2 100644 --- a/samples/standalone/messaging/stream-sink/gradlew.bat +++ b/samples/standalone/messaging/stream-sink/gradlew.bat @@ -1,90 +1,84 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/standalone/messaging/stream-sink/pom.xml b/samples/standalone/messaging/stream-sink/pom.xml index 73c3e5d34c..84daa75556 100644 --- a/samples/standalone/messaging/stream-sink/pom.xml +++ b/samples/standalone/messaging/stream-sink/pom.xml @@ -14,14 +14,14 @@ org.springframework.boot spring-boot-starter-parent - 1.5.8.RELEASE + 2.0.0.M6 UTF-8 1.8 - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT @@ -48,7 +48,7 @@ org.springframework.cloud spring-cloud-dependencies - Edgware.BUILD-SNAPSHOT + Finchley.BUILD-SNAPSHOT pom import diff --git a/samples/standalone/messaging/stream-source/build.gradle b/samples/standalone/messaging/stream-source/build.gradle index f37f6bd09c..f0e2a992dc 100644 --- a/samples/standalone/messaging/stream-source/build.gradle +++ b/samples/standalone/messaging/stream-source/build.gradle @@ -7,7 +7,7 @@ buildscript { maven { url "http://repo.spring.io/release" } } dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE" + classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M6" classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${findProperty('verifierVersion') ?: verifierVersion}" classpath "com.jayway.restassured:rest-assured:2.9.0" classpath "com.jayway.restassured:spring-mock-mvc:2.9.0" @@ -27,6 +27,7 @@ repositories { apply plugin: 'groovy' apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' apply plugin: 'spring-cloud-contract' apply plugin: 'maven-publish' @@ -100,3 +101,7 @@ task resolveDependencies { } } } + +task wrapper(type: Wrapper) { + gradleVersion = '4.0.2' +} \ No newline at end of file diff --git a/samples/standalone/messaging/stream-source/gradle.properties b/samples/standalone/messaging/stream-source/gradle.properties index b99fcb4df7..cb360cc45f 100644 --- a/samples/standalone/messaging/stream-source/gradle.properties +++ b/samples/standalone/messaging/stream-source/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=false -verifierVersion=1.2.2.BUILD-SNAPSHOT -BOM_VERSION=Edgware.BUILD-SNAPSHOT \ No newline at end of file +verifierVersion=2.0.0.BUILD-SNAPSHOT +BOM_VERSION=Finchley.BUILD-SNAPSHOT \ No newline at end of file diff --git a/samples/standalone/messaging/stream-source/gradle/wrapper/gradle-wrapper.jar b/samples/standalone/messaging/stream-source/gradle/wrapper/gradle-wrapper.jar index 3baa851b28..96d36c23c8 100644 Binary files a/samples/standalone/messaging/stream-source/gradle/wrapper/gradle-wrapper.jar and b/samples/standalone/messaging/stream-source/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/standalone/messaging/stream-source/gradle/wrapper/gradle-wrapper.properties b/samples/standalone/messaging/stream-source/gradle/wrapper/gradle-wrapper.properties index fed2c38616..64ffcab3bf 100644 --- a/samples/standalone/messaging/stream-source/gradle/wrapper/gradle-wrapper.properties +++ b/samples/standalone/messaging/stream-source/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Aug 19 15:39:21 CEST 2016 +#Mon Jul 31 11:13:36 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip diff --git a/samples/standalone/messaging/stream-source/gradlew b/samples/standalone/messaging/stream-source/gradlew index 27309d9231..4453ccea33 100755 --- a/samples/standalone/messaging/stream-source/gradlew +++ b/samples/standalone/messaging/stream-source/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save ( ) { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/samples/standalone/messaging/stream-source/gradlew.bat b/samples/standalone/messaging/stream-source/gradlew.bat index 832fdb6079..e95643d6a2 100644 --- a/samples/standalone/messaging/stream-source/gradlew.bat +++ b/samples/standalone/messaging/stream-source/gradlew.bat @@ -1,90 +1,84 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/standalone/messaging/stream-source/pom.xml b/samples/standalone/messaging/stream-source/pom.xml index a84336623b..59e0b77dde 100644 --- a/samples/standalone/messaging/stream-source/pom.xml +++ b/samples/standalone/messaging/stream-source/pom.xml @@ -14,14 +14,14 @@ org.springframework.boot spring-boot-starter-parent - 1.5.8.RELEASE + 2.0.0.M6 UTF-8 1.8 - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT @@ -76,7 +76,7 @@ org.springframework.cloud spring-cloud-dependencies - Edgware.BUILD-SNAPSHOT + Finchley.BUILD-SNAPSHOT pom import diff --git a/samples/standalone/pact/pact-http-client/build.gradle b/samples/standalone/pact/pact-http-client/build.gradle index f477e647d2..8d60313435 100644 --- a/samples/standalone/pact/pact-http-client/build.gradle +++ b/samples/standalone/pact/pact-http-client/build.gradle @@ -7,7 +7,7 @@ buildscript { maven { url "http://repo.spring.io/release" } } dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE" + classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M6" } } @@ -24,6 +24,7 @@ repositories { apply plugin: 'groovy' apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' apply plugin: 'maven-publish' dependencyManagement { @@ -51,7 +52,7 @@ test { } task wrapper(type: Wrapper) { - gradleVersion = '2.14' + gradleVersion = '4.0.2' } task resolveDependencies { diff --git a/samples/standalone/pact/pact-http-client/gradle.properties b/samples/standalone/pact/pact-http-client/gradle.properties index 0c444e9a19..57ed1c5339 100644 --- a/samples/standalone/pact/pact-http-client/gradle.properties +++ b/samples/standalone/pact/pact-http-client/gradle.properties @@ -1,2 +1,2 @@ org.gradle.daemon=false -BOM_VERSION=Edgware.BUILD-SNAPSHOT \ No newline at end of file +BOM_VERSION=Finchley.BUILD-SNAPSHOT \ No newline at end of file diff --git a/samples/standalone/pact/pact-http-client/gradle/wrapper/gradle-wrapper.jar b/samples/standalone/pact/pact-http-client/gradle/wrapper/gradle-wrapper.jar index 3baa851b28..96d36c23c8 100644 Binary files a/samples/standalone/pact/pact-http-client/gradle/wrapper/gradle-wrapper.jar and b/samples/standalone/pact/pact-http-client/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/standalone/pact/pact-http-client/gradle/wrapper/gradle-wrapper.properties b/samples/standalone/pact/pact-http-client/gradle/wrapper/gradle-wrapper.properties index ff3de523bd..64ffcab3bf 100644 --- a/samples/standalone/pact/pact-http-client/gradle/wrapper/gradle-wrapper.properties +++ b/samples/standalone/pact/pact-http-client/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Aug 19 15:39:05 CEST 2016 +#Mon Jul 31 11:13:36 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip diff --git a/samples/standalone/pact/pact-http-client/gradlew b/samples/standalone/pact/pact-http-client/gradlew index 27309d9231..4453ccea33 100755 --- a/samples/standalone/pact/pact-http-client/gradlew +++ b/samples/standalone/pact/pact-http-client/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save ( ) { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/samples/standalone/pact/pact-http-client/gradlew.bat b/samples/standalone/pact/pact-http-client/gradlew.bat index 832fdb6079..e95643d6a2 100644 --- a/samples/standalone/pact/pact-http-client/gradlew.bat +++ b/samples/standalone/pact/pact-http-client/gradlew.bat @@ -1,90 +1,84 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/standalone/pact/pact-http-client/pom.xml b/samples/standalone/pact/pact-http-client/pom.xml index 7811daf6bd..0bd0c4c70b 100644 --- a/samples/standalone/pact/pact-http-client/pom.xml +++ b/samples/standalone/pact/pact-http-client/pom.xml @@ -13,14 +13,14 @@ org.springframework.boot spring-boot-starter-parent - 1.5.8.RELEASE + 2.0.0.M6 UTF-8 1.8 - Edgware.BUILD-SNAPSHOT + Finchley.BUILD-SNAPSHOT diff --git a/samples/standalone/pact/pact-http-server/build.gradle b/samples/standalone/pact/pact-http-server/build.gradle index 6833482dc8..a1bd11bd17 100644 --- a/samples/standalone/pact/pact-http-server/build.gradle +++ b/samples/standalone/pact/pact-http-server/build.gradle @@ -7,7 +7,7 @@ buildscript { maven { url "http://repo.spring.io/release" } } dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE" + classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M6" classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${findProperty('verifierVersion') ?: verifierVersion}" //tag::pact_dependency[] classpath "org.springframework.cloud:spring-cloud-contract-spec-pact:${findProperty('verifierVersion') ?: verifierVersion}" @@ -29,6 +29,7 @@ repositories { apply plugin: 'groovy' apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' apply plugin: 'spring-cloud-contract' apply plugin: 'maven-publish' @@ -57,7 +58,7 @@ test { } task wrapper(type: Wrapper) { - gradleVersion = '2.14' + gradleVersion = '4.0.2' } clean.doFirst { diff --git a/samples/standalone/pact/pact-http-server/gradle.properties b/samples/standalone/pact/pact-http-server/gradle.properties index b99fcb4df7..cb360cc45f 100644 --- a/samples/standalone/pact/pact-http-server/gradle.properties +++ b/samples/standalone/pact/pact-http-server/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=false -verifierVersion=1.2.2.BUILD-SNAPSHOT -BOM_VERSION=Edgware.BUILD-SNAPSHOT \ No newline at end of file +verifierVersion=2.0.0.BUILD-SNAPSHOT +BOM_VERSION=Finchley.BUILD-SNAPSHOT \ No newline at end of file diff --git a/samples/standalone/pact/pact-http-server/gradle/wrapper/gradle-wrapper.jar b/samples/standalone/pact/pact-http-server/gradle/wrapper/gradle-wrapper.jar index 3baa851b28..96d36c23c8 100644 Binary files a/samples/standalone/pact/pact-http-server/gradle/wrapper/gradle-wrapper.jar and b/samples/standalone/pact/pact-http-server/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/standalone/pact/pact-http-server/gradle/wrapper/gradle-wrapper.properties b/samples/standalone/pact/pact-http-server/gradle/wrapper/gradle-wrapper.properties index 95d7279349..64ffcab3bf 100644 --- a/samples/standalone/pact/pact-http-server/gradle/wrapper/gradle-wrapper.properties +++ b/samples/standalone/pact/pact-http-server/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Aug 19 15:38:58 CEST 2016 +#Mon Jul 31 11:13:36 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip diff --git a/samples/standalone/pact/pact-http-server/gradlew b/samples/standalone/pact/pact-http-server/gradlew index 27309d9231..4453ccea33 100755 --- a/samples/standalone/pact/pact-http-server/gradlew +++ b/samples/standalone/pact/pact-http-server/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save ( ) { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/samples/standalone/pact/pact-http-server/gradlew.bat b/samples/standalone/pact/pact-http-server/gradlew.bat index 832fdb6079..e95643d6a2 100644 --- a/samples/standalone/pact/pact-http-server/gradlew.bat +++ b/samples/standalone/pact/pact-http-server/gradlew.bat @@ -1,90 +1,84 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/standalone/pact/pact-http-server/pom.xml b/samples/standalone/pact/pact-http-server/pom.xml index d0d8769c63..81f6247744 100644 --- a/samples/standalone/pact/pact-http-server/pom.xml +++ b/samples/standalone/pact/pact-http-server/pom.xml @@ -13,15 +13,15 @@ org.springframework.boot spring-boot-starter-parent - 1.5.8.RELEASE + 2.0.0.M6 UTF-8 1.8 - 1.2.2.BUILD-SNAPSHOT - Edgware.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT + Finchley.BUILD-SNAPSHOT diff --git a/samples/standalone/pact/pom.xml b/samples/standalone/pact/pom.xml index 6ed9a76f15..2035c0bc75 100644 --- a/samples/standalone/pact/pom.xml +++ b/samples/standalone/pact/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-contract-samples-standalone - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. @@ -17,7 +17,7 @@ Spring Cloud Contract Standalone Test Samples used for end to end tests with Pact - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT diff --git a/samples/standalone/pom.xml b/samples/standalone/pom.xml index 49f22a073e..dea61ec965 100644 --- a/samples/standalone/pom.xml +++ b/samples/standalone/pom.xml @@ -6,13 +6,13 @@ org.springframework.cloud spring-cloud-contract-samples - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-samples-standalone pom - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT Spring Cloud Contract Standalone Test Samples Spring Cloud Contract Standalone Test Samples used for end to end tests diff --git a/samples/standalone/restdocs/http-client/build.gradle b/samples/standalone/restdocs/http-client/build.gradle index 612371779f..bb76c36a03 100644 --- a/samples/standalone/restdocs/http-client/build.gradle +++ b/samples/standalone/restdocs/http-client/build.gradle @@ -7,7 +7,7 @@ buildscript { maven { url "http://repo.spring.io/release" } } dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE" + classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M6" } } @@ -24,6 +24,7 @@ repositories { apply plugin: 'groovy' apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' apply plugin: 'maven-publish' dependencyManagement { @@ -51,7 +52,7 @@ test { } task wrapper(type: Wrapper) { - gradleVersion = '2.14' + gradleVersion = '4.0.2' } task resolveDependencies { diff --git a/samples/standalone/restdocs/http-client/gradle.properties b/samples/standalone/restdocs/http-client/gradle.properties index b99fcb4df7..cb360cc45f 100644 --- a/samples/standalone/restdocs/http-client/gradle.properties +++ b/samples/standalone/restdocs/http-client/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=false -verifierVersion=1.2.2.BUILD-SNAPSHOT -BOM_VERSION=Edgware.BUILD-SNAPSHOT \ No newline at end of file +verifierVersion=2.0.0.BUILD-SNAPSHOT +BOM_VERSION=Finchley.BUILD-SNAPSHOT \ No newline at end of file diff --git a/samples/standalone/restdocs/http-client/gradle/wrapper/gradle-wrapper.jar b/samples/standalone/restdocs/http-client/gradle/wrapper/gradle-wrapper.jar index 3baa851b28..96d36c23c8 100644 Binary files a/samples/standalone/restdocs/http-client/gradle/wrapper/gradle-wrapper.jar and b/samples/standalone/restdocs/http-client/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/standalone/restdocs/http-client/gradle/wrapper/gradle-wrapper.properties b/samples/standalone/restdocs/http-client/gradle/wrapper/gradle-wrapper.properties index 04160e9888..64ffcab3bf 100644 --- a/samples/standalone/restdocs/http-client/gradle/wrapper/gradle-wrapper.properties +++ b/samples/standalone/restdocs/http-client/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Aug 19 15:39:49 CEST 2016 +#Mon Jul 31 11:13:36 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip diff --git a/samples/standalone/restdocs/http-client/gradlew b/samples/standalone/restdocs/http-client/gradlew index 27309d9231..4453ccea33 100755 --- a/samples/standalone/restdocs/http-client/gradlew +++ b/samples/standalone/restdocs/http-client/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save ( ) { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/samples/standalone/restdocs/http-client/gradlew.bat b/samples/standalone/restdocs/http-client/gradlew.bat index 832fdb6079..e95643d6a2 100644 --- a/samples/standalone/restdocs/http-client/gradlew.bat +++ b/samples/standalone/restdocs/http-client/gradlew.bat @@ -1,90 +1,84 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/standalone/restdocs/http-client/pom.xml b/samples/standalone/restdocs/http-client/pom.xml index 20fdc253a2..15941c38e3 100644 --- a/samples/standalone/restdocs/http-client/pom.xml +++ b/samples/standalone/restdocs/http-client/pom.xml @@ -13,14 +13,14 @@ org.springframework.boot spring-boot-starter-parent - 1.5.8.RELEASE + 2.0.0.M6 UTF-8 1.8 - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT diff --git a/samples/standalone/restdocs/http-server/build.gradle b/samples/standalone/restdocs/http-server/build.gradle index f4c0302c39..59426bb7ea 100644 --- a/samples/standalone/restdocs/http-server/build.gradle +++ b/samples/standalone/restdocs/http-server/build.gradle @@ -10,7 +10,7 @@ buildscript { maven { url "http://repo.spring.io/plugins-staging-local/" } } dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE" + classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M6" } } @@ -27,6 +27,7 @@ repositories { apply plugin: 'groovy' apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' apply plugin: 'maven-publish' apply plugin: 'maven' @@ -54,7 +55,7 @@ test { } task wrapper(type: Wrapper) { - gradleVersion = '2.14' + gradleVersion = '4.0.2' } task stubsJar(type: Jar, dependsOn: ['copySnippets', 'copySources', 'copyClasses']) { diff --git a/samples/standalone/restdocs/http-server/gradle.properties b/samples/standalone/restdocs/http-server/gradle.properties index b99fcb4df7..cb360cc45f 100644 --- a/samples/standalone/restdocs/http-server/gradle.properties +++ b/samples/standalone/restdocs/http-server/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=false -verifierVersion=1.2.2.BUILD-SNAPSHOT -BOM_VERSION=Edgware.BUILD-SNAPSHOT \ No newline at end of file +verifierVersion=2.0.0.BUILD-SNAPSHOT +BOM_VERSION=Finchley.BUILD-SNAPSHOT \ No newline at end of file diff --git a/samples/standalone/restdocs/http-server/gradle/wrapper/gradle-wrapper.jar b/samples/standalone/restdocs/http-server/gradle/wrapper/gradle-wrapper.jar index 3baa851b28..96d36c23c8 100644 Binary files a/samples/standalone/restdocs/http-server/gradle/wrapper/gradle-wrapper.jar and b/samples/standalone/restdocs/http-server/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/standalone/restdocs/http-server/gradle/wrapper/gradle-wrapper.properties b/samples/standalone/restdocs/http-server/gradle/wrapper/gradle-wrapper.properties index 8b8a75c0ac..64ffcab3bf 100644 --- a/samples/standalone/restdocs/http-server/gradle/wrapper/gradle-wrapper.properties +++ b/samples/standalone/restdocs/http-server/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Aug 19 15:39:42 CEST 2016 +#Mon Jul 31 11:13:36 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip diff --git a/samples/standalone/restdocs/http-server/gradlew b/samples/standalone/restdocs/http-server/gradlew index 27309d9231..4453ccea33 100755 --- a/samples/standalone/restdocs/http-server/gradlew +++ b/samples/standalone/restdocs/http-server/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save ( ) { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/samples/standalone/restdocs/http-server/gradlew.bat b/samples/standalone/restdocs/http-server/gradlew.bat index 832fdb6079..e95643d6a2 100644 --- a/samples/standalone/restdocs/http-server/gradlew.bat +++ b/samples/standalone/restdocs/http-server/gradlew.bat @@ -1,90 +1,84 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/standalone/restdocs/http-server/pom.xml b/samples/standalone/restdocs/http-server/pom.xml index ac17ca768c..fd51a7329b 100644 --- a/samples/standalone/restdocs/http-server/pom.xml +++ b/samples/standalone/restdocs/http-server/pom.xml @@ -13,14 +13,14 @@ org.springframework.boot spring-boot-starter-parent - 1.5.8.RELEASE + 2.0.0.M6 UTF-8 1.8 - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT @@ -104,7 +104,9 @@ false true - ${basedir}/src/assembly/stub.xml + + ${basedir}/src/assembly/stub.xml + diff --git a/samples/standalone/restdocs/pom.xml b/samples/standalone/restdocs/pom.xml index 2c4d67c86b..ac78d0ad0d 100644 --- a/samples/standalone/restdocs/pom.xml +++ b/samples/standalone/restdocs/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-contract-samples-standalone - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. @@ -17,7 +17,7 @@ Spring Cloud Contract Standalone Test Samples used for end to end tests - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT diff --git a/samples/wiremock-jetty/pom.xml b/samples/wiremock-jetty/pom.xml index 93b783e9cf..fb538a4dd2 100644 --- a/samples/wiremock-jetty/pom.xml +++ b/samples/wiremock-jetty/pom.xml @@ -4,7 +4,7 @@ 4.0.0 wiremock-jetty - 0.0.1 + 2.0.0.BUILD-SNAPSHOT jar wiremock-jetty @@ -13,14 +13,14 @@ org.springframework.boot spring-boot-starter-parent - 1.5.8.RELEASE + 2.0.0.M6 UTF-8 1.8 - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT diff --git a/samples/wiremock-native/pom.xml b/samples/wiremock-native/pom.xml index e75600c5b1..38f1b95acb 100644 --- a/samples/wiremock-native/pom.xml +++ b/samples/wiremock-native/pom.xml @@ -4,7 +4,7 @@ 4.0.0 wiremock-native - 0.0.1 + 2.0.0.BUILD-SNAPSHOT jar wiremock-native @@ -13,14 +13,14 @@ org.springframework.boot spring-boot-starter-parent - 1.5.8.RELEASE + 2.0.0.M6 UTF-8 1.8 - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT diff --git a/samples/wiremock-tomcat/pom.xml b/samples/wiremock-tomcat/pom.xml index bddaebc37b..835d6e2dca 100644 --- a/samples/wiremock-tomcat/pom.xml +++ b/samples/wiremock-tomcat/pom.xml @@ -4,7 +4,7 @@ 4.0.0 wiremock-tomcat - 0.0.1 + 2.0.0.BUILD-SNAPSHOT jar wiremock-tomcat @@ -13,14 +13,14 @@ org.springframework.boot spring-boot-starter-parent - 1.5.8.RELEASE + 2.0.0.M6 UTF-8 1.8 - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT diff --git a/samples/wiremock-undertow-ssl/pom.xml b/samples/wiremock-undertow-ssl/pom.xml index 9634487f65..202fa7d889 100644 --- a/samples/wiremock-undertow-ssl/pom.xml +++ b/samples/wiremock-undertow-ssl/pom.xml @@ -4,7 +4,7 @@ 4.0.0 wiremock-undertow-ssl - 0.0.1 + 2.0.0.BUILD-SNAPSHOT jar wiremock-undertow-ssl @@ -13,14 +13,14 @@ org.springframework.boot spring-boot-starter-parent - 1.5.8.RELEASE + 2.0.0.M6 UTF-8 1.8 - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT diff --git a/samples/wiremock-undertow/pom.xml b/samples/wiremock-undertow/pom.xml index db5cb533a4..91e91794c8 100644 --- a/samples/wiremock-undertow/pom.xml +++ b/samples/wiremock-undertow/pom.xml @@ -4,7 +4,7 @@ 4.0.0 wiremock-undertow - 0.0.1 + 2.0.0.BUILD-SNAPSHOT jar wiremock-undertow @@ -13,14 +13,14 @@ org.springframework.boot spring-boot-starter-parent - 1.5.8.RELEASE + 2.0.0.M6 UTF-8 1.8 - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT diff --git a/spring-cloud-contract-dependencies/pom.xml b/spring-cloud-contract-dependencies/pom.xml index d4afd8f28f..30c12555db 100644 --- a/spring-cloud-contract-dependencies/pom.xml +++ b/spring-cloud-contract-dependencies/pom.xml @@ -5,11 +5,11 @@ spring-cloud-dependencies-parent org.springframework.cloud - 1.3.6.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT spring-cloud-contract-dependencies - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT pom spring-cloud-contract-dependencies Spring Cloud Contract Dependencies diff --git a/spring-cloud-contract-shade/pom.xml b/spring-cloud-contract-shade/pom.xml index 1b678eceba..d9801e51b6 100644 --- a/spring-cloud-contract-shade/pom.xml +++ b/spring-cloud-contract-shade/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-parent - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-shade diff --git a/spring-cloud-contract-spec/pom.xml b/spring-cloud-contract-spec/pom.xml index 7bc987e897..57b84600ff 100644 --- a/spring-cloud-contract-spec/pom.xml +++ b/spring-cloud-contract-spec/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-parent - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-spec diff --git a/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/BodyMatchers.groovy b/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/BodyMatchers.groovy index b865c32d62..7fe351c450 100644 --- a/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/BodyMatchers.groovy +++ b/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/BodyMatchers.groovy @@ -1,5 +1,7 @@ package org.springframework.cloud.contract.spec.internal +import java.util.regex.Pattern + import groovy.transform.Canonical import groovy.transform.CompileStatic import groovy.transform.EqualsAndHashCode @@ -46,6 +48,12 @@ class BodyMatchers { return new MatchingTypeValue(MatchingType.REGEX, regex) } + // Backward compatibility with RegexPatterns + MatchingTypeValue byRegex(Pattern regex) { + assert regex + return new MatchingTypeValue(MatchingType.REGEX, regex) + } + MatchingTypeValue byEquality() { return new MatchingTypeValue(MatchingType.EQUALITY, null) } diff --git a/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/Common.groovy b/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/Common.groovy index 122d042ef0..416fbfa367 100644 --- a/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/Common.groovy +++ b/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/Common.groovy @@ -113,6 +113,11 @@ class Common { return Pattern.compile(regex) } + // Backward compatibility with RegexPatterns + Pattern regex(Pattern regex) { + return regex + } + OptionalProperty optional(Object object) { return new OptionalProperty(object) } diff --git a/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/PatternValueDslProperty.groovy b/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/PatternValueDslProperty.groovy index d8054ca59d..6f98c5c630 100644 --- a/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/PatternValueDslProperty.groovy +++ b/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/PatternValueDslProperty.groovy @@ -36,7 +36,8 @@ abstract class PatternValueDslProperty { protected abstract T createProperty(Pattern pattern, Object generatedValue) T anyAlphaUnicode() { - return createAndValidateProperty(RegexPatterns.ONLY_ALPHA_UNICODE, randomString(20)) + return createAndValidateProperty(RegexPatterns.ONLY_ALPHA_UNICODE, + RandomStringGenerator.randomString(20)) } T anyNumber() { @@ -88,26 +89,16 @@ abstract class PatternValueDslProperty { } T anyNonBlankString() { - return createAndValidateProperty(RegexPatterns.NON_BLANK, randomString(20)) + return createAndValidateProperty(RegexPatterns.NON_BLANK, + RandomStringGenerator.randomString(20)) } T anyNonEmptyString() { - return createAndValidateProperty(RegexPatterns.NON_EMPTY, randomString(20)) + return createAndValidateProperty(RegexPatterns.NON_EMPTY, + RandomStringGenerator.randomString(20)) } T anyOf(String... values){ return createAndValidateProperty(RegexPatterns.anyOf(values), values[0]) } - - private static String randomString(int length) { - char[] characterSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray() - Random random = new Random() - char[] result = new char[length] - for (int i = 0; i < result.length; i++) { - // picks a random index out of character set > random character - int randomCharIndex = random.nextInt(characterSet.length) - result[i] = characterSet[randomCharIndex] - } - return new String(result) - } } diff --git a/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/RandomStringGenerator.java b/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/RandomStringGenerator.java new file mode 100644 index 0000000000..0cddf8713b --- /dev/null +++ b/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/RandomStringGenerator.java @@ -0,0 +1,17 @@ +package org.springframework.cloud.contract.spec.internal; + +import java.util.Random; + +class RandomStringGenerator { + static String randomString(int length) { + char[] characterSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray(); + Random random = new Random(); + char[] result = new char[length]; + for (int i = 0; i < result.length; i++) { + // picks a random index out of character set > random character + int randomCharIndex = random.nextInt(characterSet.length); + result[i] = characterSet[randomCharIndex]; + } + return new String(result); + } +} diff --git a/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/RegexPatterns.groovy b/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/RegexPatterns.groovy index 17be0c063a..aa85d1b549 100644 --- a/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/RegexPatterns.groovy +++ b/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/RegexPatterns.groovy @@ -52,60 +52,60 @@ class RegexPatterns { return Pattern.compile(values.collect({"^$it\$"}).join("|")) } - String onlyAlphaUnicode() { - return ONLY_ALPHA_UNICODE.pattern() + Pattern onlyAlphaUnicode() { + return ONLY_ALPHA_UNICODE } - String number() { - return NUMBER.pattern() + Pattern number() { + return NUMBER } - String anyBoolean() { - return TRUE_OR_FALSE.pattern() + Pattern anyBoolean() { + return TRUE_OR_FALSE } - String ipAddress() { - return IP_ADDRESS.pattern() + Pattern ipAddress() { + return IP_ADDRESS } - String hostname() { - return HOSTNAME_PATTERN.pattern() + Pattern hostname() { + return HOSTNAME_PATTERN } - String email() { - return EMAIL.pattern() + Pattern email() { + return EMAIL } - String url() { - return URL.pattern() + Pattern url() { + return URL } - String uuid(){ - return UUID.pattern() + Pattern uuid(){ + return UUID } - String isoDate() { - return ANY_DATE.pattern() + Pattern isoDate() { + return ANY_DATE } - String isoDateTime() { - return ANY_DATE_TIME.pattern() + Pattern isoDateTime() { + return ANY_DATE_TIME } - String isoTime() { - return ANY_TIME.pattern() + Pattern isoTime() { + return ANY_TIME } - String iso8601WithOffset() { - return ISO8601_WITH_OFFSET.pattern() + Pattern iso8601WithOffset() { + return ISO8601_WITH_OFFSET } - String nonEmpty() { - return NON_EMPTY.pattern() + Pattern nonEmpty() { + return NON_EMPTY } - String nonBlank() { - return NON_BLANK.pattern() + Pattern nonBlank() { + return NON_BLANK } // end::regexps[] diff --git a/spring-cloud-contract-spec/src/test/groovy/org/springframework/cloud/contract/spec/internal/RegexPatternsSpec.groovy b/spring-cloud-contract-spec/src/test/groovy/org/springframework/cloud/contract/spec/internal/RegexPatternsSpec.groovy index 5764ac588f..a4726ce569 100644 --- a/spring-cloud-contract-spec/src/test/groovy/org/springframework/cloud/contract/spec/internal/RegexPatternsSpec.groovy +++ b/spring-cloud-contract-spec/src/test/groovy/org/springframework/cloud/contract/spec/internal/RegexPatternsSpec.groovy @@ -18,15 +18,13 @@ package org.springframework.cloud.contract.spec.internal import spock.lang.Specification -import java.util.regex.Pattern - class RegexPatternsSpec extends Specification { RegexPatterns regexPatterns = new RegexPatterns() def "should generate a regex for ip address [#textToMatch] that is a match [#shouldMatch]"() { expect: - shouldMatch == Pattern.compile(regexPatterns.ipAddress()).matcher(textToMatch).matches() + shouldMatch == regexPatterns.ipAddress().matcher(textToMatch).matches() where: textToMatch || shouldMatch '123.123.123.123' || true @@ -35,7 +33,7 @@ class RegexPatternsSpec extends Specification { def "should generate a regex for hostname [#textToMatch] that is a match [#shouldMatch]"() { expect: - shouldMatch == Pattern.compile(regexPatterns.hostname()).matcher(textToMatch).matches() + shouldMatch == regexPatterns.hostname().matcher(textToMatch).matches() where: textToMatch || shouldMatch 'https://asd.com' || true @@ -48,7 +46,7 @@ class RegexPatternsSpec extends Specification { def "should generate a regex for email [#textToMatch] that is a match [#shouldMatch]"() { expect: - shouldMatch == Pattern.compile(regexPatterns.email()).matcher(textToMatch).matches() + shouldMatch == regexPatterns.email().matcher(textToMatch).matches() where: textToMatch || shouldMatch 'asd@asd.com' || true @@ -59,7 +57,7 @@ class RegexPatternsSpec extends Specification { // @see http://formvalidation.io/validators/uri/ def "should generate a regex for url [#textToMatch] that is a match [#shouldMatch]"() { expect: - shouldMatch == Pattern.compile(regexPatterns.url()).matcher(textToMatch).matches() + shouldMatch == regexPatterns.url().matcher(textToMatch).matches() where: textToMatch || shouldMatch 'ftp://asd.com:9090/asd/a?a=b' || true @@ -130,7 +128,7 @@ class RegexPatternsSpec extends Specification { def "should generate a regex for a number [#textToMatch] that is a match [#shouldMatch]"() { expect: - shouldMatch == Pattern.compile(regexPatterns.number()).matcher(textToMatch).matches() + shouldMatch == regexPatterns.number().matcher(textToMatch).matches() where: textToMatch || shouldMatch '1' || true @@ -142,7 +140,7 @@ class RegexPatternsSpec extends Specification { def "should generate a regex for a uuid [#textToMatch] that is a match [#shouldMatch]"() { expect: - shouldMatch == Pattern.compile(regexPatterns.uuid()).matcher(textToMatch).matches() + shouldMatch == regexPatterns.uuid().matcher(textToMatch).matches() where: textToMatch || shouldMatch UUID.randomUUID().toString() || true @@ -155,7 +153,7 @@ class RegexPatternsSpec extends Specification { def "should generate a regex with date [#textToMatch] in YYYY-MM-DD format that should match [#shouldMatch]"() { expect: - shouldMatch == Pattern.compile(regexPatterns.isoDate()).matcher(textToMatch).matches() + shouldMatch == regexPatterns.isoDate().matcher(textToMatch).matches() where: textToMatch || shouldMatch "2014-03-01" || true @@ -173,7 +171,7 @@ class RegexPatternsSpec extends Specification { def "should generate a regex with datetime [#textToMatch] in YYYY-MM-DDTHH:mm:ss format that should match [#shouldMatch]"() { expect: - shouldMatch == Pattern.compile(regexPatterns.isoDateTime()).matcher(textToMatch).matches() + shouldMatch == regexPatterns.isoDateTime().matcher(textToMatch).matches() where: textToMatch || shouldMatch "2014-03-01T12:23:45" || true @@ -198,7 +196,7 @@ class RegexPatternsSpec extends Specification { def "should generate a regex with time [#textToMatch] in HH:mm:ss format that should match [#shouldMatch]"() { expect: - shouldMatch == Pattern.compile(regexPatterns.isoTime()).matcher(textToMatch).matches() + shouldMatch == regexPatterns.isoTime().matcher(textToMatch).matches() where: textToMatch || shouldMatch "12:23:45" || true @@ -214,7 +212,7 @@ class RegexPatternsSpec extends Specification { def "should generate a regex with iso8601DateTimeWithTimezone [#textToMatch] in YYYY-MM-DDTHH:mm:ss.SSSZZ format that should match [#shouldMatch]"(){ expect: - shouldMatch == Pattern.compile(regexPatterns.iso8601WithOffset()).matcher(textToMatch).matches() + shouldMatch == regexPatterns.iso8601WithOffset().matcher(textToMatch).matches() where: textToMatch || shouldMatch '2014-03-01T12:23:45Z' || true @@ -227,7 +225,7 @@ class RegexPatternsSpec extends Specification { def "should generate a regex for a non blank string [#textToMatch] that should match [#shouldMatch]"(){ expect: - shouldMatch == Pattern.compile(regexPatterns.nonBlank()).matcher(textToMatch).matches() + shouldMatch == regexPatterns.nonBlank().matcher(textToMatch).matches() where: textToMatch || shouldMatch 'Not Empty' || true @@ -241,7 +239,7 @@ class RegexPatternsSpec extends Specification { def "should generate a regex for a non empty string [#textToMatch] that should match [#shouldMatch]"() { expect: - shouldMatch == Pattern.compile(regexPatterns.nonEmpty()).matcher(textToMatch).matches() + shouldMatch == regexPatterns.nonEmpty().matcher(textToMatch).matches() where: textToMatch || shouldMatch 'Not Empty' || true diff --git a/spring-cloud-contract-starters/pom.xml b/spring-cloud-contract-starters/pom.xml index 3a9f1a8ff8..c30ea485dc 100644 --- a/spring-cloud-contract-starters/pom.xml +++ b/spring-cloud-contract-starters/pom.xml @@ -7,7 +7,7 @@ org.springframework.cloud spring-cloud-contract-parent - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. diff --git a/spring-cloud-contract-starters/spring-cloud-starter-contract-stub-runner-jetty/pom.xml b/spring-cloud-contract-starters/spring-cloud-starter-contract-stub-runner-jetty/pom.xml index 9b899e9e1f..8b72e0b72b 100644 --- a/spring-cloud-contract-starters/spring-cloud-starter-contract-stub-runner-jetty/pom.xml +++ b/spring-cloud-contract-starters/spring-cloud-starter-contract-stub-runner-jetty/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-starters - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-starter-contract-stub-runner-jetty diff --git a/spring-cloud-contract-starters/spring-cloud-starter-contract-stub-runner/pom.xml b/spring-cloud-contract-starters/spring-cloud-starter-contract-stub-runner/pom.xml index 775e63461c..40d2f4f6d5 100644 --- a/spring-cloud-contract-starters/spring-cloud-starter-contract-stub-runner/pom.xml +++ b/spring-cloud-contract-starters/spring-cloud-starter-contract-stub-runner/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-starters - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-starter-contract-stub-runner @@ -17,10 +17,6 @@ org.springframework.cloud spring-cloud-contract-stub-runner - - org.springframework.integration - spring-integration-java-dsl - org.springframework.boot spring-boot-starter-test diff --git a/spring-cloud-contract-starters/spring-cloud-starter-contract-verifier/pom.xml b/spring-cloud-contract-starters/spring-cloud-starter-contract-verifier/pom.xml index 436bcbac20..96270fd5bc 100644 --- a/spring-cloud-contract-starters/spring-cloud-starter-contract-verifier/pom.xml +++ b/spring-cloud-contract-starters/spring-cloud-starter-contract-verifier/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-starters - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-starter-contract-verifier diff --git a/spring-cloud-contract-stub-runner/pom.xml b/spring-cloud-contract-stub-runner/pom.xml index 45707881ec..9fb26c48b3 100644 --- a/spring-cloud-contract-stub-runner/pom.xml +++ b/spring-cloud-contract-stub-runner/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-parent - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-stub-runner @@ -38,7 +38,7 @@ org.springframework.cloud - spring-cloud-starter-ribbon + spring-cloud-starter-netflix-ribbon true @@ -60,21 +60,6 @@ jopt-simple true - - org.apache.camel - camel-spring-boot-starter - true - - - org.apache.camel - camel-jackson - true - - - org.springframework.integration - spring-integration-java-dsl - true - junit junit @@ -131,7 +116,7 @@ org.springframework.cloud - spring-cloud-starter-eureka + spring-cloud-netflix-eureka-server true diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelConfiguration.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelConfiguration.java deleted file mode 100644 index 743224bfd5..0000000000 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelConfiguration.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2013-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.cloud.contract.stubrunner.messaging.camel; - -import java.util.Collection; -import java.util.Map; - -import org.apache.camel.RoutesBuilder; -import org.apache.camel.spring.SpringRouteBuilder; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.cloud.contract.spec.Contract; -import org.springframework.cloud.contract.stubrunner.BatchStubRunner; -import org.springframework.cloud.contract.stubrunner.StubConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * Camel configuration that iterates over the downloaded Groovy DSLs and registers a route - * for each DSL. - * - * @author Marcin Grzejszczak - */ -@Configuration -@ConditionalOnClass(RoutesBuilder.class) -@ConditionalOnProperty(name="stubrunner.camel.enabled", havingValue="true", matchIfMissing=true) -public class StubRunnerCamelConfiguration { - - @Bean - public RoutesBuilder myRouter(final BatchStubRunner batchStubRunner) { - return new SpringRouteBuilder() { - @Override - public void configure() throws Exception { - Map> contracts = batchStubRunner - .getContracts(); - for (Collection list : contracts.values()) { - for (Contract it : list) { - if (it.getInput() != null - && it.getInput().getMessageFrom() != null - && it.getOutputMessage() != null - && it.getOutputMessage().getSentTo() != null) { - from(it.getInput().getMessageFrom().getClientValue()) - .filter(new StubRunnerCamelPredicate(it)) - .process(new StubRunnerCamelProcessor(it)) - .to(it.getOutputMessage().getSentTo() - .getClientValue()); - } - } - } - } - }; - } -} diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelPredicate.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelPredicate.java deleted file mode 100644 index e5cdc683df..0000000000 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelPredicate.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2013-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.cloud.contract.stubrunner.messaging.camel; - -import java.util.Map; -import java.util.regex.Pattern; - -import org.apache.camel.Exchange; -import org.apache.camel.Predicate; -import org.springframework.cloud.contract.spec.Contract; -import org.springframework.cloud.contract.spec.internal.BodyMatcher; -import org.springframework.cloud.contract.spec.internal.BodyMatchers; -import org.springframework.cloud.contract.spec.internal.Header; -import org.springframework.cloud.contract.verifier.util.MapConverter; -import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper; -import org.springframework.cloud.contract.verifier.util.JsonPaths; -import org.springframework.cloud.contract.verifier.util.JsonToJsonPathsConverter; -import org.springframework.cloud.contract.verifier.util.MethodBufferingJsonVerifiable; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.jayway.jsonpath.DocumentContext; -import com.jayway.jsonpath.JsonPath; -import com.toomuchcoding.jsonassert.JsonAssertion; - -/** - * Passes through a message that matches the one defined in the DSL - * - * @author Marcin Grzejszczak - */ -class StubRunnerCamelPredicate implements Predicate { - - private final Contract groovyDsl; - private final ContractVerifierObjectMapper objectMapper = new ContractVerifierObjectMapper(); - - public StubRunnerCamelPredicate(Contract groovyDsl) { - this.groovyDsl = groovyDsl; - } - - @Override - public boolean matches(Exchange exchange) { - if (!headersMatch(exchange)) { - return false; - } - Object inputMessage = exchange.getIn().getBody(); - BodyMatchers matchers = this.groovyDsl.getInput().getMatchers(); - Object dslBody = MapConverter.getStubSideValues(this.groovyDsl.getInput().getMessageBody()); - Object matchingInputMessage = JsonToJsonPathsConverter - .removeMatchingJsonPaths(dslBody, matchers); - JsonPaths jsonPaths = JsonToJsonPathsConverter - .transformToJsonPathWithStubsSideValuesAndNoArraySizeCheck( - matchingInputMessage); - DocumentContext parsedJson; - try { - parsedJson = JsonPath - .parse(this.objectMapper.writeValueAsString(inputMessage)); - } - catch (JsonProcessingException e) { - throw new IllegalStateException("Cannot serialize to JSON", e); - } - boolean matches = true; - for (MethodBufferingJsonVerifiable path : jsonPaths) { - matches &= matchesJsonPath(parsedJson, path.jsonPath()); - } - if (matchers != null && matchers.hasMatchers()) { - for (BodyMatcher matcher : matchers.jsonPathMatchers()) { - String jsonPath = JsonToJsonPathsConverter.convertJsonPathAndRegexToAJsonPath(matcher, dslBody); - matches &= matchesJsonPath(parsedJson, jsonPath); - } - } - return matches; - } - - private boolean matchesJsonPath(DocumentContext parsedJson, String jsonPath) { - try { - JsonAssertion.assertThat(parsedJson).matchesJsonPath(jsonPath); - return true; - } catch (Exception e) { - return false; - } - } - - private boolean headersMatch(Exchange exchange) { - Map headers = exchange.getIn().getHeaders(); - boolean matches = true; - for (Header it : this.groovyDsl.getInput().getMessageHeaders().getEntries()) { - String name = it.getName(); - Object value = it.getClientValue(); - Object valueInHeader = headers.get(name); - matches &= value instanceof Pattern ? - ((Pattern) value).matcher(valueInHeader.toString()).matches() : - valueInHeader!=null && valueInHeader.equals(value); - } - return matches; - } -} diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelProcessor.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelProcessor.java deleted file mode 100644 index e733c5a817..0000000000 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelProcessor.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2013-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.cloud.contract.stubrunner.messaging.camel; - -import org.springframework.cloud.contract.verifier.util.BodyExtractor; -import org.apache.camel.Exchange; -import org.apache.camel.Message; -import org.apache.camel.Processor; -import org.springframework.cloud.contract.spec.Contract; -import org.springframework.cloud.contract.spec.internal.Header; - -/** - * Sends forward a message defined in the DSL. Also removes headers from the input message - * and provides the headers from the DSL. - * - * @author Marcin Grzejszczak - */ -class StubRunnerCamelProcessor implements Processor { - - private final Contract groovyDsl; - - StubRunnerCamelProcessor(Contract groovyDsl) { - this.groovyDsl = groovyDsl; - } - - @Override - public void process(Exchange exchange) throws Exception { - Message input = exchange.getIn(); - if (this.groovyDsl.getInput().getMessageHeaders() != null) { - for (Header entry : this.groovyDsl.getInput().getMessageHeaders().getEntries()) { - input.removeHeader(entry.getName()); - } - } - if (this.groovyDsl.getOutputMessage() == null) { - return; - } - input.setBody(BodyExtractor - .extractStubValueFrom(this.groovyDsl.getOutputMessage().getBody())); - if (this.groovyDsl.getOutputMessage().getHeaders() != null) { - for (Header entry : this.groovyDsl.getOutputMessage().getHeaders().getEntries()) { - input.setHeader(entry.getName(), entry.getClientValue()); - } - } - } -} diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/integration/StubRunnerIntegrationConfiguration.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/integration/StubRunnerIntegrationConfiguration.java index 49f9683a8b..c01d094891 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/integration/StubRunnerIntegrationConfiguration.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/integration/StubRunnerIntegrationConfiguration.java @@ -19,6 +19,7 @@ package org.springframework.cloud.contract.stubrunner.messaging.integration; import java.util.Collection; import java.util.Map; import java.util.Map.Entry; +import java.util.function.Consumer; import org.springframework.beans.factory.config.AutowireCapableBeanFactory; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -34,7 +35,6 @@ import org.springframework.integration.dsl.FilterEndpointSpec; import org.springframework.integration.dsl.GenericEndpointSpec; import org.springframework.integration.dsl.IntegrationFlowBuilder; import org.springframework.integration.dsl.IntegrationFlows; -import org.springframework.integration.dsl.support.Consumer; import org.springframework.integration.transformer.MessageTransformingHandler; import org.springframework.messaging.Message; diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/stream/StubRunnerStreamConfiguration.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/stream/StubRunnerStreamConfiguration.java index 9d171d4b7e..91db4dd200 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/stream/StubRunnerStreamConfiguration.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/stream/StubRunnerStreamConfiguration.java @@ -19,6 +19,7 @@ package org.springframework.cloud.contract.stubrunner.messaging.stream; import java.util.Collection; import java.util.Map; import java.util.Map.Entry; +import java.util.function.Consumer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -43,7 +44,6 @@ import org.springframework.integration.dsl.FilterEndpointSpec; import org.springframework.integration.dsl.GenericEndpointSpec; import org.springframework.integration.dsl.IntegrationFlowBuilder; import org.springframework.integration.dsl.IntegrationFlows; -import org.springframework.integration.dsl.support.Consumer; import org.springframework.integration.transformer.MessageTransformingHandler; import org.springframework.messaging.Message; import org.springframework.util.StringUtils; diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/provider/wiremock/WireMockHttpServerStub.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/provider/wiremock/WireMockHttpServerStub.java index 7146153c20..8413c934dd 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/provider/wiremock/WireMockHttpServerStub.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/provider/wiremock/WireMockHttpServerStub.java @@ -94,8 +94,8 @@ public class WireMockHttpServerStub implements HttpServerStub { @Override public HttpServerStub start() { if (isRunning()) { - if (log.isDebugEnabled()) { - log.debug("The server is already running at port [" + port() + "]"); + if (log.isTraceEnabled()) { + log.trace("The server is already running at port [" + port() + "]"); } return this; } @@ -113,8 +113,8 @@ public class WireMockHttpServerStub implements HttpServerStub { @Override public HttpServerStub stop() { if (!isRunning()) { - if (log.isDebugEnabled()) { - log.debug("Trying to stop a non started server!"); + if (log.isTraceEnabled()) { + log.trace("Trying to stop a non started server!"); } return this; } diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerDiscoveryClient.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerDiscoveryClient.java index 05af101388..d98313f262 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerDiscoveryClient.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerDiscoveryClient.java @@ -25,7 +25,6 @@ import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.springframework.cloud.client.DefaultServiceInstance; import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.discovery.DiscoveryClient; import org.springframework.cloud.contract.stubrunner.RunningStubs; @@ -51,7 +50,7 @@ class StubRunnerDiscoveryClient implements DiscoveryClient { public StubRunnerDiscoveryClient(DiscoveryClient delegate, StubFinder stubFinder, StubMapperProperties stubMapperProperties, String springAppName) { this.delegate = delegate instanceof StubRunnerDiscoveryClient ? - noOpDiscoveryClient(springAppName) : delegate; + noOpDiscoveryClient() : delegate; if (log.isDebugEnabled()) { log.debug("Will delegate calls to discovery service [" + this.delegate + "] if a stub is not found"); } @@ -61,7 +60,7 @@ class StubRunnerDiscoveryClient implements DiscoveryClient { public StubRunnerDiscoveryClient(StubFinder stubFinder, StubMapperProperties stubMapperProperties, String springAppName) { - this.delegate = noOpDiscoveryClient(springAppName); + this.delegate = noOpDiscoveryClient(); if (log.isDebugEnabled()) { log.debug("Will delegate calls to discovery service [" + this.delegate + "] if a stub is not found"); } @@ -69,8 +68,8 @@ class StubRunnerDiscoveryClient implements DiscoveryClient { this.stubMapperProperties = stubMapperProperties; } - private StubRunnerNoOpDiscoveryClient noOpDiscoveryClient(String springAppName) { - return new StubRunnerNoOpDiscoveryClient(new DefaultServiceInstance(springAppName, "localhost", 0, false)); + private StubRunnerNoOpDiscoveryClient noOpDiscoveryClient() { + return new StubRunnerNoOpDiscoveryClient(); } @Override @@ -85,18 +84,6 @@ class StubRunnerDiscoveryClient implements DiscoveryClient { return ""; } - @Override - public ServiceInstance getLocalServiceInstance() { - try { - return this.delegate.getLocalServiceInstance(); - } catch (Exception e) { - if (log.isDebugEnabled()) { - log.debug("Failed to get local service instance from delegate", e); - } - } - return null; - } - @Override public List getInstances(String serviceId) { String ivyNotation = this.stubMapperProperties.fromServiceIdToIvyNotation(serviceId); @@ -155,22 +142,11 @@ class StubRunnerDiscoveryClient implements DiscoveryClient { class StubRunnerNoOpDiscoveryClient implements DiscoveryClient { - private final ServiceInstance instance; - - public StubRunnerNoOpDiscoveryClient(ServiceInstance instance) { - this.instance = instance; - } - @Override public String description() { return "Spring Cloud Stub Runner No-op DiscoveryClient"; } - @Override - public ServiceInstance getLocalServiceInstance() { - return this.instance; - } - @Override public List getInstances(String serviceId) { return Collections.emptyList(); diff --git a/spring-cloud-contract-stub-runner/src/main/resources/META-INF/spring.factories b/spring-cloud-contract-stub-runner/src/main/resources/META-INF/spring.factories index dc3d4e026a..6d40105b96 100644 --- a/spring-cloud-contract-stub-runner/src/main/resources/META-INF/spring.factories +++ b/spring-cloud-contract-stub-runner/src/main/resources/META-INF/spring.factories @@ -5,7 +5,6 @@ org.springframework.cloud.contract.stubrunner.spring.cloud.StubRunnerSpringCloud org.springframework.cloud.contract.stubrunner.spring.cloud.ribbon.StubRunnerRibbonAutoConfiguration,\ org.springframework.cloud.contract.stubrunner.messaging.stream.StubRunnerStreamConfiguration,\ org.springframework.cloud.contract.stubrunner.messaging.integration.StubRunnerIntegrationConfiguration,\ -org.springframework.cloud.contract.stubrunner.messaging.camel.StubRunnerCamelConfiguration,\ org.springframework.cloud.contract.stubrunner.spring.cloud.zookeeper.StubRunnerSpringCloudZookeeperAutoConfiguration,\ org.springframework.cloud.contract.stubrunner.spring.cloud.eureka.StubRunnerSpringCloudEurekaAutoConfiguration,\ org.springframework.cloud.contract.stubrunner.spring.cloud.consul.StubRunnerSpringCloudConsulAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerExecutorSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerExecutorSpec.groovy index fdcfbf5f29..9422952229 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerExecutorSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerExecutorSpec.groovy @@ -28,8 +28,8 @@ import spock.lang.Specification class StubRunnerExecutorSpec extends Specification { - static final int MIN_PORT = 8999 - static final int MAX_PORT = 9999 + static final int MIN_PORT = 18999 + static final int MAX_PORT = 19999 private AvailablePortScanner portScanner private StubRepository repository diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelPredicateSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelPredicateSpec.groovy deleted file mode 100644 index ba71c68044..0000000000 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelPredicateSpec.groovy +++ /dev/null @@ -1,137 +0,0 @@ -package org.springframework.cloud.contract.stubrunner.messaging.camel - -import org.apache.camel.Exchange -import org.apache.camel.Message -import org.springframework.cloud.contract.spec.Contract -import spock.lang.Specification - -/** - * @author Marcin Grzejszczak - */ -class StubRunnerCamelPredicateSpec extends Specification { - Exchange exchange = Stub(Exchange) - Message message = Stub(Message) - - def "should return false if headers don't match"() { - given: - Contract dsl = Contract.make { - input { - messageFrom "foo" - messageBody(foo: "bar") - messageHeaders { - header("foo", $(c(regex("[0-9]{3}")), p(123))) - } - } - } - and: - StubRunnerCamelPredicate predicate = new StubRunnerCamelPredicate(dsl) - exchange.in >> message - message.headers >> [ - foo: "non matching stuff" - ] - expect: - !predicate.matches(exchange) - } - - def "should return false if headers match and body doesn't"() { - given: - Contract dsl = Contract.make { - input { - messageFrom "foo" - messageHeaders { - header("foo", 123) - } - messageBody(foo: $(c(regex("[0-9]{3}")), p(123))) - } - } - and: - StubRunnerCamelPredicate predicate = new StubRunnerCamelPredicate(dsl) - exchange.in >> message - message.headers >> [ - foo: 123 - ] - message.body >> [ - foo: "non matching stuff" - ] - expect: - !predicate.matches(exchange) - } - - def "should return false if headers match and body doesn't when it's using matchers"() { - given: - Contract dsl = Contract.make { - input { - messageFrom "foo" - messageHeaders { - header("foo", 123) - } - messageBody(foo: "non matching stuff") - stubMatchers { - jsonPath('$.foo', byRegex("[0-9]{3}")) - } - } - } - and: - StubRunnerCamelPredicate predicate = new StubRunnerCamelPredicate(dsl) - exchange.in >> message - message.headers >> [ - foo: 123 - ] - message.body >> [ - foo: "non matching stuff" - ] - expect: - !predicate.matches(exchange) - } - def "should return true if headers and body match"() { - given: - Contract dsl = Contract.make { - input { - messageFrom "foo" - messageHeaders { - header("foo", 123) - } - messageBody(foo: $(c(regex("[0-9]{3}")), p(123))) - - } - } - and: - StubRunnerCamelPredicate predicate = new StubRunnerCamelPredicate(dsl) - exchange.in >> message - message.headers >> [ - foo: 123 - ] - message.body >> [ - foo: 123 - ] - expect: - predicate.matches(exchange) - - } - def "should return true if headers and body using matchers match"() { - given: - Contract dsl = Contract.make { - input { - messageFrom "foo" - messageHeaders { - header("foo", 123) - } - messageBody(foo: 123) - stubMatchers { - jsonPath('$.foo', byRegex("[0-9]{3}")) - } - } - } - and: - StubRunnerCamelPredicate predicate = new StubRunnerCamelPredicate(dsl) - exchange.in >> message - message.headers >> [ - foo: 123 - ] - message.body >> [ - foo: 123 - ] - expect: - predicate.matches(exchange) - } -} diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/server/StubRunnerBootSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/server/StubRunnerBootSpec.groovy index 197b6c0c3a..c436dfc803 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/server/StubRunnerBootSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/server/StubRunnerBootSpec.groovy @@ -16,16 +16,16 @@ package org.springframework.cloud.contract.stubrunner.server -import io.restassured.module.mockmvc.RestAssuredMockMvc import groovy.json.JsonSlurper +import io.restassured.module.mockmvc.RestAssuredMockMvc +import spock.lang.Specification + import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootContextLoader import org.springframework.boot.test.context.SpringBootTest import org.springframework.cloud.contract.stubrunner.StubRunning import org.springframework.test.context.ActiveProfiles import org.springframework.test.context.ContextConfiguration -import spock.lang.Specification - /** * @author Marcin Grzejszczak */ @@ -55,7 +55,7 @@ class StubRunnerBootSpec extends Specification { def response = RestAssuredMockMvc.get("/stubs/${stubId}") then: response.statusCode == 200 - response.body.as(Integer) > 0 + Integer.valueOf(response.body.asString()) > 0 where: stubId << ['org.springframework.cloud.contract.verifier.stubs:bootService:+:stubs', 'org.springframework.cloud.contract.verifier.stubs:bootService:0.0.1-SNAPSHOT:stubs', diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/serverexamples/StubRunnerBootConsulExample.java b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/serverexamples/StubRunnerBootConsulExample.java index 9cc35ccab1..538edfe53d 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/serverexamples/StubRunnerBootConsulExample.java +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/serverexamples/StubRunnerBootConsulExample.java @@ -43,7 +43,6 @@ public class StubRunnerBootConsulExample { -Dstubrunner.ids=org.springframework.cloud.contract.verifier.stubs:loanIssuance,org.springframework.cloud.contract.verifier.stubs:fraudDetectionServer,org.springframework.cloud.contract.verifier.stubs:bootService -Dstubrunner.idsToServiceIds.fraudDetectionServer=someNameThatShouldMapFraudDetectionServer -Dstubrunner.cloud.consul.enabled=true --Dstubrunner.camel.enabled=false -Dspring.cloud.zookeeper.enabled=false -Deureka.client.enabled=false -Dspring.cloud.zookeeper.discovery.enabled=false diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/serverexamples/StubRunnerBootEurekaExample.java b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/serverexamples/StubRunnerBootEurekaExample.java index 7973900003..a8dcc118f3 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/serverexamples/StubRunnerBootEurekaExample.java +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/serverexamples/StubRunnerBootEurekaExample.java @@ -56,7 +56,6 @@ public class StubRunnerBootEurekaExample { -Dstubrunner.cloud.eureka.enabled=true -Dstubrunner.repositoryRoot=classpath:m2repo/repository/ --Dstubrunner.camel.enabled=false -Dspring.cloud.zookeeper.enabled=false -Dspring.cloud.zookeeper.discovery.enabled=false -Ddebug=true diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/serverexamples/StubRunnerBootZookeeperExample.java b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/serverexamples/StubRunnerBootZookeeperExample.java index 5e6af84c81..984722d66c 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/serverexamples/StubRunnerBootZookeeperExample.java +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/serverexamples/StubRunnerBootZookeeperExample.java @@ -43,7 +43,6 @@ public class StubRunnerBootZookeeperExample { -Dstubrunner.cloud.stubbed.discovery.enabled=false -Dstubrunner.cloud.zookeepr.enabled=true -Dstubrunner.repositoryRoot=classpath:m2repo/repository/ --Dstubrunner.camel.enabled=false -Deureka.client.enabled=false -Ddebug=true diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfigurationSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfigurationSpec.groovy index 4dad71a21e..6851b346cb 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfigurationSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfigurationSpec.groovy @@ -39,7 +39,6 @@ import spock.lang.Specification // tag::test[] @ContextConfiguration(classes = Config, loader = SpringBootContextLoader) @SpringBootTest(properties = [" stubrunner.cloud.enabled=false", - "stubrunner.camel.enabled=false", 'foo=${stubrunner.runningstubs.fraudDetectionServer.port}']) @AutoConfigureStubRunner(mappingsOutputFolder = "target/outputmappings/") @DirtiesContext diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerSpec.groovy index c51b1496d8..272920c915 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerSpec.groovy @@ -16,6 +16,8 @@ package org.springframework.cloud.contract.stubrunner.spring.cloud +import spock.lang.Specification + import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.autoconfigure.EnableAutoConfiguration import org.springframework.boot.test.context.SpringBootContextLoader @@ -32,8 +34,6 @@ import org.springframework.http.ResponseEntity import org.springframework.messaging.Message import org.springframework.test.annotation.DirtiesContext import org.springframework.test.context.ContextConfiguration -import spock.lang.Specification - /** * @author Marcin Grzejszczak */ diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerWithConsumerNameSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerWithConsumerNameSpec.groovy index 8e451ff9e6..eb61c7b1bf 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerWithConsumerNameSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerStubsPerConsumerWithConsumerNameSpec.groovy @@ -16,6 +16,8 @@ package org.springframework.cloud.contract.stubrunner.spring.cloud +import spock.lang.Specification + import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.autoconfigure.EnableAutoConfiguration import org.springframework.boot.test.context.SpringBootContextLoader @@ -32,8 +34,6 @@ import org.springframework.http.ResponseEntity import org.springframework.messaging.Message import org.springframework.test.annotation.DirtiesContext import org.springframework.test.context.ContextConfiguration -import spock.lang.Specification - /** * @author Marcin Grzejszczak */ diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/consul/StubRunnerSpringCloudConsulAutoConfigurationSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/consul/StubRunnerSpringCloudConsulAutoConfigurationSpec.groovy index 236e96080c..a2cbcc277e 100644 --- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/consul/StubRunnerSpringCloudConsulAutoConfigurationSpec.groovy +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/consul/StubRunnerSpringCloudConsulAutoConfigurationSpec.groovy @@ -18,22 +18,22 @@ package org.springframework.cloud.contract.stubrunner.spring.cloud.consul import com.ecwid.consul.v1.ConsulClient import com.ecwid.consul.v1.agent.model.NewService -import org.hamcrest.Description -import org.hamcrest.TypeSafeMatcher import org.junit.AfterClass import org.junit.BeforeClass +import org.mockito.ArgumentMatcher +import org.springframework.cloud.consul.discovery.ConsulDiscoveryProperties +import spock.lang.Specification + import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.autoconfigure.EnableAutoConfiguration import org.springframework.boot.test.context.SpringBootContextLoader import org.springframework.boot.test.context.SpringBootTest import org.springframework.cloud.client.discovery.EnableDiscoveryClient -import org.springframework.cloud.consul.discovery.ConsulDiscoveryProperties import org.springframework.cloud.contract.stubrunner.spring.AutoConfigureStubRunner import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.test.annotation.DirtiesContext import org.springframework.test.context.ContextConfiguration -import spock.lang.Specification import static org.mockito.BDDMockito.then import static org.mockito.Matchers.argThat @@ -43,8 +43,7 @@ import static org.mockito.Mockito.mock */ @ContextConfiguration(classes = Config, loader = SpringBootContextLoader) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, - properties = ["stubrunner.camel.enabled=false", - "eureka.client.enabled=false", + properties = ["eureka.client.enabled=false", "spring.cloud.zookeeper.enabled=false", "stubrunner.cloud.stubbed.discovery.enabled=false", "stubrunner.cloud.eureka.enabled=false", @@ -81,7 +80,7 @@ class StubRunnerSpringCloudConsulAutoConfigurationSpec extends Specification { serviceName << ['loanIssuance:loanIssuance', 'bootService:bootService', 'fraudDetectionServer:someNameThatShouldMapFraudDetectionServer'] } - private static class NewServiceMatcher extends TypeSafeMatcher { + private static class NewServiceMatcher implements ArgumentMatcher { private final String expectedId private final String expectedName @@ -92,14 +91,9 @@ class StubRunnerSpringCloudConsulAutoConfigurationSpec extends Specification { } @Override - protected boolean matchesSafely(NewService item) { + boolean matches(NewService item) { return item.id == expectedId && item.name == expectedName } - - @Override - void describeTo(Description description) { - - } } @Configuration @@ -114,7 +108,7 @@ class StubRunnerSpringCloudConsulAutoConfigurationSpec extends Specification { @Bean ConsulDiscoveryProperties consulDiscoveryProperties() { - return new ConsulDiscoveryProperties() + return mock(ConsulDiscoveryProperties) } } } diff --git a/spring-cloud-contract-stub-runner/src/test/resources/application-cloudtest.yml b/spring-cloud-contract-stub-runner/src/test/resources/application-cloudtest.yml index e748b714b5..ea941760d1 100644 --- a/spring-cloud-contract-stub-runner/src/test/resources/application-cloudtest.yml +++ b/spring-cloud-contract-stub-runner/src/test/resources/application-cloudtest.yml @@ -1,5 +1,4 @@ stubrunner: - camel.enabled: false cloud.stubbed.discovery.enabled: true spring.cloud: zookeeper: diff --git a/spring-cloud-contract-stub-runner/src/test/resources/application-test.yml b/spring-cloud-contract-stub-runner/src/test/resources/application-test.yml index 1381be8b05..9541d7973c 100644 --- a/spring-cloud-contract-stub-runner/src/test/resources/application-test.yml +++ b/spring-cloud-contract-stub-runner/src/test/resources/application-test.yml @@ -8,8 +8,6 @@ stubrunner: # end::test[] cloud: enabled: false - camel: - enabled: false spring.cloud: consul.enabled: false diff --git a/spring-cloud-contract-stub-runner/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/producerWithMultipleConsumers/0.0.1-SNAPSHOT/producerWithMultipleConsumers-0.0.1-SNAPSHOT-stubs.jar b/spring-cloud-contract-stub-runner/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/producerWithMultipleConsumers/0.0.1-SNAPSHOT/producerWithMultipleConsumers-0.0.1-SNAPSHOT-stubs.jar index 73554a760b..b5a09c6c90 100644 Binary files a/spring-cloud-contract-stub-runner/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/producerWithMultipleConsumers/0.0.1-SNAPSHOT/producerWithMultipleConsumers-0.0.1-SNAPSHOT-stubs.jar and b/spring-cloud-contract-stub-runner/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/producerWithMultipleConsumers/0.0.1-SNAPSHOT/producerWithMultipleConsumers-0.0.1-SNAPSHOT-stubs.jar differ diff --git a/spring-cloud-contract-stub-runner/src/test/resources/simulation.json b/spring-cloud-contract-stub-runner/src/test/resources/simulation.json index 93942f7f56..2f1571b1ce 100644 --- a/spring-cloud-contract-stub-runner/src/test/resources/simulation.json +++ b/spring-cloud-contract-stub-runner/src/test/resources/simulation.json @@ -1 +1 @@ -{"data":{"pairs":[],"globalActions":{"delays":[]}},"meta":{"schemaVersion":"v1","hoverflyVersion":"v0.9.0","timeExported":"2017-06-26T10:48:01+02:00"}} \ No newline at end of file +{"data":{"pairs":[],"globalActions":{"delays":[]}},"meta":{"schemaVersion":"v1","hoverflyVersion":"v0.9.0","timeExported":"2017-06-26T11:40:47+02:00"}} \ No newline at end of file diff --git a/spring-cloud-contract-tools/pom.xml b/spring-cloud-contract-tools/pom.xml index 656bd286ac..1f2a7ae820 100644 --- a/spring-cloud-contract-tools/pom.xml +++ b/spring-cloud-contract-tools/pom.xml @@ -7,7 +7,7 @@ org.springframework.cloud spring-cloud-contract-parent - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. diff --git a/spring-cloud-contract-tools/spring-cloud-contract-converters/pom.xml b/spring-cloud-contract-tools/spring-cloud-contract-converters/pom.xml index 2efc2d4918..dd49e7e10f 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-converters/pom.xml +++ b/spring-cloud-contract-tools/spring-cloud-contract-converters/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-tools - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-converters diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/build.gradle b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/build.gradle index 5674941167..d289534e48 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/build.gradle +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/build.gradle @@ -23,7 +23,7 @@ ext { ] } -project.version = findProperty('verifierVersion') ?: '1.5.4.RELEASE' +project.version = findProperty('verifierVersion') ?: '2.0.0.BUILD-SNAPSHOT' apply plugin: 'groovy' apply from: "$rootDir/gradle/release.gradle" apply plugin: 'eclipse' @@ -135,5 +135,5 @@ task resolveDependencies { } task wrapper(type: Wrapper) { - gradleVersion = '3.4' + gradleVersion = '4.0.2' } \ No newline at end of file diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle.properties b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle.properties index 6e0df725d8..1946c9108a 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle.properties +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle.properties @@ -16,6 +16,6 @@ nexusUsername = nexusPassword = -verifierVersion=1.2.2.BUILD-SNAPSHOT +verifierVersion=2.0.0.BUILD-SNAPSHOT org.gradle.daemon=false aetherVersion=1.0.2.v20150114 \ No newline at end of file diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.jar b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.jar index deedc7fa5e..96d36c23c8 100644 Binary files a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.jar and b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.jar differ diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.properties b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.properties index 19de5bfeda..64ffcab3bf 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.properties +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Feb 28 14:19:34 CET 2017 +#Mon Jul 31 11:13:36 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew index 9aa616c273..4453ccea33 100755 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -154,16 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save ( ) { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then cd "$(dirname "$0")" fi -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew.bat b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew.bat index f9553162f1..e95643d6a2 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew.bat +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew.bat @@ -1,84 +1,84 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/pom.xml b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/pom.xml index b043a61f4f..f6aa31661c 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/pom.xml +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-contract-tools - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/bootSimple/build.gradle b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/bootSimple/build.gradle index 48c07458e6..2a33e16b91 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/bootSimple/build.gradle +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/bootSimple/build.gradle @@ -1,6 +1,9 @@ buildscript { repositories { mavenCentral() + maven { url "http://repo.spring.io/snapshot" } + maven { url "http://repo.spring.io/milestone" } + maven { url "http://repo.spring.io/release" } } } @@ -20,12 +23,15 @@ ext { repositories { mavenCentral() mavenLocal() + maven { url "http://repo.spring.io/snapshot" } + maven { url "http://repo.spring.io/milestone" } + maven { url "http://repo.spring.io/release" } } dependencies { compile "org.springframework:spring-web" compile "org.springframework:spring-context-support" - compile "org.codehaus.groovy:groovy-all:2.4.11" + compile "org.codehaus.groovy:groovy-all:2.5.0-beta-1" compile 'com.jayway.jsonpath:json-path-assert:2.2.0' testCompile "com.github.tomakehurst:wiremock:${wiremockVersion}" @@ -49,7 +55,7 @@ contracts { generateContractTests.dependsOn generateWireMockClientStubs wrapper { - gradleVersion '2.2.1' + gradleVersion '3.5' } test { diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/bootSimple/gradle.properties b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/bootSimple/gradle.properties index 2f45204455..4cde276f6d 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/bootSimple/gradle.properties +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/bootSimple/gradle.properties @@ -15,5 +15,5 @@ # wiremockVersion=2.12.0 jsonAssertVersion=0.4.10 -verifierVersion=1.2.2.BUILD-SNAPSHOT +verifierVersion=2.0.0.BUILD-SNAPSHOT diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/bootSimple/gradle/wrapper/gradle-wrapper.jar b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/bootSimple/gradle/wrapper/gradle-wrapper.jar index 3baa851b28..6ffa237849 100644 Binary files a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/bootSimple/gradle/wrapper/gradle-wrapper.jar and b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/bootSimple/gradle/wrapper/gradle-wrapper.jar differ diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/bootSimple/gradle/wrapper/gradle-wrapper.properties b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/bootSimple/gradle/wrapper/gradle-wrapper.properties index 95d7279349..1534560008 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/bootSimple/gradle/wrapper/gradle-wrapper.properties +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/bootSimple/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Aug 19 15:38:58 CEST 2016 +#Fri Apr 28 10:55:26 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleJerseyProject/build.gradle b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleJerseyProject/build.gradle index e1f690423a..0f9de2c136 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleJerseyProject/build.gradle +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleJerseyProject/build.gradle @@ -18,9 +18,12 @@ buildscript { repositories { mavenLocal() mavenCentral() + maven { url "http://repo.spring.io/snapshot" } + maven { url "http://repo.spring.io/milestone" } + maven { url "http://repo.spring.io/release" } } dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE") + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M3") } } @@ -42,10 +45,13 @@ subprojects { repositories { mavenCentral() mavenLocal() + maven { url "http://repo.spring.io/snapshot" } + maven { url "http://repo.spring.io/milestone" } + maven { url "http://repo.spring.io/release" } } dependencies { - testCompile 'org.codehaus.groovy:groovy-all:2.4.11' + testCompile 'org.codehaus.groovy:groovy-all:2.5.0-beta-1' testCompile "org.spockframework:spock-core:$spockVersion" testCompile 'junit:junit:4.12' testCompile "com.github.tomakehurst:wiremock:${wiremockVersion}" @@ -55,7 +61,8 @@ subprojects { } configure([project(':fraudDetectionService'), project(':loanApplicationService')]) { - apply plugin: 'spring-boot' + apply plugin: 'org.springframework.boot' + apply plugin: 'io.spring.dependency-management' apply plugin: 'maven-publish' ext['jetty.version'] = '9.2.17.v20160517' @@ -83,7 +90,7 @@ configure([project(':fraudDetectionService'), project(':loanApplicationService') testCompile "org.mockito:mockito-core" testCompile "org.springframework:spring-test" testCompile "org.springframework.boot:spring-boot-test" - testCompile("com.github.tomakehurst:wiremock:2.9.0") { + testCompile("com.github.tomakehurst:wiremock:${wiremockVersion}") { exclude group: 'org.eclipse.jetty' } } @@ -140,3 +147,6 @@ configure(project(':loanApplicationService')) { test.dependsOn('copyCollaboratorStubs') } +wrapper { + gradleVersion '3.5' +} \ No newline at end of file diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleJerseyProject/gradle.properties b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleJerseyProject/gradle.properties index a979b2c048..99be1efefa 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleJerseyProject/gradle.properties +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleJerseyProject/gradle.properties @@ -15,4 +15,4 @@ # wiremockVersion=2.12.0 jsonAssertVersion=0.4.10 -verifierVersion=1.2.2.BUILD-SNAPSHOT +verifierVersion=2.0.0.BUILD-SNAPSHOT diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleJerseyProject/gradle/wrapper/gradle-wrapper.jar b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleJerseyProject/gradle/wrapper/gradle-wrapper.jar index 3baa851b28..6ffa237849 100644 Binary files a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleJerseyProject/gradle/wrapper/gradle-wrapper.jar and b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleJerseyProject/gradle/wrapper/gradle-wrapper.jar differ diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleJerseyProject/gradle/wrapper/gradle-wrapper.properties b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleJerseyProject/gradle/wrapper/gradle-wrapper.properties index 95d7279349..1534560008 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleJerseyProject/gradle/wrapper/gradle-wrapper.properties +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleJerseyProject/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Aug 19 15:38:58 CEST 2016 +#Fri Apr 28 10:55:26 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleProject/build.gradle b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleProject/build.gradle index c690f91b42..1a63d36f7e 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleProject/build.gradle +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleProject/build.gradle @@ -18,9 +18,12 @@ buildscript { repositories { mavenCentral() mavenLocal() + maven { url "http://repo.spring.io/snapshot" } + maven { url "http://repo.spring.io/milestone" } + maven { url "http://repo.spring.io/release" } } dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE") + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M3") } } @@ -39,10 +42,13 @@ subprojects { repositories { mavenCentral() mavenLocal() + maven { url "http://repo.spring.io/snapshot" } + maven { url "http://repo.spring.io/milestone" } + maven { url "http://repo.spring.io/release" } } dependencies { - testCompile "org.codehaus.groovy:groovy-all:2.4.11" + testCompile "org.codehaus.groovy:groovy-all:2.5.0-beta-1" testCompile "org.spockframework:spock-core:$spockVersion" testCompile("junit:junit:4.12") testCompile "com.github.tomakehurst:wiremock:${wiremockVersion}" @@ -52,7 +58,8 @@ subprojects { } configure([project(':fraudDetectionService'), project(':loanApplicationService')]) { - apply plugin: 'spring-boot' + apply plugin: 'org.springframework.boot' + apply plugin: 'io.spring.dependency-management' apply plugin: 'spring-cloud-contract' apply plugin: 'maven-publish' @@ -108,7 +115,7 @@ configure(project(':fraudDetectionService')) { configure(project(':loanApplicationService')) { - task copyCollaboratorStubs(type: com.sun.org.apache.xalan.internal.xsltc.compiler.Copy) { + task copyCollaboratorStubs(type: Copy) { File fraudBuildDir = project(':fraudDetectionService').buildDir from(new File(fraudBuildDir, "/production/${project(':fraudDetectionService').name}-stubs/")) into "src/test/resources/" @@ -117,3 +124,6 @@ configure(project(':loanApplicationService')) { generateContractTests.dependsOn('copyCollaboratorStubs') } +wrapper { + gradleVersion '3.5' +} diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleProject/gradle.properties b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleProject/gradle.properties index 887e30a1a5..a771813121 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleProject/gradle.properties +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleProject/gradle.properties @@ -15,4 +15,4 @@ # wiremockVersion=2.12.0 jsonAssertVersion=0.4.10 -verifierVersion=1.2.2.BUILD-SNAPSHOT \ No newline at end of file +verifierVersion=2.0.0.BUILD-SNAPSHOT \ No newline at end of file diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleProject/gradle/wrapper/gradle-wrapper.jar b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleProject/gradle/wrapper/gradle-wrapper.jar index 3baa851b28..6ffa237849 100644 Binary files a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleProject/gradle/wrapper/gradle-wrapper.jar and b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleProject/gradle/wrapper/gradle-wrapper.jar differ diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleProject/gradle/wrapper/gradle-wrapper.properties b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleProject/gradle/wrapper/gradle-wrapper.properties index 95d7279349..1534560008 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleProject/gradle/wrapper/gradle-wrapper.properties +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/sampleProject/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Aug 19 15:38:58 CEST 2016 +#Fri Apr 28 10:55:26 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/scenarioProject/build.gradle b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/scenarioProject/build.gradle index 12068579b3..6921a6f2ab 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/scenarioProject/build.gradle +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/scenarioProject/build.gradle @@ -18,9 +18,12 @@ buildscript { repositories { mavenCentral() mavenLocal() + maven { url "http://repo.spring.io/snapshot" } + maven { url "http://repo.spring.io/milestone" } + maven { url "http://repo.spring.io/release" } } dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE") + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M3") } } @@ -40,10 +43,13 @@ subprojects { repositories { mavenCentral() mavenLocal() + maven { url "http://repo.spring.io/snapshot" } + maven { url "http://repo.spring.io/milestone" } + maven { url "http://repo.spring.io/release" } } dependencies { - testCompile "org.codehaus.groovy:groovy-all:2.4.11" + testCompile "org.codehaus.groovy:groovy-all:2.5.0-beta-1" testCompile "org.spockframework:spock-core:$spockVersion" testCompile "junit:junit:4.12" testCompile "com.github.tomakehurst:wiremock:${wiremockVersion}" @@ -54,7 +60,8 @@ subprojects { } configure([project(':fraudDetectionService'), project(':loanApplicationService')]) { - apply plugin: 'spring-boot' + apply plugin: 'org.springframework.boot' + apply plugin: 'io.spring.dependency-management' apply plugin: 'spring-cloud-contract' // tag::jar_setup[] @@ -141,3 +148,6 @@ configure(project(':loanApplicationService')) { generateContractTests.dependsOn('copyCollaboratorStubs') } +wrapper { + gradleVersion '3.5' +} diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/scenarioProject/gradle.properties b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/scenarioProject/gradle.properties index 2f45204455..4cde276f6d 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/scenarioProject/gradle.properties +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/scenarioProject/gradle.properties @@ -15,5 +15,5 @@ # wiremockVersion=2.12.0 jsonAssertVersion=0.4.10 -verifierVersion=1.2.2.BUILD-SNAPSHOT +verifierVersion=2.0.0.BUILD-SNAPSHOT diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/scenarioProject/gradle/wrapper/gradle-wrapper.jar b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/scenarioProject/gradle/wrapper/gradle-wrapper.jar index 3baa851b28..6ffa237849 100644 Binary files a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/scenarioProject/gradle/wrapper/gradle-wrapper.jar and b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/scenarioProject/gradle/wrapper/gradle-wrapper.jar differ diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/scenarioProject/gradle/wrapper/gradle-wrapper.properties b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/scenarioProject/gradle/wrapper/gradle-wrapper.properties index 95d7279349..1534560008 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/scenarioProject/gradle/wrapper/gradle-wrapper.properties +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/scenarioProject/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Aug 19 15:38:58 CEST 2016 +#Fri Apr 28 10:55:26 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip diff --git a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/pom.xml b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/pom.xml index 47e1578ff7..a18e5c6ff9 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/pom.xml +++ b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-contract-tools - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. @@ -23,7 +23,7 @@ 3.2.5 - 3.4 + 3.5 UTF-8 UTF-8 @@ -33,7 +33,7 @@ 1.7 - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT 2016 @@ -262,6 +262,12 @@ org.springframework.cloud spring-cloud-contract-converters + + + org.apache.logging.log4j + log4j-to-slf4j + + org.springframework.cloud diff --git a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/complex-configuration/pom.xml b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/complex-configuration/pom.xml index a678e7e0f9..43992aab15 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/complex-configuration/pom.xml +++ b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/complex-configuration/pom.xml @@ -28,7 +28,7 @@ org.springframework.boot spring-boot-starter-parent - 1.3.5.RELEASE + 2.0.0.BUILD-SNAPSHOT diff --git a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/complex-remote-contracts/pom.xml b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/complex-remote-contracts/pom.xml index d0215f5907..638a01ec4a 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/complex-remote-contracts/pom.xml +++ b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/complex-remote-contracts/pom.xml @@ -30,7 +30,7 @@ org.springframework.cloud spring-cloud-contract-maven-plugin - 1.2.0.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT com/example/server diff --git a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/pact/pom.xml b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/pact/pom.xml index 97e7f6441c..4a2a27e42f 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/pact/pom.xml +++ b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/pact/pom.xml @@ -26,7 +26,7 @@ 0.1 - 1.2.0.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT diff --git a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/plugin-extension/pom.xml b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/plugin-extension/pom.xml index 3c718f96f0..205c490878 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/plugin-extension/pom.xml +++ b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/plugin-extension/pom.xml @@ -28,7 +28,7 @@ org.springframework.boot spring-boot-starter-parent - 1.5.4.RELEASE + 2.0.0.BUILD-SNAPSHOT @@ -81,4 +81,64 @@ + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + true + + + false + + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + false + + + + spring-releases + Spring Releases + https://repo.spring.io/release + + false + + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + true + + + false + + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + false + + + + spring-releases + Spring Releases + https://repo.spring.io/libs-release-local + + false + + + diff --git a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/spring-boot-groovy/pom.xml b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/spring-boot-groovy/pom.xml index 77aacd7970..e7288e7563 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/spring-boot-groovy/pom.xml +++ b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/spring-boot-groovy/pom.xml @@ -28,7 +28,7 @@ org.springframework.boot spring-boot-starter-parent - 1.5.4.RELEASE + 2.0.0.BUILD-SNAPSHOT @@ -47,6 +47,7 @@ org.spockframework spock-core + 1.0-groovy-2.4 test @@ -122,4 +123,63 @@ + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + true + + + false + + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + false + + + + spring-releases + Spring Releases + https://repo.spring.io/release + + false + + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + true + + + false + + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + false + + + + spring-releases + Spring Releases + https://repo.spring.io/libs-release-local + + false + + + + diff --git a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/spring-boot-java/pom.xml b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/spring-boot-java/pom.xml index 3c718f96f0..e4763a19c1 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/spring-boot-java/pom.xml +++ b/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/test/projects/spring-boot-java/pom.xml @@ -28,7 +28,7 @@ org.springframework.boot spring-boot-starter-parent - 1.5.4.RELEASE + 2.0.0.BUILD-SNAPSHOT @@ -81,4 +81,64 @@ + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + true + + + false + + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + false + + + + spring-releases + Spring Releases + https://repo.spring.io/release + + false + + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + true + + + false + + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + false + + + + spring-releases + Spring Releases + https://repo.spring.io/libs-release-local + + false + + + diff --git a/spring-cloud-contract-tools/spring-cloud-contract-spec-pact/pom.xml b/spring-cloud-contract-tools/spring-cloud-contract-spec-pact/pom.xml index 010a145f03..4fe0364be0 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-spec-pact/pom.xml +++ b/spring-cloud-contract-tools/spring-cloud-contract-spec-pact/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-tools - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-spec-pact diff --git a/spring-cloud-contract-verifier/pom.xml b/spring-cloud-contract-verifier/pom.xml index 1bfbef1670..e42cb45136 100644 --- a/spring-cloud-contract-verifier/pom.xml +++ b/spring-cloud-contract-verifier/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-parent - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-verifier @@ -26,11 +26,6 @@ spring-messaging true - - org.apache.camel - camel-spring - true - org.springframework.cloud spring-cloud-stream-test-support @@ -146,6 +141,12 @@ org.eclipse.jetty test + + javax.ws.rs-api + javax.ws.rs + 2.1 + test + diff --git a/spring-cloud-contract-verifier/src/main/groovy/org/springframework/cloud/contract/verifier/builder/MethodBodyBuilder.groovy b/spring-cloud-contract-verifier/src/main/groovy/org/springframework/cloud/contract/verifier/builder/MethodBodyBuilder.groovy index f77f2ea466..6eb7e0c149 100644 --- a/spring-cloud-contract-verifier/src/main/groovy/org/springframework/cloud/contract/verifier/builder/MethodBodyBuilder.groovy +++ b/spring-cloud-contract-verifier/src/main/groovy/org/springframework/cloud/contract/verifier/builder/MethodBodyBuilder.groovy @@ -390,6 +390,7 @@ abstract class MethodBodyBuilder { protected void methodForEqualityCheck(BodyMatcher bodyMatcher, BlockBuilder bb, Object copiedBody) { String path = quotedAndEscaped(bodyMatcher.path()) Object retrievedValue = value(copiedBody, bodyMatcher) + retrievedValue = retrievedValue instanceof Pattern ? ((Pattern) retrievedValue).pattern() : retrievedValue String valueAsParam = retrievedValue instanceof String ? quotedAndEscaped(retrievedValue.toString()) : retrievedValue.toString() if (arrayRelated(path) && MatchingType.regexRelated(bodyMatcher.matchingType())) { buildCustomMatchingConditionForEachElement(bb, path, valueAsParam) diff --git a/spring-cloud-contract-verifier/src/main/groovy/org/springframework/cloud/contract/verifier/dsl/wiremock/BaseWireMockStubStrategy.groovy b/spring-cloud-contract-verifier/src/main/groovy/org/springframework/cloud/contract/verifier/dsl/wiremock/BaseWireMockStubStrategy.groovy index d7aecf5570..aaa49b7261 100755 --- a/spring-cloud-contract-verifier/src/main/groovy/org/springframework/cloud/contract/verifier/dsl/wiremock/BaseWireMockStubStrategy.groovy +++ b/spring-cloud-contract-verifier/src/main/groovy/org/springframework/cloud/contract/verifier/dsl/wiremock/BaseWireMockStubStrategy.groovy @@ -96,9 +96,7 @@ abstract class BaseWireMockStubStrategy { */ String parseBody(Map map, ContentType contentType) { def transformedMap = MapConverter.getStubSideValues(map) - String responseSideBody = toJson(MapConverter.getTestSideValues(contract.request.body)) - DocumentContext context = JsonPath.parse(responseSideBody) - transformedMap = processEntriesForTemplating(transformedMap, context) + transformedMap = transformMapIfRequestPresent(transformedMap) String json = toJson(transformedMap) // the space is important cause at the end of the json body you also have a } // you can't have 4 } next to each other @@ -106,6 +104,17 @@ abstract class BaseWireMockStubStrategy { return parseBody(unquotedJson, contentType) } + private Object transformMapIfRequestPresent(Object transformedMap) { + def requestBody = contract.request.body + if (requestBody == null) { + return transformedMap + } + String testSideBody = toJson( + MapConverter.getTestSideValues(requestBody)) + DocumentContext context = JsonPath.parse(testSideBody) + return processEntriesForTemplating(transformedMap, context) + } + private Object processEntriesForTemplating(transformedMap, DocumentContext context) { return transformValues(transformedMap, { if (it instanceof String && processor.containsJsonPathTemplateEntry(it)) { diff --git a/spring-cloud-contract-verifier/src/main/groovy/org/springframework/cloud/contract/verifier/file/ContractFileScanner.groovy b/spring-cloud-contract-verifier/src/main/groovy/org/springframework/cloud/contract/verifier/file/ContractFileScanner.groovy index 37da2a9593..0449b3d1ab 100755 --- a/spring-cloud-contract-verifier/src/main/groovy/org/springframework/cloud/contract/verifier/file/ContractFileScanner.groovy +++ b/spring-cloud-contract-verifier/src/main/groovy/org/springframework/cloud/contract/verifier/file/ContractFileScanner.groovy @@ -94,15 +94,17 @@ class ContractFileScanner { if (!files) { return } - files.sort().eachWithIndex { File file, int index -> + File[] sortedFiles = files.sort() as File[] + for (int i = 0; i < sortedFiles.length; i++) { + File file = sortedFiles[i] boolean excluded = matchesPattern(file, excludeMatchers) if (!excluded) { boolean contractFile = isContractFile(file) boolean included = includeMatcher ? file.absolutePath.matches(includeMatcher) : true if (contractFile && included) { - addContractToTestGeneration(result, files, file, index, ContractVerifierDslConverter.convertAsCollection(baseDir, file)) + addContractToTestGeneration(result, files, file, i, ContractVerifierDslConverter.convertAsCollection(baseDir, file)) } else if (!contractFile && included) { - addContractToTestGeneration(converters, result, files, file, index) + addContractToTestGeneration(converters, result, files, file, i) } else { appendRecursively(file, result) if (log.isDebugEnabled()) { diff --git a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/amqp/SpringAmqpStubMessages.java b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/amqp/SpringAmqpStubMessages.java index 32a0599cee..ab12b92a22 100644 --- a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/amqp/SpringAmqpStubMessages.java +++ b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/amqp/SpringAmqpStubMessages.java @@ -64,8 +64,9 @@ public class SpringAmqpStubMessages implements @Autowired public SpringAmqpStubMessages(RabbitTemplate rabbitTemplate, MessageListenerAccessor messageListenerAccessor) { - Assert.notNull(rabbitTemplate); - Assert.isTrue(mockingDetails(rabbitTemplate).isSpy() || mockingDetails(rabbitTemplate).isMock()); //we get send messages by capturing arguments on the spy + Assert.notNull(rabbitTemplate, "RabbitTemplate must be set"); + Assert.isTrue(mockingDetails(rabbitTemplate).isSpy() || mockingDetails(rabbitTemplate).isMock(), + "StubRunner AMQP will work only if RabbiTemplate is a spy"); //we get send messages by capturing arguments on the spy this.rabbitTemplate = rabbitTemplate; this.messageListenerAccessor = messageListenerAccessor; } diff --git a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/camel/CamelStubMessages.java b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/camel/CamelStubMessages.java deleted file mode 100644 index b5a2461373..0000000000 --- a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/camel/CamelStubMessages.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2013-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.cloud.contract.verifier.messaging.camel; - -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.apache.camel.CamelContext; -import org.apache.camel.ConsumerTemplate; -import org.apache.camel.Exchange; -import org.apache.camel.Message; -import org.apache.camel.ProducerTemplate; -import org.apache.camel.impl.DefaultExchange; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cloud.contract.verifier.messaging.MessageVerifier; -import org.springframework.stereotype.Component; - -/** - * @author Marcin Grzejszczak - */ -@Component -public class CamelStubMessages implements MessageVerifier { - - private static final Logger log = LoggerFactory.getLogger( - CamelStubMessages.class); - - private final CamelContext context; - private final ContractVerifierCamelMessageBuilder builder = new ContractVerifierCamelMessageBuilder(); - - @Autowired - public CamelStubMessages(CamelContext context) { - this.context = context; - } - - @Override - public void send(Message message, String destination) { - try { - ProducerTemplate producerTemplate = this.context.createProducerTemplate(); - Exchange exchange = new DefaultExchange(this.context); - exchange.setIn(message); - producerTemplate.send(destination, exchange); - } catch (Exception e) { - log.error("Exception occurred while trying to send a message [" + message + "] " + - "to a channel with name [" + destination + "]", e); - throw e; - } - } - - @Override - public void send(T payload, Map headers, String destination) { - send(this.builder.create(payload, headers), destination); - } - - @Override - public Message receive(String destination, long timeout, TimeUnit timeUnit) { - try { - ConsumerTemplate consumerTemplate = this.context.createConsumerTemplate(); - Exchange exchange = consumerTemplate.receive(destination, timeUnit.toMillis(timeout)); - return exchange.getIn(); - } catch (Exception e) { - log.error("Exception occurred while trying to read a message from " + - " a channel with name [" + destination + "]", e); - throw new IllegalStateException(e); - } - } - - @Override - public Message receive(String destination) { - return receive(destination, 5, TimeUnit.SECONDS); - } - -} diff --git a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/camel/ContractVerifierCamelConfiguration.java b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/camel/ContractVerifierCamelConfiguration.java deleted file mode 100644 index 21f06395b6..0000000000 --- a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/camel/ContractVerifierCamelConfiguration.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2013-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.cloud.contract.verifier.messaging.camel; - -import org.apache.camel.CamelContext; -import org.apache.camel.Message; -import org.springframework.boot.autoconfigure.AutoConfigureBefore; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.cloud.contract.verifier.messaging.MessageVerifier; -import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage; -import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessaging; -import org.springframework.cloud.contract.verifier.messaging.noop.NoOpContractVerifierAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * @author Marcin Grzejszczak - */ -@Configuration -@ConditionalOnClass(Message.class) -@AutoConfigureBefore(NoOpContractVerifierAutoConfiguration.class) -public class ContractVerifierCamelConfiguration { - - @Bean - @ConditionalOnMissingBean - MessageVerifier contractVerifierMessageExchange( - CamelContext context) { - return new CamelStubMessages(context); - } - - @Bean - @ConditionalOnMissingBean - public ContractVerifierMessaging contractVerifierMessaging( - MessageVerifier exchange) { - return new ContractVerifierCamelHelper(exchange); - } -} - -class ContractVerifierCamelHelper extends ContractVerifierMessaging { - - public ContractVerifierCamelHelper( - MessageVerifier exchange) { - super(exchange); - } - - @Override - protected ContractVerifierMessage convert(Message receive) { - return new ContractVerifierMessage(receive.getBody(), receive.getHeaders()); - } -} diff --git a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/camel/ContractVerifierCamelMessageBuilder.java b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/camel/ContractVerifierCamelMessageBuilder.java deleted file mode 100644 index c2e87c94ca..0000000000 --- a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/camel/ContractVerifierCamelMessageBuilder.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2013-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.cloud.contract.verifier.messaging.camel; - -import java.util.Map; - -import org.apache.camel.Message; -import org.apache.camel.impl.DefaultMessage; - -/** - * @author Marcin Grzejszczak - */ -class ContractVerifierCamelMessageBuilder { - - public Message create(T payload, Map headers) { - DefaultMessage message = new DefaultMessage(); - message.setBody(payload); - message.setHeaders(headers); - return message; - } - -} diff --git a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/stream/StreamStubMessages.java b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/stream/StreamStubMessages.java index 00cebd3016..fdb7a8b043 100644 --- a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/stream/StreamStubMessages.java +++ b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/stream/StreamStubMessages.java @@ -21,7 +21,6 @@ import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.contract.verifier.messaging.MessageVerifier; import org.springframework.cloud.stream.config.BindingProperties; import org.springframework.cloud.stream.config.BindingServiceProperties; @@ -41,7 +40,6 @@ public class StreamStubMessages implements MessageVerifier> { private final MessageCollector messageCollector; private final ContractVerifierStreamMessageBuilder builder = new ContractVerifierStreamMessageBuilder(); - @Autowired public StreamStubMessages(ApplicationContext context) { this.context = context; this.messageCollector = context.getBean(MessageCollector.class); diff --git a/spring-cloud-contract-verifier/src/main/resources/META-INF/spring.factories b/spring-cloud-contract-verifier/src/main/resources/META-INF/spring.factories index 0e6be1c75d..c7cfc35629 100644 --- a/spring-cloud-contract-verifier/src/main/resources/META-INF/spring.factories +++ b/spring-cloud-contract-verifier/src/main/resources/META-INF/spring.factories @@ -4,5 +4,4 @@ org.springframework.cloud.contract.verifier.messaging.stream.ContractVerifierStr org.springframework.cloud.contract.verifier.messaging.integration.ContractVerifierIntegrationConfiguration,\ org.springframework.cloud.contract.verifier.messaging.amqp.ContractVerifierAmqpAutoConfiguration,\ org.springframework.cloud.contract.verifier.messaging.amqp.RabbitMockConnectionFactoryAutoConfiguration,\ -org.springframework.cloud.contract.verifier.messaging.camel.ContractVerifierCamelConfiguration,\ org.springframework.cloud.contract.verifier.messaging.noop.NoOpContractVerifierAutoConfiguration \ No newline at end of file diff --git a/spring-cloud-contract-verifier/src/test/groovy/org/springframework/cloud/contract/verifier/builder/MockMvcMethodBodyBuilderSpec.groovy b/spring-cloud-contract-verifier/src/test/groovy/org/springframework/cloud/contract/verifier/builder/MockMvcMethodBodyBuilderSpec.groovy index f83e35b19d..6373f8386c 100644 --- a/spring-cloud-contract-verifier/src/test/groovy/org/springframework/cloud/contract/verifier/builder/MockMvcMethodBodyBuilderSpec.groovy +++ b/spring-cloud-contract-verifier/src/test/groovy/org/springframework/cloud/contract/verifier/builder/MockMvcMethodBodyBuilderSpec.groovy @@ -16,19 +16,20 @@ package org.springframework.cloud.contract.verifier.builder +import java.util.regex.Pattern + import org.codehaus.groovy.control.MultipleCompilationErrorsException import org.junit.Rule -import org.springframework.boot.test.rule.OutputCapture -import org.springframework.cloud.contract.spec.Contract -import org.springframework.cloud.contract.verifier.config.ContractVerifierConfigProperties -import org.springframework.cloud.contract.verifier.dsl.WireMockStubVerifier -import org.springframework.cloud.contract.verifier.util.SyntaxChecker import spock.lang.Issue import spock.lang.Shared import spock.lang.Specification import spock.util.environment.RestoreSystemProperties -import java.util.regex.Pattern +import org.springframework.boot.test.rule.OutputCapture +import org.springframework.cloud.contract.spec.Contract +import org.springframework.cloud.contract.verifier.config.ContractVerifierConfigProperties +import org.springframework.cloud.contract.verifier.dsl.WireMockStubVerifier +import org.springframework.cloud.contract.verifier.util.SyntaxChecker /** * @author Jakub Kubrynski, codearte.io */ diff --git a/spring-cloud-contract-verifier/src/test/groovy/org/springframework/cloud/contract/verifier/builder/SingleTestGeneratorSpec.groovy b/spring-cloud-contract-verifier/src/test/groovy/org/springframework/cloud/contract/verifier/builder/SingleTestGeneratorSpec.groovy index ebc56fc8ac..897321b198 100644 --- a/spring-cloud-contract-verifier/src/test/groovy/org/springframework/cloud/contract/verifier/builder/SingleTestGeneratorSpec.groovy +++ b/spring-cloud-contract-verifier/src/test/groovy/org/springframework/cloud/contract/verifier/builder/SingleTestGeneratorSpec.groovy @@ -406,7 +406,7 @@ class SingleTestGeneratorSpec extends Specification { // tag::context_path_baseclass[] import io.restassured.RestAssured; import org.junit.Before; - import org.springframework.boot.context.embedded.LocalServerPort; + import org.springframework.boot.web.server.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest(classes = ContextPathTestingBaseClass.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) diff --git a/spring-cloud-contract-verifier/src/test/groovy/org/springframework/cloud/contract/verifier/util/SyntaxChecker.groovy b/spring-cloud-contract-verifier/src/test/groovy/org/springframework/cloud/contract/verifier/util/SyntaxChecker.groovy index e70d86fe44..e6cb43bcf6 100644 --- a/spring-cloud-contract-verifier/src/test/groovy/org/springframework/cloud/contract/verifier/util/SyntaxChecker.groovy +++ b/spring-cloud-contract-verifier/src/test/groovy/org/springframework/cloud/contract/verifier/util/SyntaxChecker.groovy @@ -1,13 +1,32 @@ package org.springframework.cloud.contract.verifier.util +import java.lang.reflect.Method +import javax.inject.Inject +import javax.ws.rs.client.Entity +import javax.ws.rs.client.WebTarget +import javax.ws.rs.core.Response + +import com.jayway.jsonpath.DocumentContext +import com.jayway.jsonpath.JsonPath +import com.toomuchcoding.jsonassert.JsonAssertion import groovy.transform.CompileStatic +import io.restassured.RestAssured +import io.restassured.module.mockmvc.RestAssuredMockMvc +import io.restassured.response.ResponseOptions import org.codehaus.groovy.control.CompilerConfiguration import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer import org.codehaus.groovy.control.customizers.ImportCustomizer +import org.junit.Rule +import org.junit.Test import org.mdkt.compiler.InMemoryJavaCompiler -import org.springframework.util.ReflectionUtils -import java.lang.reflect.Method +import org.springframework.cloud.contract.spec.Contract +import org.springframework.cloud.contract.verifier.assertion.SpringCloudContractAssertions +import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage +import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessaging +import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper +import org.springframework.cloud.contract.verifier.messaging.util.ContractVerifierMessagingUtil +import org.springframework.util.ReflectionUtils /** * checking the syntax of produced scripts @@ -15,21 +34,24 @@ import java.lang.reflect.Method @CompileStatic class SyntaxChecker { + WebTarget webTarget + Entity entity + private static final String[] DEFAULT_IMPORTS = [ - "org.springframework.cloud.contract.spec.Contract", - "io.restassured.response.ResponseOptions", + Contract.name, + ResponseOptions.name, "io.restassured.module.mockmvc.specification.*", "io.restassured.module.mockmvc.*", - "org.junit.Test", - "org.junit.Rule", - "com.jayway.jsonpath.DocumentContext", - "com.jayway.jsonpath.JsonPath", - "javax.inject.Inject", - "org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper", - "org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage", - "org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessaging", - "javax.ws.rs.client.WebTarget", - "javax.ws.rs.core.Response" + Test.name, + Rule.name, + DocumentContext.name, + JsonPath.name, + Inject.name, + ContractVerifierObjectMapper.name, + ContractVerifierMessage.name, + ContractVerifierMessaging.name, + WebTarget.name, + Response.name ] private static final String DEFAULT_IMPORTS_AS_STRING = DEFAULT_IMPORTS.collect { @@ -37,13 +59,13 @@ class SyntaxChecker { }.join("\n") private static final String STATIC_IMPORTS = [ - "io.restassured.module.mockmvc.RestAssuredMockMvc.given", - "io.restassured.module.mockmvc.RestAssuredMockMvc.when", - "io.restassured.RestAssured.*", - "javax.ws.rs.client.Entity.*", - "org.springframework.cloud.contract.verifier.messaging.util.ContractVerifierMessagingUtil.headers", - "com.toomuchcoding.jsonassert.JsonAssertion.assertThatJson", - "org.springframework.cloud.contract.verifier.assertion.SpringCloudContractAssertions.assertThat" + "${RestAssuredMockMvc.name}.given", + "${RestAssuredMockMvc.name}.when", + "${RestAssured.name}.*", + "${Entity.name}.*", + "${ContractVerifierMessagingUtil.name}.headers", + "${JsonAssertion.name}.assertThatJson", + "${SpringCloudContractAssertions.name}.assertThat" ].collect { "import static ${it};"}.join("\n") static void tryToCompile(String builderName, String test) { diff --git a/spring-cloud-contract-wiremock/pom.xml b/spring-cloud-contract-wiremock/pom.xml index d8917f583d..dde0ef9318 100644 --- a/spring-cloud-contract-wiremock/pom.xml +++ b/spring-cloud-contract-wiremock/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-parent - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-wiremock @@ -17,6 +17,16 @@ com.github.tomakehurst wiremock-standalone + + io.rest-assured + rest-assured + true + + + javax.servlet + javax.servlet-api + true + org.apache.httpcomponents httpclient @@ -39,6 +49,11 @@ spring-restdocs-mockmvc true + + org.springframework.restdocs + spring-restdocs-restassured + true + org.springframework.boot spring-boot-starter-test diff --git a/spring-cloud-contract-wiremock/src/main/java/org/springframework/cloud/contract/wiremock/restdocs/WireMockRestAssuredConfiguration.java b/spring-cloud-contract-wiremock/src/main/java/org/springframework/cloud/contract/wiremock/restdocs/WireMockRestAssuredConfiguration.java new file mode 100644 index 0000000000..4e78eade35 --- /dev/null +++ b/spring-cloud-contract-wiremock/src/main/java/org/springframework/cloud/contract/wiremock/restdocs/WireMockRestAssuredConfiguration.java @@ -0,0 +1,28 @@ +package org.springframework.cloud.contract.wiremock.restdocs; + +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.test.autoconfigure.restdocs.RestDocsRestAssuredConfigurationCustomizer; +import org.springframework.context.annotation.Configuration; +import org.springframework.restdocs.restassured3.RestAssuredRestDocumentationConfigurer; + +/** + * Custom configuration for Spring RestDocs that adds a WireMock snippet (for generating + * JSON stubs). Applied automatically if you use + * {@link org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs @AutoConfigureRestDocs} in your test case and this class + * is available. JSON stubs are generated and added to the restdocs path under "stubs". + * + * @see WireMockRestDocs for a convenient entry point for customizing and asserting the + * stub behaviour + * + * @author Eddú Meléndez + */ +@Configuration +@ConditionalOnClass(RestAssuredRestDocumentationConfigurer.class) +public class WireMockRestAssuredConfiguration implements RestDocsRestAssuredConfigurationCustomizer { + + @Override + public void customize(RestAssuredRestDocumentationConfigurer configurer) { + configurer.snippets().withDefaults(new WireMockSnippet()); + } + +} diff --git a/spring-cloud-contract-wiremock/src/main/java/org/springframework/cloud/contract/wiremock/restdocs/WireMockRestDocsConfiguration.java b/spring-cloud-contract-wiremock/src/main/java/org/springframework/cloud/contract/wiremock/restdocs/WireMockRestDocsConfiguration.java index 802d37e01e..df5fc11bac 100644 --- a/spring-cloud-contract-wiremock/src/main/java/org/springframework/cloud/contract/wiremock/restdocs/WireMockRestDocsConfiguration.java +++ b/spring-cloud-contract-wiremock/src/main/java/org/springframework/cloud/contract/wiremock/restdocs/WireMockRestDocsConfiguration.java @@ -16,6 +16,7 @@ package org.springframework.cloud.contract.wiremock.restdocs; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.test.autoconfigure.restdocs.RestDocsMockMvcConfigurationCustomizer; import org.springframework.context.annotation.Configuration; import org.springframework.restdocs.mockmvc.MockMvcRestDocumentationConfigurer; @@ -33,6 +34,7 @@ import org.springframework.restdocs.mockmvc.MockMvcRestDocumentationConfigurer; * */ @Configuration +@ConditionalOnClass(MockMvcRestDocumentationConfigurer.class) public class WireMockRestDocsConfiguration implements RestDocsMockMvcConfigurationCustomizer { diff --git a/spring-cloud-contract-wiremock/src/main/resources/META-INF/spring.factories b/spring-cloud-contract-wiremock/src/main/resources/META-INF/spring.factories index 9ac5aa6677..c0e49b7d51 100644 --- a/spring-cloud-contract-wiremock/src/main/resources/META-INF/spring.factories +++ b/spring-cloud-contract-wiremock/src/main/resources/META-INF/spring.factories @@ -4,4 +4,5 @@ org.springframework.cloud.contract.wiremock.WireMockApplicationListener # RestDocs Auto Configuration org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs=\ -org.springframework.cloud.contract.wiremock.restdocs.WireMockRestDocsConfiguration +org.springframework.cloud.contract.wiremock.restdocs.WireMockRestDocsConfiguration,\ +org.springframework.cloud.contract.wiremock.restdocs.WireMockRestAssuredConfiguration diff --git a/spring-cloud-contract-wiremock/src/test/java/org/springframework/cloud/contract/wiremock/WiremockServerRestAssuredApplicationTests.java b/spring-cloud-contract-wiremock/src/test/java/org/springframework/cloud/contract/wiremock/WiremockServerRestAssuredApplicationTests.java new file mode 100644 index 0000000000..d0830fd5d3 --- /dev/null +++ b/spring-cloud-contract-wiremock/src/test/java/org/springframework/cloud/contract/wiremock/WiremockServerRestAssuredApplicationTests.java @@ -0,0 +1,83 @@ +package org.springframework.cloud.contract.wiremock; + +import io.restassured.specification.RequestSpecification; +import org.junit.Test; +import org.junit.runner.RunWith; +import wiremock.org.eclipse.jetty.http.HttpStatus; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration; +import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration; +import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; +import static org.springframework.restdocs.restassured3.RestAssuredRestDocumentation.document; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {ServletWebServerFactoryAutoConfiguration.EmbeddedTomcat.class, DispatcherServletAutoConfiguration.class}, + webEnvironment = WebEnvironment.RANDOM_PORT) +@AutoConfigureRestDocs(outputDir = "target/snippets") +public class WiremockServerRestAssuredApplicationTests { + + @Autowired + private RequestSpecification documentationSpec; + + @LocalServerPort + private int port; + + @Test + public void contextLoads() throws Exception { + given() + .port(this.port) + .when() + .get("/resource") + .then() + .assertThat() + .statusCode(is(200)) + .content(equalTo("Hello World")); + } + + @Test + public void statusIsMaintained() throws Exception { + given(this.documentationSpec) + .filter(document("status")) + .when() + .get("/status") + .then() + .assertThat() + .statusCode(is(202)) + .content(equalTo("Hello World")); + } + + @Configuration + @EnableWebMvc + @RestController + protected static class TestConfiguration { + + @ResponseBody + @RequestMapping("/resource") + public String resource() { + return "Hello World"; + } + + @ResponseBody + @RequestMapping("/status") + public ResponseEntity status() { + return ResponseEntity.status(HttpStatus.ACCEPTED_202).body("Hello World"); + } + + } + +} diff --git a/spring-cloud-contract-wiremock/src/test/java/org/springframework/cloud/contract/wiremock/restdocs/WireMockSnippetTests.java b/spring-cloud-contract-wiremock/src/test/java/org/springframework/cloud/contract/wiremock/restdocs/WireMockSnippetTests.java index 7056e78279..9d0f1d83e3 100644 --- a/spring-cloud-contract-wiremock/src/test/java/org/springframework/cloud/contract/wiremock/restdocs/WireMockSnippetTests.java +++ b/spring-cloud-contract-wiremock/src/test/java/org/springframework/cloud/contract/wiremock/restdocs/WireMockSnippetTests.java @@ -1,15 +1,7 @@ package org.springframework.cloud.contract.wiremock.restdocs; -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.util.Collection; - import com.github.tomakehurst.wiremock.matching.EqualToJsonPattern; import com.github.tomakehurst.wiremock.stubbing.StubMapping; - import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -17,8 +9,7 @@ import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.mockito.Answers; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; - +import org.mockito.junit.MockitoJUnitRunner; import org.springframework.cloud.contract.wiremock.WireMockStubMapping; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -31,10 +22,19 @@ import org.springframework.restdocs.operation.OperationRequest; import org.springframework.restdocs.operation.OperationRequestPart; import org.springframework.restdocs.operation.OperationResponse; import org.springframework.restdocs.operation.Parameters; +import org.springframework.restdocs.operation.RequestCookie; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.util.Collection; +import java.util.Collections; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.BDDMockito.given; -import static org.mockito.Matchers.anyString; /** * @author Marcin Grzejszczak @@ -192,6 +192,11 @@ public class WireMockSnippetTests { public URI getUri() { return URI.create("http://foo/bar"); } + + @Override + public Collection getCookies() { + return Collections.emptySet(); + } }; } @@ -235,6 +240,11 @@ public class WireMockSnippetTests { public URI getUri() { return URI.create("http://foo/bar"); } + + @Override + public Collection getCookies() { + return Collections.emptySet(); + } }; } @@ -276,6 +286,10 @@ public class WireMockSnippetTests { public URI getUri() { return URI.create("http://foo/bar"); } + + @Override public Collection getCookies() { + return Collections.emptySet(); + } }; } } \ No newline at end of file diff --git a/tests/pom.xml b/tests/pom.xml index 23fc5c696a..94712d4f63 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -7,7 +7,7 @@ org.springframework.cloud spring-cloud-contract-parent - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. @@ -18,14 +18,12 @@ Spring Cloud Contract Tests - samples-messaging-camel samples-messaging-spring samples-messaging-stream samples-messaging-integration samples-messaging-amqp spring-cloud-contract-stub-runner-boot-eureka spring-cloud-contract-stub-runner-boot-zookeeper - spring-cloud-contract-stub-runner-camel spring-cloud-contract-stub-runner-context-path spring-cloud-contract-stub-runner-moco-contract-jar spring-cloud-contract-stub-runner-moco diff --git a/tests/samples-messaging-amqp/pom.xml b/tests/samples-messaging-amqp/pom.xml index ae65414dcb..6d99636ccb 100644 --- a/tests/samples-messaging-amqp/pom.xml +++ b/tests/samples-messaging-amqp/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-tests - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-sample-amqp diff --git a/tests/samples-messaging-camel/.springBeans b/tests/samples-messaging-camel/.springBeans deleted file mode 100644 index b74cfc29b8..0000000000 --- a/tests/samples-messaging-camel/.springBeans +++ /dev/null @@ -1,16 +0,0 @@ - - - 1 - - - - - - - java:com.example.fraud.CamelMessagingApplication - - - - - - diff --git a/tests/samples-messaging-camel/pom.xml b/tests/samples-messaging-camel/pom.xml deleted file mode 100644 index e21d43bcc6..0000000000 --- a/tests/samples-messaging-camel/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - 4.0.0 - - org.springframework.cloud - spring-cloud-contract-tests - 1.2.2.BUILD-SNAPSHOT - .. - - spring-cloud-contract-sample-camel - jar - Spring Cloud Contract Sample Camel - Spring Cloud Contract Sample Camel - - - org.apache.camel - camel-spring-boot-starter - - - org.apache.camel - camel-jms - - - org.apache.activemq - activemq-camel - - - org.apache.activemq - activemq-pool - - - org.apache.camel - camel-jackson - - - org.springframework.cloud - spring-cloud-contract-verifier - test - - - org.spockframework - spock-spring - test - - - org.springframework.boot - spring-boot-starter-test - test - - - diff --git a/tests/samples-messaging-camel/src/main/java/com/example/BookDeleted.java b/tests/samples-messaging-camel/src/main/java/com/example/BookDeleted.java deleted file mode 100644 index 15635f725e..0000000000 --- a/tests/samples-messaging-camel/src/main/java/com/example/BookDeleted.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2013-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonCreator; - -@SuppressWarnings("serial") -public class BookDeleted implements Serializable { - public final String bookName; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - public BookDeleted(String bookName) { - this.bookName = bookName; - } -} diff --git a/tests/samples-messaging-camel/src/main/java/com/example/BookDeleter.java b/tests/samples-messaging-camel/src/main/java/com/example/BookDeleter.java deleted file mode 100644 index 31e051f696..0000000000 --- a/tests/samples-messaging-camel/src/main/java/com/example/BookDeleter.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2013-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example; - -import java.util.concurrent.atomic.AtomicBoolean; - -import org.apache.camel.Exchange; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -@Component -public class BookDeleter { - - private static final Logger log = LoggerFactory.getLogger(BookDeleter.class); - - /** - * Scenario for "should generate tests triggered by a message": client side: if sends - * a message to input.messageFrom then message will be sent to output.messageFrom - * server side: will send a message to input, verify the message contents and await - * upon receiving message on the output messageFrom - */ - public void bookDeleted(Exchange exchange) { - BookDeleted bookDeleted = exchange.getIn().getBody(BookDeleted.class); - log.info("Deleting book " + bookDeleted); - this.bookSuccessfulyDeleted.set(true); - log.info("Book successfuly deleted [" + this.bookSuccessfulyDeleted + "]"); - } - - private AtomicBoolean bookSuccessfulyDeleted = new AtomicBoolean(false); -} diff --git a/tests/samples-messaging-camel/src/main/java/com/example/BookReturned.java b/tests/samples-messaging-camel/src/main/java/com/example/BookReturned.java deleted file mode 100644 index 44b6b35003..0000000000 --- a/tests/samples-messaging-camel/src/main/java/com/example/BookReturned.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2013-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonCreator; - -@SuppressWarnings("serial") -public class BookReturned implements Serializable { - public final String bookName; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - BookReturned(String bookName) { - this.bookName = bookName; - } -} diff --git a/tests/samples-messaging-camel/src/main/java/com/example/BookRouteConfiguration.java b/tests/samples-messaging-camel/src/main/java/com/example/BookRouteConfiguration.java deleted file mode 100644 index 3f4f6c9022..0000000000 --- a/tests/samples-messaging-camel/src/main/java/com/example/BookRouteConfiguration.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2013-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example; - -import org.apache.activemq.camel.component.ActiveMQComponent; -import org.apache.camel.RoutesBuilder; -import org.apache.camel.model.dataformat.JsonLibrary; -import org.apache.camel.spring.SpringRouteBuilder; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * @author Marcin Grzejszczak - */ -@Configuration -public class BookRouteConfiguration { - - @Bean - ActiveMQComponent activeMQComponent(@Value("${activemq.url:vm://localhost?broker.persistent=false}") String url) { - ActiveMQComponent component = new ActiveMQComponent(); - component.setBrokerURL(url); - return component; - } - - @Bean - RoutesBuilder myRouter(final BookService bookService, final BookDeleter bookDeleter) { - return new SpringRouteBuilder() { - - @Override - public void configure() throws Exception { - // scenario 1 - from bean to output - from("direct:start").unmarshal().json(JsonLibrary.Jackson, BookReturned.class).bean(bookService).to("jms:output"); - // scenario 2 - from input to output - from("jms:input").unmarshal().json(JsonLibrary.Jackson, BookReturned.class).bean(bookService).to("jms:output"); - // scenario 3 - from input to no output - from("jms:delete").unmarshal().json(JsonLibrary.Jackson, BookDeleted.class).bean(bookDeleter); - } - - }; - } -} diff --git a/tests/samples-messaging-camel/src/main/java/com/example/BookService.java b/tests/samples-messaging-camel/src/main/java/com/example/BookService.java deleted file mode 100644 index a145e482d6..0000000000 --- a/tests/samples-messaging-camel/src/main/java/com/example/BookService.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2013-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example; - -import org.apache.camel.Exchange; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -@Service -public class BookService { - - private static final Logger log = LoggerFactory.getLogger(BookService.class); - - /** - * Scenario for "should generate tests triggered by a method": client side: must have - * a possibility to "trigger" sending of a message to the given messageFrom server - * side: will run the method and await upon receiving message on the output - * messageFrom - * - * Method triggers sending a message to a source - */ - public void returnBook(Exchange exchange) { - BookReturned bookReturned = exchange.getIn().getBody(BookReturned.class); - log.info("Returning book [$bookReturned]"); - exchange.getOut().setBody(bookReturned); - exchange.getOut().setHeader("BOOK-NAME", bookReturned.bookName); - } -} diff --git a/tests/samples-messaging-camel/src/main/java/com/example/CamelMessagingApplication.java b/tests/samples-messaging-camel/src/main/java/com/example/CamelMessagingApplication.java deleted file mode 100644 index 25ff4fccc4..0000000000 --- a/tests/samples-messaging-camel/src/main/java/com/example/CamelMessagingApplication.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2013-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class CamelMessagingApplication { - - public static void main(String[] args) { - SpringApplication.run(CamelMessagingApplication.class, args); - } -} diff --git a/tests/samples-messaging-camel/src/test/groovy/com/example/CamelMessagingApplicationSpec.groovy b/tests/samples-messaging-camel/src/test/groovy/com/example/CamelMessagingApplicationSpec.groovy deleted file mode 100644 index 2d43631044..0000000000 --- a/tests/samples-messaging-camel/src/test/groovy/com/example/CamelMessagingApplicationSpec.groovy +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2013-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example - -import javax.inject.Inject - -import org.apache.camel.Message -import org.apache.camel.model.ModelCamelContext -import org.junit.BeforeClass -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.boot.test.context.SpringBootContextLoader -import org.springframework.cloud.contract.spec.Contract -import org.springframework.cloud.contract.verifier.messaging.MessageVerifier -import org.springframework.cloud.contract.verifier.messaging.boot.AutoConfigureMessageVerifier -import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper; -import org.springframework.test.annotation.DirtiesContext -import org.springframework.test.context.ContextConfiguration - -import spock.lang.Specification -import spock.util.concurrent.PollingConditions - -import com.jayway.jsonpath.DocumentContext -import com.jayway.jsonpath.JsonPath -import com.toomuchcoding.jsonassert.JsonAssertion -/** - * SPIKE ON TESTS FROM NOTES IN MessagingSpec - */ -// Context configuration would end up in base class -@ContextConfiguration(classes = [CamelMessagingApplication], loader = SpringBootContextLoader) -@DirtiesContext -@AutoConfigureMessageVerifier -class CamelMessagingApplicationSpec extends Specification { - - // ALL CASES - @Autowired ModelCamelContext camelContext - @Autowired BookDeleter bookDeleter - @Inject MessageVerifier contractVerifierMessaging - - ContractVerifierObjectMapper contractVerifierObjectMapper = new ContractVerifierObjectMapper() - - @BeforeClass - static void init() { - System.setProperty("org.apache.activemq.SERIALIZABLE_PACKAGES", "*") - } - - def "should work for triggered based messaging"() { - given: - Contract.make { - label 'some_label' - input { - triggeredBy('bookReturnedTriggered()') - } - outputMessage { - sentTo('activemq:output') - body('''{ "bookName" : "foo" }''') - headers { - header('BOOK-NAME', 'foo') - } - } - } - // generated test should look like this: - when: - bookReturnedTriggered() - then: - def response = contractVerifierMessaging.receive('activemq:output') - response.headers.get('BOOK-NAME') == 'foo' - and: - DocumentContext parsedJson = JsonPath.parse(contractVerifierObjectMapper.writeValueAsString(response.body)) - JsonAssertion.assertThat(parsedJson).field('bookName').isEqualTo('foo') - } - - def "should generate tests triggered by a message"() { - given: - Contract.make { - label 'some_label' - input { - messageFrom('jms:input') - messageBody([ - bookName: 'foo' - ]) - messageHeaders { - header('sample', 'header') - - } - } - outputMessage { - sentTo('jms:output') - body([ - bookName: 'foo' - ]) - headers { - header('BOOK-NAME', 'foo') - } - } - } - // generated test should look like this: - when: - contractVerifierMessaging.send( - contractVerifierObjectMapper.writeValueAsString([bookName: 'foo']), - [sample: 'header'], 'jms:input') - then: - def response = contractVerifierMessaging.receive('jms:output') - response.headers.get('BOOK-NAME') == 'foo' - and: - DocumentContext parsedJson = JsonPath.parse(contractVerifierObjectMapper.writeValueAsString(response.body)) - JsonAssertion.assertThat(parsedJson).field('bookName').isEqualTo('foo') - } - - def "should generate tests without destination, triggered by a message"() { - given: - Contract.make { - label 'some_label' - input { - messageFrom('jms:delete') - messageBody([ - bookName: 'foo' - ]) - messageHeaders { - header('sample', 'header') - } - assertThat('bookWasDeleted()') - } - } - // generated test should look like this: - when: - contractVerifierMessaging.send(contractVerifierObjectMapper.writeValueAsString([bookName: 'foo']), - [sample: 'header'], 'jms:delete') - then: - noExceptionThrown() - bookWasDeleted() - } - - void bookReturnedTriggered() { - camelContext.createProducerTemplate().sendBody('direct:start', '''{"bookName" : "foo" }''') - } - - PollingConditions pollingConditions = new PollingConditions() - - void bookWasDeleted() { - pollingConditions.eventually { - assert bookDeleter.bookSuccessfulyDeleted.get() - } - } - -} \ No newline at end of file diff --git a/tests/samples-messaging-integration/pom.xml b/tests/samples-messaging-integration/pom.xml index 61cb05a88b..e586adc71f 100644 --- a/tests/samples-messaging-integration/pom.xml +++ b/tests/samples-messaging-integration/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-tests - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-sample-integration diff --git a/tests/samples-messaging-spring/pom.xml b/tests/samples-messaging-spring/pom.xml index 05a2869d61..79a18e3fcd 100644 --- a/tests/samples-messaging-spring/pom.xml +++ b/tests/samples-messaging-spring/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-tests - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-sample-spring diff --git a/tests/samples-messaging-stream/pom.xml b/tests/samples-messaging-stream/pom.xml index 8853057412..9ad4fa8a07 100644 --- a/tests/samples-messaging-stream/pom.xml +++ b/tests/samples-messaging-stream/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-tests - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-sample-stream diff --git a/tests/spring-cloud-contract-stub-runner-amqp/pom.xml b/tests/spring-cloud-contract-stub-runner-amqp/pom.xml index 5bdd5137b1..19e2e84ac2 100644 --- a/tests/spring-cloud-contract-stub-runner-amqp/pom.xml +++ b/tests/spring-cloud-contract-stub-runner-amqp/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-tests - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-stub-runner-amqp diff --git a/tests/spring-cloud-contract-stub-runner-boot-eureka/pom.xml b/tests/spring-cloud-contract-stub-runner-boot-eureka/pom.xml index a384873054..bd05d85268 100644 --- a/tests/spring-cloud-contract-stub-runner-boot-eureka/pom.xml +++ b/tests/spring-cloud-contract-stub-runner-boot-eureka/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-tests - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-stub-runner-boot-eureka @@ -24,13 +24,13 @@ org.springframework.cloud - spring-cloud-starter-eureka + spring-cloud-starter-netflix-eureka-client true org.springframework.cloud - spring-cloud-starter-eureka-server - test + spring-cloud-starter-netflix-eureka-server + true junit diff --git a/tests/spring-cloud-contract-stub-runner-boot-eureka/src/test/resources/application.yml b/tests/spring-cloud-contract-stub-runner-boot-eureka/src/test/resources/application.yml index be0dd59c16..2b91381a2c 100644 --- a/tests/spring-cloud-contract-stub-runner-boot-eureka/src/test/resources/application.yml +++ b/tests/spring-cloud-contract-stub-runner-boot-eureka/src/test/resources/application.yml @@ -1,5 +1,4 @@ stubrunner: - camel.enabled: false idsToServiceIds: fraudDetectionServer: someNameThatShouldMapFraudDetectionServer server: diff --git a/tests/spring-cloud-contract-stub-runner-boot-zookeeper/pom.xml b/tests/spring-cloud-contract-stub-runner-boot-zookeeper/pom.xml index f161ddb383..dc43e82d6d 100644 --- a/tests/spring-cloud-contract-stub-runner-boot-zookeeper/pom.xml +++ b/tests/spring-cloud-contract-stub-runner-boot-zookeeper/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-tests - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-stub-runner-boot-zookeeper diff --git a/tests/spring-cloud-contract-stub-runner-boot-zookeeper/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/zookeeper/StubRunnerSpringCloudZookeeperAutoConfigurationSpec.groovy b/tests/spring-cloud-contract-stub-runner-boot-zookeeper/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/zookeeper/StubRunnerSpringCloudZookeeperAutoConfigurationSpec.groovy index d68ebd4a8f..82cb2b2eeb 100644 --- a/tests/spring-cloud-contract-stub-runner-boot-zookeeper/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/zookeeper/StubRunnerSpringCloudZookeeperAutoConfigurationSpec.groovy +++ b/tests/spring-cloud-contract-stub-runner-boot-zookeeper/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/zookeeper/StubRunnerSpringCloudZookeeperAutoConfigurationSpec.groovy @@ -28,7 +28,7 @@ import org.springframework.cloud.client.loadbalancer.LoadBalanced import org.springframework.cloud.contract.stubrunner.StubFinder import org.springframework.cloud.contract.stubrunner.spring.AutoConfigureStubRunner import org.springframework.cloud.zookeeper.ZookeeperProperties -import org.springframework.cloud.zookeeper.discovery.ZookeeperServiceDiscovery +import org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryClient import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.test.annotation.DirtiesContext @@ -42,8 +42,7 @@ import spock.lang.Specification */ @ContextConfiguration(classes = Config, loader = SpringBootContextLoader) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, - properties = ["stubrunner.camel.enabled=false", - "stubrunner.cloud.stubbed.discovery.enabled=false", + properties = ["stubrunner.cloud.stubbed.discovery.enabled=false", "debug=true"]) @AutoConfigureStubRunner( ids = ["org.springframework.cloud.contract.verifier.stubs:loanIssuance", @@ -55,7 +54,7 @@ class StubRunnerSpringCloudZookeeperAutoConfigurationSpec extends Specification @Autowired StubFinder stubFinder @Autowired @LoadBalanced RestTemplate restTemplate - @Autowired ZookeeperServiceDiscovery zookeeperServiceDiscovery + @Autowired ZookeeperDiscoveryClient zookeeperServiceDiscovery @BeforeClass @AfterClass @@ -76,12 +75,8 @@ class StubRunnerSpringCloudZookeeperAutoConfigurationSpec extends Specification def 'should have all apps registered in Service Discovery'() { expect: - !zookeeperServiceDiscovery.serviceDiscoveryRef.get().queryForInstances('loanIssuance').empty - !zookeeperServiceDiscovery.serviceDiscoveryRef.get().queryForInstances('someNameThatShouldMapFraudDetectionServer').empty - } - - def cleanup() { - zookeeperServiceDiscovery?.serviceDiscoveryRef?.get()?.close() + !zookeeperServiceDiscovery.getInstances('loanIssuance').empty + !zookeeperServiceDiscovery.getInstances('someNameThatShouldMapFraudDetectionServer').empty } @Configuration diff --git a/tests/spring-cloud-contract-stub-runner-boot-zookeeper/src/test/resources/application.yml b/tests/spring-cloud-contract-stub-runner-boot-zookeeper/src/test/resources/application.yml index ddf61bbcac..abde606911 100644 --- a/tests/spring-cloud-contract-stub-runner-boot-zookeeper/src/test/resources/application.yml +++ b/tests/spring-cloud-contract-stub-runner-boot-zookeeper/src/test/resources/application.yml @@ -1,5 +1,4 @@ stubrunner: - camel.enabled: false idsToServiceIds: fraudDetectionServer: someNameThatShouldMapFraudDetectionServer server: diff --git a/tests/spring-cloud-contract-stub-runner-camel/README.adoc b/tests/spring-cloud-contract-stub-runner-camel/README.adoc deleted file mode 100644 index 8ad67e3ce5..0000000000 --- a/tests/spring-cloud-contract-stub-runner-camel/README.adoc +++ /dev/null @@ -1,132 +0,0 @@ -:input_name: jms:input -:output_name: jms:output - -=== Stub Runner Camel - -Spring Cloud Contract Verifier Stub Runner's messaging module gives you an easy way to -integrate with Apache Camel. For the provided artifacts, it automatically downloads the -stubs and registers the required routes. - -==== Adding the Runner to the Project - -You can have both Apache Camel and Spring Cloud Contract Stub Runner on the classpath. -Remember to annotate your test class with `@AutoConfigureStubRunner`. - -==== Disabling the functionality - -If you need to disable this functionality, set the `stubrunner.camel.enabled=false` -property. - -Assume that you have the following Maven repository with deployed stubs for the -`camelService` application: - -[source,bash,indent=0] ----- -└── .m2 - └── repository - └── io - └── codearte - └── accurest - └── stubs - └── camelService - ├── 0.0.1-SNAPSHOT - │   ├── camelService-0.0.1-SNAPSHOT.pom - │   ├── camelService-0.0.1-SNAPSHOT-stubs.jar - │   └── maven-metadata-local.xml - └── maven-metadata-local.xml ----- - -Further assume that the stubs contain the following structure: - -[source,bash,indent=0] ----- -├── META-INF -│   └── MANIFEST.MF -└── repository - ├── accurest - │   ├── bookDeleted.groovy - │   ├── bookReturned1.groovy - │   └── bookReturned2.groovy - └── mappings ----- - -Consider the following contracts (numbered *1*): - -[source,groovy] ----- -include::src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=sample_dsl,indent=0] ----- - -Now consider *2* - -[source,groovy] ----- -include::src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=sample_dsl_2,indent=0] ----- - -These examples lend themselves to three scenarios: - -* <> -* <> -* <> - -[[camel-scenario-1]] -===== Scenario 1 (no input message) - -To trigger a message via the `return_book_1` label, use the `StubTigger` interface, as -follows: - -[source,groovy] ----- -include::src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=client_trigger,indent=0] ----- - -To listen to the output of the message sent to `{output_name}`: - -[source,groovy] ----- -include::src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=client_trigger_receive,indent=0] ----- - -The received message passes the following assertions: - -[source,groovy] ----- -include::src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=client_trigger_message,indent=0] ----- - -[[camel-scenario-2]] -===== Scenario 2 (output triggered by input) - -Since the route is set for you, you can send a message to the `{output_name}` -destination: - -[source,groovy] ----- -include::src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=client_send,indent=0] ----- - -You can listen to the output of the message sent to `{output_name}`: - -[source,groovy] ----- -include::src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=client_receive,indent=0] ----- - -The received message passes the following assertions: - -[source,groovy] ----- -include::src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=client_receive_message,indent=0] ----- - -[[camel-scenario-3]] -===== Scenario 3 (input with no output) - -Since the route is set for you, you can send a message to the `{output_name}` -destination: - -[source,groovy] ----- -include::src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=trigger_no_output,indent=0] ----- diff --git a/tests/spring-cloud-contract-stub-runner-camel/pom.xml b/tests/spring-cloud-contract-stub-runner-camel/pom.xml deleted file mode 100644 index 43b9e29099..0000000000 --- a/tests/spring-cloud-contract-stub-runner-camel/pom.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - 4.0.0 - - org.springframework.cloud - spring-cloud-contract-tests - 1.2.2.BUILD-SNAPSHOT - .. - - spring-cloud-contract-stub-runner-camel - jar - Spring Cloud Contract Stub Runner Camel - Spring Cloud Contract Stub Runner Camel - - - org.springframework.cloud - spring-cloud-contract-stub-runner - - - org.springframework.cloud - spring-cloud-starter-contract-stub-runner-jetty - test - - - org.apache.camel - camel-spring-boot-starter - - - org.apache.camel - camel-jackson - - - junit - junit - test - - - org.codehaus.groovy - groovy - - - org.spockframework - spock-core - test - - - org.spockframework - spock-spring - test - - - org.springframework.boot - spring-boot-starter-test - test - - - org.apache.activemq - activemq-camel - test - - - org.apache.activemq - activemq-pool - test - - - org.springframework.boot - spring-boot-starter-web - test - - - info.solidsoft.spock - spock-global-unroll - test - - - - - - org.codehaus.gmavenplus - gmavenplus-plugin - - - - testCompile - - - - - - - diff --git a/tests/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/BookReturned.groovy b/tests/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/BookReturned.groovy deleted file mode 100644 index 26428fd9fd..0000000000 --- a/tests/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/BookReturned.groovy +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2013-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.cloud.contract.stubrunner.messaging.camel - -import com.fasterxml.jackson.annotation.JsonCreator -import groovy.transform.CompileStatic -import groovy.transform.EqualsAndHashCode - -@CompileStatic -@EqualsAndHashCode -class BookReturned implements Serializable { - final String bookName - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - BookReturned(String bookName) { - this.bookName = bookName - } -} diff --git a/tests/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy b/tests/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy deleted file mode 100644 index 8c6c525c5b..0000000000 --- a/tests/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright 2013-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.cloud.contract.stubrunner.messaging.camel - -import groovy.json.JsonOutput -import groovy.json.JsonSlurper -import org.apache.activemq.camel.component.ActiveMQComponent -import org.apache.activemq.spring.ActiveMQConnectionFactory -import org.apache.camel.CamelContext -import org.apache.camel.Exchange -import org.apache.camel.component.jms.JmsConfiguration -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.beans.factory.annotation.Value -import org.springframework.boot.autoconfigure.EnableAutoConfiguration -import org.springframework.boot.test.context.SpringBootContextLoader -import org.springframework.boot.test.context.SpringBootTest -import org.springframework.cloud.contract.spec.Contract -import org.springframework.cloud.contract.stubrunner.StubFinder -import org.springframework.cloud.contract.stubrunner.spring.AutoConfigureStubRunner -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.ComponentScan -import org.springframework.context.annotation.Configuration -import org.springframework.test.context.ContextConfiguration -import spock.lang.IgnoreIf -import spock.lang.Specification -/** - * @author Marcin Grzejszczak - */ -@ContextConfiguration(classes = Config, loader = SpringBootContextLoader) -@SpringBootTest(properties = "debug=true") -@AutoConfigureStubRunner -@IgnoreIf({ os.windows }) -class CamelStubRunnerSpec extends Specification { - - @Autowired StubFinder stubFinder - @Autowired CamelContext camelContext - - def setup() { - // ensure that message were taken from the queue - camelContext.createConsumerTemplate().receive('jms:output', 100) - } - - def 'should download the stub and register a route for it'() { - when: - // tag::client_send[] - camelContext.createProducerTemplate().sendBodyAndHeaders('jms:input', new BookReturned('foo'), [sample: 'header']) - // end::client_send[] - then: - // tag::client_receive[] - Exchange receivedMessage = camelContext.createConsumerTemplate().receive('jms:output', 5000) - // end::client_receive[] - and: - // tag::client_receive_message[] - receivedMessage != null - assertThatBodyContainsBookNameFoo(receivedMessage.in.body) - receivedMessage.in.headers.get('BOOK-NAME') == 'foo' - // end::client_receive_message[] - } - - def 'should trigger a message by label'() { - when: - // tag::client_trigger[] - stubFinder.trigger('return_book_1') - // end::client_trigger[] - then: - // tag::client_trigger_receive[] - Exchange receivedMessage = camelContext.createConsumerTemplate().receive('jms:output', 5000) - // end::client_trigger_receive[] - and: - // tag::client_trigger_message[] - receivedMessage != null - assertThatBodyContainsBookNameFoo(receivedMessage.in.body) - receivedMessage.in.headers.get('BOOK-NAME') == 'foo' - // end::client_trigger_message[] - } - - def 'should trigger a label for the existing groupId:artifactId'() { - when: - // tag::trigger_group_artifact[] - stubFinder.trigger('org.springframework.cloud.contract.verifier.stubs:camelService', 'return_book_1') - // end::trigger_group_artifact[] - then: - Exchange receivedMessage = camelContext.createConsumerTemplate().receive('jms:output', 5000) - and: - receivedMessage != null - assertThatBodyContainsBookNameFoo(receivedMessage.in.body) - receivedMessage.in.headers.get('BOOK-NAME') == 'foo' - } - - def 'should trigger a label for the existing artifactId'() { - when: - // tag::trigger_artifact[] - stubFinder.trigger('camelService', 'return_book_1') - // end::trigger_artifact[] - then: - Exchange receivedMessage = camelContext.createConsumerTemplate().receive('jms:output', 5000) - and: - receivedMessage != null - assertThatBodyContainsBookNameFoo(receivedMessage.in.body) - receivedMessage.in.headers.get('BOOK-NAME') == 'foo' - } - - def 'should throw an exception when missing label is passed'() { - when: - stubFinder.trigger('missing label') - then: - thrown(IllegalArgumentException) - } - - def 'should throw an exception when missing label and artifactid is passed'() { - when: - stubFinder.trigger('some:service', 'return_book_1') - then: - thrown(IllegalArgumentException) - } - - def 'should trigger messages by running all triggers'() { - when: - // tag::trigger_all[] - stubFinder.trigger() - // end::trigger_all[] - then: - Exchange receivedMessage = camelContext.createConsumerTemplate().receive('jms:output', 5000) - and: - receivedMessage != null - assertThatBodyContainsBookNameFoo(receivedMessage.in.body) - receivedMessage.in.headers.get('BOOK-NAME') == 'foo' - } - - def 'should trigger a label with no output message'() { - when: - // tag::trigger_no_output[] - camelContext.createProducerTemplate().sendBodyAndHeaders('jms:delete', new BookReturned('foo'), [sample: 'header']) - // end::trigger_no_output[] - then: - noExceptionThrown() - } - - def 'should not trigger a message that does not match input'() { - when: - camelContext.createProducerTemplate().sendBodyAndHeaders('jms:input', new BookReturned('notmatching'), [wrong: 'header_value']) - then: - Exchange receivedMessage = camelContext.createConsumerTemplate().receive('jms:output', 100) - and: - receivedMessage == null - } - - private boolean assertThatBodyContainsBookNameFoo(Object payload) { - String objectAsString = payload instanceof String ? payload : - JsonOutput.toJson(payload) - def json = new JsonSlurper().parseText(objectAsString) - return json.bookName == 'foo' - } - - @Configuration - @ComponentScan - @EnableAutoConfiguration - static class Config { - - @Bean - ActiveMQConnectionFactory activeMQConnectionFactory(@Value('${activemq.url:vm://localhost?broker.persistent=false}') String url) { - ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerURL: url) - try { - factory.trustAllPackages = true - } catch (Throwable e) { - } - return factory - } - - @Bean - JmsConfiguration jmsConfiguration(ActiveMQConnectionFactory activeMQConnectionFactory) { - return new JmsConfiguration(connectionFactory: activeMQConnectionFactory) - } - - @Bean - ActiveMQComponent activeMQComponent(JmsConfiguration jmsConfiguration) { - return new ActiveMQComponent(configuration: jmsConfiguration) - } - } - - - Contract dsl = - // tag::sample_dsl[] - Contract.make { - label 'return_book_1' - input { - triggeredBy('bookReturnedTriggered()') - } - outputMessage { - sentTo('jms:output') - body('''{ "bookName" : "foo" }''') - headers { - header('BOOK-NAME', 'foo') - } - } - } - // end::sample_dsl[] - - Contract dsl2 = - // tag::sample_dsl_2[] - Contract.make { - label 'return_book_2' - input { - messageFrom('jms:input') - messageBody([ - bookName: 'foo' - ]) - messageHeaders { - header('sample', 'header') - } - } - outputMessage { - sentTo('jms:output') - body([ - bookName: 'foo' - ]) - headers { - header('BOOK-NAME', 'foo') - } - } - } - // end::sample_dsl_2[] - - Contract dsl3 = - // tag::sample_dsl_3[] - Contract.make { - label 'delete_book' - input { - messageFrom('jms:delete') - messageBody([ - bookName: 'foo' - ]) - messageHeaders { - header('sample', 'header') - } - assertThat('bookWasDeleted()') - } - } - // end::sample_dsl_3[] -} diff --git a/tests/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelProcessorSpec.groovy b/tests/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelProcessorSpec.groovy deleted file mode 100644 index 279782c65e..0000000000 --- a/tests/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelProcessorSpec.groovy +++ /dev/null @@ -1,98 +0,0 @@ -package org.springframework.cloud.contract.stubrunner.messaging.camel - -import org.apache.camel.CamelContext -import org.apache.camel.Exchange -import org.apache.camel.builder.ExchangeBuilder -import org.apache.camel.spring.SpringCamelContext -import org.springframework.cloud.contract.spec.Contract -import spock.lang.Specification - -class StubRunnerCamelProcessorSpec extends Specification { - - CamelContext camelContext = new SpringCamelContext() - Exchange message = ExchangeBuilder.anExchange(camelContext).build() - - def noOutputMessageContract = Contract.make { - label 'return_book_2' - input { - messageFrom('bookStorage') - messageBody([ - bookId: $(consumer(regex('[0-9]+')), producer('123')) - ]) - messageHeaders { - header('sample', 'header') - } - } - } - - def 'should not process the message if there is no output message'() { - given: - StubRunnerCamelProcessor processor = new StubRunnerCamelProcessor(noOutputMessageContract) - when: - processor.process(message) - then: - noExceptionThrown() - } - - def dsl = Contract.make { - label 'return_book_2' - input { - messageFrom('bookStorage') - messageBody([ - bookId: $(consumer(regex('[0-9]+')), producer('123')) - ]) - messageHeaders { - header('sample', 'header') - } - } - outputMessage { - sentTo('returnBook') - body([ - responseId: $(producer(regex('[0-9]+')), consumer('123')) - ]) - headers { - header('BOOK-NAME', 'foo') - } - } - } - - def 'should process message when it has an output message section'() { - given: - StubRunnerCamelProcessor processor = new StubRunnerCamelProcessor(dsl) - when: - processor.process(message) - then: - message.getIn().getBody(String) == '{"responseId":"123"}' - } - - def dslWithRegexInGString = Contract.make { - // Human readable description - description 'Should produce valid sensor data' - // Label by means of which the output message can be triggered - label 'sensor1' - // input to the contract - input { - // the contract will be triggered by a method - triggeredBy('createSensorData()') - } - // output message of the contract - outputMessage { - // destination to which the output message will be sent - sentTo 'sensor-data' - headers { - header('contentType': 'application/json') - } - // the body of the output message - body("""{"id":"${value(producer(regex('[0-9]+')), consumer('99'))}","temperature":"123.45"}""") - } - } - - def 'should convert dsl into message with regex in GString'() { - given: - StubRunnerCamelProcessor processor = new StubRunnerCamelProcessor(dslWithRegexInGString) - when: - processor.process(message) - then: - message.getIn().getBody(String) == '''{"id":"99","temperature":"123.45"}''' - } -} diff --git a/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/application.yml b/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/application.yml deleted file mode 100644 index 7ba218ad58..0000000000 --- a/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/application.yml +++ /dev/null @@ -1,5 +0,0 @@ -stubrunner.repositoryRoot: classpath:m2repo/repository/ -stubrunner.ids: org.springframework.cloud.contract.verifier.stubs:camelService -server: - port: 0 -debug: true \ No newline at end of file diff --git a/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/camelService/0.0.1-SNAPSHOT/camelService-0.0.1-SNAPSHOT-stubs.jar b/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/camelService/0.0.1-SNAPSHOT/camelService-0.0.1-SNAPSHOT-stubs.jar deleted file mode 100644 index b27b155a3e..0000000000 Binary files a/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/camelService/0.0.1-SNAPSHOT/camelService-0.0.1-SNAPSHOT-stubs.jar and /dev/null differ diff --git a/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/camelService/0.0.1-SNAPSHOT/camelService-0.0.1-SNAPSHOT.pom b/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/camelService/0.0.1-SNAPSHOT/camelService-0.0.1-SNAPSHOT.pom deleted file mode 100644 index b2210f65ff..0000000000 --- a/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/camelService/0.0.1-SNAPSHOT/camelService-0.0.1-SNAPSHOT.pom +++ /dev/null @@ -1,25 +0,0 @@ - - - - - 4.0.0 - org.springframework.cloud.contract.verifier.stubs - camelService - 0.0.1-SNAPSHOT - pom - diff --git a/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/camelService/0.0.1-SNAPSHOT/maven-metadata-local.xml b/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/camelService/0.0.1-SNAPSHOT/maven-metadata-local.xml deleted file mode 100644 index f0954907f2..0000000000 --- a/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/camelService/0.0.1-SNAPSHOT/maven-metadata-local.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - org.springframework.cloud.contract.verifier.stubs - camelService - 0.0.1-SNAPSHOT - - - true - - 20160409062112 - - diff --git a/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/camelService/maven-metadata-local.xml b/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/camelService/maven-metadata-local.xml deleted file mode 100644 index 00bf4217ee..0000000000 --- a/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/camelService/maven-metadata-local.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - org.springframework.cloud.contract.verifier.stubs - camelService - 0.0.1-SNAPSHOT - - - 0.0.1-SNAPSHOT - - 20160409062112 - - diff --git a/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/camelService/maven-metadata.xml b/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/camelService/maven-metadata.xml deleted file mode 100644 index 00bf4217ee..0000000000 --- a/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/camelService/maven-metadata.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - org.springframework.cloud.contract.verifier.stubs - camelService - 0.0.1-SNAPSHOT - - - 0.0.1-SNAPSHOT - - 20160409062112 - - diff --git a/tests/spring-cloud-contract-stub-runner-context-path/pom.xml b/tests/spring-cloud-contract-stub-runner-context-path/pom.xml index 3d4d50809e..fb29de0bb2 100644 --- a/tests/spring-cloud-contract-stub-runner-context-path/pom.xml +++ b/tests/spring-cloud-contract-stub-runner-context-path/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-tests - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-stub-runner-context-path diff --git a/tests/spring-cloud-contract-stub-runner-context-path/src/main/java/com/example/loan/Application.java b/tests/spring-cloud-contract-stub-runner-context-path/src/main/java/com/example/loan/Application.java index 6f36301172..56af56d989 100644 --- a/tests/spring-cloud-contract-stub-runner-context-path/src/main/java/com/example/loan/Application.java +++ b/tests/spring-cloud-contract-stub-runner-context-path/src/main/java/com/example/loan/Application.java @@ -2,6 +2,8 @@ package com.example.loan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; @SpringBootApplication public class Application { @@ -11,3 +13,12 @@ public class Application { } } + + +@RestController +class CustomController { + @GetMapping("/foo") + String foo() { + return "bar"; + } +} \ No newline at end of file diff --git a/tests/spring-cloud-contract-stub-runner-context-path/src/main/resources/application.yml b/tests/spring-cloud-contract-stub-runner-context-path/src/main/resources/application.yml index 0d28926451..4ebaff95d9 100644 --- a/tests/spring-cloud-contract-stub-runner-context-path/src/main/resources/application.yml +++ b/tests/spring-cloud-contract-stub-runner-context-path/src/main/resources/application.yml @@ -1,2 +1,4 @@ -server.port: 0 -server.context-path: /my-path \ No newline at end of file +server: + port: 0 + servlet: + context-path: /my-path \ No newline at end of file diff --git a/tests/spring-cloud-contract-stub-runner-context-path/src/test/java/com/example/loan/LoanApplicationServiceTests.java b/tests/spring-cloud-contract-stub-runner-context-path/src/test/java/com/example/loan/LoanApplicationServiceTests.java index 5910bd9dcd..1a3973195b 100644 --- a/tests/spring-cloud-contract-stub-runner-context-path/src/test/java/com/example/loan/LoanApplicationServiceTests.java +++ b/tests/spring-cloud-contract-stub-runner-context-path/src/test/java/com/example/loan/LoanApplicationServiceTests.java @@ -4,9 +4,9 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.context.embedded.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.web.server.LocalServerPort; import org.springframework.cloud.contract.stubrunner.StubFinder; import org.springframework.cloud.contract.stubrunner.spring.AutoConfigureStubRunner; import org.springframework.test.annotation.DirtiesContext; @@ -41,7 +41,7 @@ public class LoanApplicationServiceTests { @Test public void shouldStartThisAppWithContextPath() { String response = new RestTemplate() - .getForObject("http://localhost:" + this.port + "/my-path/health", String.class); + .getForObject("http://localhost:" + this.port + "/my-path/foo", String.class); assertThat(response).isNotEmpty(); } diff --git a/tests/spring-cloud-contract-stub-runner-integration/pom.xml b/tests/spring-cloud-contract-stub-runner-integration/pom.xml index 7f160c2f6b..ed4fe4a69b 100644 --- a/tests/spring-cloud-contract-stub-runner-integration/pom.xml +++ b/tests/spring-cloud-contract-stub-runner-integration/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-tests - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-stub-runner-integration @@ -16,6 +16,10 @@ 1.8 + + org.springframework.boot + spring-boot-starter-integration + org.springframework.cloud spring-cloud-contract-stub-runner @@ -29,10 +33,6 @@ org.springframework.cloud spring-cloud-contract-verifier - - org.springframework.integration - spring-integration-java-dsl - junit junit diff --git a/tests/spring-cloud-contract-stub-runner-moco-contract-jar/pom.xml b/tests/spring-cloud-contract-stub-runner-moco-contract-jar/pom.xml index c1914d8fd4..40a8270173 100644 --- a/tests/spring-cloud-contract-stub-runner-moco-contract-jar/pom.xml +++ b/tests/spring-cloud-contract-stub-runner-moco-contract-jar/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-tests - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-stub-runner-moco-contract-jar diff --git a/tests/spring-cloud-contract-stub-runner-moco/pom.xml b/tests/spring-cloud-contract-stub-runner-moco/pom.xml index 9e4e1aef0e..536e2b67d4 100644 --- a/tests/spring-cloud-contract-stub-runner-moco/pom.xml +++ b/tests/spring-cloud-contract-stub-runner-moco/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-tests - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-stub-runner-moco diff --git a/tests/spring-cloud-contract-stub-runner-stream/pom.xml b/tests/spring-cloud-contract-stub-runner-stream/pom.xml index c3ea352ff3..b514f41d0d 100644 --- a/tests/spring-cloud-contract-stub-runner-stream/pom.xml +++ b/tests/spring-cloud-contract-stub-runner-stream/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-tests - 1.2.2.BUILD-SNAPSHOT + 2.0.0.BUILD-SNAPSHOT .. spring-cloud-contract-stub-runner-stream @@ -36,10 +36,6 @@ spring-cloud-stream-test-support test - - org.springframework.integration - spring-integration-java-dsl - junit junit diff --git a/tests/spring-cloud-contract-stub-runner-stream/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/stream/StreamStubRunnerSpec.groovy b/tests/spring-cloud-contract-stub-runner-stream/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/stream/StreamStubRunnerSpec.groovy index d47837d955..2ee278ee21 100644 --- a/tests/spring-cloud-contract-stub-runner-stream/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/stream/StreamStubRunnerSpec.groovy +++ b/tests/spring-cloud-contract-stub-runner-stream/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/stream/StreamStubRunnerSpec.groovy @@ -163,7 +163,8 @@ class StreamStubRunnerSpec extends Specification { private boolean assertJsons(Object payload) { String objectAsString = payload instanceof String ? payload : - JsonOutput.toJson(payload) + payload instanceof byte[] ? new String(payload) + : JsonOutput.toJson(payload) def json = new JsonSlurper().parseText(objectAsString) return json.bookName == 'foo' }