Bumped pact to 3.6.7; fixes gh-1099
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -26,7 +26,7 @@
|
||||
<activemq.version>5.15.9</activemq.version>
|
||||
<camel.version>2.24.0</camel.version>
|
||||
<checkstyle.version>2.17</checkstyle.version>
|
||||
<pact.version>3.5.13</pact.version>
|
||||
<pact.version>3.6.7</pact.version>
|
||||
<jsch-agent.version>0.0.9</jsch-agent.version>
|
||||
<spring-cloud-build.version>2.2.0.BUILD-SNAPSHOT</spring-cloud-build.version>
|
||||
<spring-cloud-zookeeper.version>2.2.0.BUILD-SNAPSHOT
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<guice.version>4.2.2</guice.version>
|
||||
<guava.version>27.1-jre</guava.version>
|
||||
<asm.version>7.1</asm.version>
|
||||
<checker.version>2.8.2</checker.version>
|
||||
|
||||
<maven-shade-plugin.version>3.2.1</maven-shade-plugin.version>
|
||||
<maven-dependency-plugin.version>3.0.0</maven-dependency-plugin.version>
|
||||
@@ -119,12 +120,6 @@
|
||||
<artifactId>guava</artifactId>
|
||||
<version>${guava.version}</version>
|
||||
<optional>true</optional>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>failureaccess</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.inject</groupId>
|
||||
@@ -145,6 +140,13 @@
|
||||
<optional>true</optional>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.checkerframework</groupId>
|
||||
<artifactId>checker</artifactId>
|
||||
<version>${checker.version}</version>
|
||||
<optional>true</optional>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@@ -86,8 +86,6 @@
|
||||
<goal>compile</goal>
|
||||
<goal>generateTestStubs</goal>
|
||||
<goal>compileTests</goal>
|
||||
<goal>removeStubs</goal>
|
||||
<goal>removeTestStubs</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
|
||||
@@ -37,8 +37,8 @@ import au.com.dius.pact.provider.junit.loader.PactBroker;
|
||||
import au.com.dius.pact.provider.junit.loader.PactBrokerAuth;
|
||||
import au.com.dius.pact.provider.junit.loader.PactBrokerLoader;
|
||||
import au.com.dius.pact.provider.junit.loader.PactLoader;
|
||||
import au.com.dius.pact.provider.junit.sysprops.SystemPropertyResolver;
|
||||
import au.com.dius.pact.provider.junit.sysprops.ValueResolver;
|
||||
import au.com.dius.pact.support.expressions.SystemPropertyResolver;
|
||||
import au.com.dius.pact.support.expressions.ValueResolver;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -288,6 +288,11 @@ class PactStubDownloader implements StubDownloader {
|
||||
|
||||
@Override
|
||||
public String protocol() {
|
||||
return scheme();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String scheme() {
|
||||
return resolver
|
||||
.resolveValue("pactbroker.protocol:" + pactBrokerUrl.getScheme());
|
||||
}
|
||||
@@ -297,6 +302,11 @@ class PactStubDownloader implements StubDownloader {
|
||||
return tags.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] consumers() {
|
||||
return new String[] { resolver.resolveValue("pactbroker.consumers:") };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean failIfNoPactsFound() {
|
||||
return true;
|
||||
|
||||
@@ -195,7 +195,7 @@ class BodyConverter {
|
||||
|
||||
private static def parseBody(OptionalBody optionalBody) {
|
||||
if (optionalBody.present) {
|
||||
return new JsonSlurper().parseText(optionalBody.value)
|
||||
return new JsonSlurper().parse(optionalBody.value)
|
||||
}
|
||||
else {
|
||||
return optionalBody.value
|
||||
|
||||
@@ -98,7 +98,7 @@ class MessagePactCreator {
|
||||
|
||||
private Map<String, String> getMetadata(Headers headers) {
|
||||
return headers.entries.collectEntries({ Header header ->
|
||||
return ["$header.name": extractValue(header)]
|
||||
return [(header.name): extractValue(header)]
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ class RequestResponseSCContractCreator {
|
||||
Category headerRules = request.matchingRules.
|
||||
rulesForCategory('header')
|
||||
headers {
|
||||
request.headers.each { k, v ->
|
||||
request.headers.each { String k, List<String> v ->
|
||||
if (headerRules.matchingRules.containsKey(k)) {
|
||||
MatchingRuleGroup ruleGroup = headerRules.matchingRules.
|
||||
get(k)
|
||||
@@ -95,15 +95,19 @@ class RequestResponseSCContractCreator {
|
||||
}
|
||||
MatchingRule rule = ruleGroup.rules[0]
|
||||
if (rule instanceof RegexMatcher) {
|
||||
header(k, new DslProperty((Object) Pattern.
|
||||
compile(rule.getRegex()), (Object) v))
|
||||
v.each({
|
||||
header(k, new DslProperty((Object) Pattern.
|
||||
compile(((RegexMatcher) rule).getRegex()), it))
|
||||
})
|
||||
}
|
||||
else {
|
||||
throw new UnsupportedOperationException("Currently only the header matcher of type regex is supported")
|
||||
}
|
||||
}
|
||||
else {
|
||||
header(k, v)
|
||||
v.each({
|
||||
header(k, it)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -191,7 +195,7 @@ class RequestResponseSCContractCreator {
|
||||
|
||||
if (FULL_BODY == key) {
|
||||
JsonPaths jsonPaths = JsonToJsonPathsConverter.
|
||||
transformToJsonPathWithStubsSideValuesAndNoArraySizeCheck(response.body.value)
|
||||
transformToJsonPathWithStubsSideValuesAndNoArraySizeCheck(response.body.value instanceof byte[] ? new String(response.body.value) : response.body.value)
|
||||
jsonPaths.each {
|
||||
jsonPath(it.keyBeforeChecking(), byType())
|
||||
}
|
||||
@@ -262,7 +266,7 @@ class RequestResponseSCContractCreator {
|
||||
Category headerRules = response.matchingRules.
|
||||
rulesForCategory('header')
|
||||
headers {
|
||||
response.headers.forEach({ String k, String v ->
|
||||
response.headers.forEach({ String k, List<String> v ->
|
||||
if (headerRules.matchingRules.containsKey(k)) {
|
||||
MatchingRuleGroup ruleGroup = headerRules.matchingRules.
|
||||
get(k)
|
||||
@@ -271,15 +275,20 @@ class RequestResponseSCContractCreator {
|
||||
}
|
||||
MatchingRule rule = ruleGroup.rules[0]
|
||||
if (rule instanceof RegexMatcher) {
|
||||
header(k, new DslProperty(new DslProperty(v), new NotToEscapePattern(Pattern.
|
||||
compile(rule.getRegex()))))
|
||||
v.each({
|
||||
header(k, new DslProperty(new DslProperty(it), new NotToEscapePattern(Pattern.
|
||||
compile(((RegexMatcher) rule).getRegex()))))
|
||||
})
|
||||
|
||||
}
|
||||
else {
|
||||
throw new UnsupportedOperationException("Currently only the header matcher of type regex is supported")
|
||||
}
|
||||
}
|
||||
else {
|
||||
header(k, v)
|
||||
v.each({
|
||||
header(k, it)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ class ValueGeneratorConverter {
|
||||
throw new UnsupportedOperationException("We currently don't support a generator of type " + generator.class.simpleName)
|
||||
}
|
||||
else {
|
||||
Object generatedValue = generator.generate(null)
|
||||
Object generatedValue = generator.generate([:])
|
||||
return dslPropertyProvider(pattern, generatedValue)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.nio.file.Files
|
||||
import au.com.dius.pact.model.Pact
|
||||
import au.com.dius.pact.model.PactSource
|
||||
import au.com.dius.pact.provider.junit.loader.PactLoader
|
||||
import au.com.dius.pact.provider.junit.sysprops.ValueResolver
|
||||
import au.com.dius.pact.support.expressions.ValueResolver
|
||||
import com.github.tomakehurst.wiremock.stubbing.StubMapping
|
||||
import org.jetbrains.annotations.NotNull
|
||||
import spock.lang.Ignore
|
||||
|
||||
@@ -338,11 +338,8 @@ class PactContractConverterSpec extends Specification {
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"pact-specification": {
|
||||
"version": "3.0.0"
|
||||
},
|
||||
"pact-jvm": {
|
||||
"version": "3.5.13"
|
||||
"version": "3.6.7"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,11 +146,8 @@
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"pact-specification": {
|
||||
"version": "3.0.0"
|
||||
},
|
||||
"pact-jvm": {
|
||||
"version": "3.5.13"
|
||||
"version": "3.6.7"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,11 +270,11 @@
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"pact-specification": {
|
||||
"pactSpecification": {
|
||||
"version": "3.0.0"
|
||||
},
|
||||
"pact-jvm": {
|
||||
"version": "3.5.13"
|
||||
"version": "3.6.7"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,11 +94,11 @@
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"pact-specification": {
|
||||
"pactSpecification": {
|
||||
"version": "3.0.0"
|
||||
},
|
||||
"pact-jvm": {
|
||||
"version": "3.5.13"
|
||||
"version": "3.6.7"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,11 +86,11 @@
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"pact-specification": {
|
||||
"pactSpecification": {
|
||||
"version": "3.0.0"
|
||||
},
|
||||
"pact-jvm": {
|
||||
"version": "3.5.13"
|
||||
"version": "3.6.7"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,7 @@
|
||||
],
|
||||
"combine": "AND"
|
||||
}
|
||||
},
|
||||
"body": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -61,18 +60,17 @@
|
||||
],
|
||||
"combine": "AND"
|
||||
}
|
||||
},
|
||||
"body": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"pact-specification": {
|
||||
"pactSpecification": {
|
||||
"version": "3.0.0"
|
||||
},
|
||||
"pact-jvm": {
|
||||
"version": "3.5.13"
|
||||
"version": "3.6.7"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,11 +35,11 @@
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"pact-specification": {
|
||||
"pactSpecification": {
|
||||
"version": "3.0.0"
|
||||
},
|
||||
"pact-jvm": {
|
||||
"version": "3.5.13"
|
||||
"version": "3.6.7"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,11 +34,11 @@
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"pact-specification": {
|
||||
"pactSpecification": {
|
||||
"version": "3.0.0"
|
||||
},
|
||||
"pact-jvm": {
|
||||
"version": "3.5.13"
|
||||
"version": "3.6.7"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"pact-specification": {
|
||||
"pactSpecification": {
|
||||
"version": "3.0.0"
|
||||
},
|
||||
"pact-jvm": {
|
||||
"version": "3.5.13"
|
||||
"version": "3.6.7"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,7 @@ class ImportsBuilder {
|
||||
}
|
||||
|
||||
ImportsBuilder json() {
|
||||
this.parentBuilder.imports(
|
||||
new JsonPathImports(builder, metaData));
|
||||
this.parentBuilder.imports(new JsonPathImports(builder, metaData));
|
||||
this.parentBuilder.staticImports(new DefaultJsonStaticImports(builder, metaData));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ import com.github.tomakehurst.wiremock.http.HttpHeader;
|
||||
import com.github.tomakehurst.wiremock.http.QueryParameter;
|
||||
import com.github.tomakehurst.wiremock.http.Request;
|
||||
import com.github.tomakehurst.wiremock.http.RequestMethod;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import wiremock.com.google.common.base.Optional;
|
||||
import wiremock.org.apache.commons.codec.binary.Base64;
|
||||
import wiremock.org.eclipse.jetty.server.handler.ContextHandler;
|
||||
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -263,7 +263,7 @@ class WireMockHttpRequestAdapter implements Request {
|
||||
.request(this.result.getMethod(), this.result.getUriTemplate())
|
||||
.contentType(this.result.getRequestHeaders().getContentType())
|
||||
.content(this.result.getRequestBodyContent())
|
||||
.buildRequest(new ContextHandler.StaticContext());
|
||||
.buildRequest(new ContextHandler.NoContext());
|
||||
try {
|
||||
return new StandardMultipartHttpServletRequest(request).getParts().stream()
|
||||
.map(part -> partFromServletPart(part)).collect(Collectors.toList());
|
||||
|
||||
Reference in New Issue
Block a user