Upgrade to 5.0.0-SNAPSHOT. Adjust to changes in Framework.
Signed-off-by: Olga Maciaszek-Sharma <olga.maciaszek-sharma@broadcom.com>
This commit is contained in:
@@ -25,7 +25,7 @@ The following example shows a generated test:
|
||||
package com.example.beer;
|
||||
|
||||
import com.example.BeerRestBase;
|
||||
import javax.inject.Inject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.contract.verifier.http.HttpVerifier;
|
||||
import org.springframework.cloud.contract.verifier.http.Request;
|
||||
import org.springframework.cloud.contract.verifier.http.Response;
|
||||
@@ -38,7 +38,7 @@ import static org.springframework.cloud.contract.verifier.http.Request.given;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class RestTest extends BeerRestBase {
|
||||
@Inject HttpVerifier httpVerifier;
|
||||
@Autowired HttpVerifier httpVerifier;
|
||||
|
||||
@Test
|
||||
public void validate_shouldGrantABeerIfOldEnough() throws Exception {
|
||||
|
||||
@@ -91,7 +91,8 @@ metadata:
|
||||
----
|
||||
====
|
||||
|
||||
Adding the metadata section will change the way the default, WireMock stub is built. It will now use the Spring Cloud Contract request matcher, so that e.g. the `query` part of the GraphQL request gets compared against the real request by ignoring whitespaces.
|
||||
Adding the metadata section will change the way the default, WireMock stub is built.
|
||||
It will now use the Spring Cloud Contract request matcher, so that e.g. the `query` part of the GraphQL request gets compared against the real request by ignoring whitespaces.
|
||||
|
||||
[[features-graphql-producer]]
|
||||
== Producer Side Setup
|
||||
@@ -177,7 +178,7 @@ public class BeerControllerGraphQLTest {
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.body(REQUEST_BODY), String.class);
|
||||
|
||||
BDDAssertions.then(responseEntity.getStatusCodeValue()).isEqualTo(200);
|
||||
BDDAssertions.then(responseEntity.getStatusCode().value()).isEqualTo(200);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
20
pom.xml
20
pom.xml
@@ -35,12 +35,12 @@
|
||||
<spring-cloud-commons.version>5.0.0-SNAPSHOT</spring-cloud-commons.version>
|
||||
<jopt-simple.version>5.0.4</jopt-simple.version>
|
||||
<cglib.version>3.3.0</cglib.version>
|
||||
<spock-spring.version>2.3-groovy-4.0</spock-spring.version> <!-- @releaser:version-check-off -->
|
||||
<spock-spring.version>2.3-groovy-4.0
|
||||
</spock-spring.version> <!-- @releaser:version-check-off -->
|
||||
<hoverfly-junit.version>0.2.2</hoverfly-junit.version>
|
||||
<commons-text.version>1.11.0</commons-text.version>
|
||||
<handlebars.version>4.3.1</handlebars.version>
|
||||
<jgit.version>6.10.1.202505221210-r</jgit.version>
|
||||
<javax-inject.version>1</javax-inject.version>
|
||||
<json-unit-assertj.version>2.38.0</json-unit-assertj.version>
|
||||
<rest-assured.version>5.2.1</rest-assured.version>
|
||||
<slf4j.version>[2.0.0,)</slf4j.version>
|
||||
@@ -49,7 +49,8 @@
|
||||
<junit-vintage.version>5.12.1</junit-vintage.version>
|
||||
<junit-jupiter.version>5.12.1</junit-jupiter.version>
|
||||
<gmavenplus-plugin.version>1.13.0</gmavenplus-plugin.version>
|
||||
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version> <!-- @releaser:version-check-off -->
|
||||
<maven-surefire-plugin.version>3.2.5
|
||||
</maven-surefire-plugin.version> <!-- @releaser:version-check-off -->
|
||||
<awaitility.version>4.2.0</awaitility.version>
|
||||
<artemis.version>2.39.0</artemis.version>
|
||||
<testcontainers.version>1.19.8</testcontainers.version>
|
||||
@@ -232,11 +233,6 @@
|
||||
<artifactId>handlebars</artifactId>
|
||||
<version>${handlebars.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.inject</groupId>
|
||||
<artifactId>javax.inject</artifactId>
|
||||
<version>${javax-inject.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Git Stub Downloader-->
|
||||
<dependency>
|
||||
@@ -414,9 +410,9 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.sonatype.sisu</groupId>
|
||||
<artifactId>sisu-inject-plexus</artifactId>
|
||||
<artifactId>sisu-inject-plexus</artifactId>
|
||||
<version>${sisu-inject-plexus.version}</version>
|
||||
</dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver</artifactId>
|
||||
@@ -632,7 +628,9 @@
|
||||
<repository>
|
||||
<id>netflix-candidates</id>
|
||||
<name>Netflix Candidates</name>
|
||||
<url>https://artifactory-oss.prod.netflix.net/artifactory/maven-oss-candidates</url>
|
||||
<url>
|
||||
https://artifactory-oss.prod.netflix.net/artifactory/maven-oss-candidates
|
||||
</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<org.eclipse.sisu.plexus.version>0.3.5</org.eclipse.sisu.plexus.version>
|
||||
<sisu-guice.version>4.2.0</sisu-guice.version>
|
||||
<guice.version>5.0.1</guice.version>
|
||||
<guava.version>33.0.0-jre</guava.version>
|
||||
<guava.version>33.4.8-jre</guava.version>
|
||||
<asm.version>9.6</asm.version>
|
||||
<checker.version>3.25.0</checker.version>
|
||||
<maven-dependency-plugin.version>3.6.1</maven-dependency-plugin.version>
|
||||
|
||||
@@ -71,8 +71,12 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
}
|
||||
""")
|
||||
when:
|
||||
String json = converter.convertContents("Test", new ContractMetadata(file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter.convertAsCollection(new File("/"), file))).values().first()
|
||||
String json =
|
||||
converter.convertContents("Test", new ContractMetadata(
|
||||
file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter
|
||||
.convertAsCollection(new File("/"), file)))
|
||||
.values().first()
|
||||
then:
|
||||
JSONAssert.assertEquals('''
|
||||
{"request":{"method":"PUT","urlPattern":"/[0-9]{2}"},"response":{"status":200}}
|
||||
@@ -115,8 +119,12 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
]
|
||||
""")
|
||||
when:
|
||||
String json = converter.convertContents("Test", new ContractMetadata(file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter.convertAsCollection(new File("/"), file))).values().first()
|
||||
String json =
|
||||
converter.convertContents("Test", new ContractMetadata(
|
||||
file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter
|
||||
.convertAsCollection(new File("/"), file)))
|
||||
.values().first()
|
||||
then:
|
||||
JSONAssert.assertEquals('''
|
||||
{"request":{"url":"/multipart","method":"POST","headers":{"Content-Type":{"matches":"multipart/form-data.*"}},"bodyPatterns":[{"matches" : ".*--(.*)\\r?\\nContent-Disposition: form-data; name=\\"file\\"; filename=\\".+\\"\\r?\\n(Content-Type: .*\\r?\\n)?(Content-Transfer-Encoding: .*\\r?\\n)?(Content-Length: \\\\d+\\r?\\n)?\\r?\\n.+\\r?\\n--.*"}]},"response":{"status":200,"body":"hello","transformers":["response-template", "spring-cloud-contract" ]}}
|
||||
@@ -165,25 +173,32 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
}
|
||||
''')
|
||||
when:
|
||||
Map<Contract, String> convertedContents = converter.convertContents("Test", new ContractMetadata(file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter.convertAsCollection(new File("/"), file)))
|
||||
Map<Contract, String> convertedContents =
|
||||
converter.convertContents("Test", new ContractMetadata(
|
||||
file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter
|
||||
.convertAsCollection(new File("/"), file)))
|
||||
then:
|
||||
convertedContents.size() == 2
|
||||
JSONAssert.assertEquals(jsonResponse(1), convertedContents.values().first(), false)
|
||||
JSONAssert.assertEquals(jsonResponse(2), convertedContents.values().last(), false)
|
||||
JSONAssert.assertEquals(
|
||||
jsonResponse(1), convertedContents.values().first(), false)
|
||||
JSONAssert.assertEquals(
|
||||
jsonResponse(2), convertedContents.values().last(), false)
|
||||
and:
|
||||
StubMapping mapping = stubMappingIsValidWireMockStub(convertedContents.values().first())
|
||||
StubMapping mapping2 = stubMappingIsValidWireMockStub(convertedContents.values().last())
|
||||
StubMapping mapping =
|
||||
stubMappingIsValidWireMockStub(convertedContents.values().first())
|
||||
StubMapping mapping2 =
|
||||
stubMappingIsValidWireMockStub(convertedContents.values().last())
|
||||
and:
|
||||
wireMockRule.addStubMapping(mapping)
|
||||
wireMockRule.addStubMapping(mapping2)
|
||||
and:
|
||||
restTemplate.exchange(RequestEntity.put("${url}/1".toURI())
|
||||
.header('Content-Type', 'application/json')
|
||||
.body(""), String)
|
||||
.header('Content-Type', 'application/json')
|
||||
.body(""), String)
|
||||
restTemplate.exchange(RequestEntity.put("${url}/2".toURI())
|
||||
.header('Content-Type', 'application/json')
|
||||
.body(""), String)
|
||||
.header('Content-Type', 'application/json')
|
||||
.body(""), String)
|
||||
}
|
||||
|
||||
private String jsonResponse(int index) {
|
||||
@@ -207,7 +222,8 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
when:
|
||||
Map<Contract, String> convertedContents = converter.convertContents("Test",
|
||||
new ContractMetadata(file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter.convertAsCollection(new File("/"), file)))
|
||||
ContractVerifierDslConverter
|
||||
.convertAsCollection(new File("/"), file)))
|
||||
then:
|
||||
convertedContents.isEmpty()
|
||||
}
|
||||
@@ -231,8 +247,12 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
}
|
||||
""")
|
||||
when:
|
||||
String json = converter.convertContents("test", new ContractMetadata(file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter.convertAsCollection(new File("/"), file))).values().first()
|
||||
String json =
|
||||
converter.convertContents("test", new ContractMetadata(
|
||||
file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter
|
||||
.convertAsCollection(new File("/"), file)))
|
||||
.values().first()
|
||||
then:
|
||||
JSONAssert.assertEquals('''
|
||||
{"request":{
|
||||
@@ -300,8 +320,12 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
}
|
||||
""")
|
||||
when:
|
||||
String json = converter.convertContents("Test", new ContractMetadata(file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter.convertAsCollection(new File("/"), file))).values().first()
|
||||
String json =
|
||||
converter.convertContents("Test", new ContractMetadata(
|
||||
file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter
|
||||
.convertAsCollection(new File("/"), file)))
|
||||
.values().first()
|
||||
then:
|
||||
JSONAssert.assertEquals('''
|
||||
{
|
||||
@@ -358,8 +382,8 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
wireMockRule.addStubMapping(mapping)
|
||||
and:
|
||||
restTemplate.exchange(RequestEntity.put("${url}/api/12".toURI())
|
||||
.header('Content-Type', 'application/vnd.org.springframework.cloud.contract.verifier.twitter-places-analyzer.v1+json')
|
||||
.body('''
|
||||
.header('Content-Type', 'application/vnd.org.springframework.cloud.contract.verifier.twitter-places-analyzer.v1+json')
|
||||
.body('''
|
||||
[{
|
||||
"created_at": "Sat Jul 26 09:38:57 +0000 2014",
|
||||
"id": 492967299297845248,
|
||||
@@ -418,8 +442,12 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
}
|
||||
""")
|
||||
when:
|
||||
String json = converter.convertContents("test", new ContractMetadata(file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter.convertAsCollection(new File("/"), file))).values().first()
|
||||
String json =
|
||||
converter.convertContents("test", new ContractMetadata(
|
||||
file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter
|
||||
.convertAsCollection(new File("/"), file)))
|
||||
.values().first()
|
||||
then:
|
||||
JSONAssert.assertEquals('''
|
||||
{"request":{"urlPath":"/foos","method":"GET"},"response":{"body":"[{\\"id\\":\\"123\\"},{\\"id\\":\\"567\\"}]"}}
|
||||
@@ -429,9 +457,12 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
and:
|
||||
wireMockRule.addStubMapping(mapping)
|
||||
and:
|
||||
def response = restTemplate.exchange(RequestEntity.get("${url}/foos".toURI()).build(), String)
|
||||
def response =
|
||||
restTemplate.exchange(
|
||||
RequestEntity.get("${url}/foos".toURI()).build(), String)
|
||||
response.headers.get('Content-Type') == ['application/json']
|
||||
JSONAssert.assertEquals('''[ { "id":"123" }, { "id": "567" } ]''', response.body, false)
|
||||
JSONAssert.assertEquals('''[ { "id":"123" }, { "id": "567" } ]''',
|
||||
response.body, false)
|
||||
}
|
||||
|
||||
|
||||
@@ -457,8 +488,12 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
}
|
||||
""")
|
||||
when:
|
||||
String json = converter.convertContents("test", new ContractMetadata(file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter.convertAsCollection(new File("/"), file))).values().first()
|
||||
String json =
|
||||
converter.convertContents("test", new ContractMetadata(
|
||||
file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter
|
||||
.convertAsCollection(new File("/"), file)))
|
||||
.values().first()
|
||||
then:
|
||||
noExceptionThrown()
|
||||
and:
|
||||
@@ -468,7 +503,9 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
and:
|
||||
wireMockRule.addStubMapping(mapping)
|
||||
and:
|
||||
def response = restTemplate.exchange(RequestEntity.get("${url}/foos".toURI()).build(), String)
|
||||
def response =
|
||||
restTemplate.exchange(
|
||||
RequestEntity.get("${url}/foos".toURI()).build(), String)
|
||||
response.body
|
||||
}
|
||||
|
||||
@@ -504,8 +541,12 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
}
|
||||
''')
|
||||
when:
|
||||
String json = converter.convertContents("Test", new ContractMetadata(file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter.convertAsCollection(new File("/"), file))).values().first()
|
||||
String json =
|
||||
converter.convertContents("Test", new ContractMetadata(
|
||||
file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter
|
||||
.convertAsCollection(new File("/"), file)))
|
||||
.values().first()
|
||||
then:
|
||||
JSONAssert.assertEquals( // tag::wiremock[]
|
||||
'''
|
||||
@@ -541,13 +582,17 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
and:
|
||||
wireMockRule.addStubMapping(mapping)
|
||||
and:
|
||||
def response = restTemplate.exchange(RequestEntity.post("${url}/users/password".toURI())
|
||||
.header("Content-Type", "application/json")
|
||||
.body('''{"email":"abc@abc.com", "callback_url":"https://partners.com"}''')
|
||||
, String)
|
||||
def response =
|
||||
restTemplate
|
||||
.exchange(RequestEntity.post("${url}/users/password".toURI())
|
||||
.header("Content-Type", "application/json")
|
||||
.body('''{"email":"abc@abc.com", "callback_url":"https://partners.com"}''')
|
||||
, String)
|
||||
response.headers.get('Content-Type') == ['application/json']
|
||||
response.statusCodeValue == 404
|
||||
JSONAssert.assertEquals('''{"code":"123123","message":"User not found by email == [not.existing@user.com]"}"''', response.body, false)
|
||||
response.getStatusCode().value() == 404
|
||||
JSONAssert
|
||||
.assertEquals('''{"code":"123123","message":"User not found by email == [not.existing@user.com]"}"''',
|
||||
response.body, false)
|
||||
}
|
||||
|
||||
def 'should convert dsl to wiremock with stub matchers'() {
|
||||
@@ -692,8 +737,12 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
}
|
||||
''')
|
||||
when:
|
||||
String json = converter.convertContents("Test", new ContractMetadata(file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter.convertAsCollection(new File("/"), file))).values().first()
|
||||
String json =
|
||||
converter.convertContents("Test", new ContractMetadata(
|
||||
file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter
|
||||
.convertAsCollection(new File("/"), file)))
|
||||
.values().first()
|
||||
then:
|
||||
JSONAssert.assertEquals(//tag::matchers[]
|
||||
'''
|
||||
@@ -764,47 +813,47 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
wireMockRule.addStubMapping(mapping)
|
||||
and:
|
||||
def response = restTemplate.exchange(RequestEntity.post("${url}/get".toURI())
|
||||
.header("Content-Type", "application/json")
|
||||
.body(JsonOutput.toJson([
|
||||
duck : 123,
|
||||
alpha : "abc",
|
||||
number : 123,
|
||||
aBoolean : true,
|
||||
date : "2017-01-01",
|
||||
dateTime : "2017-01-01T01:23:45",
|
||||
time : "01:02:34",
|
||||
valueWithoutAMatcher: "foo",
|
||||
valueWithTypeMatch : "string",
|
||||
list : [
|
||||
some : [
|
||||
nested: [
|
||||
json : "with value",
|
||||
anothervalue: 4
|
||||
.header("Content-Type", "application/json")
|
||||
.body(JsonOutput.toJson([
|
||||
duck : 123,
|
||||
alpha : "abc",
|
||||
number : 123,
|
||||
aBoolean : true,
|
||||
date : "2017-01-01",
|
||||
dateTime : "2017-01-01T01:23:45",
|
||||
time : "01:02:34",
|
||||
valueWithoutAMatcher: "foo",
|
||||
valueWithTypeMatch : "string",
|
||||
list : [
|
||||
some : [
|
||||
nested: [
|
||||
json : "with value",
|
||||
anothervalue: 4
|
||||
]
|
||||
],
|
||||
someother: [
|
||||
nested: [
|
||||
json : "with value",
|
||||
anothervalue: 4
|
||||
]
|
||||
]
|
||||
],
|
||||
someother: [
|
||||
nested: [
|
||||
json : "with value",
|
||||
anothervalue: 4
|
||||
]
|
||||
valueWithMin : [
|
||||
1, 2, 3
|
||||
],
|
||||
valueWithMax : [
|
||||
1, 2, 3
|
||||
],
|
||||
valueWithMinMax : [
|
||||
1, 2, 3
|
||||
],
|
||||
valueWithOccurrence : [
|
||||
1, 2, 3, 4
|
||||
]
|
||||
],
|
||||
valueWithMin : [
|
||||
1, 2, 3
|
||||
],
|
||||
valueWithMax : [
|
||||
1, 2, 3
|
||||
],
|
||||
valueWithMinMax : [
|
||||
1, 2, 3
|
||||
],
|
||||
valueWithOccurrence : [
|
||||
1, 2, 3, 4
|
||||
]
|
||||
]))
|
||||
]))
|
||||
, String)
|
||||
response.headers.get('Content-Type') == ['application/json']
|
||||
response.statusCodeValue == 200
|
||||
response.statusCode.value() == 200
|
||||
JSONAssert.assertEquals(JsonOutput.toJson([
|
||||
duck : 123,
|
||||
alpha : "abc",
|
||||
@@ -870,8 +919,12 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
}
|
||||
''')
|
||||
when:
|
||||
String json = converter.convertContents("Test", new ContractMetadata(file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter.convertAsCollection(new File("/"), file))).values().first()
|
||||
String json =
|
||||
converter.convertContents("Test", new ContractMetadata(
|
||||
file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter
|
||||
.convertAsCollection(new File("/"), file)))
|
||||
.values().first()
|
||||
then:
|
||||
JSONAssert.assertEquals(
|
||||
'''
|
||||
@@ -906,13 +959,17 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
and:
|
||||
wireMockRule.addStubMapping(mapping)
|
||||
and:
|
||||
def response = restTemplate.exchange(RequestEntity.post("${url}/users/password2".toURI())
|
||||
.header("Content-Type", "application/json")
|
||||
.body('''{"email":"abc@abc.com", "callback_url":"https://partners.com"}''')
|
||||
, String)
|
||||
def response =
|
||||
restTemplate
|
||||
.exchange(RequestEntity.post("${url}/users/password2".toURI())
|
||||
.header("Content-Type", "application/json")
|
||||
.body('''{"email":"abc@abc.com", "callback_url":"https://partners.com"}''')
|
||||
, String)
|
||||
response.headers.get('Content-Type') == ['application/json']
|
||||
response.statusCodeValue == 404
|
||||
JSONAssert.assertEquals('''{"code":"123123","message":"User not found by email == [not.existing@user.com]"}"''', response.body, false)
|
||||
response.statusCode.value() == 404
|
||||
JSONAssert
|
||||
.assertEquals('''{"code":"123123","message":"User not found by email == [not.existing@user.com]"}"''',
|
||||
response.body, false)
|
||||
}
|
||||
|
||||
@Issue("#515")
|
||||
@@ -965,8 +1022,12 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
}
|
||||
''')
|
||||
when:
|
||||
String json = converter.convertContents("Test", new ContractMetadata(file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter.convertAsCollection(new File("/"), file))).values().first()
|
||||
String json =
|
||||
converter.convertContents("Test", new ContractMetadata(
|
||||
file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter
|
||||
.convertAsCollection(new File("/"), file)))
|
||||
.values().first()
|
||||
then:
|
||||
JSONAssert.assertEquals(
|
||||
'''
|
||||
@@ -1004,13 +1065,16 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
and:
|
||||
wireMockRule.addStubMapping(mapping)
|
||||
and:
|
||||
def response = restTemplate.exchange(RequestEntity.post("${url}/users/password2".toURI())
|
||||
.header("Content-Type", "application/json")
|
||||
.body('''{"email":"abc@abc.com", "callback_url":"https://partners.com"}''')
|
||||
, String)
|
||||
def response =
|
||||
restTemplate
|
||||
.exchange(RequestEntity.post("${url}/users/password2".toURI())
|
||||
.header("Content-Type", "application/json")
|
||||
.body('''{"email":"abc@abc.com", "callback_url":"https://partners.com"}''')
|
||||
, String)
|
||||
response.headers.get('Content-Type') == ['application/json;charset=UTF-8']
|
||||
response.statusCodeValue == 400
|
||||
JSONAssert.assertEquals('''{"message":"[8.2 Profile/3.7 Bad Request]"}"''', response.body, false)
|
||||
response.statusCode.value() == 400
|
||||
JSONAssert.assertEquals('''{"message":"[8.2 Profile/3.7 Bad Request]"}"''',
|
||||
response.body, false)
|
||||
}
|
||||
|
||||
@Issue("#449")
|
||||
@@ -1040,8 +1104,12 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
}
|
||||
''')
|
||||
when:
|
||||
String json = converter.convertContents("Test", new ContractMetadata(file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter.convertAsCollection(new File("/"), file))).values().first()
|
||||
String json =
|
||||
converter.convertContents("Test", new ContractMetadata(
|
||||
file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter
|
||||
.convertAsCollection(new File("/"), file)))
|
||||
.values().first()
|
||||
then:
|
||||
JSONAssert.assertEquals(
|
||||
'''
|
||||
@@ -1071,7 +1139,7 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
.header("X-Smartup-Test", "asd123")
|
||||
.build()
|
||||
, String)
|
||||
response.statusCodeValue == 204
|
||||
response.statusCode.value() == 204
|
||||
}
|
||||
|
||||
|
||||
@@ -1103,8 +1171,12 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
}
|
||||
""")
|
||||
when:
|
||||
String json = converter.convertContents("Test", new ContractMetadata(file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter.convertAsCollection(new File("/"), file))).values().first()
|
||||
String json =
|
||||
converter.convertContents("Test", new ContractMetadata(
|
||||
file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter
|
||||
.convertAsCollection(new File("/"), file)))
|
||||
.values().first()
|
||||
then:
|
||||
JSONAssert.assertEquals("""
|
||||
{
|
||||
@@ -1127,10 +1199,14 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
|
||||
StubMapping stubMappingIsValidWireMockStub(String mappingDefinition) {
|
||||
StubMapping stubMapping = WireMockStubMapping.buildFrom(mappingDefinition)
|
||||
stubMapping.request.bodyPatterns.findAll { it.isPresent() && it instanceof RegexPattern }.every {
|
||||
stubMapping
|
||||
.request
|
||||
.bodyPatterns
|
||||
.findAll { it.isPresent() && it instanceof RegexPattern }.every {
|
||||
Pattern.compile(it.getValue())
|
||||
}
|
||||
assert !mappingDefinition.contains('org.springframework.cloud.contract.spec.internal')
|
||||
assert !mappingDefinition
|
||||
.contains('org.springframework.cloud.contract.spec.internal')
|
||||
return stubMapping
|
||||
}
|
||||
|
||||
@@ -1169,8 +1245,12 @@ class DslToWireMockClientConverterSpec extends Specification {
|
||||
}
|
||||
''')
|
||||
when:
|
||||
String json = converter.convertContents("Test", new ContractMetadata(file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter.convertAsCollection(new File("/"), file))).values().first()
|
||||
String json =
|
||||
converter.convertContents("Test", new ContractMetadata(
|
||||
file.toPath(), false, 0, null,
|
||||
ContractVerifierDslConverter
|
||||
.convertAsCollection(new File("/"), file)))
|
||||
.values().first()
|
||||
then:
|
||||
JSONAssert.assertEquals('''
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -10,21 +11,6 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Remove me for Gradle 8.4 - https://github.com/gradle/gradle/issues/25434
|
||||
configurations {
|
||||
all {
|
||||
resolutionStrategy {
|
||||
eachDependency { dependency ->
|
||||
// Downgrade Spring Framework as Gradle cannot cope with 6.1.0-M1's
|
||||
// multi-version jar files with bytecode in META-INF/versions/21
|
||||
if (dependency.requested.group.equals("org.springframework")) {
|
||||
dependency.useVersion("6.0.10")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ext {
|
||||
repoUser = System.getenv('REPO_USERNAME') ?: project.findProperty('REPO_USERNAME') ?: ''
|
||||
|
||||
@@ -19,7 +19,7 @@ verifierVersion=5.0.0-SNAPSHOT
|
||||
org.gradle.daemon=false
|
||||
aetherVersion=1.1.0
|
||||
springCloudBuildVersion=5.0.0-SNAPSHOT
|
||||
springVersion=6.0.10
|
||||
springVersion=7.0.0-SNAPSHOT
|
||||
jacksonDatabindVersion=2.13.2.1
|
||||
mavenResolverVersion=1.9.18
|
||||
jgitVersion=5.12.0.202106070339-r
|
||||
|
||||
@@ -341,11 +341,6 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.inject</groupId>
|
||||
<artifactId>javax.inject</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
|
||||
@@ -20,8 +20,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
@@ -31,6 +29,7 @@ import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.plugins.annotations.ResolutionScope;
|
||||
import org.eclipse.aether.RepositorySystemSession;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.contract.maven.verifier.stubrunner.LocalStubRunner;
|
||||
import org.springframework.cloud.contract.maven.verifier.stubrunner.RemoteStubRunner;
|
||||
import org.springframework.cloud.contract.stubrunner.BatchStubRunner;
|
||||
@@ -118,7 +117,7 @@ public class RunMojo extends AbstractMojo {
|
||||
@Parameter(property = "spring.cloud.contract.verifier.server-id")
|
||||
private String serverId;
|
||||
|
||||
@Inject
|
||||
@Autowired
|
||||
public RunMojo(LocalStubRunner localStubRunner, RemoteStubRunner remoteStubRunner) {
|
||||
this.localStubRunner = localStubRunner;
|
||||
this.remoteStubRunner = remoteStubRunner;
|
||||
|
||||
@@ -16,10 +16,6 @@
|
||||
|
||||
package org.springframework.cloud.contract.maven.verifier.stubrunner;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
@@ -27,12 +23,14 @@ import org.eclipse.aether.RepositorySystem;
|
||||
import org.eclipse.aether.RepositorySystemSession;
|
||||
import shaded.org.apache.maven.settings.Settings;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.contract.stubrunner.AetherStubDownloader;
|
||||
import org.springframework.cloud.contract.stubrunner.StubDownloader;
|
||||
import org.springframework.cloud.contract.stubrunner.StubDownloaderBuilder;
|
||||
import org.springframework.cloud.contract.stubrunner.StubRunnerOptions;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Builds {@link StubDownloaderBuilder} for a Maven project.
|
||||
@@ -40,8 +38,7 @@ import org.springframework.core.io.ResourceLoader;
|
||||
* @author Mariusz Smykula
|
||||
* @author Eddú Meléndez
|
||||
*/
|
||||
@Named
|
||||
@Singleton
|
||||
@Component
|
||||
public class AetherStubDownloaderFactory {
|
||||
|
||||
private static final Log log = LogFactory.getLog(AetherStubDownloaderFactory.class);
|
||||
@@ -52,7 +49,7 @@ public class AetherStubDownloaderFactory {
|
||||
|
||||
private final Settings settings;
|
||||
|
||||
@Inject
|
||||
@Autowired
|
||||
public AetherStubDownloaderFactory(RepositorySystem repoSystem, MavenProject project, Settings settings) {
|
||||
this.repoSystem = repoSystem;
|
||||
this.project = project;
|
||||
|
||||
@@ -16,21 +16,20 @@
|
||||
|
||||
package org.springframework.cloud.contract.maven.verifier.stubrunner;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.cloud.contract.stubrunner.StubConfiguration;
|
||||
import org.springframework.cloud.contract.stubrunner.StubRunner;
|
||||
import org.springframework.cloud.contract.stubrunner.StubRunnerOptions;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Allows running stubs from the given directory.
|
||||
*
|
||||
* @author Mariusz Smykula
|
||||
*/
|
||||
@Named
|
||||
@Component
|
||||
public class LocalStubRunner {
|
||||
|
||||
private static final Log log = LogFactory.getLog(LocalStubRunner.class);
|
||||
|
||||
@@ -16,32 +16,31 @@
|
||||
|
||||
package org.springframework.cloud.contract.maven.verifier.stubrunner;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.eclipse.aether.RepositorySystemSession;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.contract.stubrunner.BatchStubRunner;
|
||||
import org.springframework.cloud.contract.stubrunner.BatchStubRunnerFactory;
|
||||
import org.springframework.cloud.contract.stubrunner.RunningStubs;
|
||||
import org.springframework.cloud.contract.stubrunner.StubDownloader;
|
||||
import org.springframework.cloud.contract.stubrunner.StubRunnerOptions;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Fetches stubs from a remote location.
|
||||
*
|
||||
* @author Mariusz Smykula
|
||||
*/
|
||||
@Named
|
||||
@Component
|
||||
public class RemoteStubRunner {
|
||||
|
||||
private static final Log log = LogFactory.getLog(RemoteStubRunner.class);
|
||||
|
||||
private final AetherStubDownloaderFactory aetherStubDownloaderFactory;
|
||||
|
||||
@Inject
|
||||
@Autowired
|
||||
public RemoteStubRunner(AetherStubDownloaderFactory aetherStubDownloaderFactory) {
|
||||
this.aetherStubDownloaderFactory = aetherStubDownloaderFactory;
|
||||
}
|
||||
|
||||
@@ -110,10 +110,6 @@
|
||||
<artifactId>spring-rabbit</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.inject</groupId>
|
||||
<artifactId>javax.inject</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.tomakehurst</groupId>
|
||||
<artifactId>wiremock-jre8-standalone</artifactId>
|
||||
@@ -126,6 +122,10 @@
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jspecify</groupId>
|
||||
<artifactId>jspecify</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.rackspace.eclipse.webtools.sourceediting</groupId>
|
||||
<artifactId>org.eclipse.wst.xml.xpath2.processor</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@ class CustomModeFields implements Field, CustomModeAcceptor {
|
||||
|
||||
private final GeneratedClassMetaData generatedClassMetaData;
|
||||
|
||||
private static final String[] FIELDS = { "@Inject HttpVerifier httpVerifier" };
|
||||
private static final String[] FIELDS = { "@Autowired HttpVerifier httpVerifier" };
|
||||
|
||||
CustomModeFields(BlockBuilder blockBuilder, GeneratedClassMetaData generatedClassMetaData) {
|
||||
this.blockBuilder = blockBuilder;
|
||||
|
||||
@@ -24,7 +24,7 @@ class CustomModeImports implements Imports, CustomModeAcceptor {
|
||||
|
||||
private final GeneratedClassMetaData generatedClassMetaData;
|
||||
|
||||
private static final String[] IMPORTS = { "javax.inject.Inject",
|
||||
private static final String[] IMPORTS = { "org.springframework.beans.factory.annotation.Autowired",
|
||||
"org.springframework.cloud.contract.verifier.http.HttpVerifier",
|
||||
"org.springframework.cloud.contract.verifier.http.Request",
|
||||
"org.springframework.cloud.contract.verifier.http.Response;" };
|
||||
|
||||
@@ -26,8 +26,8 @@ class MessagingFields implements Field {
|
||||
|
||||
private final GeneratedClassMetaData generatedClassMetaData;
|
||||
|
||||
private static final String[] FIELDS = { "@Inject ContractVerifierMessaging contractVerifierMessaging",
|
||||
"@Inject ContractVerifierObjectMapper contractVerifierObjectMapper" };
|
||||
private static final String[] FIELDS = { "@Autowired ContractVerifierMessaging contractVerifierMessaging",
|
||||
"@Autowired ContractVerifierObjectMapper contractVerifierObjectMapper" };
|
||||
|
||||
MessagingFields(BlockBuilder blockBuilder, GeneratedClassMetaData generatedClassMetaData) {
|
||||
this.blockBuilder = blockBuilder;
|
||||
|
||||
@@ -26,7 +26,7 @@ class MessagingImports implements Imports {
|
||||
|
||||
private final GeneratedClassMetaData generatedClassMetaData;
|
||||
|
||||
private static final String[] IMPORTS = { "javax.inject.Inject",
|
||||
private static final String[] IMPORTS = { "org.springframework.beans.factory.annotation.Autowired",
|
||||
"org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper",
|
||||
"org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage",
|
||||
"org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessaging" };
|
||||
|
||||
@@ -18,9 +18,10 @@ package org.springframework.cloud.contract.verifier.dsl;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.jspecify.annotations.NonNull;
|
||||
|
||||
import org.springframework.cloud.contract.verifier.util.MetadataUtil;
|
||||
import org.springframework.cloud.contract.verifier.util.SpringCloudContractMetadata;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
/**
|
||||
* Metadata representation of the Contract Verifier.
|
||||
@@ -52,8 +53,7 @@ public class ContractVerifierMetadata implements SpringCloudContractMetadata {
|
||||
this.tool = tool;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static ContractVerifierMetadata fromMetadata(Map<String, Object> metadata) {
|
||||
public static @NonNull ContractVerifierMetadata fromMetadata(Map<String, Object> metadata) {
|
||||
return MetadataUtil.fromMetadata(metadata, METADATA_KEY, new ContractVerifierMetadata());
|
||||
}
|
||||
|
||||
|
||||
@@ -19,10 +19,11 @@ package org.springframework.cloud.contract.verifier.http;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jspecify.annotations.NonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.cloud.contract.verifier.util.MetadataUtil;
|
||||
import org.springframework.cloud.contract.verifier.util.SpringCloudContractMetadata;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Metadata representation of the Contract Verifier's HTTP communication.
|
||||
@@ -49,8 +50,7 @@ public class ContractVerifierHttpMetaData implements SpringCloudContractMetadata
|
||||
*/
|
||||
private Protocol protocol = Protocol.HTTP_1_1;
|
||||
|
||||
@NonNull
|
||||
public static ContractVerifierHttpMetaData fromMetadata(Map<String, Object> metadata) {
|
||||
public static @NonNull ContractVerifierHttpMetaData fromMetadata(Map<String, Object> metadata) {
|
||||
return MetadataUtil.fromMetadata(metadata, METADATA_KEY, new ContractVerifierHttpMetaData());
|
||||
}
|
||||
|
||||
@@ -106,8 +106,7 @@ public class ContractVerifierHttpMetaData implements SpringCloudContractMetadata
|
||||
/**
|
||||
* Builds an enum from string.
|
||||
*/
|
||||
@Nullable
|
||||
public static Scheme fromString(String scheme) {
|
||||
public static @Nullable Scheme fromString(String scheme) {
|
||||
return Arrays.stream(values()).filter(p -> p.name().equalsIgnoreCase(scheme)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
@@ -179,8 +178,7 @@ public class ContractVerifierHttpMetaData implements SpringCloudContractMetadata
|
||||
/**
|
||||
* Builds an enum from string.
|
||||
*/
|
||||
@Nullable
|
||||
public static Protocol fromString(String protocol) {
|
||||
public static @Nullable Protocol fromString(String protocol) {
|
||||
return Arrays.stream(values()).filter(p -> p.protocol.equalsIgnoreCase(protocol)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.cloud.contract.verifier.messaging;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.cloud.contract.verifier.converter.YamlContract;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.cloud.contract.verifier.messaging;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.cloud.contract.verifier.converter.YamlContract;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.apache.camel.ConsumerTemplate;
|
||||
import org.apache.camel.Message;
|
||||
import org.apache.camel.ProducerTemplate;
|
||||
import org.apache.camel.spring.boot.CamelAutoConfiguration;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.cloud.contract.verifier.messaging.integration;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
|
||||
@@ -18,10 +18,9 @@ package org.springframework.cloud.contract.verifier.messaging.internal;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.cloud.contract.verifier.converter.YamlContract;
|
||||
import org.springframework.cloud.contract.verifier.messaging.MessageVerifierReceiver;
|
||||
|
||||
@@ -28,7 +28,7 @@ import jakarta.jms.StreamMessage;
|
||||
import jakarta.jms.TextMessage;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.cloud.contract.verifier.messaging.stream;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
||||
@@ -105,7 +105,7 @@ package com.example
|
||||
import com.jayway.jsonpath.DocumentContext
|
||||
import com.jayway.jsonpath.JsonPath
|
||||
import spock.lang.Specification
|
||||
import javax.inject.Inject
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessaging
|
||||
@@ -118,8 +118,8 @@ import static org.springframework.cloud.contract.verifier.util.ContractVerifierU
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
class FooSpec extends Specification {
|
||||
@Inject ContractVerifierMessaging contractVerifierMessaging
|
||||
@Inject ContractVerifierObjectMapper contractVerifierObjectMapper
|
||||
@Autowired ContractVerifierMessaging contractVerifierMessaging
|
||||
@Autowired ContractVerifierObjectMapper contractVerifierObjectMapper
|
||||
|
||||
def validate_foo() throws Exception {
|
||||
when:
|
||||
@@ -191,7 +191,7 @@ import com.jayway.jsonpath.DocumentContext;
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
import org.junit.Test;
|
||||
import org.junit.Rule;
|
||||
import javax.inject.Inject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessaging;
|
||||
@@ -204,8 +204,8 @@ import static org.springframework.cloud.contract.verifier.util.ContractVerifierU
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class FooTest {
|
||||
@Inject ContractVerifierMessaging contractVerifierMessaging;
|
||||
@Inject ContractVerifierObjectMapper contractVerifierObjectMapper;
|
||||
@Autowired ContractVerifierMessaging contractVerifierMessaging;
|
||||
@Autowired ContractVerifierObjectMapper contractVerifierObjectMapper;
|
||||
|
||||
@Test
|
||||
public void validate_foo() throws Exception {
|
||||
@@ -269,7 +269,7 @@ import com.jayway.jsonpath.DocumentContext;
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
import org.junit.Test;
|
||||
import org.junit.Rule;
|
||||
import javax.inject.Inject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessaging;
|
||||
@@ -282,8 +282,8 @@ import static org.springframework.cloud.contract.verifier.util.ContractVerifierU
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class FooTest {
|
||||
@Inject ContractVerifierMessaging contractVerifierMessaging;
|
||||
@Inject ContractVerifierObjectMapper contractVerifierObjectMapper;
|
||||
@Autowired ContractVerifierMessaging contractVerifierMessaging;
|
||||
@Autowired ContractVerifierObjectMapper contractVerifierObjectMapper;
|
||||
|
||||
@Test
|
||||
public void validate_foo() throws Exception {
|
||||
@@ -479,7 +479,7 @@ package com.example
|
||||
import com.jayway.jsonpath.DocumentContext
|
||||
import com.jayway.jsonpath.JsonPath
|
||||
import spock.lang.Specification
|
||||
import javax.inject.Inject
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessaging
|
||||
@@ -492,8 +492,8 @@ import static org.springframework.cloud.contract.verifier.util.ContractVerifierU
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
class FooSpec extends Specification {
|
||||
@Inject ContractVerifierMessaging contractVerifierMessaging
|
||||
@Inject ContractVerifierObjectMapper contractVerifierObjectMapper
|
||||
@Autowired ContractVerifierMessaging contractVerifierMessaging
|
||||
@Autowired ContractVerifierObjectMapper contractVerifierObjectMapper
|
||||
|
||||
def validate_foo() throws Exception {
|
||||
when:
|
||||
@@ -551,7 +551,7 @@ package com.example
|
||||
import com.jayway.jsonpath.DocumentContext
|
||||
import com.jayway.jsonpath.JsonPath
|
||||
import spock.lang.Specification
|
||||
import javax.inject.Inject
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessaging
|
||||
@@ -564,8 +564,8 @@ import static org.springframework.cloud.contract.verifier.util.ContractVerifierU
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
class FooSpec extends Specification {
|
||||
@Inject ContractVerifierMessaging contractVerifierMessaging
|
||||
@Inject ContractVerifierObjectMapper contractVerifierObjectMapper
|
||||
@Autowired ContractVerifierMessaging contractVerifierMessaging
|
||||
@Autowired ContractVerifierObjectMapper contractVerifierObjectMapper
|
||||
|
||||
def validate_foo() throws Exception {
|
||||
when:
|
||||
@@ -623,7 +623,7 @@ package com.example
|
||||
import com.jayway.jsonpath.DocumentContext
|
||||
import com.jayway.jsonpath.JsonPath
|
||||
import spock.lang.Specification
|
||||
import javax.inject.Inject
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessaging
|
||||
@@ -636,8 +636,8 @@ import static org.springframework.cloud.contract.verifier.util.ContractVerifierU
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
class FooSpec extends Specification {
|
||||
@Inject ContractVerifierMessaging contractVerifierMessaging
|
||||
@Inject ContractVerifierObjectMapper contractVerifierObjectMapper
|
||||
@Autowired ContractVerifierMessaging contractVerifierMessaging
|
||||
@Autowired ContractVerifierObjectMapper contractVerifierObjectMapper
|
||||
|
||||
def validate_foo() throws Exception {
|
||||
when:
|
||||
@@ -697,7 +697,7 @@ import com.jayway.jsonpath.DocumentContext;
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
import org.junit.Test;
|
||||
import org.junit.Rule;
|
||||
import javax.inject.Inject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessaging;
|
||||
@@ -710,8 +710,8 @@ import static org.springframework.cloud.contract.verifier.util.ContractVerifierU
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class FooTest {
|
||||
@Inject ContractVerifierMessaging contractVerifierMessaging;
|
||||
@Inject ContractVerifierObjectMapper contractVerifierObjectMapper;
|
||||
@Autowired ContractVerifierMessaging contractVerifierMessaging;
|
||||
@Autowired ContractVerifierObjectMapper contractVerifierObjectMapper;
|
||||
|
||||
@Test
|
||||
public void validate_foo() throws Exception {
|
||||
@@ -776,7 +776,7 @@ package com.example
|
||||
import com.jayway.jsonpath.DocumentContext
|
||||
import com.jayway.jsonpath.JsonPath
|
||||
import spock.lang.Specification
|
||||
import javax.inject.Inject
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessaging
|
||||
@@ -789,8 +789,8 @@ import static org.springframework.cloud.contract.verifier.util.ContractVerifierU
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
class FooSpec extends Specification {
|
||||
@Inject ContractVerifierMessaging contractVerifierMessaging
|
||||
@Inject ContractVerifierObjectMapper contractVerifierObjectMapper
|
||||
@Autowired ContractVerifierMessaging contractVerifierMessaging
|
||||
@Autowired ContractVerifierObjectMapper contractVerifierObjectMapper
|
||||
|
||||
def validate_foo() throws Exception {
|
||||
when:
|
||||
@@ -819,7 +819,7 @@ import com.jayway.jsonpath.DocumentContext;
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
import org.junit.Test;
|
||||
import org.junit.Rule;
|
||||
import javax.inject.Inject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessaging;
|
||||
@@ -832,8 +832,8 @@ import static org.springframework.cloud.contract.verifier.util.ContractVerifierU
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class FooTest {
|
||||
@Inject ContractVerifierMessaging contractVerifierMessaging;
|
||||
@Inject ContractVerifierObjectMapper contractVerifierObjectMapper;
|
||||
@Autowired ContractVerifierMessaging contractVerifierMessaging;
|
||||
@Autowired ContractVerifierObjectMapper contractVerifierObjectMapper;
|
||||
|
||||
@Test
|
||||
public void validate_foo() throws Exception {
|
||||
@@ -905,7 +905,7 @@ package com.example
|
||||
import com.jayway.jsonpath.DocumentContext
|
||||
import com.jayway.jsonpath.JsonPath
|
||||
import spock.lang.Specification
|
||||
import javax.inject.Inject
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessaging
|
||||
@@ -918,8 +918,8 @@ import static org.springframework.cloud.contract.verifier.util.ContractVerifierU
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
class FooSpec extends Specification {
|
||||
@Inject ContractVerifierMessaging contractVerifierMessaging
|
||||
@Inject ContractVerifierObjectMapper contractVerifierObjectMapper
|
||||
@Autowired ContractVerifierMessaging contractVerifierMessaging
|
||||
@Autowired ContractVerifierObjectMapper contractVerifierObjectMapper
|
||||
|
||||
def validate_foo() throws Exception {
|
||||
when:
|
||||
@@ -961,7 +961,7 @@ import com.jayway.jsonpath.DocumentContext;
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
import org.junit.Test;
|
||||
import org.junit.Rule;
|
||||
import javax.inject.Inject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessaging;
|
||||
@@ -974,8 +974,8 @@ import static org.springframework.cloud.contract.verifier.util.ContractVerifierU
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class FooTest {
|
||||
@Inject ContractVerifierMessaging contractVerifierMessaging;
|
||||
@Inject ContractVerifierObjectMapper contractVerifierObjectMapper;
|
||||
@Autowired ContractVerifierMessaging contractVerifierMessaging;
|
||||
@Autowired ContractVerifierObjectMapper contractVerifierObjectMapper;
|
||||
|
||||
@Test
|
||||
public void validate_foo() throws Exception {
|
||||
@@ -1046,7 +1046,7 @@ package com.example
|
||||
import com.jayway.jsonpath.DocumentContext
|
||||
import com.jayway.jsonpath.JsonPath
|
||||
import spock.lang.Specification
|
||||
import javax.inject.Inject
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessaging
|
||||
@@ -1059,8 +1059,8 @@ import static org.springframework.cloud.contract.verifier.util.ContractVerifierU
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
class FooSpec extends Specification {
|
||||
@Inject ContractVerifierMessaging contractVerifierMessaging
|
||||
@Inject ContractVerifierObjectMapper contractVerifierObjectMapper
|
||||
@Autowired ContractVerifierMessaging contractVerifierMessaging
|
||||
@Autowired ContractVerifierObjectMapper contractVerifierObjectMapper
|
||||
|
||||
def validate_foo() throws Exception {
|
||||
when:
|
||||
@@ -1088,7 +1088,7 @@ import com.jayway.jsonpath.DocumentContext;
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
import org.junit.Test;
|
||||
import org.junit.Rule;
|
||||
import javax.inject.Inject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage;
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessaging;
|
||||
@@ -1101,8 +1101,8 @@ import static org.springframework.cloud.contract.verifier.util.ContractVerifierU
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class FooTest {
|
||||
@Inject ContractVerifierMessaging contractVerifierMessaging;
|
||||
@Inject ContractVerifierObjectMapper contractVerifierObjectMapper;
|
||||
@Autowired ContractVerifierMessaging contractVerifierMessaging;
|
||||
@Autowired ContractVerifierObjectMapper contractVerifierObjectMapper;
|
||||
|
||||
@Test
|
||||
public void validate_foo() throws Exception {
|
||||
|
||||
@@ -357,7 +357,7 @@ class SingleTestGeneratorSpec extends Specification {
|
||||
|
||||
then:
|
||||
classStrings.each { clazz.contains(it) }
|
||||
clazz.contains('@Inject ContractVerifierMessaging')
|
||||
clazz.contains('@Autowired ContractVerifierMessaging')
|
||||
|
||||
and:
|
||||
asserter(clazz)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,7 +18,6 @@ package org.springframework.cloud.contract.verifier.util
|
||||
|
||||
import java.lang.reflect.Method
|
||||
|
||||
import javax.inject.Inject
|
||||
import javax.tools.Diagnostic
|
||||
import javax.tools.DiagnosticCollector
|
||||
import javax.tools.FileObject
|
||||
@@ -48,6 +47,7 @@ import org.junit.Test
|
||||
import org.w3c.dom.Document
|
||||
import org.xml.sax.InputSource
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.cloud.contract.spec.Contract
|
||||
import org.springframework.cloud.contract.verifier.assertion.SpringCloudContractAssertions
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage
|
||||
@@ -72,7 +72,7 @@ class SyntaxChecker {
|
||||
Rule.name,
|
||||
DocumentContext.name,
|
||||
JsonPath.name,
|
||||
Inject.name,
|
||||
Autowired.name,
|
||||
ContractVerifierObjectMapper.name,
|
||||
ContractVerifierMessage.name,
|
||||
ContractVerifierMessaging.name,
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.Set;
|
||||
|
||||
import org.apache.groovy.util.Maps;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -60,6 +61,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
// FIXME: 5.0.0 restdocs dropped junit 4
|
||||
// @RunWith(SpringRunner.class)
|
||||
// @SpringBootTest(classes = ContractDslSnippetTests.Config.class)
|
||||
// JUnit4 support will be removed with 5.0.0
|
||||
@Ignore
|
||||
public class ContractDslSnippetTests {
|
||||
|
||||
private static final String OUTPUT = "target/generated-snippets";
|
||||
|
||||
@@ -16,12 +16,10 @@
|
||||
|
||||
package com.example
|
||||
|
||||
import javax.inject.Inject
|
||||
|
||||
import com.jayway.jsonpath.DocumentContext
|
||||
import com.jayway.jsonpath.JsonPath
|
||||
import com.toomuchcoding.jsonassert.JsonAssertion
|
||||
import groovy.json.JsonOutput
|
||||
import org.junit.jupiter.api.Disabled
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
@@ -29,14 +27,9 @@ import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.boot.test.context.SpringBootTest
|
||||
import org.springframework.cloud.contract.spec.Contract
|
||||
import org.springframework.cloud.contract.verifier.messaging.boot.AutoConfigureMessageVerifier
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessage
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierMessaging
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper
|
||||
|
||||
import static com.toomuchcoding.jsonassert.JsonAssertion.assertThatJson
|
||||
import static org.assertj.core.api.Assertions.assertThat
|
||||
import static org.springframework.cloud.contract.verifier.messaging.util.ContractVerifierMessagingUtil.headers
|
||||
|
||||
// Context configuration would end up in base class
|
||||
@AutoConfigureMessageVerifier
|
||||
@SpringBootTest(classes = AmqpMessagingApplication, properties = "stubrunner.amqp.enabled=true")
|
||||
@@ -44,47 +37,47 @@ import static org.springframework.cloud.contract.verifier.messaging.util.Contrac
|
||||
class AmqpMessagingApplicationSpec {
|
||||
|
||||
// ALL CASES
|
||||
@Inject
|
||||
@Autowired
|
||||
ContractVerifierMessaging contractVerifierMessaging
|
||||
@Inject
|
||||
@Autowired
|
||||
ContractVerifierObjectMapper contractVerifierObjectMapper
|
||||
|
||||
@Test
|
||||
void should_work_for_triggered_based_messaging() {
|
||||
// given:
|
||||
def dsl = Contract.make {
|
||||
// Human readable description
|
||||
description 'Some description'
|
||||
// Label by means of which the output message can be triggered
|
||||
label 'some_label'
|
||||
// input to the contract
|
||||
input {
|
||||
// the contract will be triggered by a method
|
||||
triggeredBy('publishBook()')
|
||||
}
|
||||
// output message of the contract
|
||||
outputMessage {
|
||||
// destination to which the output message will be sent
|
||||
sentTo('test-exchange')
|
||||
// the body of the output message
|
||||
body('''{ "name" : "some" }''')
|
||||
// the headers of the output message
|
||||
headers {
|
||||
header('contentType', 'application/json')
|
||||
header('__TypeId__', 'com.example.Book')
|
||||
}
|
||||
def dsl = Contract.make {
|
||||
// Human readable description
|
||||
description 'Some description'
|
||||
// Label by means of which the output message can be triggered
|
||||
label 'some_label'
|
||||
// input to the contract
|
||||
input {
|
||||
// the contract will be triggered by a method
|
||||
triggeredBy('publishBook()')
|
||||
}
|
||||
// output message of the contract
|
||||
outputMessage {
|
||||
// destination to which the output message will be sent
|
||||
sentTo('test-exchange')
|
||||
// the body of the output message
|
||||
body('''{ "name" : "some" }''')
|
||||
// the headers of the output message
|
||||
headers {
|
||||
header('contentType', 'application/json')
|
||||
header('__TypeId__', 'com.example.Book')
|
||||
}
|
||||
}
|
||||
// generated test should look like this:
|
||||
}
|
||||
// generated test should look like this:
|
||||
// when:
|
||||
publishBook()
|
||||
publishBook()
|
||||
// then:
|
||||
def response = contractVerifierMessaging.receive('test-exchange')
|
||||
response.headers.get('contentType') == 'application/json'
|
||||
def response = contractVerifierMessaging.receive('test-exchange')
|
||||
response.headers.get('contentType') == 'application/json'
|
||||
// and:
|
||||
DocumentContext parsedJson = JsonPath.
|
||||
parse(contractVerifierObjectMapper.writeValueAsString(response.payload))
|
||||
JsonAssertion.assertThat(parsedJson).field('name').isEqualTo('some')
|
||||
DocumentContext parsedJson = JsonPath.
|
||||
parse(contractVerifierObjectMapper.writeValueAsString(response.payload))
|
||||
JsonAssertion.assertThat(parsedJson).field('name').isEqualTo('some')
|
||||
}
|
||||
|
||||
// BASE CLASS WOULD HAVE THIS:
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.example
|
||||
|
||||
import javax.inject.Inject
|
||||
|
||||
import com.jayway.jsonpath.DocumentContext
|
||||
import com.jayway.jsonpath.JsonPath
|
||||
@@ -35,6 +34,7 @@ import org.springframework.cloud.contract.verifier.messaging.internal.ContractVe
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper
|
||||
import org.springframework.test.context.DynamicPropertyRegistry
|
||||
import org.springframework.test.context.DynamicPropertySource
|
||||
|
||||
/**
|
||||
* SPIKE ON TESTS FROM NOTES IN MessagingSpec
|
||||
*/
|
||||
@@ -47,7 +47,7 @@ class CamelMessagingApplicationSpec {
|
||||
// ALL CASES
|
||||
@Autowired
|
||||
ModelCamelContext camelContext
|
||||
@Inject
|
||||
@Autowired
|
||||
ContractVerifierMessaging contractVerifierMessaging
|
||||
|
||||
ContractVerifierObjectMapper contractVerifierObjectMapper = new ContractVerifierObjectMapper()
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.example
|
||||
|
||||
import javax.inject.Inject
|
||||
|
||||
import com.jayway.jsonpath.DocumentContext
|
||||
import com.jayway.jsonpath.JsonPath
|
||||
@@ -37,7 +36,7 @@ import org.springframework.messaging.Message
|
||||
class IntegrationMessagingApplicationSpec {
|
||||
|
||||
// ALL CASES
|
||||
@Inject
|
||||
@Autowired
|
||||
ContractVerifierMessaging<Message<?>> contractVerifierMessaging
|
||||
ContractVerifierObjectMapper contractVerifierObjectMapper = new ContractVerifierObjectMapper()
|
||||
|
||||
|
||||
@@ -16,11 +16,6 @@
|
||||
|
||||
package com.example
|
||||
|
||||
import org.junit.jupiter.api.condition.EnabledForJreRange
|
||||
import org.junit.jupiter.api.condition.JRE
|
||||
|
||||
import javax.inject.Inject
|
||||
|
||||
import com.jayway.jsonpath.DocumentContext
|
||||
import com.jayway.jsonpath.JsonPath
|
||||
import com.toomuchcoding.jsonassert.JsonAssertion
|
||||
@@ -28,6 +23,8 @@ import jakarta.jms.JMSException
|
||||
import jakarta.jms.Message
|
||||
import org.junit.jupiter.api.BeforeAll
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.condition.EnabledForJreRange
|
||||
import org.junit.jupiter.api.condition.JRE
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.boot.test.context.SpringBootTest
|
||||
@@ -38,6 +35,7 @@ import org.springframework.cloud.contract.verifier.messaging.internal.ContractVe
|
||||
import org.springframework.cloud.contract.verifier.messaging.internal.ContractVerifierObjectMapper
|
||||
import org.springframework.jms.core.JmsTemplate
|
||||
import org.springframework.jms.core.MessagePostProcessor
|
||||
|
||||
/**
|
||||
* SPIKE ON TESTS FROM NOTES IN MessagingSpec
|
||||
*/
|
||||
@@ -50,9 +48,9 @@ class JmsMessagingApplicationSpec {
|
||||
// ALL CASES
|
||||
@Autowired
|
||||
JmsTemplate jmsTemplate
|
||||
@Inject
|
||||
@Autowired
|
||||
ContractVerifierMessaging contractVerifierMessaging
|
||||
@Inject
|
||||
@Autowired
|
||||
ContractVerifierObjectMapper contractVerifierObjectMapper
|
||||
|
||||
@BeforeAll
|
||||
|
||||
Reference in New Issue
Block a user