diff --git a/pom.xml b/pom.xml
index 98f81b72a8..66501c0ab0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -48,6 +48,8 @@
1.3.2
5.4.2
5.4.2
+ 3.0.0-M3
+ 1.6.3
2.4.16
@@ -484,6 +486,7 @@
org.apache.maven.plugins
maven-surefire-plugin
+ ${maven-surefire-plugin.version}
**/*Spec.*
@@ -497,7 +500,7 @@
org.codehaus.gmavenplus
gmavenplus-plugin
- 1.6.2
+ ${gmavenplus-plugin.version}
diff --git a/spring-cloud-contract-shade/pom.xml b/spring-cloud-contract-shade/pom.xml
index 5369eef1f4..38dc191b3a 100644
--- a/spring-cloud-contract-shade/pom.xml
+++ b/spring-cloud-contract-shade/pom.xml
@@ -192,6 +192,8 @@
+ **/shaded/**/*.*,**/org/eclipse/**/*.*,**/org/codehaus/plexus/**/*.*
+
@@ -224,4 +226,27 @@
+
+
+
+ ide
+
+ false
+
+
+
+ org.jetbrains
+ annotations
+ 15.0
+ compile
+
+
+ com.google.code.findbugs
+ jsr305
+ 1.3.9
+ compile
+
+
+
+
diff --git a/spring-cloud-contract-stub-runner/pom.xml b/spring-cloud-contract-stub-runner/pom.xml
index d3468897d3..2a4ec12154 100644
--- a/spring-cloud-contract-stub-runner/pom.xml
+++ b/spring-cloud-contract-stub-runner/pom.xml
@@ -190,24 +190,23 @@
org.apache.maven.plugins
maven-surefire-plugin
-
- org.junit.platform
- junit-platform-surefire-provider
- ${junit-platform.version}
-
-
- org.junit.vintage
- junit-vintage-engine
- ${junit-vintage.version}
-
-
org.junit.jupiter
junit-jupiter-engine
${junit-jupiter.version}
+
+ org.junit.vintage
+ junit-vintage-engine
+ ${junit-vintage.version}
+
+
+
+ org.junit.jupiter:junit-vintage-engine
+
+
diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubRunnerOptions.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubRunnerOptions.java
index c74da90760..6e029be3c3 100644
--- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubRunnerOptions.java
+++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubRunnerOptions.java
@@ -170,6 +170,7 @@ public class StubRunnerOptions {
.withDeleteStubsAfterTest(Boolean.parseBoolean(
System.getProperty("stubrunner.delete-stubs-after-test", "true")))
.withProperties(stubRunnerProps());
+ builder = httpStubConfigurer(builder);
String proxyHost = System.getProperty("stubrunner.proxy.host");
if (proxyHost != null) {
builder.withProxy(proxyHost,
@@ -178,6 +179,21 @@ public class StubRunnerOptions {
return builder.build();
}
+ private static StubRunnerOptionsBuilder httpStubConfigurer(
+ StubRunnerOptionsBuilder builder) {
+ String classProperty = System.getProperty(
+ "stubrunner.http-server-stub-configurer",
+ HttpServerStubConfigurer.NoOpHttpServerStubConfigurer.class.getName());
+ try {
+ Class clazz = Class.forName(classProperty);
+ return builder.withHttpServerStubConfigurer(clazz);
+ }
+ catch (ClassNotFoundException ex) {
+ throw new IllegalStateException("Class [" + classProperty + "] not found",
+ ex);
+ }
+ }
+
private static Map stubRunnerProps() {
Map map = new HashMap<>();
Properties properties = System.getProperties();
diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubRunnerOptionsBuilder.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubRunnerOptionsBuilder.java
index ef53d63a8f..733ba66be5 100644
--- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubRunnerOptionsBuilder.java
+++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubRunnerOptionsBuilder.java
@@ -195,6 +195,7 @@ public class StubRunnerOptionsBuilder {
? options.stubIdsToPortMapping : new LinkedHashMap<>();
this.deleteStubsAfterTest = options.isDeleteStubsAfterTest();
this.properties = options.getProperties();
+ this.httpServerStubConfigurer = options.getHttpServerStubConfigurer();
return this;
}
diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/stream/StubRunnerStreamMessageSelector.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/stream/StubRunnerStreamMessageSelector.java
index ae54f11460..248c118db2 100644
--- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/stream/StubRunnerStreamMessageSelector.java
+++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/messaging/stream/StubRunnerStreamMessageSelector.java
@@ -158,8 +158,9 @@ class StubRunnerStreamMessageSelector implements MessageSelector {
BodyMatchers matchers = groovyDsl.getInput().getBodyMatchers();
matches = matchesForJsonPayload(groovyDsl, inputMessage, matchers, dslBody);
}
- else if (dslBody instanceof RegexProperty && inputMessage instanceof String) {
- Pattern pattern = ((RegexProperty) dslBody).getPattern();
+ else if ((dslBody instanceof RegexProperty || dslBody instanceof Pattern)
+ && inputMessage instanceof String) {
+ Pattern pattern = new RegexProperty(dslBody).getPattern();
matches = pattern.matcher((String) inputMessage).matches();
bodyUnmatchedLog(dslBody, matches, pattern);
}
diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerOptionsBuilderSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerOptionsBuilderSpec.groovy
index ec273ade82..a5b637001d 100644
--- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerOptionsBuilderSpec.groovy
+++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubRunnerOptionsBuilderSpec.groovy
@@ -290,7 +290,7 @@ class StubRunnerOptionsBuilderSpec extends Specification {
System.setProperty("stubrunner.properties.foo-bar", "bar")
System.setProperty("stubrunner.properties.foo-baz", "baz")
System.setProperty("stubrunner.properties.bar.bar", "foo")
- System.setProperty("stubrunner.httpServerStubConfigurer", "org.springframework.cloud.contract.stubrunner.Foo")
+ System.setProperty("stubrunner.http-server-stub-configurer", "org.springframework.cloud.contract.stubrunner.Foo")
when:
StubRunnerOptions options = StubRunnerOptions.fromSystemProps()
then:
diff --git a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubServerSpec.groovy b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubServerSpec.groovy
index 095738434c..7b184ae3bb 100644
--- a/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubServerSpec.groovy
+++ b/spring-cloud-contract-stub-runner/src/test/groovy/org/springframework/cloud/contract/stubrunner/StubServerSpec.groovy
@@ -31,7 +31,7 @@ class StubServerSpec extends Specification {
given:
List mappingDescriptors = new StubRepository(repository).getStubs()
StubServer pingStubServer = new StubServer(stubConfiguration, mappingDescriptors, [],
- new WireMockHttpServerStub()).start(STUB_SERVER_PORT)
+ new WireMockHttpServerStub()).start(new HttpServerStubConfiguration(new HttpServerStubConfigurer.NoOpHttpServerStubConfigurer(), StubRunnerOptions.fromSystemProps(), new StubConfiguration("a:b:c:d"), STUB_SERVER_PORT))
when:
pingStubServer.start()
then:
@@ -43,7 +43,7 @@ class StubServerSpec extends Specification {
given:
List mappingDescriptors = new StubRepository(repository).getStubs()
StubServer pingStubServer = new StubServer(stubConfiguration, mappingDescriptors, [],
- new WireMockHttpServerStub()).start(STUB_SERVER_PORT)
+ new WireMockHttpServerStub()).start(new HttpServerStubConfiguration(new HttpServerStubConfigurer.NoOpHttpServerStubConfigurer(), StubRunnerOptions.fromSystemProps(), new StubConfiguration("a:b:c:d"), STUB_SERVER_PORT))
when:
pingStubServer.start()
then:
diff --git a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/GitRepoTests.java b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/GitRepoTests.java
index 12553ef8f6..3e25c5d35c 100644
--- a/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/GitRepoTests.java
+++ b/spring-cloud-contract-stub-runner/src/test/java/org/springframework/cloud/contract/stubrunner/GitRepoTests.java
@@ -92,7 +92,7 @@ public class GitRepoTests extends AbstractGitTest {
fail("should throw an exception");
}
catch (IllegalStateException e) {
- then(e).hasMessageContaining("Ref nonExistingBranch can not be resolved");
+ then(e).hasMessageContaining("Ref nonExistingBranch cannot be resolved");
}
}
diff --git a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/stream/ContractVerifierStreamAutoConfiguration.java b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/stream/ContractVerifierStreamAutoConfiguration.java
index e5c8d77224..e1187d2179 100644
--- a/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/stream/ContractVerifierStreamAutoConfiguration.java
+++ b/spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/messaging/stream/ContractVerifierStreamAutoConfiguration.java
@@ -17,6 +17,7 @@
package org.springframework.cloud.contract.verifier.messaging.stream;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -40,6 +41,7 @@ import org.springframework.util.Assert;
@ConditionalOnProperty(name = "stubrunner.stream.enabled", havingValue = "true",
matchIfMissing = true)
@AutoConfigureBefore(NoOpContractVerifierAutoConfiguration.class)
+@ConditionalOnBean(MessageCollector.class)
public class ContractVerifierStreamAutoConfiguration {
@Bean