diff --git a/README.adoc b/README.adoc index 724f5e4f5a..ebf565e469 100644 --- a/README.adoc +++ b/README.adoc @@ -15,7 +15,7 @@ What you always need it confidence in pushing new features into a new applicatio == Spring Cloud Contract Verifier -:images_url: https://raw.githubusercontent.com/Codearte/accurest/master/docs/src/main/asciidoc/images +:images_url: https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/master/docs/src/main/asciidoc/images == Introduction @@ -149,7 +149,8 @@ video::130779882[vimeo] === Samples -Here you can find some https://github.com/Codearte/accurest-samples[working samples]. Check the readme of each project for more information. +Here you can find some https://github.com/spring-cloud/spring-cloud-contract[working samples]. Check the `spring-cloud-contract-verifier-standalone-test-samples` folder +and read readme of each project for more information. === Why use Spring Cloud Contract Verifier and not X ? @@ -225,4 +226,67 @@ added after the original pull request but before a merge. other target branch in the main project). * When writing a commit message please follow http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[these conventions], if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit - message (where XXXX is the issue number). \ No newline at end of file + message (where XXXX is the issue number). + +== How to build it + +=== Project structure + +Here you can find the Spring Cloud Contract folder structure + +``` +├── samples +├── scripts +├── spring-cloud-contract-spec +├── spring-cloud-contract-stub-runner +├── spring-cloud-contract-verifier +├── spring-cloud-contract-verifier-gradle-plugin +├── spring-cloud-contract-verifier-maven-plugin +└── spring-cloud-contract-verifier-standalone-test-samples +``` + + - `samples` - folder contains integration test samples used also to build documentation + - `scripts` - contains scripts to build and test `Spring Cloud Contract` with Maven, Gradle and standalone projects + - `spring-cloud-contract-spec` - contains specification modules (contains concept of a Contract) + - `spring-cloud-contract-stub-runner` - contains Stub Runner related modules + - `spring-cloud-contract-verifier` - core of the `Spring Cloud Contract Verifier` functionality + - `spring-cloud-contract-verifier-gradle-plugin` - Gradle plugin for `Spring Cloud Contract Verifier` + - `spring-cloud-contract-verifier-maven-plugin` - Maven plugin for `Spring Cloud Contract Verifier` + - `spring-cloud-contract-verifier-standalone-test-samples` - standalone test sample that use `Spring Cloud Contract Verifier` + +=== Commands + +To build the core functionality together with Maven Plugin you can run + +``` +./mvnw clean install +``` + +To build the Gradle Plugin + +``` +cd spring-cloud-contract-verifier-gradle-plugin +./gradlew clean build +``` + +=== Scripts + +For your convenience we have created a bunch of scripts to build and test the whole functionality. + +Build both Maven and Gradle project + +``` +./scripts/build.sh +``` + +Run tests on the standalone projects + +``` +./scripts/runTests.sh +``` + +Build both Maven and Gradle projects and run tests on standalone projects + +``` +./scripts/buildAndTest.sh +``` \ No newline at end of file diff --git a/build.sh b/build.sh deleted file mode 100755 index b70bfa83fe..0000000000 --- a/build.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -./mvnw install -(cd *-gradle-plugin; ./gradlew clean build --parallel) diff --git a/circle.yml b/circle.yml index c495880da3..8152f70fb0 100644 --- a/circle.yml +++ b/circle.yml @@ -22,20 +22,12 @@ dependencies: - touch ~/.gradle/gradle.properties && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties override: - ./mvnw -s .settings.xml --fail-never dependency:go-offline || true + - cd spring-cloud-contract-verifier-samples && ./mvnw --fail-never dependency:go-offline || true test: override: # docs take 15 minutes to run #- ./mvnw install -P docs -q -U -DskipTests=true $MVN_LOCAL_OPTS - - | - echo "Running Spring Cloud Contract Verifier" - ./mvnw clean install --batch-mode -Dmaven.test.redirectTestOutputToFile=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn - - | - echo "Running Spring Cloud Contract Verifier Gradle Plugin" - cd spring-cloud-contract-verifier-gradle-plugin - ./gradlew clean build install - - | - echo "Checking if samples are not broken" - ./scripts/runTests.sh + - ./scripts/buildAndTest.sh post: - mkdir -p $CIRCLE_TEST_REPORTS/junit/ - find . -type f -regex ".*/target/.*-reports/.*" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \; diff --git a/deploy.sh b/deploy.sh deleted file mode 100755 index c92e3c1bdd..0000000000 --- a/deploy.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -./mvnw deploy && (cd *-gradle-plugin; ./gradlew clean build install) && ./scripts/runTests.sh && (cd *-gradle-plugin; ./gradlew uploadArchives -x test) diff --git a/docs/src/main/asciidoc/README.adoc b/docs/src/main/asciidoc/README.adoc index 34484a2b99..0a956cd9d4 100644 --- a/docs/src/main/asciidoc/README.adoc +++ b/docs/src/main/asciidoc/README.adoc @@ -24,3 +24,5 @@ You can read more about Spring Cloud Contract Verifier by reading the {documenta == Contributing include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing.adoc[] + +include::building.adoc[] \ No newline at end of file diff --git a/docs/src/main/asciidoc/building.adoc b/docs/src/main/asciidoc/building.adoc new file mode 100644 index 0000000000..1e05a687b6 --- /dev/null +++ b/docs/src/main/asciidoc/building.adoc @@ -0,0 +1,62 @@ +== How to build it + +=== Project structure + +Here you can find the Spring Cloud Contract folder structure + +``` +├── samples +├── scripts +├── spring-cloud-contract-spec +├── spring-cloud-contract-stub-runner +├── spring-cloud-contract-verifier +├── spring-cloud-contract-verifier-gradle-plugin +├── spring-cloud-contract-verifier-maven-plugin +└── spring-cloud-contract-verifier-standalone-test-samples +``` + + - `samples` - folder contains integration test samples used also to build documentation + - `scripts` - contains scripts to build and test `Spring Cloud Contract` with Maven, Gradle and standalone projects + - `spring-cloud-contract-spec` - contains specification modules (contains concept of a Contract) + - `spring-cloud-contract-stub-runner` - contains Stub Runner related modules + - `spring-cloud-contract-verifier` - core of the `Spring Cloud Contract Verifier` functionality + - `spring-cloud-contract-verifier-gradle-plugin` - Gradle plugin for `Spring Cloud Contract Verifier` + - `spring-cloud-contract-verifier-maven-plugin` - Maven plugin for `Spring Cloud Contract Verifier` + - `spring-cloud-contract-verifier-standalone-test-samples` - standalone test sample that use `Spring Cloud Contract Verifier` + +=== Commands + +To build the core functionality together with Maven Plugin you can run + +``` +./mvnw clean install +``` + +To build the Gradle Plugin + +``` +cd spring-cloud-contract-verifier-gradle-plugin +./gradlew clean build +``` + +=== Scripts + +For your convenience we have created a bunch of scripts to build and test the whole functionality. + +Build both Maven and Gradle project + +``` +./scripts/build.sh +``` + +Run tests on the standalone projects + +``` +./scripts/runTests.sh +``` + +Build both Maven and Gradle projects and run tests on standalone projects + +``` +./scripts/buildAndTest.sh +``` diff --git a/docs/src/main/asciidoc/contract.adoc b/docs/src/main/asciidoc/contract.adoc index a846910959..cd6e239c38 100644 --- a/docs/src/main/asciidoc/contract.adoc +++ b/docs/src/main/asciidoc/contract.adoc @@ -190,7 +190,7 @@ The output message can be triggered by calling a method (e.g. a Scheduler was st [source,groovy] ---- -include::../../../../samples/samples-messaging-integration/src/test/groovy/org/springframework/cloud/contract/verifier/samples/messaging/IntegrationMessagingApplicationSpec.groovy[tags=method_trigger,indent=0] +include::../../../../samples/samples-messaging-integration/src/test/groovy/com/example/IntegrationMessagingApplicationSpec.groovy[tags=method_trigger,indent=0] ---- In this case the output message will be sent to `output` if a method called `bookReturnedTriggered` will be executed. In the message *publisher's* side @@ -202,7 +202,7 @@ The output message can be triggered by receiving a message. [source,groovy] ---- -include::../../../../samples/samples-messaging-integration/src/test/groovy/org/springframework/cloud/contract/verifier/samples/messaging/IntegrationMessagingApplicationSpec.groovy[tags=message_trigger,indent=0] +include::../../../../samples/samples-messaging-integration/src/test/groovy/com/example/IntegrationMessagingApplicationSpec.groovy[tags=message_trigger,indent=0] ---- In this case the output message will be sent to `output` if a proper message will be received on the `input` destination. In the message *publisher's* side diff --git a/docs/src/main/asciidoc/introduction.adoc b/docs/src/main/asciidoc/introduction.adoc index 86eb75f37d..78d5ffdb74 100644 --- a/docs/src/main/asciidoc/introduction.adoc +++ b/docs/src/main/asciidoc/introduction.adoc @@ -1,4 +1,4 @@ -:images_url: https://raw.githubusercontent.com/Codearte/accurest/master/docs/src/main/asciidoc/images +:images_url: https://raw.githubusercontent.com/spring-cloud/spring-cloud-contract/master/docs/src/main/asciidoc/images == Introduction @@ -132,7 +132,8 @@ video::130779882[vimeo] === Samples -Here you can find some https://github.com/Codearte/accurest-samples[working samples]. Check the readme of each project for more information. +Here you can find some https://github.com/spring-cloud/spring-cloud-contract[working samples]. Check the `spring-cloud-contract-verifier-standalone-test-samples` folder +and read readme of each project for more information. === Why use Spring Cloud Contract Verifier and not X ? diff --git a/pom.xml b/pom.xml index 19a9e58c53..682a7f7c20 100644 --- a/pom.xml +++ b/pom.xml @@ -1,38 +1,39 @@ - - 4.0.0 + + 4.0.0 org.springframework.cloud spring-cloud-build 1.2.0.BUILD-SNAPSHOT - + - org.springframework.cloud.contract - spring-cloud-contract-parent - pom - 1.0.0.BUILD-SNAPSHOT + org.springframework.cloud.contract + spring-cloud-contract-parent + pom + 1.0.0.BUILD-SNAPSHOT - Spring Cloud Contract - Spring Cloud Contract + Spring Cloud Contract + Spring Cloud Contract - https://github.com/spring-cloud/spring-cloud-contract + https://github.com/spring-cloud/spring-cloud-contract - 2016 + 2016 - + docs - spring-cloud-contract-verifier - spring-cloud-contract-spec - spring-cloud-contract-stub-runner - spring-cloud-contract-verifier-maven-plugin + spring-cloud-contract-verifier + spring-cloud-contract-spec + spring-cloud-contract-stub-runner + spring-cloud-contract-verifier-maven-plugin samples - + - 2.0.10-beta + 2.1.7 0.4.7 2.17.0 1.1.0 @@ -78,22 +79,22 @@ org.springframework.cloud.contract - spring-cloud-verifier-messaging-core + spring-cloud-contract-verifier-messaging-core ${project.version} org.springframework.cloud.contract - spring-cloud-verifier-camel + spring-cloud-contract-verifier-camel ${project.version} org.springframework.cloud.contract - spring-cloud-verifier-integration + spring-cloud-contract-verifier-integration ${project.version} org.springframework.cloud.contract - spring-cloud-verifier-messaging-stream + spring-cloud-contract-verifier-stream ${project.version} @@ -130,6 +131,12 @@ org.apache.curator curator-test 2.9.1 + + + com.google.guava + guava + + commons-io @@ -324,48 +331,48 @@ - - [3.2.1,) - + + [3.2.1,) + - - Spring - http://spring.io/ - + + Spring + http://spring.io/ + - - - mariuszs - Mariusz Smykula - mariuszs@gmail.com - - - marcingrzejszczak - Marcin Grzejszczak - marcin@grzejszczak.pl - - + + + mariuszs + Mariusz Smykula + mariuszs@gmail.com + + + marcingrzejszczak + Marcin Grzejszczak + marcin@grzejszczak.pl + + - - scm:git:https://github.com/spring-cloud/spring-cloud-contract.git - scm:git:git@github.com:spring-cloud/spring-cloud-contract.git - https://github.com/spring-cloud/spring-cloud-contract - HEAD - + + scm:git:https://github.com/spring-cloud/spring-cloud-contract.git + scm:git:git@github.com:spring-cloud/spring-cloud-contract.git + https://github.com/spring-cloud/spring-cloud-contract + HEAD + - - GitHub Issues - https://github.com/spring-cloud/spring-cloud-contract - + + GitHub Issues + https://github.com/spring-cloud/spring-cloud-contract + - - Travis - https://travis-ci.org/spring-cloud/spring-cloud-contract - + + Travis + https://travis-ci.org/spring-cloud/spring-cloud-contract + - - - + + + org.apache.maven.plugins maven-surefire-plugin @@ -377,28 +384,28 @@ - - org.codehaus.plexus - plexus-component-metadata - 1.6 - - - maven-plugin-plugin - ${maven.plugin.plugin.version} - - - io.takari.maven.plugins - takari-lifecycle-plugin - 1.12.0 - - - org.eluder.coveralls - coveralls-maven-plugin - 4.1.0 - - - - + + org.codehaus.plexus + plexus-component-metadata + 1.6 + + + maven-plugin-plugin + ${maven.plugin.plugin.version} + + + io.takari.maven.plugins + takari-lifecycle-plugin + 1.12.0 + + + org.eluder.coveralls + coveralls-maven-plugin + 4.1.0 + + + + diff --git a/samples/samples-messaging-camel/pom.xml b/samples/samples-messaging-camel/pom.xml index 99e090bb63..60d977991b 100644 --- a/samples/samples-messaging-camel/pom.xml +++ b/samples/samples-messaging-camel/pom.xml @@ -42,7 +42,7 @@ org.springframework.cloud.contract - spring-cloud-verifier-camel + spring-cloud-contract-verifier-camel test diff --git a/samples/samples-messaging-integration/pom.xml b/samples/samples-messaging-integration/pom.xml index e8a6657385..f79574f2e9 100644 --- a/samples/samples-messaging-integration/pom.xml +++ b/samples/samples-messaging-integration/pom.xml @@ -29,7 +29,7 @@ org.springframework.cloud.contract - spring-cloud-verifier-integration + spring-cloud-contract-verifier-integration test diff --git a/samples/samples-messaging-spring/pom.xml b/samples/samples-messaging-spring/pom.xml index 6d59effe8c..8a5ef86d4a 100644 --- a/samples/samples-messaging-spring/pom.xml +++ b/samples/samples-messaging-spring/pom.xml @@ -34,7 +34,7 @@ org.springframework.cloud.contract - spring-cloud-verifier-messaging-core + spring-cloud-contract-verifier-messaging-core test diff --git a/samples/samples-messaging-stream/pom.xml b/samples/samples-messaging-stream/pom.xml index b5276eeaea..8aa22dec23 100644 --- a/samples/samples-messaging-stream/pom.xml +++ b/samples/samples-messaging-stream/pom.xml @@ -24,7 +24,7 @@ org.springframework.cloud.contract - spring-cloud-verifier-messaging-stream + spring-cloud-contract-verifier-stream test diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000000..04d89f3f6b --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -o errexit + +ROOT_FOLDER=`pwd` +echo "Current folder is $ROOT_FOLDER" + +if [[ ! -e "${ROOT_FOLDER}/.git" ]]; then + cd .. + ROOT_FOLDER=`pwd` +fi + +ADDITIONAL_MAVEN_OPTS=${ADDITIONAL_MAVEN_OPTS:--Dmaven.test.redirectTestOutputToFile=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn} + +echo "Building Maven stuff with additional opts [$ADDITIONAL_MAVEN_OPTS]" +./mvnw clean install --batch-mode $ADDITIONAL_MAVEN_OPTS + +echo "Building Gradle plugin" +(cd *-gradle-plugin; ./gradlew clean build install) diff --git a/scripts/buildAndTest.sh b/scripts/buildAndTest.sh new file mode 100755 index 0000000000..c095d8d669 --- /dev/null +++ b/scripts/buildAndTest.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -o errexit + +ROOT_FOLDER=`pwd` +echo "Current folder is $ROOT_FOLDER" + +if [[ ! -e "${ROOT_FOLDER}/.git" ]]; then + cd .. + ROOT_FOLDER=`pwd` +fi + +echo "Building all libraries" +$ROOT_FOLDER/scripts/build.sh + +echo "Running tests" +$ROOT_FOLDER/scripts/runTests.sh diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 0000000000..4d1cd7d5c2 --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -o errexit + +ROOT_FOLDER=`pwd` +echo "Current folder is $ROOT_FOLDER" + +if [[ ! -e "${ROOT_FOLDER}/.git" ]]; then + cd .. + ROOT_FOLDER=`pwd` +fi + + +./mvnw clean install && (cd *-gradle-plugin; ./gradlew clean build install) && ./scripts/runTests.sh && ./mvnw deploy && (cd *-gradle-plugin; ./gradlew uploadArchives -x test) diff --git a/scripts/runTests.sh b/scripts/runTests.sh index 0a9c7a63f7..f494c6be8a 100755 --- a/scripts/runTests.sh +++ b/scripts/runTests.sh @@ -5,17 +5,17 @@ set -o errexit ROOT_FOLDER=`pwd` echo "Current folder is $ROOT_FOLDER" -mkdir -p target +if [[ ! -e "${ROOT_FOLDER}/.git" ]]; then + cd .. + ROOT_FOLDER=`pwd` +fi + CONTRACT_VERIFIER_VERSION=1.0.0.BUILD-SNAPSHOT export CONTRACT_VERIFIER_VERSION=${CONTRACT_VERIFIER_VERSION} echo "Current Spring Cloud Contract Verifier version is ${CONTRACT_VERIFIER_VERSION}" -cd target -echo "Cloning samples" -rm -rf spring-cloud-contract-verifier-samples -git clone https://github.com/spring-cloud-samples/spring-cloud-contract-verifier-samples -cd spring-cloud-contract-verifier-samples +cd spring-cloud-contract-verifier-standalone-test-samples echo "Running Gradle tests" . ./runTests.sh diff --git a/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/MatchingStrategy.groovy b/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/MatchingStrategy.groovy index 0b30b40f23..4d4a366f9f 100644 --- a/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/MatchingStrategy.groovy +++ b/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/MatchingStrategy.groovy @@ -54,7 +54,7 @@ class MatchingStrategy extends DslProperty { } enum Type { - EQUAL_TO("equalTo"), CONTAINS("containing"), MATCHING("matches"), NOT_MATCHING("doesNotMatch"), + EQUAL_TO("equalTo"), CONTAINS("containing"), MATCHING("matching"), NOT_MATCHING("notMatching"), EQUAL_TO_JSON("equalToJson"), EQUAL_TO_XML("equalToXml"), ABSENT("absent") final String name diff --git a/spring-cloud-contract-stub-runner/pom.xml b/spring-cloud-contract-stub-runner/pom.xml index f9391357a4..f0aac06979 100644 --- a/spring-cloud-contract-stub-runner/pom.xml +++ b/spring-cloud-contract-stub-runner/pom.xml @@ -1,7 +1,8 @@ - - 4.0.0 + + 4.0.0 org.springframework.cloud.contract @@ -10,20 +11,20 @@ .. - spring-cloud-contract-stub-runner-build - pom + spring-cloud-contract-stub-runner-build + pom - Spring Cloud Contract Stub Runner Build - Spring Cloud Contract Stub Runner Build - - - spring-cloud-contract-stub-runner - spring-cloud-contract-stub-runner-junit - spring-cloud-contract-stub-runner-spring - spring-cloud-contract-stub-runner-boot - spring-cloud-contract-stub-runner-messaging - spring-cloud-contract-stub-runner-spring-cloud - + Spring Cloud Contract Stub Runner Build + Spring Cloud Contract Stub Runner Build + + + spring-cloud-contract-stub-runner + spring-cloud-contract-stub-runner-junit + spring-cloud-contract-stub-runner-spring + spring-cloud-contract-stub-runner-boot + spring-cloud-contract-stub-runner-messaging + spring-cloud-contract-stub-runner-spring-cloud + diff --git a/spring-cloud-contract-stub-runner/spring-cloud-contract-stub-runner-spring-cloud/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudAutoConfigurationSpec.groovy b/spring-cloud-contract-stub-runner/spring-cloud-contract-stub-runner-spring-cloud/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudAutoConfigurationSpec.groovy index 9f2e8208f0..1b4040ac5e 100644 --- a/spring-cloud-contract-stub-runner/spring-cloud-contract-stub-runner-spring-cloud/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudAutoConfigurationSpec.groovy +++ b/spring-cloud-contract-stub-runner/spring-cloud-contract-stub-runner-spring-cloud/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudAutoConfigurationSpec.groovy @@ -60,11 +60,7 @@ class StubRunnerSpringCloudAutoConfigurationSpec extends Specification { } TestingServer startTestingServer() { - try { - return new TestingServer(SocketUtils.findAvailableTcpPort()) - } catch (Exception e) { - log.error("Exception occurred ") - } + return new TestingServer(SocketUtils.findAvailableTcpPort()) } def cleanup() { diff --git a/spring-cloud-contract-stub-runner/spring-cloud-contract-stub-runner/pom.xml b/spring-cloud-contract-stub-runner/spring-cloud-contract-stub-runner/pom.xml index eac2023942..da4d9af00c 100644 --- a/spring-cloud-contract-stub-runner/spring-cloud-contract-stub-runner/pom.xml +++ b/spring-cloud-contract-stub-runner/spring-cloud-contract-stub-runner/pom.xml @@ -19,11 +19,7 @@ org.springframework.cloud.contract - spring-cloud-verifier-messaging-core - - - org.springframework.cloud.contract - spring-cloud-verifier-messaging-core + spring-cloud-contract-verifier-messaging-core org.springframework.cloud.contract diff --git a/spring-cloud-contract-verifier-gradle-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/plugin/SpringCloudContractVerifierGradlePlugin.groovy b/spring-cloud-contract-verifier-gradle-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/plugin/SpringCloudContractVerifierGradlePlugin.groovy index 2ee94f97da..2a98ba9cf5 100644 --- a/spring-cloud-contract-verifier-gradle-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/plugin/SpringCloudContractVerifierGradlePlugin.groovy +++ b/spring-cloud-contract-verifier-gradle-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/plugin/SpringCloudContractVerifierGradlePlugin.groovy @@ -69,7 +69,7 @@ class SpringCloudContractVerifierGradlePlugin implements Plugin { Task stubsJar = createAndConfigureStubsJarTasks(extension) createAndConfigureCopyContractsTask(stubsJar, extension) createAndConfigureMavenPublishPlugin(stubsJar, extension) - project.dependencies.add("testCompile", "com.github.tomakehurst:wiremock:2.0.10-beta") + project.dependencies.add("testCompile", "com.github.tomakehurst:wiremock:2.1.7") project.dependencies.add("testCompile", "com.toomuchcoding.jsonassert:jsonassert:0.4.7") project.dependencies.add("testCompile", "org.assertj:assertj-core:2.3.0") diff --git a/spring-cloud-contract-verifier-gradle-plugin/src/test/resources/functionalTest/bootSimple/build.gradle b/spring-cloud-contract-verifier-gradle-plugin/src/test/resources/functionalTest/bootSimple/build.gradle index 1f0e725251..51ef020a7b 100644 --- a/spring-cloud-contract-verifier-gradle-plugin/src/test/resources/functionalTest/bootSimple/build.gradle +++ b/spring-cloud-contract-verifier-gradle-plugin/src/test/resources/functionalTest/bootSimple/build.gradle @@ -40,7 +40,7 @@ dependencies { compile "org.codehaus.groovy:groovy-all:2.4.5" compile 'com.jayway.jsonpath:json-path-assert:2.2.0' - testCompile "com.github.tomakehurst:wiremock:2.0.10-beta" + testCompile "com.github.tomakehurst:wiremock:2.1.7" testCompile "org.spockframework:spock-spring:1.0-groovy-2.4" testCompile "com.jayway.restassured:rest-assured:$restAssuredVersion" testCompile "com.jayway.restassured:spring-mock-mvc:$restAssuredVersion" diff --git a/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/pom.xml b/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/pom.xml index efebefaf10..92573fcdf3 100644 --- a/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/pom.xml +++ b/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/complex-configuration/pom.xml @@ -46,7 +46,7 @@ logback-classic - + com.jayway.restassured diff --git a/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/pom.xml b/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/pom.xml index 7d5f62d156..f0692be2a3 100644 --- a/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/pom.xml +++ b/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/plugin-extension/pom.xml @@ -46,7 +46,7 @@ logback-classic - + com.jayway.restassured diff --git a/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/pom.xml b/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/pom.xml index b925aca3d1..50c90dd8f7 100644 --- a/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/pom.xml +++ b/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-groovy/pom.xml @@ -42,7 +42,7 @@ test - + org.spockframework diff --git a/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/pom.xml b/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/pom.xml index 26dd0112b4..07698d883c 100644 --- a/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/pom.xml +++ b/spring-cloud-contract-verifier-maven-plugin/spring-cloud-contract-verifier-maven-plugin/src/test/projects/spring-boot-java/pom.xml @@ -46,7 +46,7 @@ logback-classic - + com.jayway.restassured diff --git a/spring-cloud-contract-verifier-standalone-test-samples/.mvn/maven.config b/spring-cloud-contract-verifier-standalone-test-samples/.mvn/maven.config new file mode 100644 index 0000000000..ef4026d606 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/.mvn/maven.config @@ -0,0 +1 @@ +--non-recursive \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/.mvn/wrapper/maven-wrapper.jar b/spring-cloud-contract-verifier-standalone-test-samples/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000..c6feb8bb6f Binary files /dev/null and b/spring-cloud-contract-verifier-standalone-test-samples/.mvn/wrapper/maven-wrapper.jar differ diff --git a/spring-cloud-contract-verifier-standalone-test-samples/.mvn/wrapper/maven-wrapper.properties b/spring-cloud-contract-verifier-standalone-test-samples/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..6637cedb28 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/README.adoc b/spring-cloud-contract-verifier-standalone-test-samples/README.adoc new file mode 100644 index 0000000000..1531eb9e37 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/README.adoc @@ -0,0 +1,21 @@ += Spring Cloud Contract Verifier Samples + +Projects that contain different samples of Spring Cloud Contract Verifier. + +WARNING: The Verifier Maven Plugin is disabled by default. That's because we want in the + IDE help in terms of compilation verification. If someone executes `./mvnw clean install` + from the root of the `Spring Cloud Contract` project the samples will not blow up. To + ensure that you're running the `Verifier` tests you have to pass the `-Ptests` from the + `spring-cloud-contract-verifier-standalone-test-samples` project. Or just run the tests + from each of the standalone sample projects (since each of them is a separate Maven project). + +Below you can find a list of samples: + +include::http-server/README.adoc[] + +include::http-client/README.adoc[] + +include::contract-verifier-sample-stream-sink/README.adoc[] + +include::contract-verifier-sample-stream-source/README.adoc[] + diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/.mvn/wrapper/maven-wrapper.jar b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000..5fd4d5023f Binary files /dev/null and b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/.mvn/wrapper/maven-wrapper.jar differ diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/.mvn/wrapper/maven-wrapper.properties b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..eb91947648 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/README.adoc b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/README.adoc new file mode 100644 index 0000000000..99ab003a42 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/README.adoc @@ -0,0 +1,26 @@ += Stream Sink + +== Prerequisites + +First you have to publish to Maven Local the stubs of the *contract-verifier-sample-stream-source* stubs + +== How to run it? + +Run + +[source=groovy] +-------- +./gradlew clean build +-------- + +or + +-------- +./mvnw clean package +-------- + +To + +- build the app +- use spring-cloud-contract-stub-runner-stream[Stub Runner Spring] to download the stub of `contract-verifier-sample-stream-source` +- run the tests against stubbed producer \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/build.gradle b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/build.gradle new file mode 100644 index 0000000000..e99c3e5fcb --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/build.gradle @@ -0,0 +1,57 @@ +buildscript { + repositories { + mavenCentral() + mavenLocal() + maven { url "http://repo.spring.io/plugins-release-local" } + maven { url "http://repo.spring.io/plugins-staging-local/" } + } + dependencies { + classpath "org.springframework.boot:spring-boot-gradle-plugin:1.3.5.RELEASE" + } +} + +group = 'org.springframework.cloud.contract.testprojects' +version = '0.0.1-SNAPSHOT' + +repositories { + mavenCentral() + mavenLocal() + maven { url "http://repo.spring.io/libs-release-local" } + maven { url "http://repo.spring.io/libs-snapshot-local/" } + maven { url "http://repo.spring.io/libs-milestone-local/" } +} + +apply plugin: 'groovy' +apply plugin: 'spring-boot' +apply plugin: 'maven-publish' + +dependencyManagement { + imports { + mavenBom "org.springframework.cloud:spring-cloud-dependencies:$BOM_VERSION" + } +} + +dependencies { + compile("org.springframework.boot:spring-boot-starter-web") { + exclude module: "spring-boot-starter-tomcat" + } + compile("org.springframework.boot:spring-boot-starter-jetty") + compile("org.springframework.boot:spring-boot-starter-actuator") + compile("org.springframework.cloud:spring-cloud-starter-stream-rabbit") + + testRuntime "org.spockframework:spock-spring" + testCompile "org.springframework:spring-test" + testCompile "org.spockframework:spock-core" + testCompile "junit:junit" + testCompile "org.springframework.cloud.contract:spring-cloud-contract-stub-runner-stream:${findProperty('verifierVersion') ?: verifierVersion}" +} + +test { + testLogging { + exceptionFormat = 'full' + } +} + +task wrapper(type: Wrapper) { + gradleVersion = '2.14' +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/gradle.properties b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/gradle.properties new file mode 100644 index 0000000000..23f6ea0c77 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/gradle.properties @@ -0,0 +1,2 @@ +verifierVersion=1.0.0.BUILD-SNAPSHOT +BOM_VERSION=Brixton.SR1 \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/gradle/wrapper/gradle-wrapper.jar b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..ca78035ef0 Binary files /dev/null and b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/gradle/wrapper/gradle-wrapper.jar differ diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/gradle/wrapper/gradle-wrapper.properties b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..74754caf0d --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Jun 29 17:30:41 CEST 2016 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/gradlew b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/gradlew new file mode 100755 index 0000000000..27309d9231 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/gradlew.bat b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/gradlew.bat new file mode 100644 index 0000000000..832fdb6079 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/gradlew.bat @@ -0,0 +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 +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/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/mvnw b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/mvnw new file mode 100755 index 0000000000..a1ba1bf554 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/mvnw @@ -0,0 +1,233 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # + # Look for the Apple JDKs first to preserve the existing behaviour, and then look + # for the new JDKs provided by Oracle. + # + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then + # + # Oracle JDKs + # + export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then + # + # Apple JDKs + # + export JAVA_HOME=`/usr/libexec/java_home` + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Migwn, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + local basedir=$(pwd) + local wdir=$(pwd) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} "$@" diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/mvnw.cmd b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/mvnw.cmd new file mode 100644 index 0000000000..2b934e89dd --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/mvnw.cmd @@ -0,0 +1,145 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +set MAVEN_CMD_LINE_ARGS=%* + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" + +set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/pom.xml b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/pom.xml new file mode 100644 index 0000000000..6127eec4c3 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/pom.xml @@ -0,0 +1,143 @@ + + + 4.0.0 + + org.springframework.cloud.contract.testprojects + contract-verifier-sample-stream-sink + 0.0.1-SNAPSHOT + jar + + Spring Cloud Contract Verifier Stream Sink Sample + Spring Cloud Contract Verifier Stream Sink Sample + + + org.springframework.boot + spring-boot-starter-parent + 1.3.5.RELEASE + + + + + UTF-8 + 1.8 + 1.0.0.BUILD-SNAPSHOT + + + + + org.springframework.cloud + spring-cloud-starter-stream-rabbit + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.cloud.contract + spring-cloud-contract-stub-runner-stream + ${spring-cloud-contract-verifier.version} + test + + + + + + + org.springframework.cloud + spring-cloud-dependencies + Brixton.SR3 + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + maven-deploy-plugin + + true + + + + + + + + spring + + true + + + + spring-snapshots + Spring Snapshots + http://repo.spring.io/libs-snapshot-local + + true + + + + spring-milestones + Spring Milestones + http://repo.spring.io/libs-milestone-local + + false + + + + spring-releases + Spring Releases + http://repo.spring.io/release + + false + + + + + + spring-snapshots + Spring Snapshots + http://repo.spring.io/libs-snapshot-local + + true + + + + spring-milestones + Spring Milestones + http://repo.spring.io/libs-milestone-local + + false + + + + spring-plugin-snapshots + Spring Snapshots + http://repo.spring.io/plugins-snapshot-local + + true + + + + spring-plugin-milestones + Spring Milestones + http://repo.spring.io/plugins-milestone-local + + false + + + + + + + + diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/settings.gradle b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/settings.gradle new file mode 100644 index 0000000000..98b3e61896 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'contract-verifier-sample-stream-sink' diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/src/main/java/org/springframework/cloud/stream/verifier/sample/sink/ContractVerifierSampleStreamSinkApplication.java b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/src/main/java/org/springframework/cloud/stream/verifier/sample/sink/ContractVerifierSampleStreamSinkApplication.java new file mode 100644 index 0000000000..75ced70b0e --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/src/main/java/org/springframework/cloud/stream/verifier/sample/sink/ContractVerifierSampleStreamSinkApplication.java @@ -0,0 +1,21 @@ +package org.springframework.cloud.stream.verifier.sample.sink; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.stream.annotation.EnableBinding; +import org.springframework.cloud.stream.annotation.StreamListener; +import org.springframework.cloud.stream.messaging.Sink; + +@SpringBootApplication +@EnableBinding(Sink.class) +public class ContractVerifierSampleStreamSinkApplication { + + @StreamListener(Sink.INPUT) + public void logSensorData(SensorData data) { + System.out.println(data); + } + + public static void main(String[] args) { + SpringApplication.run(ContractVerifierSampleStreamSinkApplication.class, args); + } +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/src/main/java/org/springframework/cloud/stream/verifier/sample/sink/SensorData.java b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/src/main/java/org/springframework/cloud/stream/verifier/sample/sink/SensorData.java new file mode 100644 index 0000000000..6cd7f84e28 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/src/main/java/org/springframework/cloud/stream/verifier/sample/sink/SensorData.java @@ -0,0 +1,43 @@ +/* + * Copyright 2016 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.stream.verifier.sample.sink; + +/** + * @author Marius Bogoevici + */ +public class SensorData { + + private Long id; + + private Double temperature; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Double getTemperature() { + return temperature; + } + + public void setTemperature(Double temperature) { + this.temperature = temperature; + } +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/src/test/java/org/springframework/cloud/stream/verifier/sample/sink/ContractVerifierSampleStreamSinkApplicationTests.java b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/src/test/java/org/springframework/cloud/stream/verifier/sample/sink/ContractVerifierSampleStreamSinkApplicationTests.java new file mode 100644 index 0000000000..8523a76b78 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/src/test/java/org/springframework/cloud/stream/verifier/sample/sink/ContractVerifierSampleStreamSinkApplicationTests.java @@ -0,0 +1,16 @@ +package org.springframework.cloud.stream.verifier.sample.sink; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(classes = ContractVerifierSampleStreamSinkApplication.class) +public class ContractVerifierSampleStreamSinkApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/src/test/java/org/springframework/cloud/stream/verifier/sample/sink/MessageConsumedTests.java b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/src/test/java/org/springframework/cloud/stream/verifier/sample/sink/MessageConsumedTests.java new file mode 100644 index 0000000000..b5e9b94af2 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/src/test/java/org/springframework/cloud/stream/verifier/sample/sink/MessageConsumedTests.java @@ -0,0 +1,43 @@ +/* + * Copyright 2016 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.stream.verifier.sample.sink; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.IntegrationTest; +import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.cloud.contract.stubrunner.StubTrigger; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Marius Bogoevici + */ +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(classes = ContractVerifierSampleStreamSinkApplication.class) +@IntegrationTest("spring.cloud.stream.bindings.input.destination=sensor-data") +public class MessageConsumedTests { + + @Autowired + StubTrigger stubTrigger; + + @Test + public void testMessageConsumed() throws Exception { + stubTrigger.trigger("sensor1"); + } +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/src/test/resources/application.yml b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/src/test/resources/application.yml new file mode 100644 index 0000000000..f80ed31b18 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-sink/src/test/resources/application.yml @@ -0,0 +1,3 @@ +stubrunner: + work-offline: true + stubs.ids: 'org.springframework.cloud.contract.testprojects:contract-verifier-sample-stream-source' \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/.mvn/wrapper/maven-wrapper.jar b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000..5fd4d5023f Binary files /dev/null and b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/.mvn/wrapper/maven-wrapper.jar differ diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/.mvn/wrapper/maven-wrapper.properties b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..eb91947648 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/README.adoc b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/README.adoc new file mode 100644 index 0000000000..4b6b6a49d8 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/README.adoc @@ -0,0 +1,20 @@ += Stream Source + +Run + +[source=groovy] +-------- +./gradlew clean build publishToMavenLocal +-------- + +or + +-------- +./mvnw clean install +-------- + +To + +- build the app +- generate and run Spring Cloud Contract Verifier tests +- publish the fatJar and the stubs to Maven Local \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/build.gradle b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/build.gradle new file mode 100644 index 0000000000..743acc1f07 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/build.gradle @@ -0,0 +1,91 @@ +buildscript { + repositories { + mavenCentral() + mavenLocal() + maven { url "http://repo.spring.io/snapshot" } + maven { url "http://repo.spring.io/milestone" } + maven { url "http://repo.spring.io/plugins-release-local" } + maven { url "http://repo.spring.io/plugins-staging-local/" } + } + dependencies { + classpath "org.springframework.boot:spring-boot-gradle-plugin:1.3.5.RELEASE" + classpath "org.springframework.cloud.contract:spring-cloud-contract-verifier-gradle-plugin:${findProperty('verifierVersion') ?: verifierVersion}" + } +} + +group = 'org.springframework.cloud.contract.testprojects' +version = '0.0.1-SNAPSHOT' + +repositories { + mavenCentral() + mavenLocal() + maven { url "http://repo.spring.io/snapshot" } + maven { url "http://repo.spring.io/milestone" } + maven { url "http://repo.spring.io/libs-release-local" } + maven { url "http://repo.spring.io/libs-staging-local/" } +} + +apply plugin: 'groovy' +apply plugin: 'spring-boot' +apply plugin: 'contract-verifier' +apply plugin: 'maven-publish' + +dependencyManagement { + imports { + mavenBom "org.springframework.cloud:spring-cloud-dependencies:$BOM_VERSION" + } +} + +ext { + stubsOutputDirRoot = file("${project.buildDir}/stubs/") +} + +contractVerifier { + baseClassForTests = 'org.springframework.cloud.stream.sample.verifier.source.SensorSourceTestBase' + stubsOutputDir = stubsOutputDirRoot +} + +dependencies { + compile("org.springframework.boot:spring-boot-starter-web") { + exclude module: "spring-boot-starter-tomcat" + } + compile("org.springframework.boot:spring-boot-starter-jetty") + compile("org.springframework.boot:spring-boot-starter-actuator") + compile("org.springframework.cloud:spring-cloud-starter-stream-rabbit") + compile("org.springframework.cloud.contract:spring-cloud-contract-verifier-stream:${findProperty('verifierVersion') ?: verifierVersion}") + + testRuntime "org.spockframework:spock-spring" + testCompile "org.spockframework:spock-core" + testCompile "org.springframework:spring-test" + testCompile "com.jayway.restassured:spring-mock-mvc:2.9.0" + testCompile "junit:junit" +} + +task stubsJar(type: Jar, dependsOn: "generateWireMockClientStubs") { + baseName = "${project.name}" + classifier = "stubs" + from stubsOutputDirRoot +} + +artifacts { + archives stubsJar +} + +publishing { + publications { + stubs(MavenPublication) { + artifactId "${project.name}" + artifact stubsJar + } + } +} + +test { + testLogging { + exceptionFormat = 'full' + } +} + +task wrapper(type: Wrapper) { + gradleVersion = '2.14' +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/gradle.properties b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/gradle.properties new file mode 100644 index 0000000000..23f6ea0c77 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/gradle.properties @@ -0,0 +1,2 @@ +verifierVersion=1.0.0.BUILD-SNAPSHOT +BOM_VERSION=Brixton.SR1 \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/gradle/wrapper/gradle-wrapper.jar b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..d3b83982b9 Binary files /dev/null and b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/gradle/wrapper/gradle-wrapper.jar differ diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/gradle/wrapper/gradle-wrapper.properties b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..622fd61678 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Jun 29 17:30:32 CEST 2016 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/gradlew b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/gradlew new file mode 100755 index 0000000000..27309d9231 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/gradlew.bat b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/gradlew.bat new file mode 100644 index 0000000000..832fdb6079 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/gradlew.bat @@ -0,0 +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 +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/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/mvnw b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/mvnw new file mode 100755 index 0000000000..a1ba1bf554 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/mvnw @@ -0,0 +1,233 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # + # Look for the Apple JDKs first to preserve the existing behaviour, and then look + # for the new JDKs provided by Oracle. + # + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then + # + # Oracle JDKs + # + export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then + # + # Apple JDKs + # + export JAVA_HOME=`/usr/libexec/java_home` + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Migwn, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + local basedir=$(pwd) + local wdir=$(pwd) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} "$@" diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/mvnw.cmd b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/mvnw.cmd new file mode 100644 index 0000000000..2b934e89dd --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/mvnw.cmd @@ -0,0 +1,145 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +set MAVEN_CMD_LINE_ARGS=%* + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" + +set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/pom.xml b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/pom.xml new file mode 100644 index 0000000000..2f506b4858 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/pom.xml @@ -0,0 +1,176 @@ + + + 4.0.0 + + org.springframework.cloud.contract.testprojects + contract-verifier-sample-stream-source + 0.0.1-SNAPSHOT + jar + + Spring Cloud Contract Verifier Stream Source Sample + Spring Cloud Contract Verifier Stream Source Sample + + + org.springframework.boot + spring-boot-starter-parent + 1.3.5.RELEASE + + + + + UTF-8 + 1.8 + 1.0.0.BUILD-SNAPSHOT + 1.0.0.BUILD-SNAPSHOT + + + + + org.springframework.cloud + spring-cloud-starter-stream-rabbit + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.springframework.cloud.contract + spring-cloud-contract-verifier-core + ${spring-cloud-contract-verifier.version} + test + + + + org.springframework.cloud.contract + spring-cloud-contract-verifier-stream + ${spring-cloud-contract-verifier.version} + test + + + + org.assertj + assertj-core + 2.4.1 + test + + + + + + + org.springframework.cloud + spring-cloud-dependencies + Brixton.SR3 + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.springframework.cloud.contract + spring-cloud-contract-verifier-maven-plugin + ${spring-cloud-contract-verifier-maven-plugin.version} + true + + org.springframework.cloud.stream.sample.verifier.source.SensorSourceTestBase + + + + + org.springframework.cloud.contract + spring-cloud-contract-verifier-core + ${spring-cloud-contract-verifier.version} + + + + + maven-deploy-plugin + + true + + + + + + + + spring + + true + + + + spring-snapshots + Spring Snapshots + http://repo.spring.io/libs-snapshot-local + + true + + + + spring-milestones + Spring Milestones + http://repo.spring.io/libs-milestone-local + + false + + + + spring-releases + Spring Releases + http://repo.spring.io/release + + false + + + + + + spring-snapshots + Spring Snapshots + http://repo.spring.io/libs-snapshot-local + + true + + + + spring-milestones + Spring Milestones + http://repo.spring.io/libs-milestone-local + + false + + + + spring-plugin-snapshots + Spring Snapshots + http://repo.spring.io/plugins-snapshot-local + + true + + + + spring-plugin-milestones + Spring Milestones + http://repo.spring.io/plugins-milestone-local + + false + + + + + + + + diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/settings.gradle b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/settings.gradle new file mode 100644 index 0000000000..1f3ab8f121 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'contract-verifier-sample-stream-source' diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/src/main/java/org/springframework/cloud/stream/sample/verifier/source/ContractVerifierSampleStreamSourceApplication.java b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/src/main/java/org/springframework/cloud/stream/sample/verifier/source/ContractVerifierSampleStreamSourceApplication.java new file mode 100644 index 0000000000..2fca9839a2 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/src/main/java/org/springframework/cloud/stream/sample/verifier/source/ContractVerifierSampleStreamSourceApplication.java @@ -0,0 +1,24 @@ +package org.springframework.cloud.stream.sample.verifier.source; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.stream.annotation.EnableBinding; +import org.springframework.cloud.stream.messaging.Source; +import org.springframework.integration.support.MessageBuilder; + +@SpringBootApplication +@EnableBinding(Source.class) +public class ContractVerifierSampleStreamSourceApplication { + + @Autowired + Source source; + + public static void main(String[] args) { + SpringApplication.run(ContractVerifierSampleStreamSourceApplication.class, args); + } + + public void poll() { + source.output().send(MessageBuilder.withPayload("{\"id\":\"99\",\"temperature\":\"123.45\"}").build()); + } +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/src/main/resources/application.properties b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/src/main/resources/application.properties new file mode 100644 index 0000000000..33a33fc971 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.cloud.stream.bindings.output.contentType=application/json diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/src/test/java/org/springframework/cloud/stream/sample/verifier/source/ContractVerifierSampleStreamSourceApplicationTests.java b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/src/test/java/org/springframework/cloud/stream/sample/verifier/source/ContractVerifierSampleStreamSourceApplicationTests.java new file mode 100644 index 0000000000..d3c5a1a13c --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/src/test/java/org/springframework/cloud/stream/sample/verifier/source/ContractVerifierSampleStreamSourceApplicationTests.java @@ -0,0 +1,16 @@ +package org.springframework.cloud.stream.sample.verifier.source; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(classes = ContractVerifierSampleStreamSourceApplication.class) +public class ContractVerifierSampleStreamSourceApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/src/test/java/org/springframework/cloud/stream/sample/verifier/source/SensorSourceTestBase.java b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/src/test/java/org/springframework/cloud/stream/sample/verifier/source/SensorSourceTestBase.java new file mode 100644 index 0000000000..838452cd1b --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/src/test/java/org/springframework/cloud/stream/sample/verifier/source/SensorSourceTestBase.java @@ -0,0 +1,43 @@ +/* + * Copyright 2016 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.stream.sample.verifier.source; + +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.IntegrationTest; +import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * Base class for sensor autogenerated tests (used by Spring Cloud Contract). + * + * This bootstraps the Spring Boot application code. + * + * @author Marius Bogoevici + */ +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(classes = ContractVerifierSampleStreamSourceApplication.class) +@IntegrationTest("spring.cloud.stream.bindings.output.destination=sensor-data") +public abstract class SensorSourceTestBase { + + @Autowired + ContractVerifierSampleStreamSourceApplication application; + + public void createSensorData() { + application.poll(); + } +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/src/test/resources/contracts/shouldProduceValidSensorData.groovy b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/src/test/resources/contracts/shouldProduceValidSensorData.groovy new file mode 100644 index 0000000000..9eb30debf0 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/contract-verifier-sample-stream-source/src/test/resources/contracts/shouldProduceValidSensorData.groovy @@ -0,0 +1,26 @@ +package contracts + +org.springframework.cloud.contract.spec.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: $(consumer(9), producer(regex("[0-9]+"))), + temperature: "123.45" + ]) + } +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/.gitignore b/spring-cloud-contract-verifier-standalone-test-samples/http-client/.gitignore new file mode 100644 index 0000000000..b05ba7bd6d --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/.gitignore @@ -0,0 +1,6 @@ + +target/ + +.gradle +build/ + diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/.mvn/jvm.config b/spring-cloud-contract-verifier-standalone-test-samples/http-client/.mvn/jvm.config new file mode 100644 index 0000000000..894bef17a5 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/.mvn/jvm.config @@ -0,0 +1 @@ +-Xmx1024m -XX:MaxPermSize=256m -Djava.awt.headless=true \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/.mvn/maven.config b/spring-cloud-contract-verifier-standalone-test-samples/http-client/.mvn/maven.config new file mode 100644 index 0000000000..affad39a42 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/.mvn/maven.config @@ -0,0 +1 @@ +-T2 \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/.mvn/wrapper/maven-wrapper.jar b/spring-cloud-contract-verifier-standalone-test-samples/http-client/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000..c6feb8bb6f Binary files /dev/null and b/spring-cloud-contract-verifier-standalone-test-samples/http-client/.mvn/wrapper/maven-wrapper.jar differ diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/.mvn/wrapper/maven-wrapper.properties b/spring-cloud-contract-verifier-standalone-test-samples/http-client/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..6637cedb28 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/README.adoc b/spring-cloud-contract-verifier-standalone-test-samples/http-client/README.adoc new file mode 100644 index 0000000000..cdcb0e4a56 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/README.adoc @@ -0,0 +1,26 @@ += Http Client + +== Prerequisites + +First you have to publish to Maven Local the stubs of the *http-server* module + +== How to run it? + +Run + +[source=groovy] +-------- +./gradlew clean build +-------- + +or + +-------- +./mvnw clean package +-------- + +To + +- build the app +- use spring-cloud-contract-stub-runner-spring[Stub Runner Spring] to download the stub of `Http Server` +- run the tests against stubbed server \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/build.gradle b/spring-cloud-contract-verifier-standalone-test-samples/http-client/build.gradle new file mode 100644 index 0000000000..b687ad3cbb --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/build.gradle @@ -0,0 +1,50 @@ +buildscript { + repositories { + mavenCentral() + mavenLocal() + maven { url "http://repo.spring.io/plugins-release-local" } + maven { url "http://repo.spring.io/plugins-staging-local/" } + } + dependencies { + classpath "org.springframework.boot:spring-boot-gradle-plugin:1.3.5.RELEASE" + } +} + +group = 'org.springframework.cloud.contract.testprojects' +version = '0.0.1-SNAPSHOT' + +repositories { + mavenCentral() + mavenLocal() + maven { url "http://repo.spring.io/libs-release-local" } + maven { url "http://repo.spring.io/libs-snapshot-local/" } + maven { url "http://repo.spring.io/libs-milestone-local/" } +} + +apply plugin: 'groovy' +apply plugin: 'spring-boot' +apply plugin: 'maven-publish' + +dependencies { + compile("org.springframework.boot:spring-boot-starter-web") { + exclude module: "spring-boot-starter-tomcat" + } + compile("org.springframework.boot:spring-boot-starter-jetty") + compile("org.springframework.boot:spring-boot-starter-actuator") + + testRuntime "org.spockframework:spock-spring" + testCompile "org.springframework:spring-test" + testCompile "org.spockframework:spock-core" + testCompile "junit:junit" + testCompile "org.springframework.cloud.contract:spring-cloud-contract-stub-runner-spring:${findProperty('verifierVersion') ?: verifierVersion}" +} + +test { + testLogging { + exceptionFormat = 'full' + } +} + +task wrapper(type: Wrapper) { + gradleVersion = '2.14' +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/gradle.properties b/spring-cloud-contract-verifier-standalone-test-samples/http-client/gradle.properties new file mode 100644 index 0000000000..5183317871 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/gradle.properties @@ -0,0 +1 @@ +verifierVersion=1.0.0.BUILD-SNAPSHOT \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/gradle/wrapper/gradle-wrapper.jar b/spring-cloud-contract-verifier-standalone-test-samples/http-client/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..2c6137b878 Binary files /dev/null and b/spring-cloud-contract-verifier-standalone-test-samples/http-client/gradle/wrapper/gradle-wrapper.jar differ diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/gradle/wrapper/gradle-wrapper.properties b/spring-cloud-contract-verifier-standalone-test-samples/http-client/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..39b7c770aa --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Tue May 03 15:26:39 CEST 2016 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/gradlew b/spring-cloud-contract-verifier-standalone-test-samples/http-client/gradlew new file mode 100755 index 0000000000..9d82f78915 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/gradlew.bat b/spring-cloud-contract-verifier-standalone-test-samples/http-client/gradlew.bat new file mode 100644 index 0000000000..5f192121eb --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/gradlew.bat @@ -0,0 +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 + +@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= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@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/spring-cloud-contract-verifier-standalone-test-samples/http-client/mvnw b/spring-cloud-contract-verifier-standalone-test-samples/http-client/mvnw new file mode 100755 index 0000000000..fc7efd17d0 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/mvnw @@ -0,0 +1,234 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # + # Look for the Apple JDKs first to preserve the existing behaviour, and then look + # for the new JDKs provided by Oracle. + # + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then + # + # Oracle JDKs + # + export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then + # + # Apple JDKs + # + export JAVA_HOME=`/usr/libexec/java_home` + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Migwn, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + local basedir=$(pwd) + local wdir=$(pwd) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CMD_LINE_ARGS + diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/mvnw.cmd b/spring-cloud-contract-verifier-standalone-test-samples/http-client/mvnw.cmd new file mode 100644 index 0000000000..001048081d --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/mvnw.cmd @@ -0,0 +1,145 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +set MAVEN_CMD_LINE_ARGS=%MAVEN_CONFIG% %* + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" + +set WRAPPER_JAR=""%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/pom.xml b/spring-cloud-contract-verifier-standalone-test-samples/http-client/pom.xml new file mode 100644 index 0000000000..a0ad75fce3 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/pom.xml @@ -0,0 +1,187 @@ + + + 4.0.0 + + org.springframework.cloud.contract.testprojects + http-client + 0.0.1-SNAPSHOT + + Spring Cloud Contract Verifier Http Client Sample + Spring Cloud Contract Verifier Http Client Sample + + + org.springframework.boot + spring-boot-starter-parent + 1.3.5.RELEASE + + + + + UTF-8 + 1.8 + 1.0.0.BUILD-SNAPSHOT + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + org.springframework.boot + spring-boot-starter-jetty + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.springframework.cloud.contract + spring-cloud-contract-stub-runner-spring + ${spring-cloud-contract-verifier.version} + test + + + org.spockframework + spock-spring + test + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.codehaus.gmavenplus + gmavenplus-plugin + 1.5 + + + + testCompile + + + + + + + ${project.basedir}/src/test/groovy + + **/*.groovy + + + + ${project.build.directory}/generated-test-sources/accurest + + **/*.groovy + + + + + + + maven-surefire-plugin + 2.19.1 + + + **/*Spec.java + + + + + maven-deploy-plugin + + true + + + + + + + + spring + + true + + + + spring-snapshots + Spring Snapshots + http://repo.spring.io/libs-snapshot-local + + true + + + + spring-milestones + Spring Milestones + http://repo.spring.io/libs-milestone-local + + false + + + + spring-releases + Spring Releases + http://repo.spring.io/release + + false + + + + + + spring-snapshots + Spring Snapshots + http://repo.spring.io/libs-snapshot-local + + true + + + + spring-milestones + Spring Milestones + http://repo.spring.io/libs-milestone-local + + false + + + + spring-plugin-snapshots + Spring Snapshots + http://repo.spring.io/plugins-snapshot-local + + true + + + + spring-plugin-milestones + Spring Milestones + http://repo.spring.io/plugins-milestone-local + + false + + + + + + + diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/settings.gradle b/spring-cloud-contract-verifier-standalone-test-samples/http-client/settings.gradle new file mode 100644 index 0000000000..8dc58d5ad1 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'http-client' diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/Application.java b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/Application.java new file mode 100644 index 0000000000..bd0b4354b3 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/Application.java @@ -0,0 +1,13 @@ +package org.springframework.cloud.contract.frauddetection; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/LoanApplicationService.java b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/LoanApplicationService.java new file mode 100644 index 0000000000..3e6c4612a3 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/LoanApplicationService.java @@ -0,0 +1,68 @@ +package org.springframework.cloud.contract.frauddetection; + +import org.springframework.cloud.contract.frauddetection.model.FraudCheckStatus; +import org.springframework.cloud.contract.frauddetection.model.FraudServiceRequest; +import org.springframework.cloud.contract.frauddetection.model.FraudServiceResponse; +import org.springframework.cloud.contract.frauddetection.model.LoanApplicationResult; +import org.springframework.cloud.contract.frauddetection.model.LoanApplication; +import org.springframework.cloud.contract.frauddetection.model.LoanApplicationStatus; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +@Service +public class LoanApplicationService { + + private static final String FRAUD_SERVICE_JSON_VERSION_1 = + "application/vnd.fraud.v1+json"; + + private final RestTemplate restTemplate; + + private int port = 8080; + + public LoanApplicationService() { + this.restTemplate = new RestTemplate(); + } + + public LoanApplicationResult loanApplication(LoanApplication loanApplication) { + FraudServiceRequest request = + new FraudServiceRequest(loanApplication); + + FraudServiceResponse response = + sendRequestToFraudDetectionService(request); + + return buildResponseFromFraudResult(response); + } + + private FraudServiceResponse sendRequestToFraudDetectionService( + FraudServiceRequest request) { + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.add(HttpHeaders.CONTENT_TYPE, FRAUD_SERVICE_JSON_VERSION_1); + + ResponseEntity response = + restTemplate.exchange("http://localhost:" + port + "/fraudcheck", HttpMethod.PUT, + new HttpEntity<>(request, httpHeaders), + FraudServiceResponse.class); + + return response.getBody(); + } + + private LoanApplicationResult buildResponseFromFraudResult(FraudServiceResponse response) { + LoanApplicationStatus applicationStatus = null; + if (FraudCheckStatus.OK == response.getFraudCheckStatus()) { + applicationStatus = LoanApplicationStatus.LOAN_APPLIED; + } else if (FraudCheckStatus.FRAUD == response.getFraudCheckStatus()) { + applicationStatus = LoanApplicationStatus.LOAN_APPLICATION_REJECTED; + } + + return new LoanApplicationResult(applicationStatus, response.getRejectionReason()); + } + + public void setPort(int port) { + this.port = port; + } + +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/Client.java b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/Client.java new file mode 100644 index 0000000000..da99caabff --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/Client.java @@ -0,0 +1,14 @@ +package org.springframework.cloud.contract.frauddetection.model; + +public class Client { + + private String pesel; + + public String getPesel() { + return pesel; + } + + public void setPesel(String pesel) { + this.pesel = pesel; + } +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/FraudCheckStatus.java b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/FraudCheckStatus.java new file mode 100644 index 0000000000..f0b2785556 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/FraudCheckStatus.java @@ -0,0 +1,5 @@ +package org.springframework.cloud.contract.frauddetection.model; + +public enum FraudCheckStatus { + OK, FRAUD +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/FraudServiceRequest.java b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/FraudServiceRequest.java new file mode 100644 index 0000000000..fca478dbae --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/FraudServiceRequest.java @@ -0,0 +1,34 @@ +package org.springframework.cloud.contract.frauddetection.model; + +import java.math.BigDecimal; + +public class FraudServiceRequest { + + private String clientPesel; + + private BigDecimal loanAmount; + + public FraudServiceRequest() { + } + + public FraudServiceRequest(LoanApplication loanApplication) { + this.clientPesel = loanApplication.getClient().getPesel(); + this.loanAmount = loanApplication.getAmount(); + } + + public String getClientPesel() { + return clientPesel; + } + + public void setClientPesel(String clientPesel) { + this.clientPesel = clientPesel; + } + + public BigDecimal getLoanAmount() { + return loanAmount; + } + + public void setLoanAmount(BigDecimal loanAmount) { + this.loanAmount = loanAmount; + } +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/FraudServiceResponse.java b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/FraudServiceResponse.java new file mode 100644 index 0000000000..9093492eea --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/FraudServiceResponse.java @@ -0,0 +1,27 @@ +package org.springframework.cloud.contract.frauddetection.model; + +public class FraudServiceResponse { + + private FraudCheckStatus fraudCheckStatus; + + private String rejectionReason; + + public FraudServiceResponse() { + } + + public FraudCheckStatus getFraudCheckStatus() { + return fraudCheckStatus; + } + + public void setFraudCheckStatus(FraudCheckStatus fraudCheckStatus) { + this.fraudCheckStatus = fraudCheckStatus; + } + + public String getRejectionReason() { + return rejectionReason; + } + + public void setRejectionReason(String rejectionReason) { + this.rejectionReason = rejectionReason; + } +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/LoanApplication.java b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/LoanApplication.java new file mode 100644 index 0000000000..ae4f4d1696 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/LoanApplication.java @@ -0,0 +1,36 @@ +package org.springframework.cloud.contract.frauddetection.model; + +import java.math.BigDecimal; + +public class LoanApplication { + + private Client client; + + private BigDecimal amount; + + private String loanApplicationId; + + public Client getClient() { + return client; + } + + public void setClient(Client client) { + this.client = client; + } + + public BigDecimal getAmount() { + return amount; + } + + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + + public String getLoanApplicationId() { + return loanApplicationId; + } + + public void setLoanApplicationId(String loanApplicationId) { + this.loanApplicationId = loanApplicationId; + } +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/LoanApplicationResult.java b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/LoanApplicationResult.java new file mode 100644 index 0000000000..89db3c993a --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/LoanApplicationResult.java @@ -0,0 +1,32 @@ +package org.springframework.cloud.contract.frauddetection.model; + +public class LoanApplicationResult { + + private LoanApplicationStatus loanApplicationStatus; + + private String rejectionReason; + + public LoanApplicationResult() { + } + + public LoanApplicationResult(LoanApplicationStatus loanApplicationStatus, String rejectionReason) { + this.loanApplicationStatus = loanApplicationStatus; + this.rejectionReason = rejectionReason; + } + + public LoanApplicationStatus getLoanApplicationStatus() { + return loanApplicationStatus; + } + + public void setLoanApplicationStatus(LoanApplicationStatus loanApplicationStatus) { + this.loanApplicationStatus = loanApplicationStatus; + } + + public String getRejectionReason() { + return rejectionReason; + } + + public void setRejectionReason(String rejectionReason) { + this.rejectionReason = rejectionReason; + } +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/LoanApplicationStatus.java b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/LoanApplicationStatus.java new file mode 100644 index 0000000000..54a3f2255c --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/java/org/springframework/cloud/contract/frauddetection/model/LoanApplicationStatus.java @@ -0,0 +1,5 @@ +package org.springframework.cloud.contract.frauddetection.model; + +public enum LoanApplicationStatus { + LOAN_APPLIED, LOAN_APPLICATION_REJECTED +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/resources/application.yml b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/resources/application.yml new file mode 100644 index 0000000000..4b7fe13158 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/main/resources/application.yml @@ -0,0 +1 @@ +server.port: 8090 \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/test/groovy/org/springframework/cloud/contract/LoanApplicationServiceSpec.groovy b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/test/groovy/org/springframework/cloud/contract/LoanApplicationServiceSpec.groovy new file mode 100644 index 0000000000..1388c3f723 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/test/groovy/org/springframework/cloud/contract/LoanApplicationServiceSpec.groovy @@ -0,0 +1,42 @@ +package org.springframework.cloud.contract + +import org.springframework.cloud.contract.frauddetection.Application +import org.springframework.cloud.contract.frauddetection.LoanApplicationService +import org.springframework.cloud.contract.frauddetection.model.Client +import org.springframework.cloud.contract.frauddetection.model.LoanApplication +import org.springframework.cloud.contract.frauddetection.model.LoanApplicationResult +import org.springframework.cloud.contract.frauddetection.model.LoanApplicationStatus +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.test.SpringApplicationContextLoader +import org.springframework.test.context.ContextConfiguration +import spock.lang.Specification + +@ContextConfiguration(loader = SpringApplicationContextLoader, classes = Application) +class LoanApplicationServiceSpec extends Specification { + + @Autowired + LoanApplicationService sut + + def 'should successfully apply for loan'() { + given: + LoanApplication application = + new LoanApplication(client: new Client(pesel: '1234567890'), amount: 123.123) + when: + LoanApplicationResult loanApplication = sut.loanApplication(application) + then: + loanApplication.loanApplicationStatus == LoanApplicationStatus.LOAN_APPLIED + loanApplication.rejectionReason == null + } + + def 'should be rejected due to abnormal loan amount'() { + given: + LoanApplication application = + new LoanApplication(client: new Client(pesel: '1234567890'), amount: 99_999) + when: + LoanApplicationResult loanApplication = sut.loanApplication(application) + then: + loanApplication.loanApplicationStatus == LoanApplicationStatus.LOAN_APPLICATION_REJECTED + loanApplication.rejectionReason == 'Amount too high' + } + +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/test/resources/application.yaml b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/test/resources/application.yaml new file mode 100644 index 0000000000..37250e3d43 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-client/src/test/resources/application.yaml @@ -0,0 +1,3 @@ +stubrunner: + work-offline: true + stubs.ids: 'org.springframework.cloud.contract.testprojects:http-server:+:stubs:8080' diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/.gitignore b/spring-cloud-contract-verifier-standalone-test-samples/http-server/.gitignore new file mode 100644 index 0000000000..b05ba7bd6d --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/.gitignore @@ -0,0 +1,6 @@ + +target/ + +.gradle +build/ + diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/.mvn/jvm.config b/spring-cloud-contract-verifier-standalone-test-samples/http-server/.mvn/jvm.config new file mode 100644 index 0000000000..894bef17a5 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/.mvn/jvm.config @@ -0,0 +1 @@ +-Xmx1024m -XX:MaxPermSize=256m -Djava.awt.headless=true \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/.mvn/maven.config b/spring-cloud-contract-verifier-standalone-test-samples/http-server/.mvn/maven.config new file mode 100644 index 0000000000..7681bc67b9 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/.mvn/maven.config @@ -0,0 +1 @@ +-T2 diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/.mvn/wrapper/maven-wrapper.jar b/spring-cloud-contract-verifier-standalone-test-samples/http-server/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000..c6feb8bb6f Binary files /dev/null and b/spring-cloud-contract-verifier-standalone-test-samples/http-server/.mvn/wrapper/maven-wrapper.jar differ diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/.mvn/wrapper/maven-wrapper.properties b/spring-cloud-contract-verifier-standalone-test-samples/http-server/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..6637cedb28 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/README.adoc b/spring-cloud-contract-verifier-standalone-test-samples/http-server/README.adoc new file mode 100644 index 0000000000..2fd3fbc40d --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/README.adoc @@ -0,0 +1,20 @@ += Http Server + +Run + +[source=groovy] +-------- +./gradlew clean build publishToMavenLocal +-------- + +or + +-------- +./mvnw clean install +-------- + +To + +- build the app +- generate and run Spring Cloud Contract Verifier tests +- publish the fatJar and the stubs to Maven Local \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/build.gradle b/spring-cloud-contract-verifier-standalone-test-samples/http-server/build.gradle new file mode 100644 index 0000000000..e556c60ed9 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/build.gradle @@ -0,0 +1,62 @@ +buildscript { + repositories { + mavenCentral() + mavenLocal() + maven { url "http://repo.spring.io/snapshot" } + maven { url "http://repo.spring.io/milestone" } + maven { url "http://repo.spring.io/libs-release-local" } + maven { url "http://repo.spring.io/libs-staging-local/" } + maven { url 'http://repo.spring.io/plugins-snapshot' } + } + dependencies { + classpath "org.springframework.boot:spring-boot-gradle-plugin:1.3.5.RELEASE" + classpath "org.springframework.cloud.contract:spring-cloud-contract-verifier-gradle-plugin:${findProperty('verifierVersion') ?: verifierVersion}" + } +} + +group = 'org.springframework.cloud.contract.testprojects' +version = '0.0.1-SNAPSHOT' + +repositories { + mavenCentral() + mavenLocal() + maven { url "http://repo.spring.io/snapshot" } + maven { url "http://repo.spring.io/milestone" } + maven { url "http://repo.spring.io/libs-release-local" } + maven { url "http://repo.spring.io/libs-staging-local/" } +} + +apply plugin: 'groovy' +apply plugin: 'spring-boot' +apply plugin: 'contract-verifier' +apply plugin: 'maven-publish' + + +contractVerifier { + targetFramework = 'Spock' + baseClassForTests = 'com.toomuchcoding.MvcSpec' +} + +dependencies { + compile("org.springframework.boot:spring-boot-starter-web") { + exclude module: "spring-boot-starter-tomcat" + } + compile("org.springframework.boot:spring-boot-starter-jetty") + compile("org.springframework.boot:spring-boot-starter-actuator") + + testRuntime "org.spockframework:spock-spring" + testCompile "org.spockframework:spock-core" + testCompile "org.springframework:spring-test" + testCompile "com.jayway.restassured:spring-mock-mvc:2.9.0" + testCompile "junit:junit" +} + +test { + testLogging { + exceptionFormat = 'full' + } +} + +task wrapper(type: Wrapper) { + gradleVersion = '2.14' +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/gradle.properties b/spring-cloud-contract-verifier-standalone-test-samples/http-server/gradle.properties new file mode 100644 index 0000000000..d630c704cf --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/gradle.properties @@ -0,0 +1 @@ +verifierVersion=1.0.0.BUILD-SNAPSHOT diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/gradle/wrapper/gradle-wrapper.jar b/spring-cloud-contract-verifier-standalone-test-samples/http-server/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..ca78035ef0 Binary files /dev/null and b/spring-cloud-contract-verifier-standalone-test-samples/http-server/gradle/wrapper/gradle-wrapper.jar differ diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/gradle/wrapper/gradle-wrapper.properties b/spring-cloud-contract-verifier-standalone-test-samples/http-server/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..2bb2e4fcd9 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Thu Jun 16 11:15:50 CEST 2016 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/gradlew b/spring-cloud-contract-verifier-standalone-test-samples/http-server/gradlew new file mode 100755 index 0000000000..27309d9231 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/gradlew.bat b/spring-cloud-contract-verifier-standalone-test-samples/http-server/gradlew.bat new file mode 100644 index 0000000000..832fdb6079 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/gradlew.bat @@ -0,0 +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 +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/spring-cloud-contract-verifier-standalone-test-samples/http-server/mvnw b/spring-cloud-contract-verifier-standalone-test-samples/http-server/mvnw new file mode 100755 index 0000000000..fc7efd17d0 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/mvnw @@ -0,0 +1,234 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # + # Look for the Apple JDKs first to preserve the existing behaviour, and then look + # for the new JDKs provided by Oracle. + # + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then + # + # Oracle JDKs + # + export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then + # + # Apple JDKs + # + export JAVA_HOME=`/usr/libexec/java_home` + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Migwn, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + local basedir=$(pwd) + local wdir=$(pwd) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CMD_LINE_ARGS + diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/mvnw.cmd b/spring-cloud-contract-verifier-standalone-test-samples/http-server/mvnw.cmd new file mode 100644 index 0000000000..001048081d --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/mvnw.cmd @@ -0,0 +1,145 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +set MAVEN_CMD_LINE_ARGS=%MAVEN_CONFIG% %* + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" + +set WRAPPER_JAR=""%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/pom.xml b/spring-cloud-contract-verifier-standalone-test-samples/http-server/pom.xml new file mode 100644 index 0000000000..14c40c626f --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/pom.xml @@ -0,0 +1,174 @@ + + + 4.0.0 + + org.springframework.cloud.contract.testprojects + http-server + 0.0.1-SNAPSHOT + + Spring Cloud Contract Verifier Http Server Sample + Spring Cloud Contract Verifier Http Server Sample + + + org.springframework.boot + spring-boot-starter-parent + 1.3.5.RELEASE + + + + + UTF-8 + 1.8 + 1.0.0.BUILD-SNAPSHOT + 1.0.0.BUILD-SNAPSHOT + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + org.springframework.boot + spring-boot-starter-jetty + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + com.jayway.restassured + spring-mock-mvc + 2.9.0 + test + + + com.toomuchcoding.jsonassert + jsonassert + 0.4.7 + test + + + org.assertj + assertj-core + 3.4.1 + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.springframework.cloud.contract + spring-cloud-contract-verifier-maven-plugin + ${spring-cloud-contract-verifier-maven-plugin.version} + true + + org.springframework.cloud.MvcTest + + + + + org.springframework.cloud.contract + spring-cloud-contract-verifier-core + ${spring-cloud-contract-verifier.version} + + + + + maven-deploy-plugin + + true + + + + + + + + spring + + true + + + + spring-snapshots + Spring Snapshots + http://repo.spring.io/libs-snapshot-local + + true + + + + spring-milestones + Spring Milestones + http://repo.spring.io/libs-milestone-local + + false + + + + spring-releases + Spring Releases + http://repo.spring.io/release + + false + + + + + + spring-snapshots + Spring Snapshots + http://repo.spring.io/libs-snapshot-local + + true + + + + spring-milestones + Spring Milestones + http://repo.spring.io/libs-milestone-local + + false + + + + spring-plugin-snapshots + Spring Snapshots + http://repo.spring.io/plugins-snapshot-local + + true + + + + spring-plugin-milestones + Spring Milestones + http://repo.spring.io/plugins-milestone-local + + false + + + + + + diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/settings.gradle b/spring-cloud-contract-verifier-standalone-test-samples/http-server/settings.gradle new file mode 100644 index 0000000000..b4f382e60c --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'http-server' diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/main/java/org/springframework/cloud/contract/frauddetection/Application.java b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/main/java/org/springframework/cloud/contract/frauddetection/Application.java new file mode 100644 index 0000000000..5225f208ac --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/main/java/org/springframework/cloud/contract/frauddetection/Application.java @@ -0,0 +1,17 @@ +package org.springframework.cloud.contract.frauddetection; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@EnableAutoConfiguration +@ComponentScan +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/main/java/org/springframework/cloud/contract/frauddetection/FraudDetectionController.java b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/main/java/org/springframework/cloud/contract/frauddetection/FraudDetectionController.java new file mode 100644 index 0000000000..ac529f2cf1 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/main/java/org/springframework/cloud/contract/frauddetection/FraudDetectionController.java @@ -0,0 +1,39 @@ +package org.springframework.cloud.contract.frauddetection; + +import org.springframework.cloud.contract.frauddetection.model.FraudCheck; +import org.springframework.cloud.contract.frauddetection.model.FraudCheckResult; +import org.springframework.cloud.contract.frauddetection.model.FraudCheckStatus; + +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.math.BigDecimal; + +import static org.springframework.web.bind.annotation.RequestMethod.PUT; + +@RestController +public class FraudDetectionController { + + private static final String FRAUD_SERVICE_JSON_VERSION_1 = "application/vnd.fraud.v1+json"; + private static final String NO_REASON = null; + private static final String AMOUNT_TOO_HIGH = "Amount too high"; + private static final BigDecimal MAX_AMOUNT = new BigDecimal("5000"); + + @RequestMapping( + value = "/fraudcheck", + method = PUT, + consumes = FRAUD_SERVICE_JSON_VERSION_1, + produces = FRAUD_SERVICE_JSON_VERSION_1) + public FraudCheckResult fraudCheck(@RequestBody FraudCheck fraudCheck) { + if (amountGreaterThanThreshold(fraudCheck)) { + return new FraudCheckResult(FraudCheckStatus.FRAUD, AMOUNT_TOO_HIGH); + } + return new FraudCheckResult(FraudCheckStatus.OK, NO_REASON); + } + + private boolean amountGreaterThanThreshold(FraudCheck fraudCheck) { + return MAX_AMOUNT.compareTo(fraudCheck.getLoanAmount()) < 0; + } + +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/main/java/org/springframework/cloud/contract/frauddetection/model/FraudCheck.java b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/main/java/org/springframework/cloud/contract/frauddetection/model/FraudCheck.java new file mode 100644 index 0000000000..d7f84b28bc --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/main/java/org/springframework/cloud/contract/frauddetection/model/FraudCheck.java @@ -0,0 +1,29 @@ +package org.springframework.cloud.contract.frauddetection.model; + +import java.math.BigDecimal; + +public class FraudCheck { + + private String clientPesel; + + private BigDecimal loanAmount; + + public FraudCheck() { + } + + public String getClientPesel() { + return clientPesel; + } + + public void setClientPesel(String clientPesel) { + this.clientPesel = clientPesel; + } + + public BigDecimal getLoanAmount() { + return loanAmount; + } + + public void setLoanAmount(BigDecimal loanAmount) { + this.loanAmount = loanAmount; + } +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/main/java/org/springframework/cloud/contract/frauddetection/model/FraudCheckResult.java b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/main/java/org/springframework/cloud/contract/frauddetection/model/FraudCheckResult.java new file mode 100644 index 0000000000..ab033ef693 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/main/java/org/springframework/cloud/contract/frauddetection/model/FraudCheckResult.java @@ -0,0 +1,32 @@ +package org.springframework.cloud.contract.frauddetection.model; + +public class FraudCheckResult { + + private FraudCheckStatus fraudCheckStatus; + + private String rejectionReason; + + public FraudCheckResult() { + } + + public FraudCheckResult(FraudCheckStatus fraudCheckStatus, String rejectionReason) { + this.fraudCheckStatus = fraudCheckStatus; + this.rejectionReason = rejectionReason; + } + + public FraudCheckStatus getFraudCheckStatus() { + return fraudCheckStatus; + } + + public void setFraudCheckStatus(FraudCheckStatus fraudCheckStatus) { + this.fraudCheckStatus = fraudCheckStatus; + } + + public String getRejectionReason() { + return rejectionReason; + } + + public void setRejectionReason(String rejectionReason) { + this.rejectionReason = rejectionReason; + } +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/main/java/org/springframework/cloud/contract/frauddetection/model/FraudCheckStatus.java b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/main/java/org/springframework/cloud/contract/frauddetection/model/FraudCheckStatus.java new file mode 100644 index 0000000000..f0b2785556 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/main/java/org/springframework/cloud/contract/frauddetection/model/FraudCheckStatus.java @@ -0,0 +1,5 @@ +package org.springframework.cloud.contract.frauddetection.model; + +public enum FraudCheckStatus { + OK, FRAUD +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/main/resources/application.yml b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/main/resources/application.yml new file mode 100644 index 0000000000..a30a91f034 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/main/resources/application.yml @@ -0,0 +1 @@ +server.port=8085 \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/test/groovy/org/springframework/cloud/MvcSpec.groovy b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/test/groovy/org/springframework/cloud/MvcSpec.groovy new file mode 100644 index 0000000000..6a9ffb8950 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/test/groovy/org/springframework/cloud/MvcSpec.groovy @@ -0,0 +1,15 @@ +package com.toomuchcoding + +import org.springframework.cloud.contract.frauddetection.FraudDetectionController +import com.jayway.restassured.module.mockmvc.RestAssuredMockMvc +import spock.lang.Specification + +class MvcSpec extends Specification { + def setup() { + RestAssuredMockMvc.standaloneSetup(new FraudDetectionController()) + } + + void assertThatRejectionReasonIsNull(def rejectionReason) { + assert !rejectionReason + } +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/test/java/org/springframework/cloud/MvcTest.java b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/test/java/org/springframework/cloud/MvcTest.java new file mode 100644 index 0000000000..d508c79025 --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/test/java/org/springframework/cloud/MvcTest.java @@ -0,0 +1,18 @@ +package org.springframework.cloud; + +import com.jayway.restassured.module.mockmvc.RestAssuredMockMvc; +import org.springframework.cloud.contract.frauddetection.FraudDetectionController; + +import org.junit.Before; + +public class MvcTest { + + @Before + public void setup() { + RestAssuredMockMvc.standaloneSetup(new FraudDetectionController()); + } + + public void assertThatRejectionReasonIsNull(Object rejectionReason) { + assert rejectionReason == null; + } +} \ No newline at end of file diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/test/resources/contracts/shouldMarkClientAsFraud.groovy b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/test/resources/contracts/shouldMarkClientAsFraud.groovy new file mode 100644 index 0000000000..5dd0aae07f --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/test/resources/contracts/shouldMarkClientAsFraud.groovy @@ -0,0 +1,29 @@ +package contracts + +org.springframework.cloud.contract.spec.Contract.make { + request { + method """PUT""" + url """/fraudcheck""" + body(""" + { + "clientPesel":"${value(client(regex('[0-9]{10}')), server('1234567890'))}", + "loanAmount":99999} + """ + ) + headers { + header("""Content-Type""", """application/vnd.fraud.v1+json""") + } + + } + response { + status 200 + body( """{ + "fraudCheckStatus": "${value(client('FRAUD'), server(regex('[A-Z]{5}')))}", + "rejectionReason": "Amount too high" +}""") + headers { + header('Content-Type': 'application/vnd.fraud.v1+json') + } + } + +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/test/resources/contracts/shouldMarkClientAsNotFraud.groovy b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/test/resources/contracts/shouldMarkClientAsNotFraud.groovy new file mode 100644 index 0000000000..e142c47d0e --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/http-server/src/test/resources/contracts/shouldMarkClientAsNotFraud.groovy @@ -0,0 +1,30 @@ +package contracts + +org.springframework.cloud.contract.spec.Contract.make { + request { + method 'PUT' + url '/fraudcheck' + body(""" + { + "clientPesel":"${value(client(regex('[0-9]{10}')), server('1234567890'))}", + "loanAmount":123.123 + } + """ + ) + headers { + header('Content-Type', 'application/vnd.fraud.v1+json') + } + + } + response { + status 200 + body( + fraudCheckStatus: "OK", + rejectionReason: $(client(null), server(execute('assertThatRejectionReasonIsNull($it)'))) + ) + headers { + header('Content-Type': 'application/vnd.fraud.v1+json') + } + } + +} diff --git a/spring-cloud-contract-verifier-standalone-test-samples/mvnw b/spring-cloud-contract-verifier-standalone-test-samples/mvnw new file mode 100755 index 0000000000..349bef124b --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/mvnw @@ -0,0 +1,243 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +VERSION=$(awk '/ 0) {$0=$0} 1' `dirname $0`/pom.xml| grep '\(.*\)<.*/\1/') +if echo $VERSION | egrep -q 'M|RC'; then + echo Activating \"milestone\" profile for version=\"$VERSION\" + echo $MAVEN_ARGS | grep -q milestone || MAVEN_ARGS="$MAVEN_ARGS -Pmilestone" +else + echo Deactivating \"milestone\" profile for version=\"$VERSION\" + echo $MAVEN_ARGS | grep -q milestone && MAVEN_ARGS=$(echo $MAVEN_ARGS | sed -e 's/-Pmilestone//') +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # + # Look for the Apple JDKs first to preserve the existing behaviour, and then look + # for the new JDKs provided by Oracle. + # + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then + # + # Oracle JDKs + # + export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then + # + # Apple JDKs + # + export JAVA_HOME=`/usr/libexec/java_home` + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Migwn, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + local basedir=$(pwd) + local wdir=$(pwd) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} ${MAVEN_ARGS} "$@" + diff --git a/spring-cloud-contract-verifier-standalone-test-samples/mvnw.cmd b/spring-cloud-contract-verifier-standalone-test-samples/mvnw.cmd new file mode 100644 index 0000000000..001048081d --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/mvnw.cmd @@ -0,0 +1,145 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +set MAVEN_CMD_LINE_ARGS=%MAVEN_CONFIG% %* + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" + +set WRAPPER_JAR=""%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/spring-cloud-contract-verifier-standalone-test-samples/pom.xml b/spring-cloud-contract-verifier-standalone-test-samples/pom.xml new file mode 100644 index 0000000000..c93d90cb7e --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + + + + org.springframework.cloud + spring-cloud-contract-samples + 1.0.0-SNAPSHOT + pom + + Spring Cloud Contract Verifier Standalone Test Samples + Spring Cloud Contract Verifier Standalone Test Samples used for end to end tests + + + http-server + http-client + contract-verifier-sample-stream-sink + contract-verifier-sample-stream-source + + + + true + + + diff --git a/spring-cloud-contract-verifier-standalone-test-samples/runMavenTests.sh b/spring-cloud-contract-verifier-standalone-test-samples/runMavenTests.sh new file mode 100755 index 0000000000..6af4b0ee3d --- /dev/null +++ b/spring-cloud-contract-verifier-standalone-test-samples/runMavenTests.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +set -o errexit + +LOCAL_MAVEN_REPO=${LOCAL_MAVEN_REPO-~/.m2} +VERIFIER_VERSION=${VERIFIER_VERSION:-1.0.0.BUILD-SNAPSHOT} +ROOT=`pwd` + +cat < - - 4.0.0 + + 4.0.0 org.springframework.cloud.contract @@ -10,18 +11,18 @@ .. - spring-cloud-contract-verifier - pom + spring-cloud-contract-verifier + pom - Spring Cloud Contract Verifier Build - Spring Cloud Contract Verifier Build + Spring Cloud Contract Verifier Build + Spring Cloud Contract Verifier Build - - spring-cloud-contract-verifier-testing-utils - spring-cloud-contract-verifier-core - spring-cloud-contract-verifier-converters - spring-cloud-contract-verifier-messaging - + + spring-cloud-contract-verifier-testing-utils + spring-cloud-contract-verifier-core + spring-cloud-contract-verifier-converters + spring-cloud-contract-verifier-messaging + diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-converters/src/test/groovy/org/springframework/cloud/contract/verifier/wiremock/DslToWireMockClientConverterSpec.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-converters/src/test/groovy/org/springframework/cloud/contract/verifier/wiremock/DslToWireMockClientConverterSpec.groovy index dbd37a54f3..5ce9fd3e60 100755 --- a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-converters/src/test/groovy/org/springframework/cloud/contract/verifier/wiremock/DslToWireMockClientConverterSpec.groovy +++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-converters/src/test/groovy/org/springframework/cloud/contract/verifier/wiremock/DslToWireMockClientConverterSpec.groovy @@ -61,6 +61,8 @@ class DslToWireMockClientConverterSpec extends Specification { file.write(""" org.springframework.cloud.contract.spec.Contract.make { request { + method 'GET' + url '/foo' } response { status 200 @@ -72,7 +74,12 @@ class DslToWireMockClientConverterSpec extends Specification { String json = converter.convertContent("test", new ContractMetadata(file.toPath(), false, 0, null)) then: JSONAssert.assertEquals(''' -{"request":{},"response":{"status":200,"fixedDelayMilliseconds":1000}} +{"request":{ + "url" : "/foo", + "method" : "GET"}, +"response":{ +"status":200,"fixedDelayMilliseconds":1000 +}} ''', json, false) } diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-core/src/main/groovy/org/springframework/cloud/contract/verifier/dsl/wiremock/WireMockRequestStubStrategy.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-core/src/main/groovy/org/springframework/cloud/contract/verifier/dsl/wiremock/WireMockRequestStubStrategy.groovy index 68606b280c..4735b691b5 100755 --- a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-core/src/main/groovy/org/springframework/cloud/contract/verifier/dsl/wiremock/WireMockRequestStubStrategy.groovy +++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-core/src/main/groovy/org/springframework/cloud/contract/verifier/dsl/wiremock/WireMockRequestStubStrategy.groovy @@ -16,34 +16,19 @@ package org.springframework.cloud.contract.verifier.dsl.wiremock +import com.github.tomakehurst.wiremock.client.WireMock import com.github.tomakehurst.wiremock.http.RequestMethod -import com.github.tomakehurst.wiremock.matching.RequestPattern -import com.github.tomakehurst.wiremock.matching.ValuePattern +import com.github.tomakehurst.wiremock.matching.* import groovy.json.JsonOutput import groovy.transform.PackageScope import groovy.transform.TypeChecked import groovy.transform.TypeCheckingMode import org.springframework.cloud.contract.spec.Contract -import org.springframework.cloud.contract.spec.internal.Body -import org.springframework.cloud.contract.spec.internal.NamedProperty -import org.springframework.cloud.contract.spec.internal.QueryParameters -import org.springframework.cloud.contract.verifier.util.ContentUtils -import org.springframework.cloud.contract.verifier.util.JsonPaths -import org.springframework.cloud.contract.verifier.util.MapConverter -import org.springframework.cloud.contract.spec.internal.DslProperty -import org.springframework.cloud.contract.spec.internal.OptionalProperty -import org.springframework.cloud.contract.spec.internal.RegexPatterns -import org.springframework.cloud.contract.spec.internal.Request -import org.springframework.cloud.contract.verifier.util.JsonToJsonPathsConverter -import org.springframework.cloud.contract.spec.internal.MatchingStrategy -import org.springframework.cloud.contract.verifier.util.ContentType +import org.springframework.cloud.contract.spec.internal.* +import org.springframework.cloud.contract.verifier.util.* import java.util.regex.Pattern -import static ContentUtils.getEqualsTypeFromContentType -import static ContentUtils.recognizeContentTypeFromContent -import static ContentUtils.recognizeContentTypeFromHeader -import static ContentUtils.recognizeContentTypeFromMatchingStrategy import static org.springframework.cloud.contract.verifier.util.RegexpBuilders.buildGStringRegexpForStubSide import static org.springframework.cloud.contract.verifier.util.RegexpBuilders.buildJSONRegexpMatch @@ -67,24 +52,24 @@ class WireMockRequestStubStrategy extends BaseWireMockStubStrategy { if(!request) { return null } - RequestPattern requestPattern = new RequestPattern() - appendMethod(requestPattern) - appendHeaders(requestPattern) - appendUrl(requestPattern) - appendQueryParameters(requestPattern) - appendBody(requestPattern) - appendMultipart(requestPattern) - return requestPattern + RequestPatternBuilder requestPatternBuilder = appendMethodAndUrl() + appendHeaders(requestPatternBuilder) + appendQueryParameters(requestPatternBuilder) + appendBody(requestPatternBuilder) + appendMultipart(requestPatternBuilder) + return requestPatternBuilder.build() } - private void appendMethod(RequestPattern requestPattern) { + private RequestPatternBuilder appendMethodAndUrl() { if(!request.method) { return } - requestPattern.setMethod(RequestMethod.fromString(request.method.clientValue?.toString())) + RequestMethod requestMethod = RequestMethod.fromString(request.method.clientValue?.toString()) + UrlPattern urlPattern = urlPattern() + return RequestPatternBuilder.newRequestPattern(requestMethod, urlPattern) } - private void appendBody(RequestPattern requestPattern) { + private void appendBody(RequestPatternBuilder requestPattern) { if (!request.body) { return } @@ -92,64 +77,65 @@ class WireMockRequestStubStrategy extends BaseWireMockStubStrategy { if (contentType == ContentType.JSON) { JsonPaths values = JsonToJsonPathsConverter.transformToJsonPathWithStubsSideValues(getMatchingStrategyFromBody(request.body)?.clientValue) if (values.empty) { - requestPattern.bodyPatterns = [new ValuePattern(jsonCompareMode: org.skyscreamer.jsonassert.JSONCompareMode.LENIENT, - equalToJson: JsonOutput.toJson(getMatchingStrategy(request.body.clientValue).clientValue) ) ] + requestPattern.withRequestBody(WireMock.equalToJson(JsonOutput.toJson(getMatchingStrategy(request.body.clientValue).clientValue), false, false)) } else { - requestPattern.bodyPatterns = values.findAll{ !it.assertsSize() }.collect { new ValuePattern(matchesJsonPath: it.jsonPath().replace("\\\\", "\\")) } ?: null as List + values.findAll{ !it.assertsSize() }.each { + requestPattern.withRequestBody(WireMock.matchingJsonPath(it.jsonPath().replace("\\\\", "\\"))) + } } } else if (contentType == ContentType.XML) { - requestPattern.bodyPatterns = [new ValuePattern(equalToXml: getMatchingStrategy(request.body.clientValue).clientValue.toString())] + requestPattern.withRequestBody(WireMock.equalToXml(getMatchingStrategy(request.body.clientValue).clientValue.toString())) } else if (containsPattern(request?.body)) { MatchingStrategy matchingStrategy = appendBodyRegexpMatchPattern(request.body) - requestPattern.bodyPatterns = [convertToValuePattern(matchingStrategy)] + requestPattern.withRequestBody(convertToValuePattern(matchingStrategy)) } else { - requestPattern.bodyPatterns = [convertToValuePattern(getMatchingStrategy(request.body.clientValue))] + requestPattern.withRequestBody(convertToValuePattern(getMatchingStrategy(request.body.clientValue))) } } - private void appendMultipart(RequestPattern requestPattern) { + private void appendMultipart(RequestPatternBuilder requestPattern) { if (!request.multipart) { return } if (request.multipart.clientValue instanceof Map) { - List multipartPatterns = (request.multipart.clientValue as Map).collect { + List multipartPatterns = (request.multipart.clientValue as Map).collect { (it.value instanceof NamedProperty - ? ValuePattern.matches(RegexPatterns.multipartFile(it.key, (it.value as NamedProperty).name.clientValue, (it.value as NamedProperty).value.clientValue)) - : ValuePattern.matches(RegexPatterns.multipartParam(it.key, it.value)) ) + ? WireMock.matching(RegexPatterns.multipartFile(it.key, (it.value as NamedProperty).name.clientValue, (it.value as NamedProperty).value.clientValue)) + : WireMock.matching(RegexPatterns.multipartParam(it.key, it.value)) ) + } + multipartPatterns.each { + requestPattern.withRequestBody(it) } - - requestPattern.bodyPatterns ? requestPattern.bodyPatterns.addAll(multipartPatterns) : (requestPattern.bodyPatterns = multipartPatterns) } } - private void appendHeaders(RequestPattern requestPattern) { + private void appendHeaders(RequestPatternBuilder requestPattern) { if(!request.headers) { return } request.headers.entries.each { - requestPattern.addHeader(it.name, convertToValuePattern(it.clientValue)) + requestPattern.withHeader(it.name, convertToValuePattern(it.clientValue)) } } - private void appendUrl(RequestPattern requestPattern) { + private UrlPattern urlPattern() { Object urlPath = request?.urlPath?.clientValue if (urlPath) { if(urlPath instanceof Pattern) { - requestPattern.setUrlPathPattern(getStubSideValue(urlPath.toString()).toString()) + return WireMock.urlPathMatching(getStubSideValue(urlPath.toString()) as String) } else { - requestPattern.setUrlPath(getStubSideValue(urlPath.toString()).toString()) + return WireMock.urlPathEqualTo(getStubSideValue(urlPath.toString()) as String) } } if(!request.url) { - return + throw new IllegalStateException("URL is required!") } Object url = getUrlIfGstring(request?.url?.clientValue) if (url instanceof Pattern) { - requestPattern.setUrlPattern(url.pattern()) - } else { - requestPattern.setUrl(url.toString()) + return WireMock.urlMatching(url.pattern()) } + return WireMock.urlEqualTo(url.toString()) } private Object getUrlIfGstring(Object clientSide) { @@ -163,34 +149,34 @@ class WireMockRequestStubStrategy extends BaseWireMockStubStrategy { return clientSide } - private void appendQueryParameters(RequestPattern requestPattern) { + private void appendQueryParameters(RequestPatternBuilder requestPattern) { QueryParameters queryParameters = request?.urlPath?.queryParameters ?: request?.url?.queryParameters queryParameters?.parameters?.each { - requestPattern.addQueryParam(it.name, convertToValuePattern(it.clientValue)) + requestPattern.withQueryParam(it.name, convertToValuePattern(it.clientValue)) } } @TypeChecked(TypeCheckingMode.SKIP) - private static ValuePattern convertToValuePattern(Object object) { + private static StringValuePattern convertToValuePattern(Object object) { switch (object) { case Pattern: Pattern value = object as Pattern - return ValuePattern.matches(value.pattern()) + return WireMock.matching(value.pattern()) case OptionalProperty: OptionalProperty value = object as OptionalProperty - return ValuePattern.matches(value.optionalPattern()) + return WireMock.matching(value.optionalPattern()) case MatchingStrategy: MatchingStrategy value = object as MatchingStrategy switch (value.type) { case MatchingStrategy.Type.NOT_MATCHING: - return new ValuePattern(doesNotMatch: value.clientValue) + return WireMock.notMatching(value.clientValue.toString()) case MatchingStrategy.Type.ABSENT: - return ValuePattern.absent() + return WireMock.absent() default: - return ValuePattern."${value.type.name}"(value.clientValue) + return WireMock."${value.type.name}"(value.clientValue) } default: - return ValuePattern.equalTo(object.toString()) + return WireMock.equalTo(object.toString()) } } @@ -230,10 +216,10 @@ class WireMockRequestStubStrategy extends BaseWireMockStubStrategy { private MatchingStrategy getMatchingStrategyIncludingContentType(MatchingStrategy matchingStrategy) { MatchingStrategy.Type type = matchingStrategy.type Object value = matchingStrategy.clientValue - ContentType contentType = recognizeContentTypeFromMatchingStrategy(type) + ContentType contentType = ContentUtils.recognizeContentTypeFromMatchingStrategy(type) if (contentType == ContentType.UNKNOWN && type == MatchingStrategy.Type.EQUAL_TO) { - contentType = recognizeContentTypeFromContent(value) - type = getEqualsTypeFromContentType(contentType) + contentType = ContentUtils.recognizeContentTypeFromContent(value) + type = ContentUtils.getEqualsTypeFromContentType(contentType) } return new MatchingStrategy(parseBody(value, contentType), type) } @@ -286,7 +272,7 @@ class WireMockRequestStubStrategy extends BaseWireMockStubStrategy { } private MatchingStrategy.Type getEqualsTypeFromContentTypeHeader() { - return getEqualsTypeFromContentType(recognizeContentTypeFromHeader(request.headers)) + return ContentUtils.getEqualsTypeFromContentType(ContentUtils.recognizeContentTypeFromHeader(request.headers)) } } diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-core/src/test/groovy/org/springframework/cloud/contract/verifier/dsl/WireMockGroovyDslSpec.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-core/src/test/groovy/org/springframework/cloud/contract/verifier/dsl/WireMockGroovyDslSpec.groovy index 92c0f26a49..c4a9fec545 100755 --- a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-core/src/test/groovy/org/springframework/cloud/contract/verifier/dsl/WireMockGroovyDslSpec.groovy +++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-core/src/test/groovy/org/springframework/cloud/contract/verifier/dsl/WireMockGroovyDslSpec.groovy @@ -1181,6 +1181,7 @@ class WireMockGroovyDslSpec extends Specification implements WireMockStubVerifie org.springframework.cloud.contract.spec.Contract groovyDsl = org.springframework.cloud.contract.spec.Contract.make { request { method('POST') + url("foo") body( property: value(stub("value"), test("value")) ) @@ -1215,6 +1216,7 @@ class WireMockGroovyDslSpec extends Specification implements WireMockStubVerifie org.springframework.cloud.contract.spec.Contract groovyDsl = org.springframework.cloud.contract.spec.Contract.make { request { method('POST') + url("foo") body( values: [] ) diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-core/src/test/groovy/org/springframework/cloud/contract/verifier/dsl/WireMockStubVerifier.groovy b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-core/src/test/groovy/org/springframework/cloud/contract/verifier/dsl/WireMockStubVerifier.groovy index 825b913136..484d15938b 100644 --- a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-core/src/test/groovy/org/springframework/cloud/contract/verifier/dsl/WireMockStubVerifier.groovy +++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-core/src/test/groovy/org/springframework/cloud/contract/verifier/dsl/WireMockStubVerifier.groovy @@ -16,6 +16,7 @@ package org.springframework.cloud.contract.verifier.dsl +import com.github.tomakehurst.wiremock.matching.RegexPattern import com.github.tomakehurst.wiremock.stubbing.StubMapping import org.springframework.cloud.contract.verifier.dsl.wiremock.WireMockStubStrategy import org.springframework.cloud.contract.verifier.file.ContractMetadata @@ -26,8 +27,8 @@ trait WireMockStubVerifier { void stubMappingIsValidWireMockStub(String mappingDefinition) { StubMapping stubMapping = StubMapping.buildFrom(mappingDefinition) - stubMapping.request.bodyPatterns.findAll { it.matches }.every { - Pattern.compile(it.matches) + stubMapping.request.bodyPatterns.findAll { it.isPresent() && it instanceof RegexPattern }.every { + Pattern.compile(it.getValue()) } assert !mappingDefinition.contains('org.springframework.cloud.contract.spec.internal') } diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/pom.xml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/pom.xml index cf38029718..6ffee916a9 100644 --- a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/pom.xml +++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/pom.xml @@ -1,7 +1,8 @@ - - 4.0.0 + + 4.0.0 org.springframework.cloud.contract @@ -10,17 +11,17 @@ .. - spring-cloud-contract-verifier-messaging - pom + spring-cloud-contract-verifier-messaging + pom - Spring Cloud Contract Verifier Build - Spring Cloud Contract Verifier Build + Spring Cloud Contract Verifier Build + Spring Cloud Contract Verifier Build - - spring-cloud-contract-verifier-messaging-core - spring-cloud-contract-verifier-camel - spring-cloud-contract-verifier-integration - spring-cloud-contract-verifier-stream - + + spring-cloud-contract-verifier-messaging-core + spring-cloud-contract-verifier-camel + spring-cloud-contract-verifier-integration + spring-cloud-contract-verifier-stream + diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/spring-cloud-contract-verifier-camel/pom.xml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/spring-cloud-contract-verifier-camel/pom.xml index 2303d40f92..ffd3e4d348 100644 --- a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/spring-cloud-contract-verifier-camel/pom.xml +++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/spring-cloud-contract-verifier-camel/pom.xml @@ -8,14 +8,14 @@ 1.0.0.BUILD-SNAPSHOT .. - spring-cloud-verifier-camel + spring-cloud-contract-verifier-camel jar Spring Cloud Contract Verifier Camel Spring Cloud Contract Verifier Camel org.springframework.cloud.contract - spring-cloud-verifier-messaging-core + spring-cloud-contract-verifier-messaging-core org.apache.camel diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/spring-cloud-contract-verifier-integration/pom.xml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/spring-cloud-contract-verifier-integration/pom.xml index 7232f1b65e..01184cff90 100644 --- a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/spring-cloud-contract-verifier-integration/pom.xml +++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/spring-cloud-contract-verifier-integration/pom.xml @@ -8,14 +8,14 @@ 1.0.0.BUILD-SNAPSHOT .. - spring-cloud-verifier-integration + spring-cloud-contract-verifier-integration jar Spring Cloud Contract Verifier Integration Spring Cloud Contract Verifier Integration org.springframework.cloud.contract - spring-cloud-verifier-messaging-core + spring-cloud-contract-verifier-messaging-core org.springframework diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/spring-cloud-contract-verifier-messaging-core/pom.xml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/spring-cloud-contract-verifier-messaging-core/pom.xml index 288b7dadad..7c5a7db46e 100644 --- a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/spring-cloud-contract-verifier-messaging-core/pom.xml +++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/spring-cloud-contract-verifier-messaging-core/pom.xml @@ -8,7 +8,7 @@ 1.0.0.BUILD-SNAPSHOT .. - spring-cloud-verifier-messaging-core + spring-cloud-contract-verifier-messaging-core jar Spring Cloud Contract Verifier Messaging Core Spring Cloud Contract Verifier Messaging Core diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/spring-cloud-contract-verifier-stream/pom.xml b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/spring-cloud-contract-verifier-stream/pom.xml index 5c6d4e3732..5ec0cbffb6 100644 --- a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/spring-cloud-contract-verifier-stream/pom.xml +++ b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-messaging/spring-cloud-contract-verifier-stream/pom.xml @@ -8,14 +8,14 @@ 1.0.0.BUILD-SNAPSHOT .. - spring-cloud-verifier-messaging-stream + spring-cloud-contract-verifier-stream jar - Spring Cloud Contract Verifier Messaging Stream + Spring Cloud Contract Verifier Stream Spring Cloud Contract Verifier Messaging Stream org.springframework.cloud.contract - spring-cloud-verifier-messaging-core + spring-cloud-contract-verifier-messaging-core org.springframework.cloud