-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow sendMessage to handle body from file (#1867)
* allow sendMessage to handle body from file - add test for populating `bodyFromFileAsBytes` - update `StubRunnerExecutor` to handle more than just json payloads cherry picked changes from bugfix/1864 take 2 fixes #1864 * wrap bodyextractor value in jsonoutput, add tests for of file content types cherry picked from bugfix/1864 #1864
- Loading branch information
Showing
10 changed files
with
214 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...cloud-contract-stub-runner/src/test/resources/repository/messagecontract/contract1.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2013-2023 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. | ||
*/ | ||
|
||
org.springframework.cloud.contract.spec.Contract.make { | ||
description 'issue #1864' | ||
label 'send_order_bin' | ||
input { | ||
triggeredBy('sendOrder()') | ||
} | ||
outputMessage { | ||
sentTo 'orderEventsTopic' | ||
headers { | ||
[ | ||
header('contentType': 'application/vnd.orderplaced.v1+avro') | ||
] | ||
} | ||
body(fileAsBytes("orderplaced-event.bin")) | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...cloud-contract-stub-runner/src/test/resources/repository/messagecontract/contract2.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2013-2023 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. | ||
*/ | ||
|
||
org.springframework.cloud.contract.spec.Contract.make { | ||
description 'issue #1864' | ||
label 'send_order_json' | ||
input { | ||
triggeredBy('sendOrderJson()') | ||
} | ||
outputMessage { | ||
sentTo 'orderEventsTopic' | ||
headers { | ||
[ | ||
header('contentType': 'application/json') | ||
] | ||
} | ||
body(file("orderplaced-event.json")) | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...cloud-contract-stub-runner/src/test/resources/repository/messagecontract/contract3.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2013-2023 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. | ||
*/ | ||
|
||
org.springframework.cloud.contract.spec.Contract.make { | ||
description 'issue #1864' | ||
label 'send_order_xml' | ||
input { | ||
triggeredBy('sendOrderXml()') | ||
} | ||
outputMessage { | ||
sentTo 'orderEventsTopic' | ||
headers { | ||
[ | ||
header('contentType': 'application/xml') | ||
] | ||
} | ||
body(file("orderplaced-event.xml")) | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...cloud-contract-stub-runner/src/test/resources/repository/messagecontract/contract4.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2013-2023 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. | ||
*/ | ||
|
||
org.springframework.cloud.contract.spec.Contract.make { | ||
description 'issue #1864' | ||
label 'send_order_csv' | ||
input { | ||
triggeredBy('sendOrderCsv()') | ||
} | ||
outputMessage { | ||
sentTo 'orderEventsTopic' | ||
headers { | ||
[ | ||
header('contentType': 'text/plain') | ||
] | ||
} | ||
body(file("orderplaced-event.csv")) | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...-contract-stub-runner/src/test/resources/repository/messagecontract/orderplaced-event.bin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
H505c50a7-0c26-4582-b9ae-bc1c0f65fec10fakeCustomer@example.com��ٳ�a |
2 changes: 2 additions & 0 deletions
2
...-contract-stub-runner/src/test/resources/repository/messagecontract/orderplaced-event.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
orderId,customerId,orderCreated | ||
505c50a7-0c26-4582-b9ae-bc1c0f65fec1,fakeUser@example.com,orderCreated": "2023-01-30T15:11:00Z |
5 changes: 5 additions & 0 deletions
5
...contract-stub-runner/src/test/resources/repository/messagecontract/orderplaced-event.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"orderId": "505c50a7-0c26-4582-b9ae-bc1c0f65fec1", | ||
"customerId": "fakeUser@example.com", | ||
"orderCreated": "2023-01-30T15:11:00Z" | ||
} |
6 changes: 6 additions & 0 deletions
6
...-contract-stub-runner/src/test/resources/repository/messagecontract/orderplaced-event.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> | ||
<orderPlaced> | ||
<orderId>505c50a7-0c26-4582-b9ae-bc1c0f65fec1</orderId> | ||
<custmerId>fakeCustomer@example.com</custmerId> | ||
<orderPlaced>2023-01-30T15:11:00Z</orderPlaced> | ||
</orderPlaced> |