Merge branch '2.2.x'
This commit is contained in:
@@ -167,10 +167,7 @@ class ProjectVersion implements Comparable<ProjectVersion>, Serializable {
|
||||
return ReleaseType.SNAPSHOT;
|
||||
}
|
||||
|
||||
/*
|
||||
* E.g. 1.0.1.RELEASE is more mature than 1.0.2.RC2
|
||||
*/
|
||||
boolean isMoreMature(ProjectVersion that) {
|
||||
int isMoreMature(ProjectVersion that) {
|
||||
SplitVersion thisSplit = assertVersion();
|
||||
SplitVersion thatSplit = that.assertVersion();
|
||||
int releaseTypeComparison = this.releaseType.compareTo(that.releaseType);
|
||||
@@ -179,16 +176,30 @@ class ProjectVersion implements Comparable<ProjectVersion>, Serializable {
|
||||
&& that.isReleaseOrServiceRelease();
|
||||
// 1.0.1.M2 vs 1.0.0.RELEASE (x)
|
||||
if (thisReleaseTypeHigher && !bothGa) {
|
||||
return true;
|
||||
return 1;
|
||||
}
|
||||
int versionComparison = thisSplit.gav().compareTo(thatSplit.gav());
|
||||
if (versionComparison == 0) {
|
||||
// 1.0.0.SR1 vs 1.0.1.RELEASE (x)
|
||||
// Finchley.RELEASE vs Finchley.SR1 (x)
|
||||
return thisReleaseTypeHigher;
|
||||
int majorComparison = compare(thisSplit.major, thatSplit.major);
|
||||
if (majorComparison != 0) {
|
||||
return majorComparison;
|
||||
}
|
||||
int minorComparison = compare(thisSplit.minor, thatSplit.minor);
|
||||
if (minorComparison != 0) {
|
||||
return minorComparison;
|
||||
}
|
||||
int patchComparison = compare(thisSplit.patch, thatSplit.patch);
|
||||
if (patchComparison != 0) {
|
||||
return patchComparison;
|
||||
}
|
||||
return releaseTypeComparison;
|
||||
}
|
||||
|
||||
private int compare(String thisString, String thatString) {
|
||||
try {
|
||||
return Integer.valueOf(thisString).compareTo(Integer.valueOf(thatString));
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
return thisString.compareTo(thatString);
|
||||
}
|
||||
// 1.0.0.SR1 vs 1.0.1.RELEASE (x)
|
||||
return versionComparison > 0;
|
||||
}
|
||||
|
||||
boolean isSameWithoutSuffix(ProjectVersion that) {
|
||||
@@ -223,7 +234,6 @@ class ProjectVersion implements Comparable<ProjectVersion>, Serializable {
|
||||
|
||||
@Override
|
||||
public int compareTo(ProjectVersion o) {
|
||||
// very simple comparison
|
||||
return this.version.compareTo(o.version);
|
||||
}
|
||||
|
||||
|
||||
@@ -403,8 +403,6 @@ class FileWalker extends SimpleFileVisitor<Path> {
|
||||
|
||||
class DefaultArtifactVersionWrapper implements Comparable<DefaultArtifactVersionWrapper> {
|
||||
|
||||
private static final String SNAPSHOT_SUBSTRING = "snapshot";
|
||||
|
||||
final DefaultArtifactVersion version;
|
||||
|
||||
final File file;
|
||||
@@ -427,8 +425,7 @@ class DefaultArtifactVersionWrapper implements Comparable<DefaultArtifactVersion
|
||||
|
||||
@Override
|
||||
public int compareTo(DefaultArtifactVersionWrapper o) {
|
||||
return this.projectVersion.isMoreMature(o.projectVersion) ? 1
|
||||
: this.projectVersion.version.equals(o.projectVersion.version) ? 0 : -1;
|
||||
return this.projectVersion.isMoreMature(o.projectVersion);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -136,6 +136,13 @@ public class GitStubDownloaderTests {
|
||||
then(entry).isNotNull();
|
||||
then(entry.getValue().getAbsolutePath()).contains("com.example" + File.separator
|
||||
+ "beer-api-producer-external" + File.separator + "1.0.0.BUILD-SNAPSHOT");
|
||||
|
||||
entry = stubDownloader.downloadAndUnpackStubJar(
|
||||
new StubConfiguration("com.issue1305:beer-api-producer-external:+"));
|
||||
|
||||
then(entry).isNotNull();
|
||||
then(entry.getValue().getAbsolutePath()).contains("com.issue1305" + File.separator
|
||||
+ "beer-api-producer-external" + File.separator + "0.0.11-SNAPSHOT");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.messaging
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
description("""
|
||||
Sends a positive verification message when person is eligible to get the beer
|
||||
|
||||
```
|
||||
given:
|
||||
client is old enough
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll send a message with a positive verification
|
||||
```
|
||||
|
||||
""")
|
||||
// Label by means of which the output message can be triggered
|
||||
label 'accepted_verification'
|
||||
// input to the contract
|
||||
input {
|
||||
// the contract will be triggered by a method
|
||||
triggeredBy('clientIsOldEnough()')
|
||||
}
|
||||
// output message of the contract
|
||||
outputMessage {
|
||||
// destination to which the output message will be sent
|
||||
sentTo 'verifications'
|
||||
// the body of the output message
|
||||
body([
|
||||
eligible: true
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.messaging
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
description("""
|
||||
Sends a negative verification message when person is not eligible to get the beer
|
||||
|
||||
```
|
||||
given:
|
||||
client is too young
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll send a message with a negative verification
|
||||
```
|
||||
|
||||
""")
|
||||
// Label by means of which the output message can be triggered
|
||||
label 'rejected_verification'
|
||||
// input to the contract
|
||||
input {
|
||||
// the contract will be triggered by a method
|
||||
triggeredBy('clientIsTooYoung()')
|
||||
}
|
||||
// output message of the contract
|
||||
outputMessage {
|
||||
// destination to which the output message will be sent
|
||||
sentTo 'verifications'
|
||||
// the body of the output message
|
||||
body([
|
||||
eligible: false
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.rest
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
request {
|
||||
description("""
|
||||
Represents a successful scenario of getting a beer
|
||||
|
||||
given:
|
||||
client is old enough
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll grant him the beer
|
||||
""")
|
||||
method 'POST'
|
||||
url '/check'
|
||||
body(
|
||||
age: value(consumer(regex('[2-9][0-9]')))
|
||||
)
|
||||
headers {
|
||||
header 'Content-Type', 'application/json'
|
||||
}
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
body("""
|
||||
{
|
||||
"status": "OK"
|
||||
}
|
||||
""")
|
||||
headers {
|
||||
header(
|
||||
'Content-Type',
|
||||
value(consumer('application/json'), producer(regex('application/json.*')))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.rest
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
request {
|
||||
description("""
|
||||
Represents a unsuccessful scenario of getting a beer
|
||||
|
||||
given:
|
||||
client is not old enough
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll NOT grant him the beer
|
||||
""")
|
||||
method 'POST'
|
||||
url '/check'
|
||||
body(
|
||||
age: value(consumer(regex('[0-1][0-9]')))
|
||||
)
|
||||
headers {
|
||||
header 'Content-Type', 'application/json'
|
||||
}
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
body("""
|
||||
{
|
||||
"status": "NOT_OK"
|
||||
}
|
||||
""")
|
||||
headers {
|
||||
header(
|
||||
'Content-Type',
|
||||
value(consumer('application/json'), producer(regex('application/json.*')))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"id": "e5413ef6-0f3e-4b81-9e78-7a90b53c6ed1",
|
||||
"request": {
|
||||
"url": "/check",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Content-Type": {
|
||||
"equalTo": "application/json"
|
||||
}
|
||||
},
|
||||
"bodyPatterns": [
|
||||
{
|
||||
"matchesJsonPath": "$[?(@.['age'] =~ /[2-9][0-9]/)]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"body": "{\"status\":\"OK\"}",
|
||||
"headers": {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"transformers": [
|
||||
"response-template"
|
||||
]
|
||||
},
|
||||
"uuid": "e5413ef6-0f3e-4b81-9e78-7a90b53c6ed1"
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"id": "b54426aa-b2ef-4b12-adc9-a05fcf6a4e08",
|
||||
"request": {
|
||||
"url": "/check",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Content-Type": {
|
||||
"equalTo": "application/json"
|
||||
}
|
||||
},
|
||||
"bodyPatterns": [
|
||||
{
|
||||
"matchesJsonPath": "$[?(@.['age'] =~ /[0-1][0-9]/)]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"body": "{\"status\":\"NOT_OK\"}",
|
||||
"headers": {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"transformers": [
|
||||
"response-template"
|
||||
]
|
||||
},
|
||||
"uuid": "b54426aa-b2ef-4b12-adc9-a05fcf6a4e08"
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.messaging
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
description("""
|
||||
Sends a positive verification message when person is eligible to get the beer
|
||||
|
||||
```
|
||||
given:
|
||||
client is old enough
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll send a message with a positive verification
|
||||
```
|
||||
|
||||
""")
|
||||
// Label by means of which the output message can be triggered
|
||||
label 'accepted_verification'
|
||||
// input to the contract
|
||||
input {
|
||||
// the contract will be triggered by a method
|
||||
triggeredBy('clientIsOldEnough()')
|
||||
}
|
||||
// output message of the contract
|
||||
outputMessage {
|
||||
// destination to which the output message will be sent
|
||||
sentTo 'verifications'
|
||||
// the body of the output message
|
||||
body([
|
||||
eligible: true
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.messaging
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
description("""
|
||||
Sends a negative verification message when person is not eligible to get the beer
|
||||
|
||||
```
|
||||
given:
|
||||
client is too young
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll send a message with a negative verification
|
||||
```
|
||||
|
||||
""")
|
||||
// Label by means of which the output message can be triggered
|
||||
label 'rejected_verification'
|
||||
// input to the contract
|
||||
input {
|
||||
// the contract will be triggered by a method
|
||||
triggeredBy('clientIsTooYoung()')
|
||||
}
|
||||
// output message of the contract
|
||||
outputMessage {
|
||||
// destination to which the output message will be sent
|
||||
sentTo 'verifications'
|
||||
// the body of the output message
|
||||
body([
|
||||
eligible: false
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.rest
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
request {
|
||||
description("""
|
||||
Represents a successful scenario of getting a beer
|
||||
|
||||
given:
|
||||
client is old enough
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll grant him the beer
|
||||
""")
|
||||
method 'POST'
|
||||
url '/check'
|
||||
body(
|
||||
age: value(consumer(regex('[2-9][0-9]')))
|
||||
)
|
||||
headers {
|
||||
header 'Content-Type', 'application/json'
|
||||
}
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
body("""
|
||||
{
|
||||
"status": "OK"
|
||||
}
|
||||
""")
|
||||
headers {
|
||||
header(
|
||||
'Content-Type',
|
||||
value(consumer('application/json'), producer(regex('application/json.*')))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.rest
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
request {
|
||||
description("""
|
||||
Represents a unsuccessful scenario of getting a beer
|
||||
|
||||
given:
|
||||
client is not old enough
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll NOT grant him the beer
|
||||
""")
|
||||
method 'POST'
|
||||
url '/check'
|
||||
body(
|
||||
age: value(consumer(regex('[0-1][0-9]')))
|
||||
)
|
||||
headers {
|
||||
header 'Content-Type', 'application/json'
|
||||
}
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
body("""
|
||||
{
|
||||
"status": "NOT_OK"
|
||||
}
|
||||
""")
|
||||
headers {
|
||||
header(
|
||||
'Content-Type',
|
||||
value(consumer('application/json'), producer(regex('application/json.*')))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"id": "e5413ef6-0f3e-4b81-9e78-7a90b53c6ed1",
|
||||
"request": {
|
||||
"url": "/check",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Content-Type": {
|
||||
"equalTo": "application/json"
|
||||
}
|
||||
},
|
||||
"bodyPatterns": [
|
||||
{
|
||||
"matchesJsonPath": "$[?(@.['age'] =~ /[2-9][0-9]/)]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"body": "{\"status\":\"OK\"}",
|
||||
"headers": {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"transformers": [
|
||||
"response-template"
|
||||
]
|
||||
},
|
||||
"uuid": "e5413ef6-0f3e-4b81-9e78-7a90b53c6ed1"
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"id": "b54426aa-b2ef-4b12-adc9-a05fcf6a4e08",
|
||||
"request": {
|
||||
"url": "/check",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Content-Type": {
|
||||
"equalTo": "application/json"
|
||||
}
|
||||
},
|
||||
"bodyPatterns": [
|
||||
{
|
||||
"matchesJsonPath": "$[?(@.['age'] =~ /[0-1][0-9]/)]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"body": "{\"status\":\"NOT_OK\"}",
|
||||
"headers": {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"transformers": [
|
||||
"response-template"
|
||||
]
|
||||
},
|
||||
"uuid": "b54426aa-b2ef-4b12-adc9-a05fcf6a4e08"
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.messaging
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
description("""
|
||||
Sends a positive verification message when person is eligible to get the beer
|
||||
|
||||
```
|
||||
given:
|
||||
client is old enough
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll send a message with a positive verification
|
||||
```
|
||||
|
||||
""")
|
||||
// Label by means of which the output message can be triggered
|
||||
label 'accepted_verification'
|
||||
// input to the contract
|
||||
input {
|
||||
// the contract will be triggered by a method
|
||||
triggeredBy('clientIsOldEnough()')
|
||||
}
|
||||
// output message of the contract
|
||||
outputMessage {
|
||||
// destination to which the output message will be sent
|
||||
sentTo 'verifications'
|
||||
// the body of the output message
|
||||
body([
|
||||
eligible: true
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.messaging
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
description("""
|
||||
Sends a negative verification message when person is not eligible to get the beer
|
||||
|
||||
```
|
||||
given:
|
||||
client is too young
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll send a message with a negative verification
|
||||
```
|
||||
|
||||
""")
|
||||
// Label by means of which the output message can be triggered
|
||||
label 'rejected_verification'
|
||||
// input to the contract
|
||||
input {
|
||||
// the contract will be triggered by a method
|
||||
triggeredBy('clientIsTooYoung()')
|
||||
}
|
||||
// output message of the contract
|
||||
outputMessage {
|
||||
// destination to which the output message will be sent
|
||||
sentTo 'verifications'
|
||||
// the body of the output message
|
||||
body([
|
||||
eligible: false
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.rest
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
request {
|
||||
description("""
|
||||
Represents a successful scenario of getting a beer
|
||||
|
||||
given:
|
||||
client is old enough
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll grant him the beer
|
||||
""")
|
||||
method 'POST'
|
||||
url '/check'
|
||||
body(
|
||||
age: value(consumer(regex('[2-9][0-9]')))
|
||||
)
|
||||
headers {
|
||||
header 'Content-Type', 'application/json'
|
||||
}
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
body("""
|
||||
{
|
||||
"status": "OK"
|
||||
}
|
||||
""")
|
||||
headers {
|
||||
header(
|
||||
'Content-Type',
|
||||
value(consumer('application/json'), producer(regex('application/json.*')))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.rest
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
request {
|
||||
description("""
|
||||
Represents a unsuccessful scenario of getting a beer
|
||||
|
||||
given:
|
||||
client is not old enough
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll NOT grant him the beer
|
||||
""")
|
||||
method 'POST'
|
||||
url '/check'
|
||||
body(
|
||||
age: value(consumer(regex('[0-1][0-9]')))
|
||||
)
|
||||
headers {
|
||||
header 'Content-Type', 'application/json'
|
||||
}
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
body("""
|
||||
{
|
||||
"status": "NOT_OK"
|
||||
}
|
||||
""")
|
||||
headers {
|
||||
header(
|
||||
'Content-Type',
|
||||
value(consumer('application/json'), producer(regex('application/json.*')))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"id": "e5413ef6-0f3e-4b81-9e78-7a90b53c6ed1",
|
||||
"request": {
|
||||
"url": "/check",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Content-Type": {
|
||||
"equalTo": "application/json"
|
||||
}
|
||||
},
|
||||
"bodyPatterns": [
|
||||
{
|
||||
"matchesJsonPath": "$[?(@.['age'] =~ /[2-9][0-9]/)]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"body": "{\"status\":\"OK\"}",
|
||||
"headers": {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"transformers": [
|
||||
"response-template"
|
||||
]
|
||||
},
|
||||
"uuid": "e5413ef6-0f3e-4b81-9e78-7a90b53c6ed1"
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"id": "b54426aa-b2ef-4b12-adc9-a05fcf6a4e08",
|
||||
"request": {
|
||||
"url": "/check",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Content-Type": {
|
||||
"equalTo": "application/json"
|
||||
}
|
||||
},
|
||||
"bodyPatterns": [
|
||||
{
|
||||
"matchesJsonPath": "$[?(@.['age'] =~ /[0-1][0-9]/)]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"body": "{\"status\":\"NOT_OK\"}",
|
||||
"headers": {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"transformers": [
|
||||
"response-template"
|
||||
]
|
||||
},
|
||||
"uuid": "b54426aa-b2ef-4b12-adc9-a05fcf6a4e08"
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.messaging
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
description("""
|
||||
Sends a positive verification message when person is eligible to get the beer
|
||||
|
||||
```
|
||||
given:
|
||||
client is old enough
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll send a message with a positive verification
|
||||
```
|
||||
|
||||
""")
|
||||
// Label by means of which the output message can be triggered
|
||||
label 'accepted_verification'
|
||||
// input to the contract
|
||||
input {
|
||||
// the contract will be triggered by a method
|
||||
triggeredBy('clientIsOldEnough()')
|
||||
}
|
||||
// output message of the contract
|
||||
outputMessage {
|
||||
// destination to which the output message will be sent
|
||||
sentTo 'verifications'
|
||||
// the body of the output message
|
||||
body([
|
||||
eligible: true
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.messaging
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
description("""
|
||||
Sends a negative verification message when person is not eligible to get the beer
|
||||
|
||||
```
|
||||
given:
|
||||
client is too young
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll send a message with a negative verification
|
||||
```
|
||||
|
||||
""")
|
||||
// Label by means of which the output message can be triggered
|
||||
label 'rejected_verification'
|
||||
// input to the contract
|
||||
input {
|
||||
// the contract will be triggered by a method
|
||||
triggeredBy('clientIsTooYoung()')
|
||||
}
|
||||
// output message of the contract
|
||||
outputMessage {
|
||||
// destination to which the output message will be sent
|
||||
sentTo 'verifications'
|
||||
// the body of the output message
|
||||
body([
|
||||
eligible: false
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.rest
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
request {
|
||||
description("""
|
||||
Represents a successful scenario of getting a beer
|
||||
|
||||
given:
|
||||
client is old enough
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll grant him the beer
|
||||
""")
|
||||
method 'POST'
|
||||
url '/check'
|
||||
body(
|
||||
age: value(consumer(regex('[2-9][0-9]')))
|
||||
)
|
||||
headers {
|
||||
header 'Content-Type', 'application/json'
|
||||
}
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
body("""
|
||||
{
|
||||
"status": "OK"
|
||||
}
|
||||
""")
|
||||
headers {
|
||||
header(
|
||||
'Content-Type',
|
||||
value(consumer('application/json'), producer(regex('application/json.*')))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.rest
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
request {
|
||||
description("""
|
||||
Represents a unsuccessful scenario of getting a beer
|
||||
|
||||
given:
|
||||
client is not old enough
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll NOT grant him the beer
|
||||
""")
|
||||
method 'POST'
|
||||
url '/check'
|
||||
body(
|
||||
age: value(consumer(regex('[0-1][0-9]')))
|
||||
)
|
||||
headers {
|
||||
header 'Content-Type', 'application/json'
|
||||
}
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
body("""
|
||||
{
|
||||
"status": "NOT_OK"
|
||||
}
|
||||
""")
|
||||
headers {
|
||||
header(
|
||||
'Content-Type',
|
||||
value(consumer('application/json'), producer(regex('application/json.*')))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"id": "e5413ef6-0f3e-4b81-9e78-7a90b53c6ed1",
|
||||
"request": {
|
||||
"url": "/check",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Content-Type": {
|
||||
"equalTo": "application/json"
|
||||
}
|
||||
},
|
||||
"bodyPatterns": [
|
||||
{
|
||||
"matchesJsonPath": "$[?(@.['age'] =~ /[2-9][0-9]/)]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"body": "{\"status\":\"OK\"}",
|
||||
"headers": {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"transformers": [
|
||||
"response-template"
|
||||
]
|
||||
},
|
||||
"uuid": "e5413ef6-0f3e-4b81-9e78-7a90b53c6ed1"
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"id": "b54426aa-b2ef-4b12-adc9-a05fcf6a4e08",
|
||||
"request": {
|
||||
"url": "/check",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Content-Type": {
|
||||
"equalTo": "application/json"
|
||||
}
|
||||
},
|
||||
"bodyPatterns": [
|
||||
{
|
||||
"matchesJsonPath": "$[?(@.['age'] =~ /[0-1][0-9]/)]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"body": "{\"status\":\"NOT_OK\"}",
|
||||
"headers": {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"transformers": [
|
||||
"response-template"
|
||||
]
|
||||
},
|
||||
"uuid": "b54426aa-b2ef-4b12-adc9-a05fcf6a4e08"
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.messaging
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
description("""
|
||||
Sends a positive verification message when person is eligible to get the beer
|
||||
|
||||
```
|
||||
given:
|
||||
client is old enough
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll send a message with a positive verification
|
||||
```
|
||||
|
||||
""")
|
||||
// Label by means of which the output message can be triggered
|
||||
label 'accepted_verification'
|
||||
// input to the contract
|
||||
input {
|
||||
// the contract will be triggered by a method
|
||||
triggeredBy('clientIsOldEnough()')
|
||||
}
|
||||
// output message of the contract
|
||||
outputMessage {
|
||||
// destination to which the output message will be sent
|
||||
sentTo 'verifications'
|
||||
// the body of the output message
|
||||
body([
|
||||
eligible: true
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.messaging
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
description("""
|
||||
Sends a negative verification message when person is not eligible to get the beer
|
||||
|
||||
```
|
||||
given:
|
||||
client is too young
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll send a message with a negative verification
|
||||
```
|
||||
|
||||
""")
|
||||
// Label by means of which the output message can be triggered
|
||||
label 'rejected_verification'
|
||||
// input to the contract
|
||||
input {
|
||||
// the contract will be triggered by a method
|
||||
triggeredBy('clientIsTooYoung()')
|
||||
}
|
||||
// output message of the contract
|
||||
outputMessage {
|
||||
// destination to which the output message will be sent
|
||||
sentTo 'verifications'
|
||||
// the body of the output message
|
||||
body([
|
||||
eligible: false
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.rest
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
request {
|
||||
description("""
|
||||
Represents a successful scenario of getting a beer
|
||||
|
||||
given:
|
||||
client is old enough
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll grant him the beer
|
||||
""")
|
||||
method 'POST'
|
||||
url '/check'
|
||||
body(
|
||||
age: value(consumer(regex('[2-9][0-9]')))
|
||||
)
|
||||
headers {
|
||||
header 'Content-Type', 'application/json'
|
||||
}
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
body("""
|
||||
{
|
||||
"status": "OK"
|
||||
}
|
||||
""")
|
||||
headers {
|
||||
header(
|
||||
'Content-Type',
|
||||
value(consumer('application/json'), producer(regex('application/json.*')))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.rest
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
request {
|
||||
description("""
|
||||
Represents a unsuccessful scenario of getting a beer
|
||||
|
||||
given:
|
||||
client is not old enough
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll NOT grant him the beer
|
||||
""")
|
||||
method 'POST'
|
||||
url '/check'
|
||||
body(
|
||||
age: value(consumer(regex('[0-1][0-9]')))
|
||||
)
|
||||
headers {
|
||||
header 'Content-Type', 'application/json'
|
||||
}
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
body("""
|
||||
{
|
||||
"status": "NOT_OK"
|
||||
}
|
||||
""")
|
||||
headers {
|
||||
header(
|
||||
'Content-Type',
|
||||
value(consumer('application/json'), producer(regex('application/json.*')))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"id": "e5413ef6-0f3e-4b81-9e78-7a90b53c6ed1",
|
||||
"request": {
|
||||
"url": "/check",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Content-Type": {
|
||||
"equalTo": "application/json"
|
||||
}
|
||||
},
|
||||
"bodyPatterns": [
|
||||
{
|
||||
"matchesJsonPath": "$[?(@.['age'] =~ /[2-9][0-9]/)]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"body": "{\"status\":\"OK\"}",
|
||||
"headers": {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"transformers": [
|
||||
"response-template"
|
||||
]
|
||||
},
|
||||
"uuid": "e5413ef6-0f3e-4b81-9e78-7a90b53c6ed1"
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"id": "b54426aa-b2ef-4b12-adc9-a05fcf6a4e08",
|
||||
"request": {
|
||||
"url": "/check",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Content-Type": {
|
||||
"equalTo": "application/json"
|
||||
}
|
||||
},
|
||||
"bodyPatterns": [
|
||||
{
|
||||
"matchesJsonPath": "$[?(@.['age'] =~ /[0-1][0-9]/)]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"body": "{\"status\":\"NOT_OK\"}",
|
||||
"headers": {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"transformers": [
|
||||
"response-template"
|
||||
]
|
||||
},
|
||||
"uuid": "b54426aa-b2ef-4b12-adc9-a05fcf6a4e08"
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.messaging
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
description("""
|
||||
Sends a positive verification message when person is eligible to get the beer
|
||||
|
||||
```
|
||||
given:
|
||||
client is old enough
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll send a message with a positive verification
|
||||
```
|
||||
|
||||
""")
|
||||
// Label by means of which the output message can be triggered
|
||||
label 'accepted_verification'
|
||||
// input to the contract
|
||||
input {
|
||||
// the contract will be triggered by a method
|
||||
triggeredBy('clientIsOldEnough()')
|
||||
}
|
||||
// output message of the contract
|
||||
outputMessage {
|
||||
// destination to which the output message will be sent
|
||||
sentTo 'verifications'
|
||||
// the body of the output message
|
||||
body([
|
||||
eligible: true
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.messaging
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
description("""
|
||||
Sends a negative verification message when person is not eligible to get the beer
|
||||
|
||||
```
|
||||
given:
|
||||
client is too young
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll send a message with a negative verification
|
||||
```
|
||||
|
||||
""")
|
||||
// Label by means of which the output message can be triggered
|
||||
label 'rejected_verification'
|
||||
// input to the contract
|
||||
input {
|
||||
// the contract will be triggered by a method
|
||||
triggeredBy('clientIsTooYoung()')
|
||||
}
|
||||
// output message of the contract
|
||||
outputMessage {
|
||||
// destination to which the output message will be sent
|
||||
sentTo 'verifications'
|
||||
// the body of the output message
|
||||
body([
|
||||
eligible: false
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.rest
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
request {
|
||||
description("""
|
||||
Represents a successful scenario of getting a beer
|
||||
|
||||
given:
|
||||
client is old enough
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll grant him the beer
|
||||
""")
|
||||
method 'POST'
|
||||
url '/check'
|
||||
body(
|
||||
age: value(consumer(regex('[2-9][0-9]')))
|
||||
)
|
||||
headers {
|
||||
header 'Content-Type', 'application/json'
|
||||
}
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
body("""
|
||||
{
|
||||
"status": "OK"
|
||||
}
|
||||
""")
|
||||
headers {
|
||||
header(
|
||||
'Content-Type',
|
||||
value(consumer('application/json'), producer(regex('application/json.*')))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package contracts.beer.rest
|
||||
|
||||
org.springframework.cloud.contract.spec.Contract.make {
|
||||
request {
|
||||
description("""
|
||||
Represents a unsuccessful scenario of getting a beer
|
||||
|
||||
given:
|
||||
client is not old enough
|
||||
when:
|
||||
he applies for a beer
|
||||
then:
|
||||
we'll NOT grant him the beer
|
||||
""")
|
||||
method 'POST'
|
||||
url '/check'
|
||||
body(
|
||||
age: value(consumer(regex('[0-1][0-9]')))
|
||||
)
|
||||
headers {
|
||||
header 'Content-Type', 'application/json'
|
||||
}
|
||||
}
|
||||
response {
|
||||
status 200
|
||||
body("""
|
||||
{
|
||||
"status": "NOT_OK"
|
||||
}
|
||||
""")
|
||||
headers {
|
||||
header(
|
||||
'Content-Type',
|
||||
value(consumer('application/json'), producer(regex('application/json.*')))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"id": "e5413ef6-0f3e-4b81-9e78-7a90b53c6ed1",
|
||||
"request": {
|
||||
"url": "/check",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Content-Type": {
|
||||
"equalTo": "application/json"
|
||||
}
|
||||
},
|
||||
"bodyPatterns": [
|
||||
{
|
||||
"matchesJsonPath": "$[?(@.['age'] =~ /[2-9][0-9]/)]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"body": "{\"status\":\"OK\"}",
|
||||
"headers": {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"transformers": [
|
||||
"response-template"
|
||||
]
|
||||
},
|
||||
"uuid": "e5413ef6-0f3e-4b81-9e78-7a90b53c6ed1"
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"id": "b54426aa-b2ef-4b12-adc9-a05fcf6a4e08",
|
||||
"request": {
|
||||
"url": "/check",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Content-Type": {
|
||||
"equalTo": "application/json"
|
||||
}
|
||||
},
|
||||
"bodyPatterns": [
|
||||
{
|
||||
"matchesJsonPath": "$[?(@.['age'] =~ /[0-1][0-9]/)]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"body": "{\"status\":\"NOT_OK\"}",
|
||||
"headers": {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"transformers": [
|
||||
"response-template"
|
||||
]
|
||||
},
|
||||
"uuid": "b54426aa-b2ef-4b12-adc9-a05fcf6a4e08"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Issue 1305
|
||||
Binary file not shown.
@@ -1,2 +1,3 @@
|
||||
0000000000000000000000000000000000000000 0b36113e5fa9713025d50f046e8fd209fc8d9597 Marcin Grzejszczak <mgrzejszczak@pivotal.io> 1522062299 +0200 clone: from git@github.com:marcingrzejszczak/contract-git.git
|
||||
0b36113e5fa9713025d50f046e8fd209fc8d9597 3bd42890d5105a30abd82d0205b63cbf20a59e83 Marcin Grzejszczak <mgrzejszczak@pivotal.io> 1547107982 +0100 commit: Added more versions
|
||||
3bd42890d5105a30abd82d0205b63cbf20a59e83 49c8705a4409b1a4bd0f767665632c6ae11b5b90 Marcin Grzejszczak <marcin.grzejszczak@gmail.com> 1581521766 +0100 commit: Issue 1305
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
0000000000000000000000000000000000000000 0b36113e5fa9713025d50f046e8fd209fc8d9597 Marcin Grzejszczak <mgrzejszczak@pivotal.io> 1522062299 +0200 clone: from git@github.com:marcingrzejszczak/contract-git.git
|
||||
0b36113e5fa9713025d50f046e8fd209fc8d9597 3bd42890d5105a30abd82d0205b63cbf20a59e83 Marcin Grzejszczak <mgrzejszczak@pivotal.io> 1547107982 +0100 commit: Added more versions
|
||||
3bd42890d5105a30abd82d0205b63cbf20a59e83 49c8705a4409b1a4bd0f767665632c6ae11b5b90 Marcin Grzejszczak <marcin.grzejszczak@gmail.com> 1581521766 +0100 commit: Issue 1305
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
x<01><>1N1<10>aj<61>bz<62>hl<68><6C>^ <09>t<05>{<7B>a <09>"<22><><EFBFBD><EFBFBD>Y<EFBFBD>p<01>^Y[[8<>O<EFBFBD><4F>ed<65>E$<24><>j E%<25><14><>gJ<67><4A><EFBFBD><EFBFBD>GJ曻<4A><07>,<2C>K3
|
||||
Y$<24><>Y<EFBFBD>tH9<48><39><EFBFBD>C<EFBFBD>Y<EFBFBD>7<EFBFBD>k<>w<EFBFBD>e<EFBFBD>å<EFBFBD><C3A5><EFBFBD><EFBFBD>e<EFBFBD><1B><>_;]<5D><>|m<>|<7C><><EFBFBD>^<5E>R<EFBFBD><52>l<01><>"<22>C<EFBFBD><43>C<EFBFBD>e̼m<CCBC>C<EFBFBD>z$<24><03>)Tz
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
x<01>Q<EFBFBD>N<EFBFBD>0<10>ܯ<EFBFBD>,<2C><><EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD>@<40><06>VjoIN2!<21><><0E><>PU<50><55><19>+$<24><><EFBFBD><EFBFBD>BG<42><47><EFBFBD>W<EFBFBD>c<O<><4F>q<EFBFBD>ƃ<11><13><>#<10>h6s<><73><EFBFBD>T<EFBFBD><54><EFBFBD><1B>H<06><><EFBFBD>k<EFBFBD>l<EFBFBD>
|
||||
<EFBFBD>q<02><><EFBFBD>
|
||||
N<EFBFBD>A<EFBFBD><EFBFBD>q,3<>)<29><><EFBFBD><EFBFBD><11>@&P<><50>,<11><>BP(6<>
|
||||
.pz!Yl<59>ՖUU<55><55><EFBFBD>\+<2B><>h<EFBFBD>;g<><67><EFBFBD>nm.<1A>t<EFBFBD>]ID<49><44><EFBFBD><EFBFBD><0F>}̎QJ<51><4A><EFBFBD><EFBFBD>$<24><>Y<EFBFBD>k<EFBFBD><6B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>7<EFBFBD><37><EFBFBD><EFBFBD><EFBFBD>9<EFBFBD>P<EFBFBD>Cߥù
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
xm<>QO<51>0<10><><EFBFBD>|<7C>S^Ң6<05><><EFBFBD><EFBFBD><EFBFBD>´
|
||||
<EFBFBD>N<EFBFBD>!<21>&<1E><><EFBFBD><0E><><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><73>ت6<D8AA>}<7D><><EFBFBD><EFBFBD>;;<3B><>l<EFBFBD><6C><EFBFBD><EFBFBD><EFBFBD>7<EFBFBD><37>`f<><66>UE<55><45><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.'<27>KC<>J<EFBFBD>
|
||||
D<EFBFBD>Kci<EFBFBD>߹<EFBFBD><EFBFBD>8<EFBFBD>RI<EFBFBD>shu<68>6$M!)<29><><EFBFBD><EFBFBD>+Z<><5A><EFBFBD><EFBFBD><EFBFBD>\5<>C<EFBFBD><43><03>ؙj<>m<<3C><0E><>r<EFBFBD>U>Jl<(
|
||||
<EFBFBD><EFBFBD>M<EFBFBD><EFBFBD><EFBFBD><08><>exN_<4E><5F><EFBFBD>m_<6D>l<EFBFBD><6C><EFBFBD><EFBFBD><12><1D><>˅ |/<1A>Sz߸<7A>ɤ<EFBFBD><C9A4>Lə<>Ť<EFBFBD>r<><72><EFBFBD><EFBFBD>|<7C>:<1F><>><3E>ZW<5A>X<><58>*K<>7;
|
||||
ɒbCb+<2B>><3E>E<EFBFBD>yò;<3B><><EFBFBD><EFBFBD><08><><EFBFBD>NXd<58><64>rުM<DEAA><4D><EFBFBD>ֻ<01><>rq<1A><>
|
||||
<EFBFBD><EFBFBD>>NW<4E>Ո<EFBFBD><D588><EFBFBD>ן<EFBFBD><D79F>k<EFBFBD><6B>^]M<17><><EFBFBD>
|
||||
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
3bd42890d5105a30abd82d0205b63cbf20a59e83
|
||||
49c8705a4409b1a4bd0f767665632c6ae11b5b90
|
||||
|
||||
@@ -157,7 +157,11 @@ public class WireMockConfiguration implements SmartLifecycle {
|
||||
void resetMappings() {
|
||||
if (this.server.isRunning()) {
|
||||
this.server.resetAll();
|
||||
this.server.resetRequests();
|
||||
this.server.resetScenarios();
|
||||
WireMock.reset();
|
||||
WireMock.resetAllRequests();
|
||||
WireMock.resetAllScenarios();
|
||||
registerStubs();
|
||||
logRegisteredMappings();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user