diff --git a/README.adoc b/README.adoc index 009021db..070625ee 100644 --- a/README.adoc +++ b/README.adoc @@ -265,4 +265,33 @@ approach of generating documentation just add these plugins to your `docs` modul <3> This plugin is required to parse the Asciidoctor documentation <4> This plugin is required to copy resources into proper final destinations and to generate main README.adoc and to assert that no files use unresolved links -IMPORTANT: The order of plugin declaration is important! \ No newline at end of file +IMPORTANT: The order of plugin declaration is important! + +== Updating the guides + +We assume that your project contains guides under the `guides` folder. + +``` +. +└── guides + ├── gs-guide1 + ├── gs-guide2 + └── gs-guide3 +``` + +This means that the project contains 3 guides that would +correspond to the following guides in Spring Guides org. + +- https://github.com/spring-guides/gs-guide1 +- https://github.com/spring-guides/gs-guide2 +- https://github.com/spring-guides/gs-guide3 + +If you deploy your project with the `-Pguides` profile like this + +``` +$ ./mvnw clean deploy -Pguides +``` + +what will happen is that for GA project versions, we will clone `gs-guide1`, `gs-guide2` and `gs-guide3` and update their contents with the ones being under your `guides` project. + +You can skip this by either not adding the `guides` profile, or passing the `-DskipGuides` system property when the profile is turned on. \ No newline at end of file diff --git a/docs/src/main/asciidoc/README.adoc b/docs/src/main/asciidoc/README.adoc index 44d31c21..7f45802e 100644 --- a/docs/src/main/asciidoc/README.adoc +++ b/docs/src/main/asciidoc/README.adoc @@ -82,4 +82,33 @@ approach of generating documentation just add these plugins to your `docs` modul <3> This plugin is required to parse the Asciidoctor documentation <4> This plugin is required to copy resources into proper final destinations and to generate main README.adoc and to assert that no files use unresolved links -IMPORTANT: The order of plugin declaration is important! \ No newline at end of file +IMPORTANT: The order of plugin declaration is important! + +== Updating the guides + +We assume that your project contains guides under the `guides` folder. + +``` +. +└── guides + ├── gs-guide1 + ├── gs-guide2 + └── gs-guide3 +``` + +This means that the project contains 3 guides that would +correspond to the following guides in Spring Guides org. + +- https://github.com/spring-guides/gs-guide1 +- https://github.com/spring-guides/gs-guide2 +- https://github.com/spring-guides/gs-guide3 + +If you deploy your project with the `-Pguides` profile like this + +``` +$ ./mvnw clean deploy -Pguides +``` + +what will happen is that for GA project versions, we will clone `gs-guide1`, `gs-guide2` and `gs-guide3` and update their contents with the ones being under your `guides` project. + +You can skip this by either not adding the `guides` profile, or passing the `-DskipGuides` system property when the profile is turned on. \ No newline at end of file diff --git a/docs/src/main/asciidoc/update-guides.sh b/docs/src/main/asciidoc/update-guides.sh new file mode 100755 index 00000000..def8399c --- /dev/null +++ b/docs/src/main/asciidoc/update-guides.sh @@ -0,0 +1,149 @@ +#!/bin/bash + +set -e + +GIT_BIN="${GIT_BIN:-git}" + +echo "Project version is [${PROJECT_VERSION}]" +if [[ "${PROJECT_VERSION}" != *"RELEASE"* ]];then + echo "Will not update guides, since the version is not a RELEASE one" + exit 0 +fi + +# The script should be executed from the root folder +[[ -z "${ROOT_FOLDER}" ]] && ROOT_FOLDER="$( pwd )" +echo "Current folder is ${ROOT_FOLDER}" + +if [[ ! -e "${ROOT_FOLDER}/.git" ]]; then + echo "You're not in the root folder of the project!" + exit 1 +fi + +GUIDES_FOLDER="${ROOT_FOLDER}/guides" +SPRING_GUIDES_REPO_ROOT="${SPRING_GUIDES_REPO_ROOT:-git@github.com:spring-guides}" +echo "The Spring Guides repo root is [${SPRING_GUIDES_REPO_ROOT}]" + +if [[ ! -d "${GUIDES_FOLDER}" ]]; then + echo "No [guides] folder is present. Won't do anything" + exit 0 +fi + +function iterate_over_guides() { + for dir in "${GUIDES_FOLDER}"/*/ # list directories in the form "/tmp/dirname/" + do + local dir="${dir%*/}" # remove the trailing "/" + local folderName="${dir##*/}" # print everything after the final "/" + if [[ "${folderName}" == "target" ]]; then + echo "Skipping [${folderName}]" + continue + fi + local guideRepo="${SPRING_GUIDES_REPO_ROOT}/${folderName}" + local clonedGuideFolderParent="${ROOT_FOLDER}/target" + local clonedGuideFolder="${clonedGuideFolderParent}/${folderName}" + echo "Will clone [${guideRepo}] project [${folderName}] to target" + mkdir -p "${clonedGuideFolder}" + rm -rf "${clonedGuideFolder}" + "${GIT_BIN}" clone "${guideRepo}" "${clonedGuideFolder}" + pushd "${clonedGuideFolder}" + echo "Will start the commit process for [${folderName}]" + add_oauth_token_to_remote_url + remove_all_files + copy_new_guide "${GUIDES_FOLDER}/${folderName}" "${clonedGuideFolderParent}" + commit_and_push_new_guide_contents + echo "Successfully copied and pushed new guides for [${guideRepo}]" + popd + done +} + +function commit_and_push_new_guide_contents() { + "${GIT_BIN}" add . + "${GIT_BIN}" commit -m "Updating guides" + "${GIT_BIN}" push origin master +} + +function copy_new_guide() { + local guideFolder="${1}" + local clonedGuideFolder="${2}" + echo "Will copy new guide files from [${guideFolder}/] to [${clonedGuideFolder}]" + cp -r "${guideFolder}/" "${clonedGuideFolder}/" + echo "Copied new guide files" +} + +function remove_all_files() { + echo "Removing all non git files in [$( pwd )]" + "${GIT_BIN}" rm -rf "$( pwd )/" + "${GIT_BIN}" clean -fxd + echo "All files removed" +} + +# Adds the oauth token if present to the remote url +function add_oauth_token_to_remote_url() { + local remote + remote="$( "${GIT_BIN}" config remote.origin.url | sed -e 's/^git:/https:/' )" + echo "Current remote [${remote}]" + if [[ "${RELEASER_GIT_OAUTH_TOKEN}" != "" && ${remote} != *"@"* ]]; then + echo "OAuth token found. Will reuse it to push the code" + withToken=${remote/https:\/\//https://${RELEASER_GIT_OAUTH_TOKEN}@} + "${GIT_BIN}" remote set-url --push origin "${withToken}" + else + echo "No OAuth token found" + "${GIT_BIN}" remote set-url --push origin "$( "${GIT_BIN}" config remote.origin.url | sed -e 's/^git:/https:/' )" + fi +} + +# Prints the usage +function print_usage() { +cat < + org.springframework.cloud + spring-cloud-contract-maven-plugin + ${spring-cloud-contract.version} + true + + hello.BaseClass + + +---- + +`contract-rest-service/src/test/java/hello/BaseClass.java` +[source,java] +---- +include::complete/contract-rest-service/src/test/java/hello/BaseClass.java[] +---- + +At this step, when the tests are executed, test results should be GREEN indicating that the REST controller is aligned with the contract and you have a fully functioning service. + +==== Check the simple Person query business logic + +Model class `Person.java` +`contract-rest-service/src/main/java/hello/Person.java` +[source,java] +---- +include::complete/contract-rest-service/src/main/java/hello/Person.java[] +---- + +Service bean `PersonService.java` which just populates a few Person entity in memory and returns the one when asked. +`contract-rest-service/src/main/java/hello/PersonService.java` +[source,java] +---- +include::complete/contract-rest-service/src/main/java/hello/PersonService.java[] +---- + +RestController bean `PersonRestController.java` which calls `PersonService` bean when a REST request is received for a person with the id. +`contract-rest-service/src/main/java/hello/PersonRestController.java` +[source,java] +---- +include::complete/contract-rest-service/src/main/java/hello/PersonRestController.java[] +---- + +=== Test the contract-rest-service application + +Run the `ContractRestServiceApplication.java` class as a Java Application or Spring Boot Application. The service should start at port `8000`. + +Visit the service in the browser `http://localhost:8000/person/1`, `http://localhost:8000/person/2`, etc. + +== Create contract consumer service + +With the contract producer service ready, now we need to crate the client application which consumes the contract provided. This is a regular Spring Boot application providing a very simple REST service. The rest service simply returns a message with the queried Person's name, e.g. `Hello Anna`. + +`contract-rest-client/src/main/java/hello/ContractRestClientApplication.java` +[source,java] +---- +include::complete/contract-rest-client/src/main/java/hello/ContractRestClientApplication.java[] +---- + +=== Create the contract test + +The contract provided by the producer should be consumed as a simple Spring test. + +`contract-rest-client/src/test/java/hello/ContractRestClientApplicationTest.java` +[source,java] +---- +include::complete/contract-rest-client/src/test/java/hello/ContractRestClientApplicationTest.java[] +---- + +This test class will load the stubs of the contract producer service and make sure that the integration to the service is aligned with the contract. + +In case the communication is faulty between the consumer service's test and the producer's contract, tests will fail and the problem will need to be fixed before making a new change on production. + +=== Test the contract-rest-client application + +Run the `ContractRestClientApplication.java` class as a Java Application or Spring Boot Application. The service should start at port `9000`. + +Visit the service in the browser `http://localhost:9000/message/1`, `http://localhost:9000/message/2`, etc. + + +== Summary + +Congratulations! You've just used Spring to make your REST services declare their contract and consumer service be aligned with this contract. + + +== See Also + +The following guides may also be helpful: + +* https://spring.io/guides/gs/spring-boot/[Building an Application with Spring Boot] +* https://spring.io/guides/gs/multi-module/[Creating a Multi Module Project] + +include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/master/footer.adoc[] diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/.mvn/wrapper/maven-wrapper.jar b/docs/src/test/bats/fixtures/gs-contract-rest/complete/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 00000000..5fd4d502 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/complete/.mvn/wrapper/maven-wrapper.jar differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/.mvn/wrapper/maven-wrapper.properties b/docs/src/test/bats/fixtures/gs-contract-rest/complete/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 00000000..c954cec9 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/.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 diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/build.gradle b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/build.gradle new file mode 100644 index 00000000..19acf2f6 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/build.gradle @@ -0,0 +1,43 @@ +buildscript { + ext { springBootVersion = '2.1.4.RELEASE' } + repositories { mavenCentral() } + dependencies { + classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") + } +} + +apply plugin: 'java' +apply plugin: 'eclipse' +apply plugin: 'idea' +apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' + +group = 'com.example' +version = '0.0.1-SNAPSHOT' +bootJar { + baseName = 'contract-rest-client' +} +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + +repositories { mavenCentral() } + +dependencies { + compile('org.springframework.boot:spring-boot-starter-web') + testCompile('org.springframework.boot:spring-boot-starter-test') + testCompile('org.springframework.cloud:spring-cloud-starter-contract-stub-runner') +} + +dependencyManagement { + imports { + mavenBom "org.springframework.cloud:spring-cloud-dependencies:Finchley.SR2" + } +} + +eclipse { + classpath { + containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') + containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' + } +} + diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/gradle/wrapper/gradle-wrapper.jar b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..6b6ea3ab Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/gradle/wrapper/gradle-wrapper.jar differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/gradle/wrapper/gradle-wrapper.properties b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..ea720f98 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/gradlew b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/gradlew new file mode 100755 index 00000000..cccdd3d5 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## 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 + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/gradlew.bat b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/gradlew.bat new file mode 100644 index 00000000..f9553162 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/pom.xml b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/pom.xml new file mode 100644 index 00000000..77f7e96a --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/pom.xml @@ -0,0 +1,64 @@ + + + 4.0.0 + + com.example + contract-rest-client + 0.0.1-SNAPSHOT + jar + + + org.springframework.boot + spring-boot-starter-parent + 2.1.4.RELEASE + + + + + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.cloud + spring-cloud-starter-contract-stub-runner + test + + + + + + + + org.springframework.cloud + spring-cloud-dependencies + Finchley.SR2 + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/src/main/java/hello/ContractRestClientApplication.java b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/src/main/java/hello/ContractRestClientApplication.java new file mode 100644 index 00000000..2ae34d72 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/src/main/java/hello/ContractRestClientApplication.java @@ -0,0 +1,34 @@ +package hello; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestTemplate; + +@SpringBootApplication +public class ContractRestClientApplication { + + public static void main(String[] args) { + SpringApplication.run(ContractRestClientApplication.class, args); + } +} + +@RestController +class MessageRestController { + + private final RestTemplate restTemplate; + + MessageRestController(RestTemplateBuilder restTemplateBuilder) { + this.restTemplate = restTemplateBuilder.build(); + } + + @RequestMapping("/message/{personId}") + String getMessage(@PathVariable("personId") Long personId) { + Person person = this.restTemplate.getForObject("http://localhost:8000/person/{personId}", Person.class, personId); + return "Hello " + person.getName(); + } + +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/src/main/java/hello/Person.java b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/src/main/java/hello/Person.java new file mode 100644 index 00000000..14225f9c --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/src/main/java/hello/Person.java @@ -0,0 +1,44 @@ +package hello; + +class Person { + + public Person() { + } + + public Person(Long id, String name, String surname) { + this.id = id; + this.name = name; + this.surname = surname; + } + + private Long id; + + private String name; + + private String surname; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSurname() { + return surname; + } + + public void setSurname(String surname) { + this.surname = surname; + } + +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/src/main/resources/application.properties b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/src/main/resources/application.properties new file mode 100644 index 00000000..af7da77e --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/src/main/resources/application.properties @@ -0,0 +1,3 @@ +spring.application.name=contract-rest-client + +server.port=9000 diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/src/test/java/hello/ContractRestClientApplicationTest.java b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/src/test/java/hello/ContractRestClientApplicationTest.java new file mode 100644 index 00000000..831b53df --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-client/src/test/java/hello/ContractRestClientApplicationTest.java @@ -0,0 +1,39 @@ +package hello; + +import org.assertj.core.api.BDDAssertions; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.cloud.contract.stubrunner.junit.StubRunnerRule; +import org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.web.client.RestTemplate; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class ContractRestClientApplicationTest { + + @Rule + public StubRunnerRule stubRunnerRule = new StubRunnerRule() + .downloadStub("com.example", "contract-rest-service", "0.0.1-SNAPSHOT", "stubs") + .withPort(8100) + .stubsMode(StubRunnerProperties.StubsMode.LOCAL); + + @Test + public void get_person_from_service_contract() { + // given: + RestTemplate restTemplate = new RestTemplate(); + + // when: + ResponseEntity personResponseEntity = restTemplate.getForEntity("http://localhost:8100/person/1", Person.class); + + // then: + BDDAssertions.then(personResponseEntity.getStatusCodeValue()).isEqualTo(200); + BDDAssertions.then(personResponseEntity.getBody().getId()).isEqualTo(1l); + BDDAssertions.then(personResponseEntity.getBody().getName()).isEqualTo("foo"); + BDDAssertions.then(personResponseEntity.getBody().getSurname()).isEqualTo("bee"); + + } +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/build.gradle b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/build.gradle new file mode 100644 index 00000000..ab4228bb --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/build.gradle @@ -0,0 +1,50 @@ +buildscript { + ext { + springBootVersion = '2.1.4.RELEASE' + verifierVersion = '2.0.2.RELEASE' + } + repositories { mavenCentral() } + dependencies { + classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") + classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${verifierVersion}" + } +} + +apply plugin: 'groovy' +apply plugin: 'java' +apply plugin: 'eclipse' +apply plugin: 'idea' +apply plugin: 'maven' +apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' +apply plugin: 'spring-cloud-contract' + + +group = 'com.example' +version = '0.0.1-SNAPSHOT' +bootJar { + baseName = 'contract-rest-service' +} +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + +repositories { mavenCentral() } + +dependencies { + compile('org.springframework.boot:spring-boot-starter-web') + testCompile('org.springframework.boot:spring-boot-starter-test') + testCompile('org.springframework.cloud:spring-cloud-starter-contract-verifier') +} + +dependencyManagement { + imports { + mavenBom "org.springframework.cloud:spring-cloud-dependencies:Finchley.SR2" + } +} + +contracts { + packageWithBaseClasses = 'hello' + baseClassMappings { + baseClassMapping(".*hello.*", "hello.BaseClass") + } +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/gradle/wrapper/gradle-wrapper.jar b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..6b6ea3ab Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/gradle/wrapper/gradle-wrapper.jar differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/gradle/wrapper/gradle-wrapper.properties b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..ea720f98 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/gradlew b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/gradlew new file mode 100755 index 00000000..cccdd3d5 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## 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 + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/gradlew.bat b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/gradlew.bat new file mode 100644 index 00000000..f9553162 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/pom.xml b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/pom.xml new file mode 100644 index 00000000..432772db --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/pom.xml @@ -0,0 +1,77 @@ + + + 4.0.0 + + com.example + contract-rest-service + 0.0.1-SNAPSHOT + jar + + + org.springframework.boot + spring-boot-starter-parent + 2.1.4.RELEASE + + + + + UTF-8 + 1.8 + Finchley.SR2 + 2.0.2.RELEASE + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.cloud + spring-cloud-starter-contract-verifier + test + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.springframework.cloud + spring-cloud-contract-maven-plugin + ${spring-cloud-contract.version} + true + + hello.BaseClass + + + + + + + + + diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/main/java/hello/ContractRestServiceApplication.java b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/main/java/hello/ContractRestServiceApplication.java new file mode 100644 index 00000000..081ec994 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/main/java/hello/ContractRestServiceApplication.java @@ -0,0 +1,12 @@ +package hello; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ContractRestServiceApplication { + + public static void main(String[] args) { + SpringApplication.run(ContractRestServiceApplication.class, args); + } +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/main/java/hello/Person.java b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/main/java/hello/Person.java new file mode 100644 index 00000000..988259b9 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/main/java/hello/Person.java @@ -0,0 +1,40 @@ +package hello; + +class Person { + + Person(Long id, String name, String surname) { + this.id = id; + this.name = name; + this.surname = surname; + } + + private Long id; + + private String name; + + private String surname; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSurname() { + return surname; + } + + public void setSurname(String surname) { + this.surname = surname; + } +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/main/java/hello/PersonRestController.java b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/main/java/hello/PersonRestController.java new file mode 100644 index 00000000..7e13377a --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/main/java/hello/PersonRestController.java @@ -0,0 +1,20 @@ +package hello; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RestController; + +@RestController +class PersonRestController { + + private final PersonService personService; + + public PersonRestController(PersonService personService) { + this.personService = personService; + } + + @GetMapping("/person/{id}") + public Person findPersonById(@PathVariable("id") Long id) { + return personService.findPersonById(id); + } +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/main/java/hello/PersonService.java b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/main/java/hello/PersonService.java new file mode 100644 index 00000000..fa70645f --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/main/java/hello/PersonService.java @@ -0,0 +1,23 @@ +package hello; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.stereotype.Service; + +@Service +class PersonService { + + private final Map personMap; + + public PersonService() { + personMap = new HashMap<>(); + personMap.put(1L, new Person(1L, "Richard", "Gere")); + personMap.put(2L, new Person(2L, "Emma", "Choplin")); + personMap.put(3L, new Person(3L, "Anna", "Carolina")); + } + + Person findPersonById(Long id) { + return personMap.get(id); + } +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/main/resources/application.properties b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/main/resources/application.properties new file mode 100644 index 00000000..5ee314c7 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/main/resources/application.properties @@ -0,0 +1 @@ +server.port=8000 diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/test/java/hello/BaseClass.java b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/test/java/hello/BaseClass.java new file mode 100644 index 00000000..0331aa78 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/test/java/hello/BaseClass.java @@ -0,0 +1,28 @@ +package hello; + +import org.junit.Before; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.context.junit4.SpringRunner; + +import io.restassured.module.mockmvc.RestAssuredMockMvc; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = ContractRestServiceApplication.class) +public abstract class BaseClass { + + @Autowired PersonRestController personRestController; + + @MockBean PersonService personService; + + @Before public void setup() { + RestAssuredMockMvc.standaloneSetup(personRestController); + + Mockito.when(personService.findPersonById(1L)) + .thenReturn(new Person(1L, "foo", "bee")); + } + +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/test/resources/contracts/hello/find_person_by_id.groovy b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/test/resources/contracts/hello/find_person_by_id.groovy new file mode 100644 index 00000000..fee99aad --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/contract-rest-service/src/test/resources/contracts/hello/find_person_by_id.groovy @@ -0,0 +1,22 @@ +import org.springframework.cloud.contract.spec.Contract + +Contract.make { + description "should return person by id=1" + + request { + url "/person/1" + method GET() + } + + response { + status OK() + headers { + contentType applicationJson() + } + body ( + id: 1, + name: "foo", + surname: "bee" + ) + } +} \ No newline at end of file diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/gradle/wrapper/gradle-wrapper.jar b/docs/src/test/bats/fixtures/gs-contract-rest/complete/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..877f7c1f Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/complete/gradle/wrapper/gradle-wrapper.jar differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/gradle/wrapper/gradle-wrapper.properties b/docs/src/test/bats/fixtures/gs-contract-rest/complete/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..ea55541d --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Nov 15 10:48:25 CET 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-bin.zip diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/gradlew b/docs/src/test/bats/fixtures/gs-contract-rest/complete/gradlew new file mode 100755 index 00000000..9d82f789 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/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/docs/src/test/bats/fixtures/gs-contract-rest/complete/gradlew.bat b/docs/src/test/bats/fixtures/gs-contract-rest/complete/gradlew.bat new file mode 100644 index 00000000..8a0b282a --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/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 Windowz 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/docs/src/test/bats/fixtures/gs-contract-rest/complete/mvnw b/docs/src/test/bats/fixtures/gs-contract-rest/complete/mvnw new file mode 100755 index 00000000..02217b1e --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/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 +# +# https://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/docs/src/test/bats/fixtures/gs-contract-rest/complete/mvnw.cmd b/docs/src/test/bats/fixtures/gs-contract-rest/complete/mvnw.cmd new file mode 100755 index 00000000..4b98b78c --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/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 https://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/docs/src/test/bats/fixtures/gs-contract-rest/complete/pom.xml b/docs/src/test/bats/fixtures/gs-contract-rest/complete/pom.xml new file mode 100644 index 00000000..edeb2a15 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + org.springframework + gs-contract-rest + 0.1.0 + + pom + + + contract-rest-service + contract-rest-client + + + diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/complete/settings.gradle b/docs/src/test/bats/fixtures/gs-contract-rest/complete/settings.gradle new file mode 100644 index 00000000..1008e67c --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/complete/settings.gradle @@ -0,0 +1,4 @@ +rootProject.name = 'gs-contract-rest' + +include 'contract-rest-service' +include 'contract-rest-client' diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/COMMIT_EDITMSG b/docs/src/test/bats/fixtures/gs-contract-rest/git/COMMIT_EDITMSG new file mode 100644 index 00000000..9dfcf117 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/COMMIT_EDITMSG @@ -0,0 +1 @@ +Updated to latest diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/FETCH_HEAD b/docs/src/test/bats/fixtures/gs-contract-rest/git/FETCH_HEAD new file mode 100644 index 00000000..fe5aae60 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/FETCH_HEAD @@ -0,0 +1 @@ +1d776d21deba9bd58877220abd802e8794ddb6a3 branch 'master' of github.com:spring-guides/gs-contract-rest diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/HEAD b/docs/src/test/bats/fixtures/gs-contract-rest/git/HEAD new file mode 100644 index 00000000..cb089cd8 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/ORIG_HEAD b/docs/src/test/bats/fixtures/gs-contract-rest/git/ORIG_HEAD new file mode 100644 index 00000000..5d3dda78 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/ORIG_HEAD @@ -0,0 +1 @@ +06e323583eeda1364779d80eef55110256411426 diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/config b/docs/src/test/bats/fixtures/gs-contract-rest/git/config new file mode 100644 index 00000000..fe29604c --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/config @@ -0,0 +1,11 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true +[remote "origin"] + url = git@github.com:spring-guides/gs-contract-rest.git + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/description b/docs/src/test/bats/fixtures/gs-contract-rest/git/description new file mode 100644 index 00000000..498b267a --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/applypatch-msg.sample b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/applypatch-msg.sample new file mode 100755 index 00000000..a5d7b84a --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/applypatch-msg.sample @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +commitmsg="$(git rev-parse --git-path hooks/commit-msg)" +test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} +: diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/commit-msg.sample b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/commit-msg.sample new file mode 100755 index 00000000..b58d1184 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/commit-msg.sample @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/fsmonitor-watchman.sample b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/fsmonitor-watchman.sample new file mode 100755 index 00000000..e673bb39 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/fsmonitor-watchman.sample @@ -0,0 +1,114 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use IPC::Open2; + +# An example hook script to integrate Watchman +# (https://facebook.github.io/watchman/) with git to speed up detecting +# new and modified files. +# +# The hook is passed a version (currently 1) and a time in nanoseconds +# formatted as a string and outputs to stdout all files that have been +# modified since the given time. Paths must be relative to the root of +# the working tree and separated by a single NUL. +# +# To enable this hook, rename this file to "query-watchman" and set +# 'git config core.fsmonitor .git/hooks/query-watchman' +# +my ($version, $time) = @ARGV; + +# Check the hook interface version + +if ($version == 1) { + # convert nanoseconds to seconds + $time = int $time / 1000000000; +} else { + die "Unsupported query-fsmonitor hook version '$version'.\n" . + "Falling back to scanning...\n"; +} + +my $git_work_tree; +if ($^O =~ 'msys' || $^O =~ 'cygwin') { + $git_work_tree = Win32::GetCwd(); + $git_work_tree =~ tr/\\/\//; +} else { + require Cwd; + $git_work_tree = Cwd::cwd(); +} + +my $retry = 1; + +launch_watchman(); + +sub launch_watchman { + + my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty') + or die "open2() failed: $!\n" . + "Falling back to scanning...\n"; + + # In the query expression below we're asking for names of files that + # changed since $time but were not transient (ie created after + # $time but no longer exist). + # + # To accomplish this, we're using the "since" generator to use the + # recency index to select candidate nodes and "fields" to limit the + # output to file names only. Then we're using the "expression" term to + # further constrain the results. + # + # The category of transient files that we want to ignore will have a + # creation clock (cclock) newer than $time_t value and will also not + # currently exist. + + my $query = <<" END"; + ["query", "$git_work_tree", { + "since": $time, + "fields": ["name"], + "expression": ["not", ["allof", ["since", $time, "cclock"], ["not", "exists"]]] + }] + END + + print CHLD_IN $query; + close CHLD_IN; + my $response = do {local $/; }; + + die "Watchman: command returned no output.\n" . + "Falling back to scanning...\n" if $response eq ""; + die "Watchman: command returned invalid output: $response\n" . + "Falling back to scanning...\n" unless $response =~ /^\{/; + + my $json_pkg; + eval { + require JSON::XS; + $json_pkg = "JSON::XS"; + 1; + } or do { + require JSON::PP; + $json_pkg = "JSON::PP"; + }; + + my $o = $json_pkg->new->utf8->decode($response); + + if ($retry > 0 and $o->{error} and $o->{error} =~ m/unable to resolve root .* directory (.*) is not watched/) { + print STDERR "Adding '$git_work_tree' to watchman's watch list.\n"; + $retry--; + qx/watchman watch "$git_work_tree"/; + die "Failed to make watchman watch '$git_work_tree'.\n" . + "Falling back to scanning...\n" if $? != 0; + + # Watchman will always return all files on the first query so + # return the fast "everything is dirty" flag to git and do the + # Watchman query just to get it over with now so we won't pay + # the cost in git to look up each individual file. + print "/\0"; + eval { launch_watchman() }; + exit 0; + } + + die "Watchman: $o->{error}.\n" . + "Falling back to scanning...\n" if $o->{error}; + + binmode STDOUT, ":utf8"; + local $, = "\0"; + print @{$o->{files}}; +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/post-update.sample b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/post-update.sample new file mode 100755 index 00000000..ec17ec19 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/post-update.sample @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/pre-applypatch.sample b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/pre-applypatch.sample new file mode 100755 index 00000000..4142082b --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/pre-applypatch.sample @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +precommit="$(git rev-parse --git-path hooks/pre-commit)" +test -x "$precommit" && exec "$precommit" ${1+"$@"} +: diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/pre-commit.sample b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/pre-commit.sample new file mode 100755 index 00000000..68d62d54 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/pre-commit.sample @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/pre-push.sample b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/pre-push.sample new file mode 100755 index 00000000..6187dbf4 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/pre-push.sample @@ -0,0 +1,53 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +z40=0000000000000000000000000000000000000000 + +while read local_ref local_sha remote_ref remote_sha +do + if [ "$local_sha" = $z40 ] + then + # Handle delete + : + else + if [ "$remote_sha" = $z40 ] + then + # New branch, examine all commits + range="$local_sha" + else + # Update to existing branch, examine new commits + range="$remote_sha..$local_sha" + fi + + # Check for WIP commit + commit=`git rev-list -n 1 --grep '^WIP' "$range"` + if [ -n "$commit" ] + then + echo >&2 "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/pre-rebase.sample b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/pre-rebase.sample new file mode 100755 index 00000000..6cbef5c3 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/pre-rebase.sample @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up to date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/pre-receive.sample b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/pre-receive.sample new file mode 100755 index 00000000..a1fd29ec --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/pre-receive.sample @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to make use of push options. +# The example simply echoes all push options that start with 'echoback=' +# and rejects all pushes when the "reject" push option is used. +# +# To enable this hook, rename this file to "pre-receive". + +if test -n "$GIT_PUSH_OPTION_COUNT" +then + i=0 + while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" + do + eval "value=\$GIT_PUSH_OPTION_$i" + case "$value" in + echoback=*) + echo "echo from the pre-receive-hook: ${value#*=}" >&2 + ;; + reject) + exit 1 + esac + i=$((i + 1)) + done +fi diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/prepare-commit-msg.sample b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/prepare-commit-msg.sample new file mode 100755 index 00000000..10fa14c5 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/prepare-commit-msg.sample @@ -0,0 +1,42 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first one removes the +# "# Please enter the commit message..." help message. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +COMMIT_MSG_FILE=$1 +COMMIT_SOURCE=$2 +SHA1=$3 + +/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE" + +# case "$COMMIT_SOURCE,$SHA1" in +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;; +# *) ;; +# esac + +# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE" +# if test -z "$COMMIT_SOURCE" +# then +# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE" +# fi diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/update.sample b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/update.sample new file mode 100755 index 00000000..80ba9413 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/hooks/update.sample @@ -0,0 +1,128 @@ +#!/bin/sh +# +# An example hook script to block unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --bool hooks.allowunannotated) +allowdeletebranch=$(git config --bool hooks.allowdeletebranch) +denycreatebranch=$(git config --bool hooks.denycreatebranch) +allowdeletetag=$(git config --bool hooks.allowdeletetag) +allowmodifytag=$(git config --bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero="0000000000000000000000000000000000000000" +if [ "$newrev" = "$zero" ]; then + newrev_type=delete +else + newrev_type=$(git cat-file -t $newrev) +fi + +case "$refname","$newrev_type" in + refs/tags/*,commit) + # un-annotated tag + short_refname=${refname##refs/tags/} + if [ "$allowunannotated" != "true" ]; then + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/index b/docs/src/test/bats/fixtures/gs-contract-rest/git/index new file mode 100644 index 00000000..df6d496a Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/index differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/info/exclude b/docs/src/test/bats/fixtures/gs-contract-rest/git/info/exclude new file mode 100644 index 00000000..a5196d1b --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/info/exclude @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/logs/HEAD b/docs/src/test/bats/fixtures/gs-contract-rest/git/logs/HEAD new file mode 100644 index 00000000..44e42740 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/logs/HEAD @@ -0,0 +1,4 @@ +0000000000000000000000000000000000000000 f0bd0f6aaabf6cc795d48fa1cc7fb02b6bffab5e Marcin Grzejszczak 1545049294 +0100 clone: from git@github.com:spring-guides/gs-contract-rest.git +f0bd0f6aaabf6cc795d48fa1cc7fb02b6bffab5e 06e323583eeda1364779d80eef55110256411426 Marcin Grzejszczak 1545050508 +0100 commit: Updated contract to the latest version; fixes gh-2 +06e323583eeda1364779d80eef55110256411426 1d776d21deba9bd58877220abd802e8794ddb6a3 Marcin Grzejszczak 1556531881 +0400 pull --rebase origin master: Fast-forward +1d776d21deba9bd58877220abd802e8794ddb6a3 9918bc61b3b4ba0b5005e9ed7debdd50c9838393 Marcin Grzejszczak 1556532308 +0400 commit: Updated to latest diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/logs/refs/heads/master b/docs/src/test/bats/fixtures/gs-contract-rest/git/logs/refs/heads/master new file mode 100644 index 00000000..44e42740 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/logs/refs/heads/master @@ -0,0 +1,4 @@ +0000000000000000000000000000000000000000 f0bd0f6aaabf6cc795d48fa1cc7fb02b6bffab5e Marcin Grzejszczak 1545049294 +0100 clone: from git@github.com:spring-guides/gs-contract-rest.git +f0bd0f6aaabf6cc795d48fa1cc7fb02b6bffab5e 06e323583eeda1364779d80eef55110256411426 Marcin Grzejszczak 1545050508 +0100 commit: Updated contract to the latest version; fixes gh-2 +06e323583eeda1364779d80eef55110256411426 1d776d21deba9bd58877220abd802e8794ddb6a3 Marcin Grzejszczak 1556531881 +0400 pull --rebase origin master: Fast-forward +1d776d21deba9bd58877220abd802e8794ddb6a3 9918bc61b3b4ba0b5005e9ed7debdd50c9838393 Marcin Grzejszczak 1556532308 +0400 commit: Updated to latest diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/logs/refs/remotes/origin/HEAD b/docs/src/test/bats/fixtures/gs-contract-rest/git/logs/refs/remotes/origin/HEAD new file mode 100644 index 00000000..c09eb876 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/logs/refs/remotes/origin/HEAD @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 f0bd0f6aaabf6cc795d48fa1cc7fb02b6bffab5e Marcin Grzejszczak 1545049294 +0100 clone: from git@github.com:spring-guides/gs-contract-rest.git diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/logs/refs/remotes/origin/master b/docs/src/test/bats/fixtures/gs-contract-rest/git/logs/refs/remotes/origin/master new file mode 100644 index 00000000..ad3e734f --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/logs/refs/remotes/origin/master @@ -0,0 +1,3 @@ +f0bd0f6aaabf6cc795d48fa1cc7fb02b6bffab5e 06e323583eeda1364779d80eef55110256411426 Marcin Grzejszczak 1545050516 +0100 update by push +06e323583eeda1364779d80eef55110256411426 1d776d21deba9bd58877220abd802e8794ddb6a3 Marcin Grzejszczak 1556531881 +0400 pull --rebase origin master: fast-forward +1d776d21deba9bd58877220abd802e8794ddb6a3 9918bc61b3b4ba0b5005e9ed7debdd50c9838393 Marcin Grzejszczak 1556532314 +0400 update by push diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/02/217b1ecbbaad1a2f40af8ae23e9d0646c128cd b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/02/217b1ecbbaad1a2f40af8ae23e9d0646c128cd new file mode 100644 index 00000000..dc714cc9 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/02/217b1ecbbaad1a2f40af8ae23e9d0646c128cd differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/05/642da04af298f4073e65af38040869340f5dcf b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/05/642da04af298f4073e65af38040869340f5dcf new file mode 100644 index 00000000..3bd1b720 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/05/642da04af298f4073e65af38040869340f5dcf differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/05/c625cda72724071a9f0ad794f9e76f7db6ea74 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/05/c625cda72724071a9f0ad794f9e76f7db6ea74 new file mode 100644 index 00000000..91db0962 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/05/c625cda72724071a9f0ad794f9e76f7db6ea74 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/06/e323583eeda1364779d80eef55110256411426 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/06/e323583eeda1364779d80eef55110256411426 new file mode 100644 index 00000000..e5def2af Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/06/e323583eeda1364779d80eef55110256411426 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/07/c5d94dec69904bc5909c980429cece477dfcef b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/07/c5d94dec69904bc5909c980429cece477dfcef new file mode 100644 index 00000000..fb84ec37 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/07/c5d94dec69904bc5909c980429cece477dfcef differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/0c/76fd1968cf36fd58b656fad187600898ec529d b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/0c/76fd1968cf36fd58b656fad187600898ec529d new file mode 100644 index 00000000..e69d39bd Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/0c/76fd1968cf36fd58b656fad187600898ec529d differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/10/58721e18f5701a7df5e054669153bd96cd671a b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/10/58721e18f5701a7df5e054669153bd96cd671a new file mode 100644 index 00000000..3df31dac Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/10/58721e18f5701a7df5e054669153bd96cd671a differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/12/f88cf082eb043cf13c28ffc34d3803780389b1 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/12/f88cf082eb043cf13c28ffc34d3803780389b1 new file mode 100644 index 00000000..9cb79b00 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/12/f88cf082eb043cf13c28ffc34d3803780389b1 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/14/0c91f11cd2795f57128b6949ad0f27250f25c1 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/14/0c91f11cd2795f57128b6949ad0f27250f25c1 new file mode 100644 index 00000000..6a8a9184 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/14/0c91f11cd2795f57128b6949ad0f27250f25c1 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/14/ed2dca94be823fe1a17c1135496759df85c6f4 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/14/ed2dca94be823fe1a17c1135496759df85c6f4 new file mode 100644 index 00000000..7faae558 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/14/ed2dca94be823fe1a17c1135496759df85c6f4 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/16/5e7f36b3b60076b69486b822d30fbec60ead8e b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/16/5e7f36b3b60076b69486b822d30fbec60ead8e new file mode 100644 index 00000000..5cb77555 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/16/5e7f36b3b60076b69486b822d30fbec60ead8e differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/19/acf2f6cc0f0ce4dadfe84585c8dc9f9a0adefe b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/19/acf2f6cc0f0ce4dadfe84585c8dc9f9a0adefe new file mode 100644 index 00000000..4909aff2 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/19/acf2f6cc0f0ce4dadfe84585c8dc9f9a0adefe differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/1d/776d21deba9bd58877220abd802e8794ddb6a3 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/1d/776d21deba9bd58877220abd802e8794ddb6a3 new file mode 100644 index 00000000..08dc0a27 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/1d/776d21deba9bd58877220abd802e8794ddb6a3 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/34/36aa104c656156ab2a07a70f48df45c2a5aad7 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/34/36aa104c656156ab2a07a70f48df45c2a5aad7 new file mode 100644 index 00000000..acb4aa55 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/34/36aa104c656156ab2a07a70f48df45c2a5aad7 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/36/7a2c8f0efd08ee6e9fd0eec0d81c96e86007fa b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/36/7a2c8f0efd08ee6e9fd0eec0d81c96e86007fa new file mode 100644 index 00000000..90c5d9fe Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/36/7a2c8f0efd08ee6e9fd0eec0d81c96e86007fa differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/37/a44dfd41056b153b5e16f66b2c890b0bd2ac45 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/37/a44dfd41056b153b5e16f66b2c890b0bd2ac45 new file mode 100644 index 00000000..1583a413 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/37/a44dfd41056b153b5e16f66b2c890b0bd2ac45 @@ -0,0 +1,4 @@ +xTj0ݫ Y4C2XьYo%$ŝ)^9`qʺ'Ws :]}xS*xDJ+j IЏ4Kݭ7,`{4M$ٓĂNzm%8y +oL)6`);gNRm+vsoy >-<奂ܨ]%ۧ}: #.=+ޕp 'Nfߧa=!#UVN˿yGEJ,a.:wy^A.=~F J6nэsgsə~d(;+`k4YRI!֌]m 8`$ė +&Kb ^!ri6"8B8DTubMt0"k 3AQ'وmC2=Kc +I؂R7 9:NRvџ`;n#b}z \ No newline at end of file diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/39/3a15a127573a68fae586616c9a4a3cf1a5f9fe b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/39/3a15a127573a68fae586616c9a4a3cf1a5f9fe new file mode 100644 index 00000000..6ff47bbf Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/39/3a15a127573a68fae586616c9a4a3cf1a5f9fe differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/42/6b51cb75cb7cb668ff9988054db174b2fecf96 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/42/6b51cb75cb7cb668ff9988054db174b2fecf96 new file mode 100644 index 00000000..a62cc4cd Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/42/6b51cb75cb7cb668ff9988054db174b2fecf96 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/43/2772dbfb681ea778012f875d4234944096bc93 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/43/2772dbfb681ea778012f875d4234944096bc93 new file mode 100644 index 00000000..e447cebe Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/43/2772dbfb681ea778012f875d4234944096bc93 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/43/42e448a0b60216f76c1aab5e6b5d4b76f47454 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/43/42e448a0b60216f76c1aab5e6b5d4b76f47454 new file mode 100644 index 00000000..751f865c Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/43/42e448a0b60216f76c1aab5e6b5d4b76f47454 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/43/9311e4ddc9d8e15c210f63852207e3ebb51757 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/43/9311e4ddc9d8e15c210f63852207e3ebb51757 new file mode 100644 index 00000000..bbe6d112 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/43/9311e4ddc9d8e15c210f63852207e3ebb51757 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/44/dcc06bf5e546644d945fc4a1f63c2c5a5e04eb b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/44/dcc06bf5e546644d945fc4a1f63c2c5a5e04eb new file mode 100644 index 00000000..5161e965 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/44/dcc06bf5e546644d945fc4a1f63c2c5a5e04eb @@ -0,0 +1,3 @@ +x+)JMU025b040031Q+.(KwJM+fNH%M<5o]YT]RifN^zQbJN*nRQ*-/& P*my +_e4l_ 275(g8sU?AJ`x^_3]CK~&}T:.m(\s㭛 +s*rsxJf7-oB\S\̐޽{wd79KoR"hA(Ζlx \'L] WZ猥|9W@\[vJG&ET\-~h4fnofx0$ΔY 8W6z#B-W#ScI,-`p"+;|֊ ȿEA(R +; +s.uࡶLK$& +&@ 9@}̾_Ͼ=#\%Q[Cz U!/!RҺ^6oY +snia}}jHZEOH}f̜U.\ȦϺF;Ь%jgtIn=܂u['>n|C3~VO΋սv2cFZ n\O"^pzcS/ WZG\**XA qX7Aj3vI9M1a|PԂ_13 \ No newline at end of file diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/5e/cfe0a368c37fc691fbc4402d7b7c9a09bc61c9 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/5e/cfe0a368c37fc691fbc4402d7b7c9a09bc61c9 new file mode 100644 index 00000000..e4fbc7d9 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/5e/cfe0a368c37fc691fbc4402d7b7c9a09bc61c9 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/60/f8f09f47b7f829675c4605064077dd1cacc5af b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/60/f8f09f47b7f829675c4605064077dd1cacc5af new file mode 100644 index 00000000..7e2f0b6b Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/60/f8f09f47b7f829675c4605064077dd1cacc5af differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/63/69872cfd8183dc786fb7b63287e4c902c9a9c1 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/63/69872cfd8183dc786fb7b63287e4c902c9a9c1 new file mode 100644 index 00000000..f5834abf Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/63/69872cfd8183dc786fb7b63287e4c902c9a9c1 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/64/14451b4b130a26848705ef62bf4bdb2bbc1e82 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/64/14451b4b130a26848705ef62bf4bdb2bbc1e82 new file mode 100644 index 00000000..d542dc48 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/64/14451b4b130a26848705ef62bf4bdb2bbc1e82 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/65/6cf310557e762b7a41984324b6374069c74830 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/65/6cf310557e762b7a41984324b6374069c74830 new file mode 100644 index 00000000..89094cb7 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/65/6cf310557e762b7a41984324b6374069c74830 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/66/a90db2ca3cfd613c56c0ec359c0ae389028b92 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/66/a90db2ca3cfd613c56c0ec359c0ae389028b92 new file mode 100644 index 00000000..a5c7692f Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/66/a90db2ca3cfd613c56c0ec359c0ae389028b92 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/69/15eac7f22860887f3b38fbb69f1bc05a81ee81 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/69/15eac7f22860887f3b38fbb69f1bc05a81ee81 new file mode 100644 index 00000000..1212d8c5 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/69/15eac7f22860887f3b38fbb69f1bc05a81ee81 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/6d/200fda0a7535a5b3593ae8aaba6725f0c745c6 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/6d/200fda0a7535a5b3593ae8aaba6725f0c745c6 new file mode 100644 index 00000000..57c904cc Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/6d/200fda0a7535a5b3593ae8aaba6725f0c745c6 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/6d/3283f926beb40856d18052f7ebd68e01033b6c b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/6d/3283f926beb40856d18052f7ebd68e01033b6c new file mode 100644 index 00000000..cb8a9275 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/6d/3283f926beb40856d18052f7ebd68e01033b6c differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/6e/1b6437bbb1c27d6f019b53b5ec3033838bf0c3 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/6e/1b6437bbb1c27d6f019b53b5ec3033838bf0c3 new file mode 100644 index 00000000..ef40c139 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/6e/1b6437bbb1c27d6f019b53b5ec3033838bf0c3 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/77/f7e96ac43a58d5b5a248fbf95679be2d1384e0 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/77/f7e96ac43a58d5b5a248fbf95679be2d1384e0 new file mode 100644 index 00000000..ebd654af Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/77/f7e96ac43a58d5b5a248fbf95679be2d1384e0 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/79/c2a48f28f1075264be65edcfc1cf89cc9eed3d b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/79/c2a48f28f1075264be65edcfc1cf89cc9eed3d new file mode 100644 index 00000000..375c59f6 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/79/c2a48f28f1075264be65edcfc1cf89cc9eed3d differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/7a/3f111ab6adbaf604563d04921cbe9d2c05a671 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/7a/3f111ab6adbaf604563d04921cbe9d2c05a671 new file mode 100644 index 00000000..ddf5bd5f Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/7a/3f111ab6adbaf604563d04921cbe9d2c05a671 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/7a/a6deb6649e03435cea9d769bbf201ddd69e6ac b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/7a/a6deb6649e03435cea9d769bbf201ddd69e6ac new file mode 100644 index 00000000..c635fe6e Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/7a/a6deb6649e03435cea9d769bbf201ddd69e6ac differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/7e/88bddc151803161105d37aad44850243bc572f b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/7e/88bddc151803161105d37aad44850243bc572f new file mode 100644 index 00000000..b5f218f6 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/7e/88bddc151803161105d37aad44850243bc572f differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/7f/cac8bff6db915a1dcd7dbae6b0a871a7bd0360 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/7f/cac8bff6db915a1dcd7dbae6b0a871a7bd0360 new file mode 100644 index 00000000..9f2c51aa Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/7f/cac8bff6db915a1dcd7dbae6b0a871a7bd0360 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/80/c090f6bb954c7ff9c2bd29e47f7fdd66088073 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/80/c090f6bb954c7ff9c2bd29e47f7fdd66088073 new file mode 100644 index 00000000..d26a9a2d Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/80/c090f6bb954c7ff9c2bd29e47f7fdd66088073 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/8d/3e70429b301ff5bfd04d3db7b83ffc0fe8d377 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/8d/3e70429b301ff5bfd04d3db7b83ffc0fe8d377 new file mode 100644 index 00000000..9d5735a5 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/8d/3e70429b301ff5bfd04d3db7b83ffc0fe8d377 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/8f/d5689001911d7cef1df3e483391e883c8028bd b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/8f/d5689001911d7cef1df3e483391e883c8028bd new file mode 100644 index 00000000..0b6290bc Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/8f/d5689001911d7cef1df3e483391e883c8028bd differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/90/603f5ec53464213fd95d6abce3d48e5a8c1fdd b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/90/603f5ec53464213fd95d6abce3d48e5a8c1fdd new file mode 100644 index 00000000..ac2309f7 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/90/603f5ec53464213fd95d6abce3d48e5a8c1fdd @@ -0,0 +1,6 @@ +xVo0`ѾNM*JM6]ՁKB&?4JKx>޽{wd7KoR"hA(Ζlx \'L] WZ猥|9W@\[L<ߩFo[=h4fnofx0$ΔY 8W6z#B-W#ScI,-`p"+;|֊ ȿEA(R +; +s.uࡶLK$& +&@ 9@}̾_Ͼ=#\%Q[Cz U!/!RҺ^6oY +snia}}jHZEOH}f̜U.\ȦϺF;Ь%jgtIn=܂u['>n|C3~VO΋սv2cFZ n\O"^pzcS/ WZG\**XA qX7Aj3vI9M1a|PԂ_12 \ No newline at end of file diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/93/cc79712428d299c17ca6c1c3289597dd9308d7 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/93/cc79712428d299c17ca6c1c3289597dd9308d7 new file mode 100644 index 00000000..20cb3069 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/93/cc79712428d299c17ca6c1c3289597dd9308d7 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/96/3fecd3b48f0e30a07849975792c657ce660fc1 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/96/3fecd3b48f0e30a07849975792c657ce660fc1 new file mode 100644 index 00000000..4fee8fb9 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/96/3fecd3b48f0e30a07849975792c657ce660fc1 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/98/1c971f8b95299fb716b9e089c8f4f62986005f b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/98/1c971f8b95299fb716b9e089c8f4f62986005f new file mode 100644 index 00000000..ef1ff38e Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/98/1c971f8b95299fb716b9e089c8f4f62986005f differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/99/18bc61b3b4ba0b5005e9ed7debdd50c9838393 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/99/18bc61b3b4ba0b5005e9ed7debdd50c9838393 new file mode 100644 index 00000000..f5726851 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/99/18bc61b3b4ba0b5005e9ed7debdd50c9838393 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/9a/33d8bd92dc9a1cb68cc6597fc58a220da7c554 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/9a/33d8bd92dc9a1cb68cc6597fc58a220da7c554 new file mode 100644 index 00000000..7347771a Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/9a/33d8bd92dc9a1cb68cc6597fc58a220da7c554 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/a0/075039ad15e31566d66cb8fb02f49e4eac9e9d b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/a0/075039ad15e31566d66cb8fb02f49e4eac9e9d new file mode 100644 index 00000000..3275d88b Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/a0/075039ad15e31566d66cb8fb02f49e4eac9e9d differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/a1/57874edcedad4c0992b990afb2fc66ea643ea9 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/a1/57874edcedad4c0992b990afb2fc66ea643ea9 new file mode 100644 index 00000000..e44f6c71 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/a1/57874edcedad4c0992b990afb2fc66ea643ea9 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/a1/b8a3c355c86992a7fad50ab636927edf47c024 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/a1/b8a3c355c86992a7fad50ab636927edf47c024 new file mode 100644 index 00000000..6beeec6f Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/a1/b8a3c355c86992a7fad50ab636927edf47c024 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/a4/9d7aa1a7dc76e5dbf7eaa08184c5bb103cd719 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/a4/9d7aa1a7dc76e5dbf7eaa08184c5bb103cd719 new file mode 100644 index 00000000..98f5e1a4 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/a4/9d7aa1a7dc76e5dbf7eaa08184c5bb103cd719 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/a5/eabcf7c43012d5933f1a88e94abc3be163e4ed b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/a5/eabcf7c43012d5933f1a88e94abc3be163e4ed new file mode 100644 index 00000000..d3e4f410 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/a5/eabcf7c43012d5933f1a88e94abc3be163e4ed differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/aa/59769ed864c32772e43ef4feccfc2f6fb51657 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/aa/59769ed864c32772e43ef4feccfc2f6fb51657 new file mode 100644 index 00000000..1f924885 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/aa/59769ed864c32772e43ef4feccfc2f6fb51657 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/aa/9cab821068932e018437d1e6e4351fadf546ba b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/aa/9cab821068932e018437d1e6e4351fadf546ba new file mode 100644 index 00000000..c5d0d2b4 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/aa/9cab821068932e018437d1e6e4351fadf546ba differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/ab/4228bb1d37ac55766fcc97de5cb0a0d10c01d9 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/ab/4228bb1d37ac55766fcc97de5cb0a0d10c01d9 new file mode 100644 index 00000000..9100a805 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/ab/4228bb1d37ac55766fcc97de5cb0a0d10c01d9 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/ab/731a2b0e47fd42f6a67bf83de93562bebf3cb3 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/ab/731a2b0e47fd42f6a67bf83de93562bebf3cb3 new file mode 100644 index 00000000..1acaaf91 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/ab/731a2b0e47fd42f6a67bf83de93562bebf3cb3 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/af/e58c2e92836fb2cac22ba5f6634aee9d55243b b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/af/e58c2e92836fb2cac22ba5f6634aee9d55243b new file mode 100644 index 00000000..0812e7e0 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/af/e58c2e92836fb2cac22ba5f6634aee9d55243b differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/b2/35a16fd9d634f7f80dbf7a97deb3bfa2060baf b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/b2/35a16fd9d634f7f80dbf7a97deb3bfa2060baf new file mode 100644 index 00000000..830d58dd Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/b2/35a16fd9d634f7f80dbf7a97deb3bfa2060baf differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/b2/a2195d221f2ae4531bebcb3d3de84694f42116 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/b2/a2195d221f2ae4531bebcb3d3de84694f42116 new file mode 100644 index 00000000..93eaaaf7 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/b2/a2195d221f2ae4531bebcb3d3de84694f42116 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/b5/ed2b7dce19e5f4fad66380a02ba73f6d53ceb8 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/b5/ed2b7dce19e5f4fad66380a02ba73f6d53ceb8 new file mode 100644 index 00000000..f7670022 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/b5/ed2b7dce19e5f4fad66380a02ba73f6d53ceb8 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/b9/5abbbdd39472e5bc971b792b0d9d7a4a531f90 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/b9/5abbbdd39472e5bc971b792b0d9d7a4a531f90 new file mode 100644 index 00000000..23e63023 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/b9/5abbbdd39472e5bc971b792b0d9d7a4a531f90 @@ -0,0 +1,5 @@ +xSn0U +( N.CEk4NaUR$ARN,;hzD ss:^_!KWXa<}&u +Uh:@K6cWl~IY=,Vî@-Ayx +J0JPšDQ!sHۊ}'mGIxO*K M% hBI'{B1})B!qpr.J8-~i7amRs+Q̊ qqiZO,8 :R}ʦld6=nlK]"Rfxn+YEU$*_HǯMG{D 4 t )Hb&OlXĄ K9Qm=fڥFl@ό@QG -6>}nT sBw}={,=A@lI-u Evڹ􆾋uBmK nTD,\ܖ +S&*a* \ No newline at end of file diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/bc/1b35ca134aca5ae9c8a24f2b18838152fdc039 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/bc/1b35ca134aca5ae9c8a24f2b18838152fdc039 new file mode 100644 index 00000000..54c8b605 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/bc/1b35ca134aca5ae9c8a24f2b18838152fdc039 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/bd/3645700bcf3b9b31c8e98da229dad39c461a48 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/bd/3645700bcf3b9b31c8e98da229dad39c461a48 new file mode 100644 index 00000000..fdd0c1fe Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/bd/3645700bcf3b9b31c8e98da229dad39c461a48 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/cf/745d792fe8239c7e8cff42be7a0d8dd5e4fd04 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/cf/745d792fe8239c7e8cff42be7a0d8dd5e4fd04 new file mode 100644 index 00000000..d41d8dac Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/cf/745d792fe8239c7e8cff42be7a0d8dd5e4fd04 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/d3/a7e95ca8ce419071d12f927bb54c17c6402c1c b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/d3/a7e95ca8ce419071d12f927bb54c17c6402c1c new file mode 100644 index 00000000..afc83216 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/d3/a7e95ca8ce419071d12f927bb54c17c6402c1c differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/d4/0b1ce91a5a9ee121abfef65e4bfa480d0f82b2 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/d4/0b1ce91a5a9ee121abfef65e4bfa480d0f82b2 new file mode 100644 index 00000000..daca1ad7 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/d4/0b1ce91a5a9ee121abfef65e4bfa480d0f82b2 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/d6/96dcda356c55fbf593fafad7b1846be8b2d4f1 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/d6/96dcda356c55fbf593fafad7b1846be8b2d4f1 new file mode 100644 index 00000000..369e35f6 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/d6/96dcda356c55fbf593fafad7b1846be8b2d4f1 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/dc/4738cc68a547838b40d80d1ccde4f3294c11be b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/dc/4738cc68a547838b40d80d1ccde4f3294c11be new file mode 100644 index 00000000..cd4eeb47 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/dc/4738cc68a547838b40d80d1ccde4f3294c11be differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/dc/fa61079179434b5319340c3fc1007a14ff5432 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/dc/fa61079179434b5319340c3fc1007a14ff5432 new file mode 100644 index 00000000..3264fb43 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/dc/fa61079179434b5319340c3fc1007a14ff5432 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/e1/ef108295d8e442e1799331513f2a3b83d64eb6 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/e1/ef108295d8e442e1799331513f2a3b83d64eb6 new file mode 100644 index 00000000..76a8dc23 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/e1/ef108295d8e442e1799331513f2a3b83d64eb6 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/e4/be60503d348b89c6d92d1fcac10daa4cd036f9 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/e4/be60503d348b89c6d92d1fcac10daa4cd036f9 new file mode 100644 index 00000000..b50c4820 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/e4/be60503d348b89c6d92d1fcac10daa4cd036f9 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/e5/cde4a98d7518c44d0bb655df3cb7464bcf4eff b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/e5/cde4a98d7518c44d0bb655df3cb7464bcf4eff new file mode 100644 index 00000000..42b67d2a --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/e5/cde4a98d7518c44d0bb655df3cb7464bcf4eff @@ -0,0 +1,4 @@ +x]o w +@ҭjUQWHI5ݴ[I8~;v;/gţOfSJ+y0*:|.4ڨ] jisL3X<>xO ʫ[z/Aw6)l,ʥuLrDpewožجD UIIBmlK $Mbׇˡ/=A0,tcݟESU0 1Gopv}?'^ٌ= %;(j4(qM \ No newline at end of file diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/e8/1516ff53cbede145f9e5172b037774c724fb27 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/e8/1516ff53cbede145f9e5172b037774c724fb27 new file mode 100644 index 00000000..090ed068 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/e8/1516ff53cbede145f9e5172b037774c724fb27 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/ea/13e4270dfb7209bd5629d60702dd7f52592277 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/ea/13e4270dfb7209bd5629d60702dd7f52592277 new file mode 100644 index 00000000..2a311a5e Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/ea/13e4270dfb7209bd5629d60702dd7f52592277 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/ec/4725a8d10e4decdc41b1ed3f831e2e9aa35a9b b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/ec/4725a8d10e4decdc41b1ed3f831e2e9aa35a9b new file mode 100644 index 00000000..417719b8 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/ec/4725a8d10e4decdc41b1ed3f831e2e9aa35a9b differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/ed/eb2a15b25e72bfc0ad450820888afe22261390 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/ed/eb2a15b25e72bfc0ad450820888afe22261390 new file mode 100644 index 00000000..a90aa0e4 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/ed/eb2a15b25e72bfc0ad450820888afe22261390 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/ee/882bcd6ecd75d2748643c1f5111f1940ee4661 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/ee/882bcd6ecd75d2748643c1f5111f1940ee4661 new file mode 100644 index 00000000..aafc263a Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/ee/882bcd6ecd75d2748643c1f5111f1940ee4661 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/f0/27490f12bca39783187755f330428f15f66a43 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/f0/27490f12bca39783187755f330428f15f66a43 new file mode 100644 index 00000000..91736f96 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/f0/27490f12bca39783187755f330428f15f66a43 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/f5/030d9ae6a801e6eba3a81c1f688c5a081d5835 b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/f5/030d9ae6a801e6eba3a81c1f688c5a081d5835 new file mode 100644 index 00000000..d0d605bc Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/f5/030d9ae6a801e6eba3a81c1f688c5a081d5835 differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/f7/91ce489788482f193eba093951bbfea3cf520a b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/f7/91ce489788482f193eba093951bbfea3cf520a new file mode 100644 index 00000000..41600323 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/f7/91ce489788482f193eba093951bbfea3cf520a @@ -0,0 +1,8 @@ +xSn0U +( @N{ *Zq +ȵ”"r*,eY}Aӓ$jwvvf)ݛpO$R;NM?{I$4Dj7VîJ@/A{+x + +AC\ j#cK~݊ +39?J+ +VM) hBI'{BD]4~;}sYiK OM 6nY%(B=bB2+aępƅ jYp!:R}ʧ|kv46PFI%}P3~E%sȿ"*/D&=XY-A8yG=k0T!Pp&z*eRX5_ \ No newline at end of file diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/pack/pack-a3986ffd65e466d0db2c9831609837ceb466b7a1.idx b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/pack/pack-a3986ffd65e466d0db2c9831609837ceb466b7a1.idx new file mode 100644 index 00000000..eadbf838 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/pack/pack-a3986ffd65e466d0db2c9831609837ceb466b7a1.idx differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/pack/pack-a3986ffd65e466d0db2c9831609837ceb466b7a1.pack b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/pack/pack-a3986ffd65e466d0db2c9831609837ceb466b7a1.pack new file mode 100644 index 00000000..fd17fcdd Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/git/objects/pack/pack-a3986ffd65e466d0db2c9831609837ceb466b7a1.pack differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/packed-refs b/docs/src/test/bats/fixtures/gs-contract-rest/git/packed-refs new file mode 100644 index 00000000..b485431b --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/packed-refs @@ -0,0 +1,10 @@ +# pack-refs with: peeled fully-peeled sorted +f0bd0f6aaabf6cc795d48fa1cc7fb02b6bffab5e refs/remotes/origin/master +1467e747b9465e3f253480553550bcb60e816ebe refs/tags/1.5.10.RELEASE +c9ed896050ee28b7b64a6e971fea7c07be909cce refs/tags/2.0.0.RELEASE +f7b110e81f4609d44057a211964ed57fe17e9997 refs/tags/2.0.1.RELEASE +ebe88e9e4da07223f139e06aaea4c426d3844887 refs/tags/2.0.2.RELEASE +2c35a5496198b31f9c2bfc19bfad8ea89fb55b54 refs/tags/2.0.3.RELEASE +acc7fc29e206b1283aabf47b19e263f156492360 refs/tags/2.0.5.RELEASE +2935ef48f784f09dd2d85805321750c7fb350dc6 refs/tags/edgware.sr2 +bc0a699ddbe6060f87fb654cbec11a125e82d053 refs/tags/finchley.sr2 diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/refs/heads/master b/docs/src/test/bats/fixtures/gs-contract-rest/git/refs/heads/master new file mode 100644 index 00000000..cb941bfa --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/refs/heads/master @@ -0,0 +1 @@ +9918bc61b3b4ba0b5005e9ed7debdd50c9838393 diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/refs/remotes/origin/HEAD b/docs/src/test/bats/fixtures/gs-contract-rest/git/refs/remotes/origin/HEAD new file mode 100644 index 00000000..6efe28ff --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/refs/remotes/origin/HEAD @@ -0,0 +1 @@ +ref: refs/remotes/origin/master diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/git/refs/remotes/origin/master b/docs/src/test/bats/fixtures/gs-contract-rest/git/refs/remotes/origin/master new file mode 100644 index 00000000..cb941bfa --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/git/refs/remotes/origin/master @@ -0,0 +1 @@ +9918bc61b3b4ba0b5005e9ed7debdd50c9838393 diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/.mvn/wrapper/maven-wrapper.jar b/docs/src/test/bats/fixtures/gs-contract-rest/initial/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 00000000..5fd4d502 Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/initial/.mvn/wrapper/maven-wrapper.jar differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/.mvn/wrapper/maven-wrapper.properties b/docs/src/test/bats/fixtures/gs-contract-rest/initial/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 00000000..c954cec9 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/.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 diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/build.gradle b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/build.gradle new file mode 100644 index 00000000..f791ce48 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/build.gradle @@ -0,0 +1,42 @@ +buildscript { + ext { springBootVersion = '2.1.4.RELEASE' } + repositories { mavenCentral() } + dependencies { + classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") + } +} + +apply plugin: 'java' +apply plugin: 'eclipse' +apply plugin: 'idea' +apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' + +bootJar { + baseName = 'contract-rest-client' + version = '0.0.1-SNAPSHOT' +} +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + +repositories { mavenCentral() } + +dependencies { + compile('org.springframework.boot:spring-boot-starter-web') + testCompile('org.springframework.boot:spring-boot-starter-test') + testCompile('org.springframework.cloud:spring-cloud-starter-contract-stub-runner') +} + +dependencyManagement { + imports { + mavenBom "org.springframework.cloud:spring-cloud-dependencies:Finchley.SR2" + } +} + +eclipse { + classpath { + containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') + containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' + } +} + diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/gradle/wrapper/gradle-wrapper.jar b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..6b6ea3ab Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/gradle/wrapper/gradle-wrapper.jar differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/gradle/wrapper/gradle-wrapper.properties b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..ea720f98 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/gradlew b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/gradlew new file mode 100755 index 00000000..cccdd3d5 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## 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 + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/gradlew.bat b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/gradlew.bat new file mode 100644 index 00000000..f9553162 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/pom.xml b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/pom.xml new file mode 100644 index 00000000..77f7e96a --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/pom.xml @@ -0,0 +1,64 @@ + + + 4.0.0 + + com.example + contract-rest-client + 0.0.1-SNAPSHOT + jar + + + org.springframework.boot + spring-boot-starter-parent + 2.1.4.RELEASE + + + + + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.cloud + spring-cloud-starter-contract-stub-runner + test + + + + + + + + org.springframework.cloud + spring-cloud-dependencies + Finchley.SR2 + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/src/main/java/hello/ContractRestClientApplication.java b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/src/main/java/hello/ContractRestClientApplication.java new file mode 100644 index 00000000..2ae34d72 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/src/main/java/hello/ContractRestClientApplication.java @@ -0,0 +1,34 @@ +package hello; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestTemplate; + +@SpringBootApplication +public class ContractRestClientApplication { + + public static void main(String[] args) { + SpringApplication.run(ContractRestClientApplication.class, args); + } +} + +@RestController +class MessageRestController { + + private final RestTemplate restTemplate; + + MessageRestController(RestTemplateBuilder restTemplateBuilder) { + this.restTemplate = restTemplateBuilder.build(); + } + + @RequestMapping("/message/{personId}") + String getMessage(@PathVariable("personId") Long personId) { + Person person = this.restTemplate.getForObject("http://localhost:8000/person/{personId}", Person.class, personId); + return "Hello " + person.getName(); + } + +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/src/main/java/hello/Person.java b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/src/main/java/hello/Person.java new file mode 100644 index 00000000..14225f9c --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/src/main/java/hello/Person.java @@ -0,0 +1,44 @@ +package hello; + +class Person { + + public Person() { + } + + public Person(Long id, String name, String surname) { + this.id = id; + this.name = name; + this.surname = surname; + } + + private Long id; + + private String name; + + private String surname; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSurname() { + return surname; + } + + public void setSurname(String surname) { + this.surname = surname; + } + +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/src/main/resources/application.properties b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/src/main/resources/application.properties new file mode 100644 index 00000000..af7da77e --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/src/main/resources/application.properties @@ -0,0 +1,3 @@ +spring.application.name=contract-rest-client + +server.port=9000 diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/src/test/java/hello/ContractRestClientApplicationTest.java b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/src/test/java/hello/ContractRestClientApplicationTest.java new file mode 100644 index 00000000..a0075039 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-client/src/test/java/hello/ContractRestClientApplicationTest.java @@ -0,0 +1,37 @@ +package hello; + +import org.assertj.core.api.BDDAssertions; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.cloud.contract.stubrunner.junit.StubRunnerRule; +import org.springframework.cloud.contract.stubrunner.spring.AutoConfigureStubRunner; +import org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.web.client.RestTemplate; + +@RunWith(SpringRunner.class) +@SpringBootTest +@AutoConfigureStubRunner( + ids = "com.example:contract-rest-service:0.0.1-SNAPSHOT:stubs:8100", + stubsMode = StubRunnerProperties.StubsMode.LOCAL +) +public class ContractRestClientApplicationTest { + + @Test + public void get_person_from_service_contract() { + // given: + RestTemplate restTemplate = new RestTemplate(); + + // when: + ResponseEntity personResponseEntity = restTemplate.getForEntity("http://localhost:8100/person/1", Person.class); + + // then: + BDDAssertions.then(personResponseEntity.getStatusCodeValue()).isEqualTo(200); + BDDAssertions.then(personResponseEntity.getBody().getId()).isEqualTo(1l); + BDDAssertions.then(personResponseEntity.getBody().getName()).isEqualTo("foo"); + BDDAssertions.then(personResponseEntity.getBody().getSurname()).isEqualTo("bee"); + } +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/build.gradle b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/build.gradle new file mode 100644 index 00000000..491e80a3 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/build.gradle @@ -0,0 +1,48 @@ +buildscript { + ext { + springBootVersion = '2.1.4.RELEASE' + verifierVersion = '2.0.2.RELEASE' + } + repositories { mavenCentral() } + dependencies { + classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") + classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${verifierVersion}" + } +} + +apply plugin: 'groovy' +apply plugin: 'java' +apply plugin: 'eclipse' +apply plugin: 'idea' +apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' +apply plugin: 'spring-cloud-contract' + + +bootJar { + baseName = 'contract-rest-service' + version = '0.0.1-SNAPSHOT' +} +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + +repositories { mavenCentral() } + +dependencies { + compile('org.springframework.boot:spring-boot-starter-web') + testCompile('org.springframework.boot:spring-boot-starter-test') + testCompile('org.springframework.cloud:spring-cloud-starter-contract-verifier') +} + +dependencyManagement { + imports { + mavenBom "org.springframework.cloud:spring-cloud-dependencies:Finchley.SR2" + } +} + +contracts { + packageWithBaseClasses = 'hello' + baseClassMappings { + baseClassMapping(".*hello.*", "hello.BaseClass") + } +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/gradle/wrapper/gradle-wrapper.jar b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..6b6ea3ab Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/gradle/wrapper/gradle-wrapper.jar differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/gradle/wrapper/gradle-wrapper.properties b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..ea720f98 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/gradlew b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/gradlew new file mode 100755 index 00000000..cccdd3d5 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## 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 + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/gradlew.bat b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/gradlew.bat new file mode 100644 index 00000000..f9553162 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/pom.xml b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/pom.xml new file mode 100644 index 00000000..5e796e3d --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/pom.xml @@ -0,0 +1,85 @@ + + + 4.0.0 + + com.example + contract-rest-service + 0.0.1-SNAPSHOT + jar + + + org.springframework.boot + spring-boot-starter-parent + 2.1.4.RELEASE + + + + + UTF-8 + 1.8 + Finchley.SR2 + 2.0.2.RELEASE + + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + + + diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/src/main/java/hello/ContractRestServiceApplication.java b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/src/main/java/hello/ContractRestServiceApplication.java new file mode 100644 index 00000000..081ec994 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/src/main/java/hello/ContractRestServiceApplication.java @@ -0,0 +1,12 @@ +package hello; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ContractRestServiceApplication { + + public static void main(String[] args) { + SpringApplication.run(ContractRestServiceApplication.class, args); + } +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/src/main/java/hello/Person.java b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/src/main/java/hello/Person.java new file mode 100644 index 00000000..988259b9 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/src/main/java/hello/Person.java @@ -0,0 +1,40 @@ +package hello; + +class Person { + + Person(Long id, String name, String surname) { + this.id = id; + this.name = name; + this.surname = surname; + } + + private Long id; + + private String name; + + private String surname; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSurname() { + return surname; + } + + public void setSurname(String surname) { + this.surname = surname; + } +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/src/main/java/hello/PersonRestController.java b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/src/main/java/hello/PersonRestController.java new file mode 100644 index 00000000..7e13377a --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/src/main/java/hello/PersonRestController.java @@ -0,0 +1,20 @@ +package hello; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RestController; + +@RestController +class PersonRestController { + + private final PersonService personService; + + public PersonRestController(PersonService personService) { + this.personService = personService; + } + + @GetMapping("/person/{id}") + public Person findPersonById(@PathVariable("id") Long id) { + return personService.findPersonById(id); + } +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/src/main/java/hello/PersonService.java b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/src/main/java/hello/PersonService.java new file mode 100644 index 00000000..fa70645f --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/src/main/java/hello/PersonService.java @@ -0,0 +1,23 @@ +package hello; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.stereotype.Service; + +@Service +class PersonService { + + private final Map personMap; + + public PersonService() { + personMap = new HashMap<>(); + personMap.put(1L, new Person(1L, "Richard", "Gere")); + personMap.put(2L, new Person(2L, "Emma", "Choplin")); + personMap.put(3L, new Person(3L, "Anna", "Carolina")); + } + + Person findPersonById(Long id) { + return personMap.get(id); + } +} diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/src/main/resources/application.properties b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/src/main/resources/application.properties new file mode 100644 index 00000000..5ee314c7 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/contract-rest-service/src/main/resources/application.properties @@ -0,0 +1 @@ +server.port=8000 diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/gradle/wrapper/gradle-wrapper.jar b/docs/src/test/bats/fixtures/gs-contract-rest/initial/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..877f7c1f Binary files /dev/null and b/docs/src/test/bats/fixtures/gs-contract-rest/initial/gradle/wrapper/gradle-wrapper.jar differ diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/gradle/wrapper/gradle-wrapper.properties b/docs/src/test/bats/fixtures/gs-contract-rest/initial/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..ea55541d --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Nov 15 10:48:25 CET 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-bin.zip diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/gradlew b/docs/src/test/bats/fixtures/gs-contract-rest/initial/gradlew new file mode 100755 index 00000000..9d82f789 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/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/docs/src/test/bats/fixtures/gs-contract-rest/initial/gradlew.bat b/docs/src/test/bats/fixtures/gs-contract-rest/initial/gradlew.bat new file mode 100644 index 00000000..8a0b282a --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/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 Windowz 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/docs/src/test/bats/fixtures/gs-contract-rest/initial/mvnw b/docs/src/test/bats/fixtures/gs-contract-rest/initial/mvnw new file mode 100755 index 00000000..02217b1e --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/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 +# +# https://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/docs/src/test/bats/fixtures/gs-contract-rest/initial/mvnw.cmd b/docs/src/test/bats/fixtures/gs-contract-rest/initial/mvnw.cmd new file mode 100755 index 00000000..4b98b78c --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/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 https://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/docs/src/test/bats/fixtures/gs-contract-rest/initial/pom.xml b/docs/src/test/bats/fixtures/gs-contract-rest/initial/pom.xml new file mode 100644 index 00000000..edeb2a15 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + org.springframework + gs-contract-rest + 0.1.0 + + pom + + + contract-rest-service + contract-rest-client + + + diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/initial/settings.gradle b/docs/src/test/bats/fixtures/gs-contract-rest/initial/settings.gradle new file mode 100644 index 00000000..1008e67c --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/initial/settings.gradle @@ -0,0 +1,4 @@ +rootProject.name = 'gs-contract-rest' + +include 'contract-rest-service' +include 'contract-rest-client' diff --git a/docs/src/test/bats/fixtures/gs-contract-rest/test/run.sh b/docs/src/test/bats/fixtures/gs-contract-rest/test/run.sh new file mode 100755 index 00000000..667a17d7 --- /dev/null +++ b/docs/src/test/bats/fixtures/gs-contract-rest/test/run.sh @@ -0,0 +1,36 @@ +#!/bin/sh +cd $(dirname $0) + +cd ../complete + +mvn clean install +ret=$? +if [ $ret -ne 0 ]; then + exit $ret +fi +rm -rf target + +./gradlew build +ret=$? +if [ $ret -ne 0 ]; then + exit $ret +fi +rm -rf build + +cd ../initial + +mvn clean compile +ret=$? +if [ $ret -ne 0 ]; then + exit $ret +fi +rm -rf target + +./gradlew compileJava +ret=$? +if [ $ret -ne 0 ]; then + exit $ret +fi +rm -rf build + +exit diff --git a/docs/src/test/bats/fixtures/guides/gs-contract-rest/ONE.adoc b/docs/src/test/bats/fixtures/guides/gs-contract-rest/ONE.adoc new file mode 100644 index 00000000..e69de29b diff --git a/docs/src/test/bats/fixtures/guides/gs-contract-rest/complete/COMPLETE.adoc b/docs/src/test/bats/fixtures/guides/gs-contract-rest/complete/COMPLETE.adoc new file mode 100644 index 00000000..e69de29b diff --git a/docs/src/test/bats/fixtures/guides/gs-contract-rest/initial/INITIAL.adoc b/docs/src/test/bats/fixtures/guides/gs-contract-rest/initial/INITIAL.adoc new file mode 100644 index 00000000..e69de29b diff --git a/docs/src/test/bats/fixtures/guides/gs-contract-rest/test/TEST.adoc b/docs/src/test/bats/fixtures/guides/gs-contract-rest/test/TEST.adoc new file mode 100644 index 00000000..e69de29b diff --git a/docs/src/test/bats/update-guides.bats b/docs/src/test/bats/update-guides.bats new file mode 100644 index 00000000..f47505ab --- /dev/null +++ b/docs/src/test/bats/update-guides.bats @@ -0,0 +1,125 @@ +#!/usr/bin/env bats + +load 'test_helper' +load 'test_helper/bats-support/load' +load 'test_helper/bats-assert/load' + +setup() { + export TEMP_DIR="$( mktemp -d )" + export COPIED_SOURCES="${TEMP_DIR}/sc-build" + export PROJECT_VERSION="1.0.0.RELEASE" + + cp -a "${SOURCE_DIR}" "${COPIED_SOURCES}" + + cp -a "${FIXTURES_DIR}/gs-contract-rest" "${TEMP_DIR}/" + cp -a "${FIXTURES_DIR}/guides" "${TEMP_DIR}/" + mv "${TEMP_DIR}/gs-contract-rest/git" "${TEMP_DIR}/gs-contract-rest/.git" +} + +teardown() { + rm -rf "${TEMP_DIR}" +} + +function fake_git { + if [[ "$*" == *"push"* ]]; then + echo "pushing the project" + elif [[ "$*" == *"pull"* ]]; then + echo "pulling the project" + fi + git $* +} + +function git_with_remotes { + if [[ "$*" == *"set-url"* ]]; then + echo "git $*" + elif [[ "$*" == *"config remote.origin.url"* ]]; then + echo "git://foo.bar/baz.git" + else + git $* + fi +} + +function printing_git { + echo "git $*" +} + +function printing_git_with_remotes { + if [[ "$*" == *"config remote.origin.url"* ]]; then + echo "git://foo.bar/baz.git" + else + printing_git $* + fi +} + +function stubbed_git { + if [[ "$*" == *"config remote.origin.url"* ]]; then + echo "git://foo.bar/baz.git" + elif [[ "$*" == *"commit"* ]]; then + printing_git $* + elif [[ "$*" == *"push"* ]]; then + printing_git $* + else + git $* + fi + } + +export -f printing_git +export -f printing_git_with_remotes +export -f stubbed_git + +@test "should do nothing when project version is not release" { + cd "${TEMP_DIR}" + mkdir .git + export GIT_BIN="stubbed_git" + export SPRING_GUIDES_REPO_ROOT="$( pwd )" + export PROJECT_VERSION="1.0.0.BUILD-SNAPSHOT" + + run "${COPIED_SOURCES}"/update-guides.sh + + assert_success + refute_output --partial "git" +} + +@test "should fail if we're not in the root of the project" { + cd "${TEMP_DIR}/sc-build" + export GIT_BIN="printing_git_with_remotes" + + run "${COPIED_SOURCES}"/update-guides.sh + + assert_failure +} + +@test "should do nothing when no guides folder is present" { + cd "${TEMP_DIR}/sc-build" + mkdir .git + export GIT_BIN="printing_git_with_remotes" + + run "${COPIED_SOURCES}"/update-guides.sh + + assert_success + refute_output --partial "git" +} + +@test "should commit and push latest guides" { + cd "${TEMP_DIR}" + mkdir .git + export GIT_BIN="stubbed_git" + export SPRING_GUIDES_REPO_ROOT="$( pwd )" + export RELEASER_GIT_OAUTH_TOKEN="mytoken" + + run "${COPIED_SOURCES}"/update-guides.sh + + assert_success + # change remote + assert_output --partial "git remote set-url --push origin https://mytoken@foo.bar/baz.git" + # commit and push + assert_output --partial "git commit -m Updating guides" + assert_output --partial "git push origin master" + tree ${TEMP_DIR} + # check the contents, old ones deleted, new ones present + assert [ -f "${TEMP_DIR}/target/gs-contract-rest/ONE.adoc" ] + assert [ -f "${TEMP_DIR}/target/gs-contract-rest/complete/COMPLETE.adoc" ] + assert [ -f "${TEMP_DIR}/target/gs-contract-rest/initial/INITIAL.adoc" ] + assert [ -f "${TEMP_DIR}/target/gs-contract-rest/test/TEST.adoc" ] + assert [ ! -f "${TEMP_DIR}/target/gs-contract-rest/README.adoc" ] +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6bdc3a8c..f21daffe 100644 --- a/pom.xml +++ b/pom.xml @@ -638,6 +638,10 @@ Spring Maven Plugins Repository https://repo.spring.io/plugins-release + + jitpack.io + https://jitpack.io + @@ -712,6 +716,65 @@ + + guides + + + + org.apache.maven.plugins + maven-dependency-plugin + ${maven-dependency-plugin.version} + + + unpack-docs + generate-resources + + unpack + + + + + org.springframework.cloud + + spring-cloud-build-docs + + ${spring-cloud-build.version} + + sources + jar + false + ${docs.resources.dir} + + + + + + + + + exec-maven-plugin + org.codehaus.mojo + + + Run guides update + deploy + + exec + + + ${skipGuides} + ${maven.multiModuleProjectDirectory} + ${docs.resources.dir}/asciidoc/update-guides.sh + + ${project.version} + + + + + + + + java8