diff --git a/pom.xml b/pom.xml
index 06567d6a62..9ad3de724c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -54,7 +54,7 @@
1.6.3
- 2.5.8
+ 2.5.9
3.5.4
diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/loadbalancer/SpringCloudLoadBalancerAutoConfiguration.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/loadbalancer/SpringCloudLoadBalancerAutoConfiguration.java
index 4f65edaab2..4ef717d7e6 100644
--- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/loadbalancer/SpringCloudLoadBalancerAutoConfiguration.java
+++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/spring/cloud/loadbalancer/SpringCloudLoadBalancerAutoConfiguration.java
@@ -63,33 +63,37 @@ public class SpringCloudLoadBalancerAutoConfiguration {
@Bean
@Primary
- LoadBalancerClientFactory stubRunnerLoadBalancerClientFactory(
- StubFinder stubFinder, StubMapperProperties stubMapperProperties) {
+ LoadBalancerClientFactory stubRunnerLoadBalancerClientFactory(StubFinder stubFinder,
+ StubMapperProperties stubMapperProperties) {
return new StubRunnerLoadBalancerClientFactory(stubFinder, stubMapperProperties);
}
}
-class StubRunnerLoadBalancerClientFactory extends LoadBalancerClientFactory implements Closeable {
+class StubRunnerLoadBalancerClientFactory extends LoadBalancerClientFactory
+ implements Closeable {
+
private final StubFinder stubFinder;
private final StubMapperProperties stubMapperProperties;
- public StubRunnerLoadBalancerClientFactory(StubFinder stubFinder, StubMapperProperties stubMapperProperties) {
+ StubRunnerLoadBalancerClientFactory(StubFinder stubFinder,
+ StubMapperProperties stubMapperProperties) {
this.stubFinder = stubFinder;
this.stubMapperProperties = stubMapperProperties;
}
@Override
public ReactiveLoadBalancer getInstance(String serviceId) {
- return request -> Mono.just(new DefaultResponse(new StubbedServiceInstance(stubFinder, stubMapperProperties, serviceId)));
+ return request -> Mono.just(new DefaultResponse(
+ new StubbedServiceInstance(stubFinder, stubMapperProperties, serviceId)));
}
-
@Override
public void close() {
StubbedServiceInstance.CACHE.clear();
}
+
}
class StubbedServiceInstance implements ServiceInstance {
@@ -115,9 +119,10 @@ class StubbedServiceInstance implements ServiceInstance {
return entry;
}
RunningStubs runningStubs = this.stubFinder.findAllRunningStubs();
- String mappedServiceName = StringUtils
- .hasText(this.stubMapperProperties.fromServiceIdToIvyNotation(this.serviceId))
- ? this.stubMapperProperties.fromServiceIdToIvyNotation(this.serviceId)
+ String mappedServiceName = StringUtils.hasText(
+ this.stubMapperProperties.fromServiceIdToIvyNotation(this.serviceId))
+ ? this.stubMapperProperties.fromServiceIdToIvyNotation(
+ this.serviceId)
: this.serviceId;
entry = runningStubs.getEntry(mappedServiceName);
CACHE.put(this.serviceId, entry);
diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudAutoConfigurationSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudAutoConfigurationSpec.groovy
index 2b9fc10017..a92e5e738a 100644
--- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudAutoConfigurationSpec.groovy
+++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/spring/cloud/StubRunnerSpringCloudAutoConfigurationSpec.groovy
@@ -35,7 +35,6 @@ import org.springframework.context.annotation.Configuration
import org.springframework.test.context.ActiveProfiles
import org.springframework.test.context.ContextConfiguration
import org.springframework.web.client.RestTemplate
-
/**
* @author Marcin Grzejszczak
*/
diff --git a/spring-cloud-contract-stub-runner/src/test/resources/application-cloudtest.yml b/spring-cloud-contract-stub-runner/src/test/resources/application-cloudtest.yml
index ffdf85bd4a..72b4677623 100644
--- a/spring-cloud-contract-stub-runner/src/test/resources/application-cloudtest.yml
+++ b/spring-cloud-contract-stub-runner/src/test/resources/application-cloudtest.yml
@@ -9,3 +9,4 @@ spring.cloud:
discovery.enabled: false
service-registry.enabled: false
eureka.client.enabled: false
+ribbon.eureka.enabled: false
diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.properties b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.properties
index 7c4388a921..5028f28f8e 100644
--- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.properties
+++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradle/wrapper/gradle-wrapper.properties
@@ -1,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-5.6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew.bat b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew.bat
index 9618d8d960..24467a141f 100644
--- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew.bat
+++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/gradlew.bat
@@ -1,100 +1,100 @@
-@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
-@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="-Xmx64m" "-Xms64m"
-
-@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
+@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
+@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="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/spring-cloud-contract-verifier/src/main/groovy/org/springframework/cloud/contract/verifier/util/BodyExtractor.groovy b/spring-cloud-contract-verifier/src/main/groovy/org/springframework/cloud/contract/verifier/util/BodyExtractor.groovy
index 9243a4777f..519d849d41 100644
--- a/spring-cloud-contract-verifier/src/main/groovy/org/springframework/cloud/contract/verifier/util/BodyExtractor.groovy
+++ b/spring-cloud-contract-verifier/src/main/groovy/org/springframework/cloud/contract/verifier/util/BodyExtractor.groovy
@@ -24,6 +24,7 @@ import groovy.transform.CompileStatic
import org.springframework.cloud.contract.spec.internal.CanBeDynamic
import org.springframework.cloud.contract.spec.internal.DslProperty
+import org.springframework.cloud.contract.spec.internal.FromFileProperty
import org.springframework.cloud.contract.spec.internal.RegexProperty
import static ContentUtils.extractValue
@@ -89,6 +90,9 @@ class BodyExtractor {
else if (bodyValue instanceof DslProperty) {
return extractClientValueFromBody(bodyValue.clientValue)
}
+ else if (bodyValue instanceof FromFileProperty && bodyValue.isString()) {
+ return MapConverter.transformValues(bodyValue.asString(), Closure.IDENTITY)
+ }
else {
return MapConverter.transformValues(bodyValue, {
Object prop = it instanceof DslProperty ? it.clientValue : it
diff --git a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/stream/StreamOutputDestinationMessageReceiver.java b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/stream/StreamOutputDestinationMessageReceiver.java
index 2924bc39b6..69e88be8a9 100644
--- a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/stream/StreamOutputDestinationMessageReceiver.java
+++ b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/stream/StreamOutputDestinationMessageReceiver.java
@@ -65,6 +65,9 @@ class StreamOutputDestinationMessageReceiver
private int indexOfDestination(StreamFunctionProperties streamFunctionProperties,
String destination) {
String[] split = streamFunctionProperties.getDefinition().split(";");
+ if (split.length == 1) {
+ return 0;
+ }
int indexOfDestination = Arrays.stream(split).map(String::toLowerCase)
.collect(Collectors.toList()).indexOf(destination.toLowerCase());
if (indexOfDestination == -1) {
diff --git a/spring-cloud-contract-verifier/src/test/groovy/org/springframework/cloud/contract/verifier/util/BodyExtractorSpec.groovy b/spring-cloud-contract-verifier/src/test/groovy/org/springframework/cloud/contract/verifier/util/BodyExtractorSpec.groovy
new file mode 100644
index 0000000000..ae321b3038
--- /dev/null
+++ b/spring-cloud-contract-verifier/src/test/groovy/org/springframework/cloud/contract/verifier/util/BodyExtractorSpec.groovy
@@ -0,0 +1,19 @@
+package org.springframework.cloud.contract.verifier.util
+
+import org.springframework.cloud.contract.spec.internal.FromFileProperty
+import spock.lang.Specification
+
+/**
+ * @author Adam BiaĆas
+ */
+class BodyExtractorSpec extends Specification {
+
+ def "should extract body from json file"() {
+ given:
+ def uri = BodyExtractorSpec.getResource("/classpath/response.json").toURI()
+ def jsonFromFile = new FromFileProperty(new File(uri), String.class)
+ expect:
+ ["status" : "RESPONSE"] == BodyExtractor.extractClientValueFromBody(jsonFromFile)
+ }
+
+}