2.2.x gradle 6.4 (#1405)

* Upgrade gradle wrapper to 6.4. Fixes gh-1387.

* Document PublishStubsToScmTask API changes.

* Upgrade groovy to 2.5.10.
This commit is contained in:
Olga Maciaszek-Sharma
2020-05-13 14:47:33 +02:00
committed by GitHub
parent ca90c521b3
commit 9fcf5a3612
71 changed files with 733 additions and 470 deletions

View File

@@ -40,7 +40,7 @@ dependencyManagement {
}
dependencies {
testCompile("org.springframework.cloud:spring-cloud-starter-contract-verifier")
testImplementation("org.springframework.cloud:spring-cloud-starter-contract-verifier")
}
test {

View File

@@ -8,7 +8,7 @@
|stubrunner.cloud.delegate.enabled | true | Whether to enable DiscoveryClient's Stub Runner implementation.
|stubrunner.cloud.enabled | true | Whether to enable Spring Cloud support for Stub Runner.
|stubrunner.cloud.eureka.enabled | true | Whether to enable stubs registration in Eureka.
|stubrunner.cloud.ribbon.enabled | true | Whether to enable Stub Runner's Ribbon integration.
|stubrunner.cloud.loadbalancer.enabled | true | Whether to enable Stub Runner's Spring Cloud Load Balancer integration.
|stubrunner.cloud.stubbed.discovery.enabled | true | Whether Service Discovery should be stubbed for Stub Runner. If set to false, stubs will get registered in real service discovery.
|stubrunner.cloud.zookeeper.enabled | true | Whether to enable stubs registration in Zookeeper.
|stubrunner.consumer-name | | You can override the default {@code spring.application.name} of this field by setting a value to this parameter.

View File

@@ -36,7 +36,7 @@ The registered WireMock server is reset after each test class, however, if you n
If you use `@AutoConfigureWireMock`, it registers WireMock JSON stubs from the file
system or classpath (by default, from `file:src/test/resources/mappings`). You can
customize the locations byusing the `stubs` attribute in the annotation, which can be an
customize the locations by using the `stubs` attribute in the annotation, which can be an
Ant-style resource pattern or a directory. In the case of a directory, `**/*.json` is
appended. The following code shows an example:

View File

@@ -718,6 +718,36 @@ the `publish` task is executed
*/
publish.dependsOn("publishStubsToScm")
----
It is also possible to further customise the `publishStubsToScm` gradle task. In the following example,
the task is customised to pick contracts from a local git repository:
[source,groovy,indent=0,role="secondary"]
.gradle
----
publishStubsToScm {
// We want to modify the default set up of the plugin when publish stubs to scm is called
// We want to pick contracts from a Git repository
contractDependency {
stringNotation = "${project.group}:${project.name}:${project.version}"
}
/*
We reuse the contract dependency section to set up the path
to the folder that contains the contract definitions. In our case the
path will be /groupId/artifactId/version/contracts
*/
contractRepository {
repositoryUrl = "git://file://${new File(project.rootDir, "../target")}/contract_empty_git/"
}
// We set the contracts mode to `LOCAL`
contractsMode = "LOCAL"
}
----
IMPORTANT:: Starting with `2.3.0.RELEASE` the `customize{}` closure previously used for the
`publishStubsToScm` customization is no longer available. The settings should be applied directly
within the `publishStubsToScm` closure as in the example above.
====
With such a setup:

View File

@@ -23,9 +23,9 @@ 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')
implementation('org.springframework.boot:spring-boot-starter-web')
testImplementation('org.springframework.boot:spring-boot-starter-test')
testImplementation('org.springframework.cloud:spring-cloud-starter-contract-stub-runner')
}
dependencyManagement {
@@ -41,3 +41,7 @@ eclipse {
}
}
task wrapper(type: Wrapper){
gradleVersion = '6.4'
}

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -28,7 +28,7 @@ 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='"-Xmx64m"'
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

View File

@@ -14,7 +14,7 @@ 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="-Xmx64m"
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

View File

@@ -31,9 +31,9 @@ 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')
implementation('org.springframework.boot:spring-boot-starter-web')
testImplementation('org.springframework.boot:spring-boot-starter-test')
testImplementation('org.springframework.cloud:spring-cloud-starter-contract-verifier')
}
dependencyManagement {
@@ -48,3 +48,7 @@ contracts {
baseClassMapping(".*hello.*", "hello.BaseClass")
}
}
task wrapper(type: Wrapper){
gradleVersion = '6.4'
}

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip

View File

@@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# 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.
#
##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ 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=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -66,6 +82,7 @@ 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
@@ -109,10 +126,11 @@ 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
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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
@@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $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" ;;
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
@@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
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" "$@"

View File

@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem 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, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@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 DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -65,6 +84,7 @@ set CMD_LINE_ARGS=%*
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%

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -28,7 +28,7 @@ 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='"-Xmx64m"'
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

View File

@@ -14,7 +14,7 @@ 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="-Xmx64m"
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

View File

@@ -22,9 +22,9 @@ 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')
implementation('org.springframework.boot:spring-boot-starter-web')
testImplementation('org.springframework.boot:spring-boot-starter-test')
testImplementation('org.springframework.cloud:spring-cloud-starter-contract-stub-runner')
}
dependencyManagement {
@@ -40,3 +40,8 @@ eclipse {
}
}
task wrapper(type: Wrapper){
gradleVersion = '6.4'
}

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# 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.
#
##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ 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='"-Xmx64m"'
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -66,6 +82,7 @@ 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
@@ -109,10 +126,11 @@ 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
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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
@@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $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" ;;
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
@@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
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" "$@"

View File

@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem 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, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@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="-Xmx64m"
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -65,6 +84,7 @@ set CMD_LINE_ARGS=%*
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%

View File

@@ -29,9 +29,9 @@ 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')
implementation('org.springframework.boot:spring-boot-starter-web')
testImplementation('org.springframework.boot:spring-boot-starter-test')
testImplementation('org.springframework.cloud:spring-cloud-starter-contract-verifier')
}
dependencyManagement {
@@ -46,3 +46,7 @@ contracts {
baseClassMapping(".*hello.*", "hello.BaseClass")
}
}
task wrapper(type: Wrapper){
gradleVersion = '6.4'
}

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# 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.
#
##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ 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='"-Xmx64m"'
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -66,6 +82,7 @@ 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
@@ -109,10 +126,11 @@ 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
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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
@@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $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" ;;
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
@@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
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" "$@"

View File

@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem 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, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@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="-Xmx64m"
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -65,6 +84,7 @@ set CMD_LINE_ARGS=%*
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%

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# 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.
#
##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ 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='"-Xmx64m"'
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -66,6 +82,7 @@ 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
@@ -109,10 +126,11 @@ 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
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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
@@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $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" ;;
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
@@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
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" "$@"

View File

@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem 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, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@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="-Xmx64m"
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -65,6 +84,7 @@ set CMD_LINE_ARGS=%*
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%

View File

@@ -56,7 +56,7 @@
<gmavenplus-plugin.version>1.6.3</gmavenplus-plugin.version>
<!-- We need to have compatibility with Gradle -->
<groovy.version>2.5.9</groovy.version>
<groovy.version>2.5.10</groovy.version>
<!-- We need to have compatibility with Boot -->
<maven.version>3.5.4</maven.version>
<!-- Resolver has to be aligned with Maven (e.g resolver 1.4 and Maven 3.6 or resolver 1.3 and Maven 3.5) -->
@@ -401,6 +401,11 @@
<artifactId>groovy-xml</artifactId>
<version>${groovy.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-macro</artifactId>
<version>${groovy.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-resolver-provider</artifactId>

View File

@@ -34,13 +34,13 @@ dependencyManagement {
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("org.springframework.cloud:spring-cloud-starter-stream-rabbit")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.cloud:spring-cloud-starter-stream-rabbit")
testCompile("org.springframework.cloud:spring-cloud-stream-test-support")
testCompile "org.springframework.cloud:spring-cloud-starter-contract-stub-runner"
testCompile "org.springframework.cloud:spring-cloud-starter-contract-verifier"
testImplementation("org.springframework.cloud:spring-cloud-stream-test-support")
testImplementation "org.springframework.cloud:spring-cloud-starter-contract-stub-runner"
testImplementation "org.springframework.cloud:spring-cloud-starter-contract-verifier"
}
test {

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -70,12 +70,12 @@ contracts {
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("org.springframework.cloud:spring-cloud-starter-stream-rabbit")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.cloud:spring-cloud-starter-stream-rabbit")
testCompile 'org.springframework.cloud:spring-cloud-starter-contract-verifier'
testCompile "org.springframework.cloud:spring-cloud-stream-test-support"
testImplementation 'org.springframework.cloud:spring-cloud-starter-contract-verifier'
testImplementation "org.springframework.cloud:spring-cloud-stream-test-support"
}
test {

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -35,14 +35,14 @@ dependencyManagement {
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
testCompile 'org.springframework.cloud:spring-cloud-contract-wiremock'
testCompile 'org.springframework.cloud:spring-cloud-starter-contract-stub-runner'
testCompile "org.springframework.boot:spring-boot-starter-test"
testCompile "com.example:http-server-restdocs:0.0.1:stubs"
testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock'
testImplementation 'org.springframework.cloud:spring-cloud-starter-contract-stub-runner'
testImplementation "org.springframework.boot:spring-boot-starter-test"
testImplementation "com.example:http-server-restdocs:0.0.1:stubs"
}
test {

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -41,15 +41,15 @@ dependencyManagement {
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
testCompile 'org.springframework.boot:spring-boot-starter-test'
testCompile 'org.springframework.cloud:spring-cloud-starter-contract-stub-runner'
testImplementation('org.springframework.boot:spring-boot-starter-test')
testImplementation 'org.springframework.cloud:spring-cloud-starter-contract-stub-runner'
// tag::dependencies[]
testCompile 'org.springframework.cloud:spring-cloud-starter-contract-verifier'
testCompile 'org.springframework.restdocs:spring-restdocs-mockmvc'
testImplementation 'org.springframework.cloud:spring-cloud-starter-contract-verifier'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
// end::dependencies[]
}

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -35,13 +35,13 @@ dependencyManagement {
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator")
testCompile 'org.springframework.cloud:spring-cloud-contract-wiremock'
testCompile 'org.springframework.cloud:spring-cloud-starter-contract-stub-runner'
testCompile "org.springframework.boot:spring-boot-starter-test"
testCompile "com.example:http-server-webclient:0.0.1:stubs"
testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock'
testImplementation 'org.springframework.cloud:spring-cloud-starter-contract-stub-runner'
testImplementation "org.springframework.boot:spring-boot-starter-test"
testImplementation "com.example:http-server-webclient:0.0.1:stubs"
}
test {

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -26,12 +26,12 @@ dependencyManagement {
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-webflux")
compile("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.springframework.boot:spring-boot-starter-actuator")
testCompile 'org.springframework.boot:spring-boot-starter-test'
testCompile 'org.springframework.restdocs:spring-restdocs-webtestclient'
testCompile 'org.springframework.cloud:spring-cloud-contract-wiremock'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.restdocs:spring-restdocs-webtestclient'
testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock'
}
contracts {

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -29,7 +29,6 @@ ext {
JavaVersion javaVer = JavaVersion.current()
println "Current Java version equal to [${javaVer}]"
javaVersionNumber = javaVer.toString()
incompatibleJdk = javaVer.ordinal() > 8
}
project.version = findProperty('verifierVersion')
@@ -89,21 +88,12 @@ task libtest() {
}
}
task checkJdkVersion {
doLast {
if (incompatibleJdk) {
logger.warn("Java Version is equal to [${javaVersionNumber}]. The tests will be disabled (due to issues with compilation)")
}
}
}
test {
testLogging {
exceptionFormat = 'full'
}
systemProperties = testSystemProperties
dependsOn(checkJdkVersion)
enabled = !project.hasProperty('fast') && !incompatibleJdk
enabled = !project.hasProperty('fast')
}
groovydoc {

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -17,14 +17,18 @@
package org.springframework.cloud.contract.verifier.plugin;
import java.io.File;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import javax.inject.Inject;
import groovy.lang.Closure;
import groovy.lang.DelegatesTo;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.gradle.api.Action;
@@ -36,6 +40,7 @@ import org.gradle.api.provider.MapProperty;
import org.gradle.api.provider.Property;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.Nested;
import org.gradle.api.tasks.Optional;
import org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties;
@@ -48,7 +53,7 @@ import org.springframework.util.Assert;
* @author Anatoliy Balakirev
* @author Shannon Pamperl
*/
public class ContractVerifierExtension {
public class ContractVerifierExtension implements Serializable {
private static final Log log = LogFactory.getLog(ContractVerifierExtension.class);
@@ -155,6 +160,8 @@ public class ContractVerifierExtension {
private ContractRepository contractRepository;
private PublishStubsToScm publishStubsToScm;
/**
* Dependency that contains packaged contracts
*/
@@ -163,7 +170,6 @@ public class ContractVerifierExtension {
/**
* The path in the JAR with all the contracts where contracts for this particular service lay.
* If not provided will be resolved to {@code groupid/artifactid}. Example:
* <p></p>
* If {@code groupid} is {@code com.example} and {@code artifactid} is {@code service} then the resolved path will be
* {@code /com/example/artifactid}
*/
@@ -186,7 +192,6 @@ public class ContractVerifierExtension {
/**
* A way to override any base class mappings. The keys are regular expressions on the package name
* and the values FQN to a base class for that given expression.
* <p></p>
* Example of a mapping
* [.*.com.example.v1..*] to [com.example.SomeBaseClass]
* When a contract's package matches the provided regular expression then extending class will be the one
@@ -236,6 +241,8 @@ public class ContractVerifierExtension {
*/
private Property<String> sourceSet;
private final ObjectFactory objects;
@Inject
public ContractVerifierExtension(ProjectLayout layout, ObjectFactory objects) {
this.testFramework = objects.property(TestFramework.class).convention(TestFramework.JUNIT);
@@ -258,6 +265,7 @@ public class ContractVerifierExtension {
this.failOnNoContracts = objects.property(Boolean.class).convention(true);
this.failOnInProgress = objects.property(Boolean.class).convention(true);
this.contractRepository = objects.newInstance(ContractRepository.class);
this.publishStubsToScm = objects.newInstance(PublishStubsToScm.class);
this.contractDependency = objects.newInstance(Dependency.class);
this.contractsPath = objects.property(String.class);
this.contractsMode = objects.property(StubRunnerProperties.StubsMode.class).convention(StubRunnerProperties.StubsMode.CLASSPATH);
@@ -270,6 +278,7 @@ public class ContractVerifierExtension {
this.contractsProperties = objects.mapProperty(String.class, String.class).convention(new HashMap<>());
this.disableStubPublication = objects.property(Boolean.class).convention(false);
this.sourceSet = objects.property(String.class);
this.objects = objects;
}
@Deprecated
@@ -455,6 +464,7 @@ public class ContractVerifierExtension {
this.failOnInProgress.set(failOnInProgress);
}
@Nested
public ContractRepository getContractRepository() {
return contractRepository;
}
@@ -463,6 +473,15 @@ public class ContractVerifierExtension {
action.execute(contractRepository);
}
@Nested
public PublishStubsToScm getPublishStubsToScm() {
return publishStubsToScm;
}
public void publishStubsToScm(Action<PublishStubsToScm> action) {
action.execute(publishStubsToScm);
}
public Dependency getContractDependency() {
return contractDependency;
}
@@ -575,7 +594,7 @@ public class ContractVerifierExtension {
this.sourceSet.set(sourceSet);
}
public static class Dependency {
public static class Dependency implements Serializable {
private Property<String> groupId;
private Property<String> artifactId;
private Property<String> version;
@@ -653,7 +672,7 @@ public class ContractVerifierExtension {
}
}
public static class BaseClassMapping {
public static class BaseClassMapping implements Serializable {
private final MapProperty<String, String> baseClassMappings;
@Inject
@@ -675,7 +694,7 @@ public class ContractVerifierExtension {
}
// This class is used as an input to the tasks, so all fields are marked as `@Input` to allow incremental build
public static class ContractRepository {
public static class ContractRepository implements Serializable {
private Property<String> repositoryUrl;
private Property<String> username;
private Property<String> password;
@@ -768,12 +787,6 @@ public class ContractVerifierExtension {
return proxyPort;
}
// favor unwrapped int
@Deprecated
public void setProxyPort(Integer proxyPort) {
this.proxyPort.set(proxyPort);
}
public void setProxyPort(int proxyPort) {
Assert.state(0 < proxyPort && proxyPort <= 65536, "Proxy port should be between 1 and 65536");
this.proxyPort.set(proxyPort);
@@ -802,4 +815,46 @@ public class ContractVerifierExtension {
'}';
}
}
}
public static class PublishStubsToScm implements Serializable {
/**
* Dependency that contains packaged contracts
*/
private Dependency contractDependency;
private ContractRepository contractRepository;
@Inject
public PublishStubsToScm(ObjectFactory objects) {
contractDependency = objects.newInstance(Dependency.class);
contractRepository = objects.newInstance(ContractRepository.class);
}
@Nested
public Dependency getContractDependency() {
return contractDependency;
}
public void contractDependency(Action<Dependency> action) {
action.execute(contractDependency);
}
@Nested
public ContractRepository getContractRepository() {
return contractRepository;
}
public void contractRepository(Action<ContractRepository> action) {
action.execute(contractRepository);
}
@Override
public String toString() {
return "PublishStubsToScm{" +
"contractDependency=" + contractDependency +
", contractRepository=" + contractRepository +
'}';
}
}
}

View File

@@ -122,7 +122,7 @@ class ContractsCopyTask extends DefaultTask {
}
private boolean contractFolderMissing() {
contractsDirectory.isPresent() && !contractsDirectory.get().asFile.exists()
return contractsDirectory.isPresent() && !contractsDirectory.get().asFile.exists()
}
@Internal
@@ -139,6 +139,8 @@ class ContractsCopyTask extends DefaultTask {
@OutputDirectory
DirectoryProperty copiedContractsFolder
@OutputDirectory
DirectoryProperty stubsOutputDir
@Optional
@OutputDirectory
DirectoryProperty backupContractsFolder
@@ -148,7 +150,7 @@ class ContractsCopyTask extends DefaultTask {
void sync() {
final DownloadedData downloadedData = downloadContractsIfNeeded()
final File contractsDirectory
final String antPattern
String antPattern = ""
if (downloadedData) {
contractsDirectory = downloadedData.downloadedContracts
antPattern = "${downloadedData.inclusionProperties.includedRootFolderAntPattern}*.*"
@@ -162,7 +164,7 @@ class ContractsCopyTask extends DefaultTask {
contractsDirectory = null
}
logger.info("For project [{}] will use contracts provided in the folder [{}]", project.name, contractsDirectory)
final String contractsRepository = config.contractRepository.repositoryUrl.isPresent() ? config.contractRepository.repositoryUrl : ""
final String contractsRepository = config.contractRepository.repositoryUrl.isPresent() ? config.contractRepository.repositoryUrl.get() : ""
throwExceptionWhenFailOnNoContracts(contractsDirectory, contractsRepository)
if (contractsDirectory == null) {
logger.info("Contracts directory not set and contracts weren't downloaded. There's nothing to copy")
@@ -170,7 +172,7 @@ class ContractsCopyTask extends DefaultTask {
}
final String slashSeparatedGroupId = project.group.toString().replace(".", File.separator)
final String slashSeparatedAntPattern = antPattern.replace(slashSeparatedGroupId, project.group.toString())
final File output = config.copiedContractsFolder.get().asFile
File output = config.copiedContractsFolder.get().getAsFile()
logger.info("Downloading and unpacking files from [${contractsDirectory}] to [$output]. The inclusion ant patterns are [${antPattern}] and [${slashSeparatedAntPattern}]")
sync(contractsDirectory, antPattern, slashSeparatedAntPattern, config.excludeBuildFolders.get(), output)
if (config.convertToYaml.get()) {
@@ -184,6 +186,7 @@ class ContractsCopyTask extends DefaultTask {
excludeBuildFolders: extension.excludeBuildFolders,
failOnNoContracts: extension.failOnNoContracts,
contractsDirectory: extension.contractsDslDir,
stubsOutputDir: extension.stubsOutputDir,
copiedContractsFolder: createTaskOutput(root, extension.stubsOutputDir, ContractsCopyTask.CONTRACTS, project),
backupContractsFolder: createTaskOutput(root, extension.stubsOutputDir, ContractsCopyTask.BACKUP, project),
contractDependency: extension.contractDependency,

View File

@@ -17,6 +17,7 @@
package org.springframework.cloud.contract.verifier.plugin
import groovy.transform.CompileStatic
import groovy.transform.builder.Builder
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
import org.gradle.api.file.Directory
@@ -50,46 +51,136 @@ class GenerateServerTestsTask extends DefaultTask {
@Nested
Config config
@CompileStatic
@Builder
static class Config {
final Provider<Directory> contractsDslDir
final Provider<String> nameSuffixForTests
final Provider<String> basePackageForTests
final Provider<String> baseClassForTests
final Provider<String> packageWithBaseClasses
final ListProperty<String> excludedFiles
final ListProperty<String> ignoredFiles
final ListProperty<String> includedFiles
final ListProperty<String> imports
final ListProperty<String> staticImports
final Provider<TestMode> testMode
final Provider<TestFramework> testFramework
final MapProperty<String, String> baseClassMappings
final Provider<Boolean> assertJsonSize
final Provider<Boolean> failOnInProgress
final DirectoryProperty generatedTestSourcesDir
final DirectoryProperty generatedTestResourcesDir
Config(Provider<Directory> contractsDslDir, Provider<String> nameSuffixForTests, Provider<String> basePackageForTests, Provider<String> baseClassForTests, Provider<String> packageWithBaseClasses, ListProperty<String> excludedFiles, ListProperty<String> ignoredFiles, ListProperty<String> includedFiles, ListProperty<String> imports, ListProperty<String> staticImports, Provider<TestMode> testMode, Provider<TestFramework> testFramework, MapProperty<String, String> baseClassMappings, Provider<Boolean> assertJsonSize, Provider<Boolean> failOnInProgress, DirectoryProperty generatedTestSourcesDir, DirectoryProperty generatedTestResourcesDir) {
this.contractsDslDir = contractsDslDir
this.nameSuffixForTests = nameSuffixForTests
this.basePackageForTests = basePackageForTests
this.baseClassForTests = baseClassForTests
this.packageWithBaseClasses = packageWithBaseClasses
this.excludedFiles = excludedFiles
this.ignoredFiles = ignoredFiles
this.includedFiles = includedFiles
this.imports = imports
this.staticImports = staticImports
this.testMode = testMode
this.testFramework = testFramework
this.baseClassMappings = baseClassMappings
this.assertJsonSize = assertJsonSize
this.failOnInProgress = failOnInProgress
this.generatedTestSourcesDir = generatedTestSourcesDir
this.generatedTestResourcesDir = generatedTestResourcesDir
}
@InputDirectory
Provider<Directory> contractsDslDir
Provider<Directory> getContractsDslDir() {
return contractsDslDir
}
@Input
@Optional
Provider<String> nameSuffixForTests
Provider<String> getNameSuffixForTests() {
return nameSuffixForTests
}
@Input
@Optional
Provider<String> basePackageForTests
Provider<String> getBasePackageForTests() {
return basePackageForTests
}
@Input
@Optional
Provider<String> baseClassForTests
Provider<String> getBaseClassForTests() {
return baseClassForTests
}
@Input
@Optional
Provider<String> packageWithBaseClasses
Provider<String> getPackageWithBaseClasses() {
return packageWithBaseClasses
}
@Input
ListProperty<String> excludedFiles
ListProperty<String> getExcludedFiles() {
return excludedFiles
}
@Input
ListProperty<String> ignoredFiles
ListProperty<String> getIgnoredFiles() {
return ignoredFiles
}
@Input
ListProperty<String> includedFiles
ListProperty<String> getIncludedFiles() {
return includedFiles
}
@Input
ListProperty<String> imports
ListProperty<String> getImports() {
return imports
}
@Input
ListProperty<String> staticImports
ListProperty<String> getStaticImports() {
return staticImports
}
@Input
Provider<TestMode> testMode
Provider<TestMode> getTestMode() {
return testMode
}
@Input
Provider<TestFramework> testFramework
Provider<TestFramework> getTestFramework() {
return testFramework
}
@Input
MapProperty<String, String> baseClassMappings
MapProperty<String, String> getBaseClassMappings() {
return baseClassMappings
}
@Input
Provider<Boolean> assertJsonSize
Provider<Boolean> getAssertJsonSize() {
return assertJsonSize
}
@Input
Provider<Boolean> failOnInProgress
Provider<Boolean> getFailOnInProgress() {
return failOnInProgress
}
@OutputDirectory
DirectoryProperty generatedTestSourcesDir
DirectoryProperty getGeneratedTestSourcesDir() {
return generatedTestSourcesDir
}
@OutputDirectory
DirectoryProperty generatedTestResourcesDir
DirectoryProperty getGeneratedTestResourcesDir() {
return generatedTestResourcesDir
}
}
@TaskAction
@@ -139,24 +230,22 @@ class GenerateServerTestsTask extends DefaultTask {
static Config fromExtension(ContractVerifierExtension extension, TaskProvider<ContractsCopyTask> copyContractsTask) {
return new Config(
contractsDslDir: copyContractsTask.flatMap { it.config.copiedContractsFolder },
nameSuffixForTests: extension.nameSuffixForTests,
basePackageForTests: extension.basePackageForTests,
baseClassForTests: extension.baseClassForTests,
packageWithBaseClasses: extension.packageWithBaseClasses,
excludedFiles: extension.excludedFiles,
ignoredFiles: extension.ignoredFiles,
includedFiles: extension.includedFiles,
imports: extension.imports,
staticImports: extension.staticImports,
testMode: extension.testMode,
testFramework: extension.testFramework,
baseClassMappings: extension.baseClassMappings.getBaseClassMappings(),
assertJsonSize: extension.assertJsonSize,
failOnInProgress: extension.failOnInProgress,
generatedTestSourcesDir: extension.generatedTestSourcesDir,
generatedTestResourcesDir: extension.generatedTestResourcesDir,
)
copyContractsTask.flatMap { it.config.copiedContractsFolder },
extension.nameSuffixForTests,
extension.basePackageForTests,
extension.baseClassForTests,
extension.packageWithBaseClasses,
extension.excludedFiles,
extension.ignoredFiles,
extension.includedFiles,
extension.imports,
extension.staticImports,
extension.testMode,
extension.testFramework,
extension.baseClassMappings.getBaseClassMappings(),
extension.assertJsonSize,
extension.failOnInProgress,
extension.generatedTestSourcesDir,
extension.generatedTestResourcesDir)
}
}

View File

@@ -17,12 +17,15 @@
package org.springframework.cloud.contract.verifier.plugin
import groovy.transform.CompileStatic
import groovy.transform.PackageScope
import org.gradle.api.DefaultTask
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.MapProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.Nested
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
import org.springframework.cloud.contract.stubrunner.ContractProjectUpdater
import org.springframework.cloud.contract.stubrunner.ScmStubDownloaderBuilder
@@ -34,6 +37,10 @@ import org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties
* to the cloned repo with contracts and stubs. Will also
* commit the changes and push them to origin.
*
* NOTE: starting with 2.3.0.RELEASE the <code>customize{}</code> closure previously used for
* {@link PublishStubsToScmTask} customisation is no longer available. The settings should be applied directly
* within the <code>publishStubsToScm</code> closure as in the example above.
*
* @author Marcin Grzejszczak
* @author Anatoliy Balakirev
* @since 2.0.0
@@ -42,120 +49,67 @@ import org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties
class PublishStubsToScmTask extends DefaultTask {
static final String TASK_NAME = 'publishStubsToScm'
@Nested
Config config
private Closure customizationClosure = Closure.IDENTITY
@CompileStatic
static class Config {
private ObjectFactory objects
ContractVerifierExtension.ContractRepository contractRepository
Property<StubRunnerProperties.StubsMode> contractsMode
Property<Boolean> deleteStubsAfterTest
Property<Boolean> failOnNoContracts
MapProperty<String, String> contractsProperties
DirectoryProperty stubsOutputDir
@Nested
final Property<ContractVerifierExtension.ContractRepository> contractRepository
@Nested
final Property<ContractVerifierExtension.PublishStubsToScm> publishStubsToScm
@Input
final Property<StubRunnerProperties.StubsMode> contractsMode
@Input
final Property<Boolean> deleteStubsAfterTest
@Input
final Property<Boolean> failOnNoContracts
@Input
final MapProperty<String, String> contractsProperties
@OutputDirectory
final DirectoryProperty stubsOutputDir
@Internal
final ObjectFactory objects
void setContractsMode(Property<StubRunnerProperties.StubsMode> contractsMode) {
this.contractsMode = contractsMode
}
void setContractsMode(String contractsMode) {
if (contractsMode) {
this.contractsMode = objects.property(StubRunnerProperties.StubsMode).convention(StubRunnerProperties.StubsMode.valueOf(contractsMode.toUpperCase()))
}
}
void setDeleteStubsAfterTest(Property<Boolean> deleteStubsAfterTest) {
this.deleteStubsAfterTest = deleteStubsAfterTest
}
void setDeleteStubsAfterTest(Boolean deleteStubsAfterTest) {
if (deleteStubsAfterTest != null) {
this.deleteStubsAfterTest = objects.property(Boolean).convention(deleteStubsAfterTest)
}
}
void setFailOnNoContracts(Property<Boolean> failOnNoContracts) {
this.failOnNoContracts = failOnNoContracts
}
void setFailOnNoContracts(Boolean failOnNoContracts) {
if (failOnNoContracts != null) {
this.failOnNoContracts = objects.property(Boolean).convention(failOnNoContracts)
}
}
void setContractsProperties(MapProperty<String, String> contractsProperties) {
this.contractsProperties = contractsProperties
}
void setContractsProperties(Map<String, String> contractsProperties) {
if (contractsProperties) {
this.contractsProperties = objects.mapProperty(String, String).convention(contractsProperties)
}
}
void setStubsOutputDir(DirectoryProperty stubsOutputDir) {
this.stubsOutputDir = stubsOutputDir
}
void setStubsOutputDir(String stubsOutputDir) {
if (stubsOutputDir) {
this.stubsOutputDir = objects.directoryProperty()
this.stubsOutputDir.set(new File(stubsOutputDir))
}
}
void setStubsOutputDir(GString stubsOutputDir) {
if (stubsOutputDir) {
this.stubsOutputDir = objects.directoryProperty()
this.stubsOutputDir.set(new File(stubsOutputDir.toString()))
}
}
void contractRepository(@DelegatesTo(ContractVerifierExtension.ContractRepository) Closure closure) {
closure.delegate = contractRepository
closure.call()
}
@Deprecated
void contractDependency(Closure closure) {
// Here only to preserve backward compatibility. Was never used here.
}
@PackageScope
void setObjects(ObjectFactory objects) {
Config(ObjectFactory objects, ContractVerifierExtension extension) {
this.objects = objects
this.contractRepository = objects.property(ContractVerifierExtension.ContractRepository)
this.contractRepository.set(extension.contractRepository)
this.publishStubsToScm = objects.property(ContractVerifierExtension.PublishStubsToScm)
this.publishStubsToScm.set(extension.publishStubsToScm)
this.contractsMode = objects.property(StubRunnerProperties.StubsMode)
this.contractsMode.set(extension.contractsMode)
this.deleteStubsAfterTest = objects.property(Boolean)
this.deleteStubsAfterTest.set(extension.failOnNoContracts)
this.failOnNoContracts = objects.property(Boolean)
this.failOnNoContracts.set(extension.deleteStubsAfterTest)
this.contractsProperties = objects.mapProperty(String, String)
this.contractsProperties.set(extension.contractsProperties)
this.stubsOutputDir = objects.directoryProperty()
this.stubsOutputDir.set(extension.stubsOutputDir)
}
}
@TaskAction
void publishStubsToScm() {
applyConfigCustomizations()
if (!shouldRun()) {
ContractVerifierExtension.ContractRepository repository = merged()
if (!shouldRun(repository)) {
return
}
String projectName = project.group.toString() + ":" + project.name.toString() + ":" + this.project.version.toString()
project.logger.info("Pushing Stubs to SCM for project [" + projectName + "]")
StubRunnerOptions stubRunnerOptions = StubRunnerOptionsFactory.createStubRunnerOptions(
config.contractRepository, config.contractsMode.getOrNull(), config.deleteStubsAfterTest.get(),
repository, config.contractsMode.getOrElse(StubRunnerProperties.StubsMode.REMOTE), config.deleteStubsAfterTest.get(),
config.contractsProperties.get(), config.failOnNoContracts.get())
new ContractProjectUpdater(stubRunnerOptions).updateContractProject(projectName, config.stubsOutputDir.get().asFile.toPath())
}
static Config fromExtension(ContractVerifierExtension extension, ObjectFactory objects) {
return new Config(
contractRepository: extension.contractRepository,
contractsMode: extension.contractsMode,
failOnNoContracts: extension.failOnNoContracts,
deleteStubsAfterTest: extension.deleteStubsAfterTest,
contractsProperties: extension.contractsProperties,
stubsOutputDir: extension.stubsOutputDir,
objects: objects
)
return new Config(objects, extension)
}
private boolean shouldRun() {
String contractRepoUrl = config.contractRepository.repositoryUrl.getOrNull() ?: ""
private boolean shouldRun(ContractVerifierExtension.ContractRepository repository) {
String contractRepoUrl = repository.repositoryUrl.getOrNull() ?: ""
if (!contractRepoUrl || !ScmStubDownloaderBuilder.isProtocolAccepted(contractRepoUrl)) {
project.logger.warn("Skipping pushing stubs to scm since your contracts repository URL [${contractRepoUrl}] doesn't match any of the accepted protocols for SCM stub downloader")
return false
@@ -163,37 +117,18 @@ class PublishStubsToScmTask extends DefaultTask {
return true
}
/**
* Some builds might want to customize this task only, overriding settings from plugin.
*/
void customize(@DelegatesTo(Config) Closure closure) {
customizationClosure = closure
}
private void applyConfigCustomizations() {
// Needs to be copied, otherwise properties won't be updated:
config.contractRepository = copy(config.contractRepository, project.objects)
customizationClosure.delegate = config
customizationClosure.call()
}
private static ContractVerifierExtension.ContractRepository copy(ContractVerifierExtension.ContractRepository original, ObjectFactory objects) {
ContractVerifierExtension.ContractRepository copied = new ContractVerifierExtension.ContractRepository(objects)
if (original.repositoryUrl.getOrNull()) {
copied.repositoryUrl.set(original.repositoryUrl.get())
}
if (original.username.getOrNull()) {
copied.username.set(original.username.get())
}
if (original.password.getOrNull()) {
copied.password.set(original.password.get())
}
if (original.proxyPort.getOrNull()) {
copied.proxyPort.set(original.proxyPort.get())
}
if (original.proxyHost.getOrNull()) {
copied.proxyHost.set(original.proxyHost.get())
private ContractVerifierExtension.ContractRepository merged() {
ContractVerifierExtension.ContractRepository original = config.contractRepository.get()
ContractVerifierExtension.ContractRepository stubs = config.publishStubsToScm.get().getContractRepository()
ContractVerifierExtension.ContractRepository copied = new ContractVerifierExtension.ContractRepository(config.objects)
copied.setRepositoryUrl(stubs.getRepositoryUrl().getOrElse(original.getRepositoryUrl().getOrNull()))
copied.setUsername(stubs.getUsername().getOrElse(original.getUsername().getOrNull()))
copied.setPassword(stubs.getPassword().getOrElse(original.getPassword().getOrNull()))
Integer port = stubs.getProxyPort().getOrElse(original.getProxyPort().getOrNull())
if (port != null ) {
copied.setProxyPort(port)
}
copied.setProxyHost(stubs.getProxyHost().getOrElse(original.getProxyHost().getOrNull()))
return copied
}
}

View File

@@ -17,8 +17,10 @@
package org.springframework.cloud.contract.verifier.plugin
import org.gradle.api.internal.provider.DefaultProperty
import org.gradle.api.internal.provider.PropertyHost
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Property
import org.gradle.internal.service.scopes.ProjectBackedPropertyHost
import spock.lang.Specification
import org.springframework.cloud.contract.stubrunner.StubConfiguration
@@ -97,7 +99,7 @@ class GradleContractsDownloaderHelperSpec extends Specification {
}
// Have to use this internal property impl here. Is there some better way?
static <T> Property<T> prop(Class<T> aClass) {
return new DefaultProperty(aClass)
public <T> Property<T> prop(Class<T> aClass) {
return new DefaultProperty(Stub(PropertyHost), aClass)
}
}

View File

@@ -31,20 +31,20 @@ repositories {
}
dependencies {
compile "org.springframework:spring-web"
compile "org.springframework:spring-context-support"
compile "org.codehaus.groovy:groovy-all:${groovyVersion}"
compile 'com.jayway.jsonpath:json-path-assert:2.2.0'
implementation "org.springframework:spring-web"
implementation "org.springframework:spring-context-support"
implementation "org.codehaus.groovy:groovy-all:${groovyVersion}"
implementation 'com.jayway.jsonpath:json-path-assert:2.2.0'
testCompile "com.github.tomakehurst:wiremock:${wiremockVersion}"
testCompile "com.toomuchcoding.jsonassert:jsonassert:${jsonAssertVersion}"
testCompile("org.spockframework:spock-spring:1.0-groovy-2.4") {
testImplementation "com.github.tomakehurst:wiremock:${wiremockVersion}"
testImplementation "com.toomuchcoding.jsonassert:jsonassert:${jsonAssertVersion}"
testImplementation("org.spockframework:spock-spring:1.0-groovy-2.4") {
exclude(group: 'org.codehaus.groovy')
}
testCompile "io.restassured:rest-assured:$restAssuredVersion"
testCompile "io.restassured:spring-mock-mvc:$restAssuredVersion"
testCompile "ch.qos.logback:logback-classic:1.1.2"
testCompile "org.springframework.cloud:spring-cloud-contract-verifier:${verifierVersion}"
testImplementation "io.restassured:rest-assured:$restAssuredVersion"
testImplementation "io.restassured:spring-mock-mvc:$restAssuredVersion"
testImplementation "ch.qos.logback:logback-classic:1.1.2"
testImplementation "org.springframework.cloud:spring-cloud-contract-verifier:${verifierVersion}"
}
contracts {

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# 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.
#
##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ 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='"-Xmx64m"'
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

View File

@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem 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, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -14,7 +30,7 @@ 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="-Xmx64m"
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2019 the original author or authors.
* Copyright 2013-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,15 +45,15 @@ subprojects {
}
dependencies {
testCompile "org.codehaus.groovy:groovy"
testCompile("org.spockframework:spock-core:$spockVersion") {
testImplementation "org.codehaus.groovy:groovy"
testImplementation("org.spockframework:spock-core:$spockVersion") {
exclude(group: 'org.codehaus.groovy')
}
testCompile "junit:junit:4.12"
testCompile "com.github.tomakehurst:wiremock:${wiremockVersion}"
testCompile "com.toomuchcoding.jsonassert:jsonassert:${jsonAssertVersion}"
testCompile "org.assertj:assertj-core:2.4.1"
testCompile "org.springframework.cloud:spring-cloud-contract-verifier:${verifierVersion}"
testImplementation "junit:junit:4.12"
testImplementation "com.github.tomakehurst:wiremock:${wiremockVersion}"
testImplementation "com.toomuchcoding.jsonassert:jsonassert:${jsonAssertVersion}"
testImplementation "org.assertj:assertj-core:2.4.1"
testImplementation "org.springframework.cloud:spring-cloud-contract-verifier:${verifierVersion}"
}
}
@@ -106,20 +106,20 @@ configure([project(':fraudDetectionService'), project(':loanApplicationService')
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web") {
implementation("org.springframework.boot:spring-boot-starter-web") {
exclude module: "spring-boot-starter-tomcat"
}
compile("org.springframework.boot:spring-boot-starter-jetty")
compile("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-jetty")
implementation("org.springframework.boot:spring-boot-starter-actuator")
testRuntime("org.spockframework:spock-spring:$spockVersion") {
exclude(group: 'org.codehaus.groovy')
}
testCompile "org.mockito:mockito-core"
testCompile "org.springframework:spring-test"
testCompile "org.springframework.boot:spring-boot-test"
testCompile "io.rest-assured:rest-assured:$restAssuredVersion"
testCompile "io.rest-assured:spring-mock-mvc:$restAssuredVersion"
testImplementation "org.mockito:mockito-core"
testImplementation "org.springframework:spring-test"
testImplementation "org.springframework.boot:spring-boot-test"
testImplementation "io.rest-assured:rest-assured:$restAssuredVersion"
testImplementation "io.rest-assured:spring-mock-mvc:$restAssuredVersion"
}
task cleanup(type: Delete) {

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# 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.
#
##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ 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='"-Xmx64m"'
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

View File

@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem 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, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -14,7 +30,7 @@ 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="-Xmx64m"
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

View File

@@ -1,23 +0,0 @@
{
"request": {
"method": "PUT",
"headers": {
"Content-Type": {
"equalTo": "application/vnd.fraud.v1+json"
}
},
"url": "/fraudcheck",
"bodyPatterns": [
{
"matches": "{\"clientPesel\":\"[0-9]{10}\",\"loanAmount\":\"99999\"}"
}
]
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/vnd.fraud.v1+json"
},
"body": "{\"fraudCheckStatus\":\"FRAUD\",\"rejectionReason\":\"Amount too high\"}"
}
}

View File

@@ -1,23 +0,0 @@
{
"request": {
"method": "PUT",
"headers": {
"Content-Type": {
"equalTo": "application/vnd.fraud.v1+json"
}
},
"url": "/fraudcheck",
"bodyPatterns": [
{
"matches": "{\"clientPesel\":\"[0-9]{10}\",\"loanAmount\":\"123.123\"}"
}
]
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/vnd.fraud.v1+json"
},
"body": "{\"fraudCheckStatus\":\"OK\",\"rejectionReason\":null}"
}
}

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# 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.
#
##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ 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='"-Xmx64m"'
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

View File

@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem 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, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -14,7 +30,7 @@ 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="-Xmx64m"
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

View File

@@ -1,23 +0,0 @@
{
"request": {
"method": "PUT",
"headers": {
"Content-Type": {
"equalTo": "application/vnd.fraud.v1+json"
}
},
"url": "/fraudcheck",
"bodyPatterns": [
{
"matches": "{\"clientPesel\":\"[0-9]{10}\",\"loanAmount\":\"99999\"}"
}
]
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/vnd.fraud.v1+json"
},
"body": "{\"fraudCheckStatus\":\"FRAUD\",\"rejectionReason\":\"Amount too high\"}"
}
}

View File

@@ -1,23 +0,0 @@
{
"request": {
"method": "PUT",
"headers": {
"Content-Type": {
"equalTo": "application/vnd.fraud.v1+json"
}
},
"url": "/fraudcheck",
"bodyPatterns": [
{
"matches": "{\"clientPesel\":\"[0-9]{10}\",\"loanAmount\":\"123.123\"}"
}
]
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/vnd.fraud.v1+json"
},
"body": "{\"fraudCheckStatus\":\"OK\",\"rejectionReason\":null}"
}
}

View File

@@ -47,4 +47,5 @@
<suppress files=".*HttpStatus.*" checks="HideUtility*"/>
<suppress files=".*contractsToCompile.*" checks=".*"/>
<suppress files=".*RegexPatterns.*" checks="HideUtility*"/>
<suppress files=".*.gradle.*" checks=".*"/>
</suppressions>