diff --git a/docs/pom.xml b/docs/pom.xml index 644d4e4222..1139dc4e22 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-contract-parent - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. spring-cloud-contract-docs @@ -16,7 +16,7 @@ spring-cloud-contract ${basedir}/.. 3.4 - 1.0.x,1.1.x,2.0.x + 1.0.x,1.1.x diff --git a/docs/src/main/asciidoc/migrations.adoc b/docs/src/main/asciidoc/migrations.adoc index d6c77f812a..5cd5952f32 100644 --- a/docs/src/main/asciidoc/migrations.adoc +++ b/docs/src/main/asciidoc/migrations.adoc @@ -171,12 +171,4 @@ 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] - -[[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 +Done via https://github.com/spring-cloud/spring-cloud-contract/issues/267[issue 267] \ 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 5402d775ec..adfd9f1225 100644 --- a/docs/src/main/asciidoc/verifier_stubrunner_msg.adoc +++ b/docs/src/main/asciidoc/verifier_stubrunner_msg.adoc @@ -5,6 +5,7 @@ frameworks: * Spring Integration * Spring Cloud Stream +* Apache Camel * Spring AMQP It also provides entry points to integrate with any other solution on the market. @@ -38,14 +39,14 @@ or the other in your tests. [source,groovy] ---- -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] +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] ---- [[trigger-group-artifact-ids]] ==== Trigger by Group and Artifact Ids [source,groovy] ---- -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] +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] ---- [[trigger-artifact-ids]] @@ -53,7 +54,7 @@ include::{tests_path}/spring-cloud-contract-stub-runner-stream/src/test/groovy/o [source,groovy] ---- -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] +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] ---- [[trigger-all-messages]] @@ -61,9 +62,11 @@ include::{tests_path}/spring-cloud-contract-stub-runner-stream/src/test/groovy/o [source,groovy] ---- -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/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-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 ad304aff5f..215bfc9d00 100644 --- a/pom.xml +++ b/pom.xml @@ -7,13 +7,13 @@ org.springframework.cloud spring-cloud-build - 2.0.0.BUILD-SNAPSHOT + 1.3.6.BUILD-SNAPSHOT spring-cloud-contract-parent pom - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT Spring Cloud Contract Spring Cloud Contract @@ -23,13 +23,15 @@ 2016 + 5.12.1 + 2.18.3 2.17 - 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 + 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 @@ -55,6 +57,36 @@ 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 @@ -83,11 +115,12 @@ org.springframework.amqp spring-rabbit - 2.0.0.M4 + 1.6.2.RELEASE org.mockito mockito-core + 1.10.19 io.specto @@ -116,6 +149,13 @@ pom import + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + org.springframework.cloud spring-cloud-netflix-dependencies @@ -231,6 +271,11 @@ gmavenplus-plugin 1.5 + + com.agilejava.docbkx + docbkx-maven-plugin + 2.0.15 + @@ -269,7 +314,7 @@ spring-snapshots Spring Snapshots - https://repo.spring.io/libs-snapshot-local + https://repo.spring.io/snapshot true @@ -280,7 +325,7 @@ spring-milestones Spring Milestones - https://repo.spring.io/libs-milestone-local + https://repo.spring.io/milestone false @@ -298,7 +343,7 @@ spring-snapshots Spring Snapshots - https://repo.spring.io/libs-snapshot-local + https://repo.spring.io/snapshot true @@ -309,7 +354,7 @@ spring-milestones Spring Milestones - https://repo.spring.io/libs-milestone-local + https://repo.spring.io/milestone false @@ -317,7 +362,7 @@ spring-releases Spring Releases - https://repo.spring.io/libs-release-local + https://repo.spring.io/release false diff --git a/samples/pom.xml b/samples/pom.xml index 5593036e94..fd8423495f 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -6,13 +6,13 @@ org.springframework.cloud spring-cloud-contract-parent - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. spring-cloud-contract-samples pom - 2.0.0.BUILD-SNAPSHOT + 1.2.2.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 4772345cb7..9df3c430cf 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 - 2.0.0.M6 + 1.5.8.RELEASE UTF-8 1.8 - 2.0.0.BUILD-SNAPSHOT - Finchley.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT + Edgware.BUILD-SNAPSHOT true diff --git a/samples/standalone/dsl/http-client/build.gradle b/samples/standalone/dsl/http-client/build.gradle index 42575c7858..8c205cbed3 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:2.0.0.M6" + classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE" } } @@ -24,7 +24,6 @@ repositories { apply plugin: 'groovy' apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' apply plugin: 'maven-publish' dependencyManagement { @@ -48,7 +47,7 @@ test { } task wrapper(type: Wrapper) { - gradleVersion = '4.0.2' + gradleVersion = '2.14' } task resolveDependencies { diff --git a/samples/standalone/dsl/http-client/gradle.properties b/samples/standalone/dsl/http-client/gradle.properties index 57ed1c5339..0c444e9a19 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=Finchley.BUILD-SNAPSHOT \ No newline at end of file +BOM_VERSION=Edgware.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 96d36c23c8..3baa851b28 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 64ffcab3bf..ff3de523bd 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 @@ -#Mon Jul 31 11:13:36 CEST 2017 +#Fri Aug 19 15:39:05 CEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip diff --git a/samples/standalone/dsl/http-client/gradlew b/samples/standalone/dsl/http-client/gradlew index 4453ccea33..27309d9231 100755 --- a/samples/standalone/dsl/http-client/gradlew +++ b/samples/standalone/dsl/http-client/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash ############################################################################## ## @@ -154,19 +154,11 @@ if $cygwin ; then esac fi -# Escape application args -save ( ) { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") } -APP_ARGS=$(save "$@") +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" -# 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" "$@" +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/standalone/dsl/http-client/gradlew.bat b/samples/standalone/dsl/http-client/gradlew.bat index e95643d6a2..832fdb6079 100644 --- a/samples/standalone/dsl/http-client/gradlew.bat +++ b/samples/standalone/dsl/http-client/gradlew.bat @@ -1,84 +1,90 @@ -@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 +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 diff --git a/samples/standalone/dsl/http-client/pom.xml b/samples/standalone/dsl/http-client/pom.xml index 2122992e44..20d4bd48f9 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 - 2.0.0.M6 + 1.5.8.RELEASE UTF-8 1.8 - Finchley.BUILD-SNAPSHOT + Edgware.BUILD-SNAPSHOT diff --git a/samples/standalone/dsl/http-server/build.gradle b/samples/standalone/dsl/http-server/build.gradle index 67dcae105a..708e19075e 100644 --- a/samples/standalone/dsl/http-server/build.gradle +++ b/samples/standalone/dsl/http-server/build.gradle @@ -9,8 +9,7 @@ buildscript { } // end::repos[] dependencies { - 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.boot:spring-boot-gradle-plugin:1.5.4.RELEASE" classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${findProperty('verifierVersion') ?: verifierVersion}" } } @@ -30,7 +29,6 @@ repositories { apply plugin: 'groovy' apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' apply plugin: 'spring-cloud-contract' apply plugin: 'maven-publish' @@ -59,7 +57,7 @@ test { } task wrapper(type: Wrapper) { - gradleVersion = '4.0.2' + gradleVersion = '2.14' } clean.doFirst { diff --git a/samples/standalone/dsl/http-server/gradle.properties b/samples/standalone/dsl/http-server/gradle.properties index cb360cc45f..b99fcb4df7 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=2.0.0.BUILD-SNAPSHOT -BOM_VERSION=Finchley.BUILD-SNAPSHOT \ No newline at end of file +verifierVersion=1.2.2.BUILD-SNAPSHOT +BOM_VERSION=Edgware.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 96d36c23c8..3baa851b28 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 64ffcab3bf..95d7279349 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 @@ -#Mon Jul 31 11:13:36 CEST 2017 +#Fri Aug 19 15:38:58 CEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip diff --git a/samples/standalone/dsl/http-server/gradlew b/samples/standalone/dsl/http-server/gradlew index 4453ccea33..27309d9231 100755 --- a/samples/standalone/dsl/http-server/gradlew +++ b/samples/standalone/dsl/http-server/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash ############################################################################## ## @@ -154,19 +154,11 @@ if $cygwin ; then esac fi -# Escape application args -save ( ) { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") } -APP_ARGS=$(save "$@") +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" -# 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" "$@" +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/standalone/dsl/http-server/gradlew.bat b/samples/standalone/dsl/http-server/gradlew.bat index e95643d6a2..832fdb6079 100644 --- a/samples/standalone/dsl/http-server/gradlew.bat +++ b/samples/standalone/dsl/http-server/gradlew.bat @@ -1,84 +1,90 @@ -@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 +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 diff --git a/samples/standalone/dsl/http-server/pom.xml b/samples/standalone/dsl/http-server/pom.xml index c25346ef07..222b5b7c73 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 - 2.0.0.M6 + 1.5.8.RELEASE UTF-8 1.8 - 2.0.0.BUILD-SNAPSHOT - Finchley.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT + Edgware.BUILD-SNAPSHOT diff --git a/samples/standalone/dsl/pom.xml b/samples/standalone/dsl/pom.xml index 0515f233b6..c56bd4c79e 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. @@ -17,7 +17,7 @@ Spring Cloud Contract Standalone Test Samples used for end to end tests - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT diff --git a/samples/standalone/messaging/pom.xml b/samples/standalone/messaging/pom.xml index bf67ee7ecc..3eea667768 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. @@ -17,7 +17,7 @@ Spring Cloud Contract Standalone Test Samples used for end to end tests - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT diff --git a/samples/standalone/messaging/stream-sink/build.gradle b/samples/standalone/messaging/stream-sink/build.gradle index 955c84027b..804e0a1224 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:2.0.0.M6" + classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE" } } @@ -24,7 +24,6 @@ repositories { apply plugin: 'groovy' apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' apply plugin: 'maven-publish' dependencyManagement { @@ -61,8 +60,4 @@ 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 cb360cc45f..b99fcb4df7 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=2.0.0.BUILD-SNAPSHOT -BOM_VERSION=Finchley.BUILD-SNAPSHOT \ No newline at end of file +verifierVersion=1.2.2.BUILD-SNAPSHOT +BOM_VERSION=Edgware.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 96d36c23c8..3baa851b28 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 64ffcab3bf..d7cdc356ad 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 @@ -#Mon Jul 31 11:13:36 CEST 2017 +#Fri Aug 19 15:39:28 CEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip diff --git a/samples/standalone/messaging/stream-sink/gradlew b/samples/standalone/messaging/stream-sink/gradlew index 4453ccea33..27309d9231 100755 --- a/samples/standalone/messaging/stream-sink/gradlew +++ b/samples/standalone/messaging/stream-sink/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash ############################################################################## ## @@ -154,19 +154,11 @@ if $cygwin ; then esac fi -# Escape application args -save ( ) { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") } -APP_ARGS=$(save "$@") +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" -# 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" "$@" +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/standalone/messaging/stream-sink/gradlew.bat b/samples/standalone/messaging/stream-sink/gradlew.bat index e95643d6a2..832fdb6079 100644 --- a/samples/standalone/messaging/stream-sink/gradlew.bat +++ b/samples/standalone/messaging/stream-sink/gradlew.bat @@ -1,84 +1,90 @@ -@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 +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 diff --git a/samples/standalone/messaging/stream-sink/pom.xml b/samples/standalone/messaging/stream-sink/pom.xml index 84daa75556..73c3e5d34c 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 - 2.0.0.M6 + 1.5.8.RELEASE UTF-8 1.8 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT @@ -48,7 +48,7 @@ org.springframework.cloud spring-cloud-dependencies - Finchley.BUILD-SNAPSHOT + Edgware.BUILD-SNAPSHOT pom import diff --git a/samples/standalone/messaging/stream-source/build.gradle b/samples/standalone/messaging/stream-source/build.gradle index f0e2a992dc..f37f6bd09c 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:2.0.0.M6" + classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE" 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,7 +27,6 @@ repositories { apply plugin: 'groovy' apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' apply plugin: 'spring-cloud-contract' apply plugin: 'maven-publish' @@ -101,7 +100,3 @@ 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 cb360cc45f..b99fcb4df7 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=2.0.0.BUILD-SNAPSHOT -BOM_VERSION=Finchley.BUILD-SNAPSHOT \ No newline at end of file +verifierVersion=1.2.2.BUILD-SNAPSHOT +BOM_VERSION=Edgware.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 96d36c23c8..3baa851b28 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 64ffcab3bf..fed2c38616 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 @@ -#Mon Jul 31 11:13:36 CEST 2017 +#Fri Aug 19 15:39:21 CEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip diff --git a/samples/standalone/messaging/stream-source/gradlew b/samples/standalone/messaging/stream-source/gradlew index 4453ccea33..27309d9231 100755 --- a/samples/standalone/messaging/stream-source/gradlew +++ b/samples/standalone/messaging/stream-source/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash ############################################################################## ## @@ -154,19 +154,11 @@ if $cygwin ; then esac fi -# Escape application args -save ( ) { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") } -APP_ARGS=$(save "$@") +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" -# 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" "$@" +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/standalone/messaging/stream-source/gradlew.bat b/samples/standalone/messaging/stream-source/gradlew.bat index e95643d6a2..832fdb6079 100644 --- a/samples/standalone/messaging/stream-source/gradlew.bat +++ b/samples/standalone/messaging/stream-source/gradlew.bat @@ -1,84 +1,90 @@ -@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 +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 diff --git a/samples/standalone/messaging/stream-source/pom.xml b/samples/standalone/messaging/stream-source/pom.xml index 59e0b77dde..a84336623b 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 - 2.0.0.M6 + 1.5.8.RELEASE UTF-8 1.8 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT @@ -76,7 +76,7 @@ org.springframework.cloud spring-cloud-dependencies - Finchley.BUILD-SNAPSHOT + Edgware.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 8d60313435..f477e647d2 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:2.0.0.M6" + classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE" } } @@ -24,7 +24,6 @@ repositories { apply plugin: 'groovy' apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' apply plugin: 'maven-publish' dependencyManagement { @@ -52,7 +51,7 @@ test { } task wrapper(type: Wrapper) { - gradleVersion = '4.0.2' + gradleVersion = '2.14' } task resolveDependencies { diff --git a/samples/standalone/pact/pact-http-client/gradle.properties b/samples/standalone/pact/pact-http-client/gradle.properties index 57ed1c5339..0c444e9a19 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=Finchley.BUILD-SNAPSHOT \ No newline at end of file +BOM_VERSION=Edgware.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 96d36c23c8..3baa851b28 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 64ffcab3bf..ff3de523bd 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 @@ -#Mon Jul 31 11:13:36 CEST 2017 +#Fri Aug 19 15:39:05 CEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip diff --git a/samples/standalone/pact/pact-http-client/gradlew b/samples/standalone/pact/pact-http-client/gradlew index 4453ccea33..27309d9231 100755 --- a/samples/standalone/pact/pact-http-client/gradlew +++ b/samples/standalone/pact/pact-http-client/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash ############################################################################## ## @@ -154,19 +154,11 @@ if $cygwin ; then esac fi -# Escape application args -save ( ) { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") } -APP_ARGS=$(save "$@") +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" -# 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" "$@" +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/standalone/pact/pact-http-client/gradlew.bat b/samples/standalone/pact/pact-http-client/gradlew.bat index e95643d6a2..832fdb6079 100644 --- a/samples/standalone/pact/pact-http-client/gradlew.bat +++ b/samples/standalone/pact/pact-http-client/gradlew.bat @@ -1,84 +1,90 @@ -@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 +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 diff --git a/samples/standalone/pact/pact-http-client/pom.xml b/samples/standalone/pact/pact-http-client/pom.xml index 0bd0c4c70b..7811daf6bd 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 - 2.0.0.M6 + 1.5.8.RELEASE UTF-8 1.8 - Finchley.BUILD-SNAPSHOT + Edgware.BUILD-SNAPSHOT diff --git a/samples/standalone/pact/pact-http-server/build.gradle b/samples/standalone/pact/pact-http-server/build.gradle index a1bd11bd17..6833482dc8 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:2.0.0.M6" + classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE" 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,7 +29,6 @@ repositories { apply plugin: 'groovy' apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' apply plugin: 'spring-cloud-contract' apply plugin: 'maven-publish' @@ -58,7 +57,7 @@ test { } task wrapper(type: Wrapper) { - gradleVersion = '4.0.2' + gradleVersion = '2.14' } clean.doFirst { diff --git a/samples/standalone/pact/pact-http-server/gradle.properties b/samples/standalone/pact/pact-http-server/gradle.properties index cb360cc45f..b99fcb4df7 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=2.0.0.BUILD-SNAPSHOT -BOM_VERSION=Finchley.BUILD-SNAPSHOT \ No newline at end of file +verifierVersion=1.2.2.BUILD-SNAPSHOT +BOM_VERSION=Edgware.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 96d36c23c8..3baa851b28 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 64ffcab3bf..95d7279349 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 @@ -#Mon Jul 31 11:13:36 CEST 2017 +#Fri Aug 19 15:38:58 CEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip diff --git a/samples/standalone/pact/pact-http-server/gradlew b/samples/standalone/pact/pact-http-server/gradlew index 4453ccea33..27309d9231 100755 --- a/samples/standalone/pact/pact-http-server/gradlew +++ b/samples/standalone/pact/pact-http-server/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash ############################################################################## ## @@ -154,19 +154,11 @@ if $cygwin ; then esac fi -# Escape application args -save ( ) { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") } -APP_ARGS=$(save "$@") +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" -# 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" "$@" +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/standalone/pact/pact-http-server/gradlew.bat b/samples/standalone/pact/pact-http-server/gradlew.bat index e95643d6a2..832fdb6079 100644 --- a/samples/standalone/pact/pact-http-server/gradlew.bat +++ b/samples/standalone/pact/pact-http-server/gradlew.bat @@ -1,84 +1,90 @@ -@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 +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 diff --git a/samples/standalone/pact/pact-http-server/pom.xml b/samples/standalone/pact/pact-http-server/pom.xml index 81f6247744..d0d8769c63 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 - 2.0.0.M6 + 1.5.8.RELEASE UTF-8 1.8 - 2.0.0.BUILD-SNAPSHOT - Finchley.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT + Edgware.BUILD-SNAPSHOT diff --git a/samples/standalone/pact/pom.xml b/samples/standalone/pact/pom.xml index 2035c0bc75..6ed9a76f15 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. @@ -17,7 +17,7 @@ Spring Cloud Contract Standalone Test Samples used for end to end tests with Pact - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT diff --git a/samples/standalone/pom.xml b/samples/standalone/pom.xml index dea61ec965..49f22a073e 100644 --- a/samples/standalone/pom.xml +++ b/samples/standalone/pom.xml @@ -6,13 +6,13 @@ org.springframework.cloud spring-cloud-contract-samples - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. spring-cloud-contract-samples-standalone pom - 2.0.0.BUILD-SNAPSHOT + 1.2.2.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 bb76c36a03..612371779f 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:2.0.0.M6" + classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE" } } @@ -24,7 +24,6 @@ repositories { apply plugin: 'groovy' apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' apply plugin: 'maven-publish' dependencyManagement { @@ -52,7 +51,7 @@ test { } task wrapper(type: Wrapper) { - gradleVersion = '4.0.2' + gradleVersion = '2.14' } task resolveDependencies { diff --git a/samples/standalone/restdocs/http-client/gradle.properties b/samples/standalone/restdocs/http-client/gradle.properties index cb360cc45f..b99fcb4df7 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=2.0.0.BUILD-SNAPSHOT -BOM_VERSION=Finchley.BUILD-SNAPSHOT \ No newline at end of file +verifierVersion=1.2.2.BUILD-SNAPSHOT +BOM_VERSION=Edgware.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 96d36c23c8..3baa851b28 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 64ffcab3bf..04160e9888 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 @@ -#Mon Jul 31 11:13:36 CEST 2017 +#Fri Aug 19 15:39:49 CEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip diff --git a/samples/standalone/restdocs/http-client/gradlew b/samples/standalone/restdocs/http-client/gradlew index 4453ccea33..27309d9231 100755 --- a/samples/standalone/restdocs/http-client/gradlew +++ b/samples/standalone/restdocs/http-client/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash ############################################################################## ## @@ -154,19 +154,11 @@ if $cygwin ; then esac fi -# Escape application args -save ( ) { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") } -APP_ARGS=$(save "$@") +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" -# 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" "$@" +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/standalone/restdocs/http-client/gradlew.bat b/samples/standalone/restdocs/http-client/gradlew.bat index e95643d6a2..832fdb6079 100644 --- a/samples/standalone/restdocs/http-client/gradlew.bat +++ b/samples/standalone/restdocs/http-client/gradlew.bat @@ -1,84 +1,90 @@ -@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 +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 diff --git a/samples/standalone/restdocs/http-client/pom.xml b/samples/standalone/restdocs/http-client/pom.xml index 15941c38e3..20fdc253a2 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 - 2.0.0.M6 + 1.5.8.RELEASE UTF-8 1.8 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT diff --git a/samples/standalone/restdocs/http-server/build.gradle b/samples/standalone/restdocs/http-server/build.gradle index 59426bb7ea..f4c0302c39 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:2.0.0.M6" + classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE" } } @@ -27,7 +27,6 @@ repositories { apply plugin: 'groovy' apply plugin: 'org.springframework.boot' -apply plugin: 'io.spring.dependency-management' apply plugin: 'maven-publish' apply plugin: 'maven' @@ -55,7 +54,7 @@ test { } task wrapper(type: Wrapper) { - gradleVersion = '4.0.2' + gradleVersion = '2.14' } 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 cb360cc45f..b99fcb4df7 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=2.0.0.BUILD-SNAPSHOT -BOM_VERSION=Finchley.BUILD-SNAPSHOT \ No newline at end of file +verifierVersion=1.2.2.BUILD-SNAPSHOT +BOM_VERSION=Edgware.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 96d36c23c8..3baa851b28 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 64ffcab3bf..8b8a75c0ac 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 @@ -#Mon Jul 31 11:13:36 CEST 2017 +#Fri Aug 19 15:39:42 CEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip diff --git a/samples/standalone/restdocs/http-server/gradlew b/samples/standalone/restdocs/http-server/gradlew index 4453ccea33..27309d9231 100755 --- a/samples/standalone/restdocs/http-server/gradlew +++ b/samples/standalone/restdocs/http-server/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash ############################################################################## ## @@ -154,19 +154,11 @@ if $cygwin ; then esac fi -# Escape application args -save ( ) { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") } -APP_ARGS=$(save "$@") +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" -# 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" "$@" +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/standalone/restdocs/http-server/gradlew.bat b/samples/standalone/restdocs/http-server/gradlew.bat index e95643d6a2..832fdb6079 100644 --- a/samples/standalone/restdocs/http-server/gradlew.bat +++ b/samples/standalone/restdocs/http-server/gradlew.bat @@ -1,84 +1,90 @@ -@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 +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 diff --git a/samples/standalone/restdocs/http-server/pom.xml b/samples/standalone/restdocs/http-server/pom.xml index fd51a7329b..ac17ca768c 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 - 2.0.0.M6 + 1.5.8.RELEASE UTF-8 1.8 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT @@ -104,9 +104,7 @@ 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 ac78d0ad0d..2c4d67c86b 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. @@ -17,7 +17,7 @@ Spring Cloud Contract Standalone Test Samples used for end to end tests - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT diff --git a/samples/wiremock-jetty/pom.xml b/samples/wiremock-jetty/pom.xml index fb538a4dd2..93b783e9cf 100644 --- a/samples/wiremock-jetty/pom.xml +++ b/samples/wiremock-jetty/pom.xml @@ -4,7 +4,7 @@ 4.0.0 wiremock-jetty - 2.0.0.BUILD-SNAPSHOT + 0.0.1 jar wiremock-jetty @@ -13,14 +13,14 @@ org.springframework.boot spring-boot-starter-parent - 2.0.0.M6 + 1.5.8.RELEASE UTF-8 1.8 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT diff --git a/samples/wiremock-native/pom.xml b/samples/wiremock-native/pom.xml index 38f1b95acb..e75600c5b1 100644 --- a/samples/wiremock-native/pom.xml +++ b/samples/wiremock-native/pom.xml @@ -4,7 +4,7 @@ 4.0.0 wiremock-native - 2.0.0.BUILD-SNAPSHOT + 0.0.1 jar wiremock-native @@ -13,14 +13,14 @@ org.springframework.boot spring-boot-starter-parent - 2.0.0.M6 + 1.5.8.RELEASE UTF-8 1.8 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT diff --git a/samples/wiremock-tomcat/pom.xml b/samples/wiremock-tomcat/pom.xml index 835d6e2dca..bddaebc37b 100644 --- a/samples/wiremock-tomcat/pom.xml +++ b/samples/wiremock-tomcat/pom.xml @@ -4,7 +4,7 @@ 4.0.0 wiremock-tomcat - 2.0.0.BUILD-SNAPSHOT + 0.0.1 jar wiremock-tomcat @@ -13,14 +13,14 @@ org.springframework.boot spring-boot-starter-parent - 2.0.0.M6 + 1.5.8.RELEASE UTF-8 1.8 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT diff --git a/samples/wiremock-undertow-ssl/pom.xml b/samples/wiremock-undertow-ssl/pom.xml index 202fa7d889..9634487f65 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 - 2.0.0.BUILD-SNAPSHOT + 0.0.1 jar wiremock-undertow-ssl @@ -13,14 +13,14 @@ org.springframework.boot spring-boot-starter-parent - 2.0.0.M6 + 1.5.8.RELEASE UTF-8 1.8 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT diff --git a/samples/wiremock-undertow/pom.xml b/samples/wiremock-undertow/pom.xml index 91e91794c8..db5cb533a4 100644 --- a/samples/wiremock-undertow/pom.xml +++ b/samples/wiremock-undertow/pom.xml @@ -4,7 +4,7 @@ 4.0.0 wiremock-undertow - 2.0.0.BUILD-SNAPSHOT + 0.0.1 jar wiremock-undertow @@ -13,14 +13,14 @@ org.springframework.boot spring-boot-starter-parent - 2.0.0.M6 + 1.5.8.RELEASE UTF-8 1.8 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT diff --git a/spring-cloud-contract-dependencies/pom.xml b/spring-cloud-contract-dependencies/pom.xml index 30c12555db..d4afd8f28f 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 - 2.0.0.BUILD-SNAPSHOT + 1.3.6.BUILD-SNAPSHOT spring-cloud-contract-dependencies - 2.0.0.BUILD-SNAPSHOT + 1.2.2.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 d9801e51b6..1b678eceba 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. spring-cloud-contract-shade diff --git a/spring-cloud-contract-spec/pom.xml b/spring-cloud-contract-spec/pom.xml index 57b84600ff..7bc987e897 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.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 7fe351c450..b865c32d62 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,7 +1,5 @@ package org.springframework.cloud.contract.spec.internal -import java.util.regex.Pattern - import groovy.transform.Canonical import groovy.transform.CompileStatic import groovy.transform.EqualsAndHashCode @@ -48,12 +46,6 @@ 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 416fbfa367..122d042ef0 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,11 +113,6 @@ 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 6f98c5c630..d8054ca59d 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,8 +36,7 @@ abstract class PatternValueDslProperty { protected abstract T createProperty(Pattern pattern, Object generatedValue) T anyAlphaUnicode() { - return createAndValidateProperty(RegexPatterns.ONLY_ALPHA_UNICODE, - RandomStringGenerator.randomString(20)) + return createAndValidateProperty(RegexPatterns.ONLY_ALPHA_UNICODE, randomString(20)) } T anyNumber() { @@ -89,16 +88,26 @@ abstract class PatternValueDslProperty { } T anyNonBlankString() { - return createAndValidateProperty(RegexPatterns.NON_BLANK, - RandomStringGenerator.randomString(20)) + return createAndValidateProperty(RegexPatterns.NON_BLANK, randomString(20)) } T anyNonEmptyString() { - return createAndValidateProperty(RegexPatterns.NON_EMPTY, - RandomStringGenerator.randomString(20)) + return createAndValidateProperty(RegexPatterns.NON_EMPTY, 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 deleted file mode 100644 index 0cddf8713b..0000000000 --- a/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/RandomStringGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -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 aa85d1b549..17be0c063a 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("|")) } - Pattern onlyAlphaUnicode() { - return ONLY_ALPHA_UNICODE + String onlyAlphaUnicode() { + return ONLY_ALPHA_UNICODE.pattern() } - Pattern number() { - return NUMBER + String number() { + return NUMBER.pattern() } - Pattern anyBoolean() { - return TRUE_OR_FALSE + String anyBoolean() { + return TRUE_OR_FALSE.pattern() } - Pattern ipAddress() { - return IP_ADDRESS + String ipAddress() { + return IP_ADDRESS.pattern() } - Pattern hostname() { - return HOSTNAME_PATTERN + String hostname() { + return HOSTNAME_PATTERN.pattern() } - Pattern email() { - return EMAIL + String email() { + return EMAIL.pattern() } - Pattern url() { - return URL + String url() { + return URL.pattern() } - Pattern uuid(){ - return UUID + String uuid(){ + return UUID.pattern() } - Pattern isoDate() { - return ANY_DATE + String isoDate() { + return ANY_DATE.pattern() } - Pattern isoDateTime() { - return ANY_DATE_TIME + String isoDateTime() { + return ANY_DATE_TIME.pattern() } - Pattern isoTime() { - return ANY_TIME + String isoTime() { + return ANY_TIME.pattern() } - Pattern iso8601WithOffset() { - return ISO8601_WITH_OFFSET + String iso8601WithOffset() { + return ISO8601_WITH_OFFSET.pattern() } - Pattern nonEmpty() { - return NON_EMPTY + String nonEmpty() { + return NON_EMPTY.pattern() } - Pattern nonBlank() { - return NON_BLANK + String nonBlank() { + return NON_BLANK.pattern() } // 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 a4726ce569..5764ac588f 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,13 +18,15 @@ 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 == regexPatterns.ipAddress().matcher(textToMatch).matches() + shouldMatch == Pattern.compile(regexPatterns.ipAddress()).matcher(textToMatch).matches() where: textToMatch || shouldMatch '123.123.123.123' || true @@ -33,7 +35,7 @@ class RegexPatternsSpec extends Specification { def "should generate a regex for hostname [#textToMatch] that is a match [#shouldMatch]"() { expect: - shouldMatch == regexPatterns.hostname().matcher(textToMatch).matches() + shouldMatch == Pattern.compile(regexPatterns.hostname()).matcher(textToMatch).matches() where: textToMatch || shouldMatch 'https://asd.com' || true @@ -46,7 +48,7 @@ class RegexPatternsSpec extends Specification { def "should generate a regex for email [#textToMatch] that is a match [#shouldMatch]"() { expect: - shouldMatch == regexPatterns.email().matcher(textToMatch).matches() + shouldMatch == Pattern.compile(regexPatterns.email()).matcher(textToMatch).matches() where: textToMatch || shouldMatch 'asd@asd.com' || true @@ -57,7 +59,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 == regexPatterns.url().matcher(textToMatch).matches() + shouldMatch == Pattern.compile(regexPatterns.url()).matcher(textToMatch).matches() where: textToMatch || shouldMatch 'ftp://asd.com:9090/asd/a?a=b' || true @@ -128,7 +130,7 @@ class RegexPatternsSpec extends Specification { def "should generate a regex for a number [#textToMatch] that is a match [#shouldMatch]"() { expect: - shouldMatch == regexPatterns.number().matcher(textToMatch).matches() + shouldMatch == Pattern.compile(regexPatterns.number()).matcher(textToMatch).matches() where: textToMatch || shouldMatch '1' || true @@ -140,7 +142,7 @@ class RegexPatternsSpec extends Specification { def "should generate a regex for a uuid [#textToMatch] that is a match [#shouldMatch]"() { expect: - shouldMatch == regexPatterns.uuid().matcher(textToMatch).matches() + shouldMatch == Pattern.compile(regexPatterns.uuid()).matcher(textToMatch).matches() where: textToMatch || shouldMatch UUID.randomUUID().toString() || true @@ -153,7 +155,7 @@ class RegexPatternsSpec extends Specification { def "should generate a regex with date [#textToMatch] in YYYY-MM-DD format that should match [#shouldMatch]"() { expect: - shouldMatch == regexPatterns.isoDate().matcher(textToMatch).matches() + shouldMatch == Pattern.compile(regexPatterns.isoDate()).matcher(textToMatch).matches() where: textToMatch || shouldMatch "2014-03-01" || true @@ -171,7 +173,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 == regexPatterns.isoDateTime().matcher(textToMatch).matches() + shouldMatch == Pattern.compile(regexPatterns.isoDateTime()).matcher(textToMatch).matches() where: textToMatch || shouldMatch "2014-03-01T12:23:45" || true @@ -196,7 +198,7 @@ class RegexPatternsSpec extends Specification { def "should generate a regex with time [#textToMatch] in HH:mm:ss format that should match [#shouldMatch]"() { expect: - shouldMatch == regexPatterns.isoTime().matcher(textToMatch).matches() + shouldMatch == Pattern.compile(regexPatterns.isoTime()).matcher(textToMatch).matches() where: textToMatch || shouldMatch "12:23:45" || true @@ -212,7 +214,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 == regexPatterns.iso8601WithOffset().matcher(textToMatch).matches() + shouldMatch == Pattern.compile(regexPatterns.iso8601WithOffset()).matcher(textToMatch).matches() where: textToMatch || shouldMatch '2014-03-01T12:23:45Z' || true @@ -225,7 +227,7 @@ class RegexPatternsSpec extends Specification { def "should generate a regex for a non blank string [#textToMatch] that should match [#shouldMatch]"(){ expect: - shouldMatch == regexPatterns.nonBlank().matcher(textToMatch).matches() + shouldMatch == Pattern.compile(regexPatterns.nonBlank()).matcher(textToMatch).matches() where: textToMatch || shouldMatch 'Not Empty' || true @@ -239,7 +241,7 @@ class RegexPatternsSpec extends Specification { def "should generate a regex for a non empty string [#textToMatch] that should match [#shouldMatch]"() { expect: - shouldMatch == regexPatterns.nonEmpty().matcher(textToMatch).matches() + shouldMatch == Pattern.compile(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 c30ea485dc..3a9f1a8ff8 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.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 8b72e0b72b..9b899e9e1f 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.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 40d2f4f6d5..775e63461c 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. spring-cloud-starter-contract-stub-runner @@ -17,6 +17,10 @@ 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 96270fd5bc..436bcbac20 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.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 9fb26c48b3..45707881ec 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. spring-cloud-contract-stub-runner @@ -38,7 +38,7 @@ org.springframework.cloud - spring-cloud-starter-netflix-ribbon + spring-cloud-starter-ribbon true @@ -60,6 +60,21 @@ 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 @@ -116,7 +131,7 @@ org.springframework.cloud - spring-cloud-netflix-eureka-server + spring-cloud-starter-eureka 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 new file mode 100644 index 0000000000..743224bfd5 --- /dev/null +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelConfiguration.java @@ -0,0 +1,67 @@ +/* + * 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 new file mode 100644 index 0000000000..e5cdc683df --- /dev/null +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelPredicate.java @@ -0,0 +1,109 @@ +/* + * 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 new file mode 100644 index 0000000000..e733c5a817 --- /dev/null +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelProcessor.java @@ -0,0 +1,59 @@ +/* + * 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 c01d094891..49f9683a8b 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,7 +19,6 @@ 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; @@ -35,6 +34,7 @@ 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 91db4dd200..9d171d4b7e 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,7 +19,6 @@ 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; @@ -44,6 +43,7 @@ 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 8413c934dd..7146153c20 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.isTraceEnabled()) { - log.trace("The server is already running at port [" + port() + "]"); + if (log.isDebugEnabled()) { + log.debug("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.isTraceEnabled()) { - log.trace("Trying to stop a non started server!"); + if (log.isDebugEnabled()) { + log.debug("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 d98313f262..05af101388 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,6 +25,7 @@ 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; @@ -50,7 +51,7 @@ class StubRunnerDiscoveryClient implements DiscoveryClient { public StubRunnerDiscoveryClient(DiscoveryClient delegate, StubFinder stubFinder, StubMapperProperties stubMapperProperties, String springAppName) { this.delegate = delegate instanceof StubRunnerDiscoveryClient ? - noOpDiscoveryClient() : delegate; + noOpDiscoveryClient(springAppName) : delegate; if (log.isDebugEnabled()) { log.debug("Will delegate calls to discovery service [" + this.delegate + "] if a stub is not found"); } @@ -60,7 +61,7 @@ class StubRunnerDiscoveryClient implements DiscoveryClient { public StubRunnerDiscoveryClient(StubFinder stubFinder, StubMapperProperties stubMapperProperties, String springAppName) { - this.delegate = noOpDiscoveryClient(); + this.delegate = noOpDiscoveryClient(springAppName); if (log.isDebugEnabled()) { log.debug("Will delegate calls to discovery service [" + this.delegate + "] if a stub is not found"); } @@ -68,8 +69,8 @@ class StubRunnerDiscoveryClient implements DiscoveryClient { this.stubMapperProperties = stubMapperProperties; } - private StubRunnerNoOpDiscoveryClient noOpDiscoveryClient() { - return new StubRunnerNoOpDiscoveryClient(); + private StubRunnerNoOpDiscoveryClient noOpDiscoveryClient(String springAppName) { + return new StubRunnerNoOpDiscoveryClient(new DefaultServiceInstance(springAppName, "localhost", 0, false)); } @Override @@ -84,6 +85,18 @@ 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); @@ -142,11 +155,22 @@ 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 6d40105b96..dc3d4e026a 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,6 +5,7 @@ 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 9422952229..fdcfbf5f29 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 = 18999 - static final int MAX_PORT = 19999 + static final int MIN_PORT = 8999 + static final int MAX_PORT = 9999 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 new file mode 100644 index 0000000000..ba71c68044 --- /dev/null +++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelPredicateSpec.groovy @@ -0,0 +1,137 @@ +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 c436dfc803..197b6c0c3a 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 groovy.json.JsonSlurper import io.restassured.module.mockmvc.RestAssuredMockMvc -import spock.lang.Specification - +import groovy.json.JsonSlurper 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 - Integer.valueOf(response.body.asString()) > 0 + response.body.as(Integer) > 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 538edfe53d..9cc35ccab1 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,6 +43,7 @@ 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 a8dcc118f3..7973900003 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,6 +56,7 @@ 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 984722d66c..5e6af84c81 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,6 +43,7 @@ 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 6851b346cb..4dad71a21e 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,6 +39,7 @@ 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 272920c915..c51b1496d8 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,8 +16,6 @@ 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 @@ -34,6 +32,8 @@ 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 eb61c7b1bf..8e451ff9e6 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,8 +16,6 @@ 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 @@ -34,6 +32,8 @@ 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 a2cbcc277e..236e96080c 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,7 +43,8 @@ import static org.mockito.Mockito.mock */ @ContextConfiguration(classes = Config, loader = SpringBootContextLoader) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, - properties = ["eureka.client.enabled=false", + properties = ["stubrunner.camel.enabled=false", + "eureka.client.enabled=false", "spring.cloud.zookeeper.enabled=false", "stubrunner.cloud.stubbed.discovery.enabled=false", "stubrunner.cloud.eureka.enabled=false", @@ -80,7 +81,7 @@ class StubRunnerSpringCloudConsulAutoConfigurationSpec extends Specification { serviceName << ['loanIssuance:loanIssuance', 'bootService:bootService', 'fraudDetectionServer:someNameThatShouldMapFraudDetectionServer'] } - private static class NewServiceMatcher implements ArgumentMatcher { + private static class NewServiceMatcher extends TypeSafeMatcher { private final String expectedId private final String expectedName @@ -91,9 +92,14 @@ class StubRunnerSpringCloudConsulAutoConfigurationSpec extends Specification { } @Override - boolean matches(NewService item) { + protected boolean matchesSafely(NewService item) { return item.id == expectedId && item.name == expectedName } + + @Override + void describeTo(Description description) { + + } } @Configuration @@ -108,7 +114,7 @@ class StubRunnerSpringCloudConsulAutoConfigurationSpec extends Specification { @Bean ConsulDiscoveryProperties consulDiscoveryProperties() { - return mock(ConsulDiscoveryProperties) + return new 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 ea941760d1..e748b714b5 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,4 +1,5 @@ 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 9541d7973c..1381be8b05 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,6 +8,8 @@ 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 b5a09c6c90..73554a760b 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 2f1571b1ce..93942f7f56 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-26T11:40:47+02:00"}} \ No newline at end of file +{"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 diff --git a/spring-cloud-contract-tools/pom.xml b/spring-cloud-contract-tools/pom.xml index 1f2a7ae820..656bd286ac 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.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 dd49e7e10f..2efc2d4918 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.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 d289534e48..5674941167 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') ?: '2.0.0.BUILD-SNAPSHOT' +project.version = findProperty('verifierVersion') ?: '1.5.4.RELEASE' apply plugin: 'groovy' apply from: "$rootDir/gradle/release.gradle" apply plugin: 'eclipse' @@ -135,5 +135,5 @@ task resolveDependencies { } task wrapper(type: Wrapper) { - gradleVersion = '4.0.2' + gradleVersion = '3.4' } \ 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 1946c9108a..6e0df725d8 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=2.0.0.BUILD-SNAPSHOT +verifierVersion=1.2.2.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 96d36c23c8..deedc7fa5e 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 64ffcab3bf..19de5bfeda 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 @@ -#Mon Jul 31 11:13:36 CEST 2017 +#Tue Feb 28 14:19:34 CET 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-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 4453ccea33..9aa616c273 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 sh +#!/usr/bin/env bash ############################################################################## ## @@ -154,19 +154,16 @@ if $cygwin ; then esac fi -# Escape application args -save ( ) { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") } -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" +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" # 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" "$@" +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 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 e95643d6a2..f9553162f1 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 f6aa31661c..b043a61f4f 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.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 2a33e16b91..48c07458e6 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,9 +1,6 @@ buildscript { repositories { mavenCentral() - maven { url "http://repo.spring.io/snapshot" } - maven { url "http://repo.spring.io/milestone" } - maven { url "http://repo.spring.io/release" } } } @@ -23,15 +20,12 @@ 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.5.0-beta-1" + compile "org.codehaus.groovy:groovy-all:2.4.11" compile 'com.jayway.jsonpath:json-path-assert:2.2.0' testCompile "com.github.tomakehurst:wiremock:${wiremockVersion}" @@ -55,7 +49,7 @@ contracts { generateContractTests.dependsOn generateWireMockClientStubs wrapper { - gradleVersion '3.5' + gradleVersion '2.2.1' } 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 4cde276f6d..2f45204455 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=2.0.0.BUILD-SNAPSHOT +verifierVersion=1.2.2.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 6ffa237849..3baa851b28 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 1534560008..95d7279349 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 Apr 28 10:55:26 CEST 2017 +#Fri Aug 19 15:38:58 CEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-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 0f9de2c136..e1f690423a 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,12 +18,9 @@ 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:2.0.0.M3") + classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE") } } @@ -45,13 +42,10 @@ 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.5.0-beta-1' + testCompile 'org.codehaus.groovy:groovy-all:2.4.11' testCompile "org.spockframework:spock-core:$spockVersion" testCompile 'junit:junit:4.12' testCompile "com.github.tomakehurst:wiremock:${wiremockVersion}" @@ -61,8 +55,7 @@ subprojects { } configure([project(':fraudDetectionService'), project(':loanApplicationService')]) { - apply plugin: 'org.springframework.boot' - apply plugin: 'io.spring.dependency-management' + apply plugin: 'spring-boot' apply plugin: 'maven-publish' ext['jetty.version'] = '9.2.17.v20160517' @@ -90,7 +83,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:${wiremockVersion}") { + testCompile("com.github.tomakehurst:wiremock:2.9.0") { exclude group: 'org.eclipse.jetty' } } @@ -147,6 +140,3 @@ 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 99be1efefa..a979b2c048 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=2.0.0.BUILD-SNAPSHOT +verifierVersion=1.2.2.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 6ffa237849..3baa851b28 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 1534560008..95d7279349 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 Apr 28 10:55:26 CEST 2017 +#Fri Aug 19 15:38:58 CEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-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 1a63d36f7e..c690f91b42 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,12 +18,9 @@ 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:2.0.0.M3") + classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE") } } @@ -42,13 +39,10 @@ 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.5.0-beta-1" + testCompile "org.codehaus.groovy:groovy-all:2.4.11" testCompile "org.spockframework:spock-core:$spockVersion" testCompile("junit:junit:4.12") testCompile "com.github.tomakehurst:wiremock:${wiremockVersion}" @@ -58,8 +52,7 @@ subprojects { } configure([project(':fraudDetectionService'), project(':loanApplicationService')]) { - apply plugin: 'org.springframework.boot' - apply plugin: 'io.spring.dependency-management' + apply plugin: 'spring-boot' apply plugin: 'spring-cloud-contract' apply plugin: 'maven-publish' @@ -115,7 +108,7 @@ configure(project(':fraudDetectionService')) { configure(project(':loanApplicationService')) { - task copyCollaboratorStubs(type: Copy) { + task copyCollaboratorStubs(type: com.sun.org.apache.xalan.internal.xsltc.compiler.Copy) { File fraudBuildDir = project(':fraudDetectionService').buildDir from(new File(fraudBuildDir, "/production/${project(':fraudDetectionService').name}-stubs/")) into "src/test/resources/" @@ -124,6 +117,3 @@ 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 a771813121..887e30a1a5 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=2.0.0.BUILD-SNAPSHOT \ No newline at end of file +verifierVersion=1.2.2.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 6ffa237849..3baa851b28 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 1534560008..95d7279349 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 Apr 28 10:55:26 CEST 2017 +#Fri Aug 19 15:38:58 CEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-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 6921a6f2ab..12068579b3 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,12 +18,9 @@ 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:2.0.0.M3") + classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE") } } @@ -43,13 +40,10 @@ 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.5.0-beta-1" + testCompile "org.codehaus.groovy:groovy-all:2.4.11" testCompile "org.spockframework:spock-core:$spockVersion" testCompile "junit:junit:4.12" testCompile "com.github.tomakehurst:wiremock:${wiremockVersion}" @@ -60,8 +54,7 @@ subprojects { } configure([project(':fraudDetectionService'), project(':loanApplicationService')]) { - apply plugin: 'org.springframework.boot' - apply plugin: 'io.spring.dependency-management' + apply plugin: 'spring-boot' apply plugin: 'spring-cloud-contract' // tag::jar_setup[] @@ -148,6 +141,3 @@ 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 4cde276f6d..2f45204455 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=2.0.0.BUILD-SNAPSHOT +verifierVersion=1.2.2.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 6ffa237849..3baa851b28 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 1534560008..95d7279349 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 Apr 28 10:55:26 CEST 2017 +#Fri Aug 19 15:38:58 CEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-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 a18e5c6ff9..47e1578ff7 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. @@ -23,7 +23,7 @@ 3.2.5 - 3.5 + 3.4 UTF-8 UTF-8 @@ -33,7 +33,7 @@ 1.7 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT 2016 @@ -262,12 +262,6 @@ 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 43992aab15..a678e7e0f9 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 - 2.0.0.BUILD-SNAPSHOT + 1.3.5.RELEASE 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 638a01ec4a..d0215f5907 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.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 4a2a27e42f..97e7f6441c 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.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 205c490878..3c718f96f0 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 - 2.0.0.BUILD-SNAPSHOT + 1.5.4.RELEASE @@ -81,64 +81,4 @@ - - - - - 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 e7288e7563..77aacd7970 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 - 2.0.0.BUILD-SNAPSHOT + 1.5.4.RELEASE @@ -47,7 +47,6 @@ org.spockframework spock-core - 1.0-groovy-2.4 test @@ -123,63 +122,4 @@ - - - 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 e4763a19c1..3c718f96f0 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 - 2.0.0.BUILD-SNAPSHOT + 1.5.4.RELEASE @@ -81,64 +81,4 @@ - - - - - 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 4fe0364be0..010a145f03 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. spring-cloud-contract-spec-pact diff --git a/spring-cloud-contract-verifier/pom.xml b/spring-cloud-contract-verifier/pom.xml index e42cb45136..1bfbef1670 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. spring-cloud-contract-verifier @@ -26,6 +26,11 @@ spring-messaging true + + org.apache.camel + camel-spring + true + org.springframework.cloud spring-cloud-stream-test-support @@ -141,12 +146,6 @@ 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 d9d5ab9303..feda50f68d 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 @@ -391,7 +391,6 @@ 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 aaa49b7261..d7aecf5570 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,7 +96,9 @@ abstract class BaseWireMockStubStrategy { */ String parseBody(Map map, ContentType contentType) { def transformedMap = MapConverter.getStubSideValues(map) - transformedMap = transformMapIfRequestPresent(transformedMap) + String responseSideBody = toJson(MapConverter.getTestSideValues(contract.request.body)) + DocumentContext context = JsonPath.parse(responseSideBody) + transformedMap = processEntriesForTemplating(transformedMap, context) 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 @@ -104,17 +106,6 @@ 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 0449b3d1ab..37da2a9593 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,17 +94,15 @@ class ContractFileScanner { if (!files) { return } - File[] sortedFiles = files.sort() as File[] - for (int i = 0; i < sortedFiles.length; i++) { - File file = sortedFiles[i] + files.sort().eachWithIndex { File file, int index -> 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, i, ContractVerifierDslConverter.convertAsCollection(baseDir, file)) + addContractToTestGeneration(result, files, file, index, ContractVerifierDslConverter.convertAsCollection(baseDir, file)) } else if (!contractFile && included) { - addContractToTestGeneration(converters, result, files, file, i) + addContractToTestGeneration(converters, result, files, file, index) } 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 ab12b92a22..32a0599cee 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,9 +64,8 @@ public class SpringAmqpStubMessages implements @Autowired public SpringAmqpStubMessages(RabbitTemplate rabbitTemplate, MessageListenerAccessor messageListenerAccessor) { - 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 + Assert.notNull(rabbitTemplate); + Assert.isTrue(mockingDetails(rabbitTemplate).isSpy() || mockingDetails(rabbitTemplate).isMock()); //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 new file mode 100644 index 0000000000..b5a2461373 --- /dev/null +++ b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/camel/CamelStubMessages.java @@ -0,0 +1,88 @@ +/* + * 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 new file mode 100644 index 0000000000..21f06395b6 --- /dev/null +++ b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/camel/ContractVerifierCamelConfiguration.java @@ -0,0 +1,65 @@ +/* + * 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 new file mode 100644 index 0000000000..c2e87c94ca --- /dev/null +++ b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/camel/ContractVerifierCamelMessageBuilder.java @@ -0,0 +1,36 @@ +/* + * 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 fdb7a8b043..00cebd3016 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,6 +21,7 @@ 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; @@ -40,6 +41,7 @@ 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 c7cfc35629..0e6be1c75d 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,4 +4,5 @@ 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 6373f8386c..f83e35b19d 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,20 +16,19 @@ package org.springframework.cloud.contract.verifier.builder -import java.util.regex.Pattern - import org.codehaus.groovy.control.MultipleCompilationErrorsException import org.junit.Rule -import spock.lang.Issue -import spock.lang.Shared -import spock.lang.Specification -import spock.util.environment.RestoreSystemProperties - 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 /** * @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 897321b198..ebc56fc8ac 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.web.server.LocalServerPort; + import org.springframework.boot.context.embedded.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 e6cb43bcf6..e70d86fe44 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,57 +1,35 @@ 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.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 +import java.lang.reflect.Method + /** * checking the syntax of produced scripts */ @CompileStatic class SyntaxChecker { - WebTarget webTarget - Entity entity - private static final String[] DEFAULT_IMPORTS = [ - Contract.name, - ResponseOptions.name, + "org.springframework.cloud.contract.spec.Contract", + "io.restassured.response.ResponseOptions", "io.restassured.module.mockmvc.specification.*", "io.restassured.module.mockmvc.*", - Test.name, - Rule.name, - DocumentContext.name, - JsonPath.name, - Inject.name, - ContractVerifierObjectMapper.name, - ContractVerifierMessage.name, - ContractVerifierMessaging.name, - WebTarget.name, - Response.name + "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" ] private static final String DEFAULT_IMPORTS_AS_STRING = DEFAULT_IMPORTS.collect { @@ -59,13 +37,13 @@ class SyntaxChecker { }.join("\n") private static final String STATIC_IMPORTS = [ - "${RestAssuredMockMvc.name}.given", - "${RestAssuredMockMvc.name}.when", - "${RestAssured.name}.*", - "${Entity.name}.*", - "${ContractVerifierMessagingUtil.name}.headers", - "${JsonAssertion.name}.assertThatJson", - "${SpringCloudContractAssertions.name}.assertThat" + "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" ].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 dde0ef9318..d8917f583d 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. spring-cloud-contract-wiremock @@ -17,16 +17,6 @@ com.github.tomakehurst wiremock-standalone - - io.rest-assured - rest-assured - true - - - javax.servlet - javax.servlet-api - true - org.apache.httpcomponents httpclient @@ -49,11 +39,6 @@ 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 deleted file mode 100644 index 4e78eade35..0000000000 --- a/spring-cloud-contract-wiremock/src/main/java/org/springframework/cloud/contract/wiremock/restdocs/WireMockRestAssuredConfiguration.java +++ /dev/null @@ -1,28 +0,0 @@ -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 df5fc11bac..802d37e01e 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,7 +16,6 @@ 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; @@ -34,7 +33,6 @@ 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 c0e49b7d51..9ac5aa6677 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,5 +4,4 @@ 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.WireMockRestAssuredConfiguration +org.springframework.cloud.contract.wiremock.restdocs.WireMockRestDocsConfiguration 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 deleted file mode 100644 index d0830fd5d3..0000000000 --- a/spring-cloud-contract-wiremock/src/test/java/org/springframework/cloud/contract/wiremock/WiremockServerRestAssuredApplicationTests.java +++ /dev/null @@ -1,83 +0,0 @@ -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 9d0f1d83e3..7056e78279 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,7 +1,15 @@ 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; @@ -9,7 +17,8 @@ import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.mockito.Answers; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.runners.MockitoJUnitRunner; + import org.springframework.cloud.contract.wiremock.WireMockStubMapping; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -22,19 +31,10 @@ 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,11 +192,6 @@ public class WireMockSnippetTests { public URI getUri() { return URI.create("http://foo/bar"); } - - @Override - public Collection getCookies() { - return Collections.emptySet(); - } }; } @@ -240,11 +235,6 @@ public class WireMockSnippetTests { public URI getUri() { return URI.create("http://foo/bar"); } - - @Override - public Collection getCookies() { - return Collections.emptySet(); - } }; } @@ -286,10 +276,6 @@ 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 94712d4f63..23fc5c696a 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -7,7 +7,7 @@ org.springframework.cloud spring-cloud-contract-parent - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. @@ -18,12 +18,14 @@ 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 6d99636ccb..ae65414dcb 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. spring-cloud-contract-sample-amqp diff --git a/tests/samples-messaging-camel/.springBeans b/tests/samples-messaging-camel/.springBeans new file mode 100644 index 0000000000..b74cfc29b8 --- /dev/null +++ b/tests/samples-messaging-camel/.springBeans @@ -0,0 +1,16 @@ + + + 1 + + + + + + + java:com.example.fraud.CamelMessagingApplication + + + + + + diff --git a/tests/samples-messaging-camel/pom.xml b/tests/samples-messaging-camel/pom.xml new file mode 100644 index 0000000000..e21d43bcc6 --- /dev/null +++ b/tests/samples-messaging-camel/pom.xml @@ -0,0 +1,52 @@ + + + 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 new file mode 100644 index 0000000000..15635f725e --- /dev/null +++ b/tests/samples-messaging-camel/src/main/java/com/example/BookDeleted.java @@ -0,0 +1,31 @@ +/* + * 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 new file mode 100644 index 0000000000..31e051f696 --- /dev/null +++ b/tests/samples-messaging-camel/src/main/java/com/example/BookDeleter.java @@ -0,0 +1,45 @@ +/* + * 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 new file mode 100644 index 0000000000..44b6b35003 --- /dev/null +++ b/tests/samples-messaging-camel/src/main/java/com/example/BookReturned.java @@ -0,0 +1,31 @@ +/* + * 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 new file mode 100644 index 0000000000..3f4f6c9022 --- /dev/null +++ b/tests/samples-messaging-camel/src/main/java/com/example/BookRouteConfiguration.java @@ -0,0 +1,56 @@ +/* + * 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 new file mode 100644 index 0000000000..a145e482d6 --- /dev/null +++ b/tests/samples-messaging-camel/src/main/java/com/example/BookService.java @@ -0,0 +1,43 @@ +/* + * 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 new file mode 100644 index 0000000000..25ff4fccc4 --- /dev/null +++ b/tests/samples-messaging-camel/src/main/java/com/example/CamelMessagingApplication.java @@ -0,0 +1,28 @@ +/* + * 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 new file mode 100644 index 0000000000..2d43631044 --- /dev/null +++ b/tests/samples-messaging-camel/src/test/groovy/com/example/CamelMessagingApplicationSpec.groovy @@ -0,0 +1,159 @@ +/* + * 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 e586adc71f..61cb05a88b 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. spring-cloud-contract-sample-integration diff --git a/tests/samples-messaging-spring/pom.xml b/tests/samples-messaging-spring/pom.xml index 79a18e3fcd..05a2869d61 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. spring-cloud-contract-sample-spring diff --git a/tests/samples-messaging-stream/pom.xml b/tests/samples-messaging-stream/pom.xml index 9ad4fa8a07..8853057412 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.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 19e2e84ac2..5bdd5137b1 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.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 bd05d85268..a384873054 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. spring-cloud-contract-stub-runner-boot-eureka @@ -24,13 +24,13 @@ org.springframework.cloud - spring-cloud-starter-netflix-eureka-client + spring-cloud-starter-eureka true org.springframework.cloud - spring-cloud-starter-netflix-eureka-server - true + spring-cloud-starter-eureka-server + test 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 2b91381a2c..be0dd59c16 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,4 +1,5 @@ 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 dc43e82d6d..f161ddb383 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.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 82cb2b2eeb..d68ebd4a8f 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.ZookeeperDiscoveryClient +import org.springframework.cloud.zookeeper.discovery.ZookeeperServiceDiscovery import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.test.annotation.DirtiesContext @@ -42,7 +42,8 @@ import spock.lang.Specification */ @ContextConfiguration(classes = Config, loader = SpringBootContextLoader) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, - properties = ["stubrunner.cloud.stubbed.discovery.enabled=false", + properties = ["stubrunner.camel.enabled=false", + "stubrunner.cloud.stubbed.discovery.enabled=false", "debug=true"]) @AutoConfigureStubRunner( ids = ["org.springframework.cloud.contract.verifier.stubs:loanIssuance", @@ -54,7 +55,7 @@ class StubRunnerSpringCloudZookeeperAutoConfigurationSpec extends Specification @Autowired StubFinder stubFinder @Autowired @LoadBalanced RestTemplate restTemplate - @Autowired ZookeeperDiscoveryClient zookeeperServiceDiscovery + @Autowired ZookeeperServiceDiscovery zookeeperServiceDiscovery @BeforeClass @AfterClass @@ -75,8 +76,12 @@ class StubRunnerSpringCloudZookeeperAutoConfigurationSpec extends Specification def 'should have all apps registered in Service Discovery'() { expect: - !zookeeperServiceDiscovery.getInstances('loanIssuance').empty - !zookeeperServiceDiscovery.getInstances('someNameThatShouldMapFraudDetectionServer').empty + !zookeeperServiceDiscovery.serviceDiscoveryRef.get().queryForInstances('loanIssuance').empty + !zookeeperServiceDiscovery.serviceDiscoveryRef.get().queryForInstances('someNameThatShouldMapFraudDetectionServer').empty + } + + def cleanup() { + zookeeperServiceDiscovery?.serviceDiscoveryRef?.get()?.close() } @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 abde606911..ddf61bbcac 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,4 +1,5 @@ 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 new file mode 100644 index 0000000000..8ad67e3ce5 --- /dev/null +++ b/tests/spring-cloud-contract-stub-runner-camel/README.adoc @@ -0,0 +1,132 @@ +: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 new file mode 100644 index 0000000000..43b9e29099 --- /dev/null +++ b/tests/spring-cloud-contract-stub-runner-camel/pom.xml @@ -0,0 +1,93 @@ + + + 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 new file mode 100644 index 0000000000..26428fd9fd --- /dev/null +++ b/tests/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/BookReturned.groovy @@ -0,0 +1,32 @@ +/* + * 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 new file mode 100644 index 0000000000..8c6c525c5b --- /dev/null +++ b/tests/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy @@ -0,0 +1,254 @@ +/* + * 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 new file mode 100644 index 0000000000..279782c65e --- /dev/null +++ b/tests/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/StubRunnerCamelProcessorSpec.groovy @@ -0,0 +1,98 @@ +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 new file mode 100644 index 0000000000..7ba218ad58 --- /dev/null +++ b/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/application.yml @@ -0,0 +1,5 @@ +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 new file mode 100644 index 0000000000..b27b155a3e Binary files /dev/null and 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 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 new file mode 100644 index 0000000000..b2210f65ff --- /dev/null +++ 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 @@ -0,0 +1,25 @@ + + + + + 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 new file mode 100644 index 0000000000..f0954907f2 --- /dev/null +++ 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 @@ -0,0 +1,28 @@ + + + + + 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 new file mode 100644 index 0000000000..00bf4217ee --- /dev/null +++ b/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/camelService/maven-metadata-local.xml @@ -0,0 +1,28 @@ + + + + + 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 new file mode 100644 index 0000000000..00bf4217ee --- /dev/null +++ b/tests/spring-cloud-contract-stub-runner-camel/src/test/resources/m2repo/repository/org/springframework/cloud/contract/verifier/stubs/camelService/maven-metadata.xml @@ -0,0 +1,28 @@ + + + + + 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 fb29de0bb2..3d4d50809e 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.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 56af56d989..6f36301172 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,8 +2,6 @@ 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 { @@ -13,12 +11,3 @@ 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 4ebaff95d9..0d28926451 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,4 +1,2 @@ -server: - port: 0 - servlet: - context-path: /my-path \ No newline at end of file +server.port: 0 +server.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 1a3973195b..5910bd9dcd 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/foo", String.class); + .getForObject("http://localhost:" + this.port + "/my-path/health", 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 ed4fe4a69b..7f160c2f6b 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. spring-cloud-contract-stub-runner-integration @@ -16,10 +16,6 @@ 1.8 - - org.springframework.boot - spring-boot-starter-integration - org.springframework.cloud spring-cloud-contract-stub-runner @@ -33,6 +29,10 @@ 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 40a8270173..c1914d8fd4 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.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 536e2b67d4..9e4e1aef0e 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.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 b514f41d0d..c3ea352ff3 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 - 2.0.0.BUILD-SNAPSHOT + 1.2.2.BUILD-SNAPSHOT .. spring-cloud-contract-stub-runner-stream @@ -36,6 +36,10 @@ 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 2ee278ee21..d47837d955 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,8 +163,7 @@ class StreamStubRunnerSpec extends Specification { private boolean assertJsons(Object payload) { String objectAsString = payload instanceof String ? payload : - payload instanceof byte[] ? new String(payload) - : JsonOutput.toJson(payload) + JsonOutput.toJson(payload) def json = new JsonSlurper().parseText(objectAsString) return json.bookName == 'foo' }