Skip to content

Commit 61d6fb7

Browse files
committed
feat: Add consumer driven contract testing
1 parent 1e02d40 commit 61d6fb7

File tree

75 files changed

+2643
-209
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+2643
-209
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
/keycloak/*
66
!/keycloak/keycloak.mv.db
77
target/
8+
workspace/
89
*.iml
Lines changed: 328 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,328 @@
1+
{
2+
"info": {
3+
"_postman_id": "38c24193-20db-400c-894c-93e289835152",
4+
"name": "Consumer-Driven Contracts",
5+
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json",
6+
"_exporter_id": "27875178"
7+
},
8+
"item": [
9+
{
10+
"name": "Get Customers",
11+
"request": {
12+
"method": "GET",
13+
"header": [],
14+
"url": "localhost:30000/customers"
15+
},
16+
"response": []
17+
},
18+
{
19+
"name": "Get Customers (test)",
20+
"request": {
21+
"method": "GET",
22+
"header": [],
23+
"url": "localhost:31000/customers"
24+
},
25+
"response": []
26+
},
27+
{
28+
"name": "Get single Customer",
29+
"request": {
30+
"method": "GET",
31+
"header": [],
32+
"url": "localhost:30000/customers/007"
33+
},
34+
"response": []
35+
},
36+
{
37+
"name": "Get single Customer (test)",
38+
"request": {
39+
"method": "GET",
40+
"header": [],
41+
"url": "localhost:31000/customers/007"
42+
},
43+
"response": []
44+
},
45+
{
46+
"name": "Set Billing Address",
47+
"request": {
48+
"method": "PUT",
49+
"header": [
50+
{
51+
"key": "Content-Type",
52+
"name": "Content-Type",
53+
"value": "application/json",
54+
"type": "text"
55+
}
56+
],
57+
"body": {
58+
"mode": "raw",
59+
"raw": "{\n \"recipient\": \"Sherlock Holmes\",\n \"street\": {\n \"name\": \"Baker Street\",\n \"number\": \"221B\"\n },\n \"city\": \"London NW1 6XE\"\n}\n"
60+
},
61+
"url": "localhost:30000/customers/007/billing-address"
62+
},
63+
"response": []
64+
},
65+
{
66+
"name": "Set Billing Address (test)",
67+
"request": {
68+
"method": "PUT",
69+
"header": [
70+
{
71+
"key": "Content-Type",
72+
"name": "Content-Type",
73+
"type": "text",
74+
"value": "application/json"
75+
}
76+
],
77+
"body": {
78+
"mode": "raw",
79+
"raw": "{\n \"recipient\": \"James Bond\",\n \"street\": {\n \"name\": \"Baker Street\",\n \"number\": \"221B\"\n },\n \"city\": \"London NW1 6XE\"\n}\n"
80+
},
81+
"url": "localhost:31000/customers/007/billing-address"
82+
},
83+
"response": []
84+
},
85+
{
86+
"name": "Set Delivery Address",
87+
"request": {
88+
"method": "PUT",
89+
"header": [
90+
{
91+
"key": "Content-Type",
92+
"name": "Content-Type",
93+
"value": "application/json",
94+
"type": "text"
95+
}
96+
],
97+
"body": {
98+
"mode": "raw",
99+
"raw": "{\n \"recipient\": \"Erika Mustermann\",\n \"street\": {\n \"name\": \"Test\",\n \"number\": \"1\"\n },\n \"city\": \"26122 Oldenburg\"\n}\n"
100+
},
101+
"url": "localhost:30000/customers/007/delivery-address"
102+
},
103+
"response": []
104+
},
105+
{
106+
"name": "Set Delivery Address (test)",
107+
"request": {
108+
"method": "PUT",
109+
"header": [
110+
{
111+
"key": "Content-Type",
112+
"name": "Content-Type",
113+
"type": "text",
114+
"value": "application/json"
115+
}
116+
],
117+
"body": {
118+
"mode": "raw",
119+
"raw": "{\n \"recipient\": \"Max Mustermann\",\n \"street\": {\n \"name\": \"Test\",\n \"number\": \"1\"\n },\n \"city\": \"26122 Oldenburg\"\n}\n"
120+
},
121+
"url": "localhost:31000/customers/007/delivery-address"
122+
},
123+
"response": []
124+
},
125+
{
126+
"name": "Validate Address (test)",
127+
"request": {
128+
"method": "POST",
129+
"header": [
130+
{
131+
"key": "Content-Type",
132+
"name": "Content-Type",
133+
"value": "application/json",
134+
"type": "text"
135+
}
136+
],
137+
"body": {
138+
"mode": "raw",
139+
"raw": "{\n \"recipient\": \"Max Mustermann\",\n \"street\": {\n \"name\": \"Poststrasse\",\n \"number\": \"1\"\n },\n \"city\": \"26122 Oldenburg\"\n}\n"
140+
},
141+
"url": "localhost:31003/valid-addresses"
142+
},
143+
"response": []
144+
},
145+
{
146+
"name": "Get Billing Address (test)",
147+
"request": {
148+
"method": "GET",
149+
"header": [],
150+
"url": "localhost:31001/billing-addresses/007"
151+
},
152+
"response": []
153+
},
154+
{
155+
"name": "Get Delivery Address (test)",
156+
"request": {
157+
"method": "GET",
158+
"header": [],
159+
"url": "http://localhost:31002/delivery-addresses/007"
160+
},
161+
"response": []
162+
},
163+
{
164+
"name": "Create Webhook for billing-service",
165+
"request": {
166+
"method": "POST",
167+
"header": [
168+
{
169+
"key": "Content-Type",
170+
"name": "Content-Type",
171+
"value": "application/json",
172+
"type": "text"
173+
}
174+
],
175+
"body": {
176+
"mode": "raw",
177+
"raw": "{\n \"provider\": {\n \"name\": \"billing-service\"\n },\n \"events\": [{\n \"name\": \"contract_content_changed\"\n }],\n \"request\": {\n \"method\": \"GET\",\n \"url\": \"http://jenkins-service:8080/generic-webhook-trigger/invoke?token=billing-service&stage=${pactbroker.consumerVersionTags}&verifyPacts=true\",\n \"headers\": {\n }\n }\n}"
178+
},
179+
"url": "http://localhost:30050/webhooks"
180+
},
181+
"response": []
182+
},
183+
{
184+
"name": "Create Webhook for delivery-service",
185+
"request": {
186+
"method": "POST",
187+
"header": [
188+
{
189+
"key": "Content-Type",
190+
"name": "Content-Type",
191+
"type": "text",
192+
"value": "application/json"
193+
}
194+
],
195+
"body": {
196+
"mode": "raw",
197+
"raw": "{\n \"provider\": {\n \"name\": \"delivery-service\"\n },\n \"events\": [{\n \"name\": \"contract_content_changed\"\n }],\n \"request\": {\n \"method\": \"GET\",\n \"url\": \"http://jenkins-service:8080/generic-webhook-trigger/invoke?token=delivery-service&stage=${pactbroker.consumerVersionTags}&verifyPacts=true\",\n \"headers\": {\n }\n }\n}"
198+
},
199+
"url": "http://localhost:30050/webhooks"
200+
},
201+
"response": []
202+
},
203+
{
204+
"name": "Create Webhook for address-validation-service",
205+
"request": {
206+
"method": "POST",
207+
"header": [
208+
{
209+
"key": "Content-Type",
210+
"name": "Content-Type",
211+
"type": "text",
212+
"value": "application/json"
213+
}
214+
],
215+
"body": {
216+
"mode": "raw",
217+
"raw": "{\n \"provider\": {\n \"name\": \"address-validation-service\"\n },\n \"events\": [{\n \"name\": \"contract_content_changed\"\n }],\n \"request\": {\n \"method\": \"GET\",\n \"url\": \"http://jenkins-service:8080/generic-webhook-trigger/invoke?token=address-validation-service&stage=${pactbroker.consumerVersionTags}&verifyPacts=true\",\n \"headers\": {\n }\n }\n}"
218+
},
219+
"url": "http://localhost:30050/webhooks"
220+
},
221+
"response": []
222+
},
223+
{
224+
"name": "Create Verification Webhook for customer-service",
225+
"request": {
226+
"method": "POST",
227+
"header": [
228+
{
229+
"key": "Content-Type",
230+
"name": "Content-Type",
231+
"type": "text",
232+
"value": "application/json"
233+
}
234+
],
235+
"body": {
236+
"mode": "raw",
237+
"raw": "{\n \"consumer\": {\n \"name\": \"customer-service\"\n },\n \"events\": [{\n \"name\": \"provider_verification_published\"\n }],\n \"request\": {\n \"method\": \"GET\",\n \"url\": \"http://jenkins-service:8080/generic-webhook-trigger/invoke?token=customer-service&stage=${pactbroker.consumerVersionTags}&deployOnly=true&deploymentVersion=${pactbroker.consumerVersionNumber}\",\n \"headers\": {\n }\n }\n}"
238+
},
239+
"url": "http://localhost:30050/webhooks"
240+
},
241+
"response": []
242+
},
243+
{
244+
"name": "Create Verification Webhook for delivery-service",
245+
"request": {
246+
"method": "POST",
247+
"header": [
248+
{
249+
"key": "Content-Type",
250+
"name": "Content-Type",
251+
"value": "application/json",
252+
"type": "text"
253+
}
254+
],
255+
"body": {
256+
"mode": "raw",
257+
"raw": "{\n \"consumer\": {\n \"name\": \"delivery-service\"\n },\n \"events\": [{\n \"name\": \"provider_verification_published\"\n }],\n \"request\": {\n \"method\": \"GET\",\n \"url\": \"http://jenkins-service:8080/generic-webhook-trigger/invoke?token=delivery-service&stage=${pactbroker.consumerVersionTags}&deployOnly=true&deploymentVersion=${pactbroker.consumerVersionNumber}\",\n \"headers\": {\n }\n }\n}"
258+
},
259+
"url": "http://localhost:30050/webhooks"
260+
},
261+
"response": []
262+
},
263+
{
264+
"name": "Execute Verification Webhook for Customer Service",
265+
"request": {
266+
"method": "POST",
267+
"header": [
268+
{
269+
"key": "Content-Type",
270+
"name": "Content-Type",
271+
"value": "application/x-www-form-urlencoded",
272+
"type": "text"
273+
}
274+
],
275+
"body": {
276+
"mode": "urlencoded",
277+
"urlencoded": []
278+
},
279+
"url": {
280+
"raw": "http://localhost:9080/generic-webhook-trigger/invoke?token=customer-service&stage=pending-prod&deployOnly=true&deploymentVersion=1.2.1",
281+
"protocol": "http",
282+
"host": [
283+
"localhost"
284+
],
285+
"port": "9080",
286+
"path": [
287+
"generic-webhook-trigger",
288+
"invoke"
289+
],
290+
"query": [
291+
{
292+
"key": "token",
293+
"value": "customer-service"
294+
},
295+
{
296+
"key": "stage",
297+
"value": "pending-prod"
298+
},
299+
{
300+
"key": "deployOnly",
301+
"value": "true"
302+
},
303+
{
304+
"key": "deploymentVersion",
305+
"value": "1.2.1"
306+
}
307+
]
308+
}
309+
},
310+
"response": []
311+
},
312+
{
313+
"name": "Set prod tag to Delivery Service",
314+
"request": {
315+
"method": "DELETE",
316+
"header": [
317+
{
318+
"key": "Content-Type",
319+
"value": "application/json",
320+
"type": "text"
321+
}
322+
],
323+
"url": "http://localhost:30050/pacticipants/delivery-service/versions/1.2.0/tags/prod"
324+
},
325+
"response": []
326+
}
327+
]
328+
}

README.md

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,3 @@
11
# Workshop API Design
22

3-
Herzlich willkommen zum Workshop API Design.
4-
5-
## Übungen
6-
7-
### API Design
8-
9-
- [OpenAPI](https://github.com/openknowledge/workshop-api-design/tree/openapi)
10-
- [Mocking](https://github.com/openknowledge/workshop-api-design/tree/wiremock)
11-
- [AsyncAPI](https://github.com/openknowledge/workshop-api-design/tree/asyncapi)
12-
13-
### API Testing
14-
15-
- [Pact](https://github.com/openknowledge/workshop-api-design/tree/pact-mock-server)
16-
- [Pact Pipeline](https://github.com/openknowledge/workshop-api-design/tree/pact)
17-
18-
### API Security
19-
20-
- [JWT](https://github.com/openknowledge/workshop-api-design/tree/jwt)
21-
- [OAuth2](https://github.com/openknowledge/workshop-api-design/tree/oauth2)
22-
- [OAuth2 mit PKCE](https://github.com/openknowledge/workshop-api-design/tree/oauth2-pkce)
23-
24-
### API Governance
25-
26-
- [Linting](https://github.com/openknowledge/workshop-api-design/tree/linting)
27-
28-
### API Management
29-
30-
- [Rate Limiting](https://github.com/openknowledge/workshop-api-design/tree/rate-limiting)
31-
- [Backstage](https://github.com/openknowledge/workshop-api-design/tree/backstage)
32-
33-
### API Operation
34-
35-
- [Observability](https://github.com/openknowledge/workshop-api-design/tree/observability)
36-
37-
### API Evolution
38-
39-
- [Versioning](https://github.com/openknowledge/workshop-api-design/tree/versioning)
3+
Herzlich willkommen zur Übung Pact.

address-validation-service/Dockerfile

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)