|
| 1 | +### Generate correlationKey |
| 2 | +< {% |
| 3 | + client.global.clearAll(); |
| 4 | +%} |
| 5 | +// @no-log |
| 6 | +GET https://www.uuidtools.com/api/generate/v4 |
| 7 | +Accept: application/json |
| 8 | + |
| 9 | +> {% |
| 10 | + const correlationKey = jsonPath(response.body, "$[0]"); |
| 11 | + console.log("Correlation key", correlationKey); |
| 12 | + client.global.set("correlationKey", correlationKey); |
| 13 | +%} |
| 14 | + |
| 15 | +### Deploy process |
| 16 | +// @no-log |
| 17 | +POST http://localhost:8081/simple-service-tasks/deploy |
| 18 | + |
| 19 | +> {% |
| 20 | + client.test("Request executed successfully", function () { |
| 21 | + client.assert(response.status === 201, "Response status is not 201"); |
| 22 | + }); |
| 23 | + |
| 24 | + client.global.set("deploymentKey", response.headers.valueOf("Location")); |
| 25 | +%} |
| 26 | + |
| 27 | + |
| 28 | +### Start process |
| 29 | +// @no-log |
| 30 | +POST http://localhost:8081/simple-service-tasks/start-process?value={{ correlationKey }}&intValue=1 |
| 31 | + |
| 32 | +> {% |
| 33 | + client.test("Request executed successfully", function () { |
| 34 | + client.assert(response.status === 201, "Response status is not 201"); |
| 35 | + }); |
| 36 | + |
| 37 | + client.global.set("instanceId", response.headers.valueOf("Location")); |
| 38 | +%} |
| 39 | + |
| 40 | +### Get user tasks |
| 41 | +< {% |
| 42 | + import {wait} from "wait"; |
| 43 | + console.log("waiting 5 secs"); |
| 44 | + wait(5); |
| 45 | +%} |
| 46 | +// @no-log |
| 47 | +GET http://localhost:8081/simple-service-tasks/tasks |
| 48 | +Accept: application/json |
| 49 | + |
| 50 | +> {% |
| 51 | + client.test("Request executed successfully", function () { |
| 52 | + client.assert(response.status === 200, "Response status is not 201"); |
| 53 | + }); |
| 54 | + client.test("Content-Type is application/json", () => { |
| 55 | + const contentType = response.headers.valueOf("content-type"); |
| 56 | + client.assert(contentType == "application/json", |
| 57 | + `Expected Content-Type is application/json, but actual is ${contentType}`); |
| 58 | + }) |
| 59 | + |
| 60 | + const tasks = response.body; |
| 61 | + const taskId = jsonPath(tasks, "$[0].taskId"); |
| 62 | + console.log("Created user task: ", taskId); |
| 63 | + client.global.set("taskId", taskId); |
| 64 | +%} |
| 65 | + |
| 66 | +### Complete user task |
| 67 | +// @no-log |
| 68 | +POST http://localhost:8081/simple-service-tasks/tasks/{{ taskId }}/complete?value=value-of-user-task-completion |
| 69 | + |
| 70 | +> {% |
| 71 | + client.test("Request executed successfully", function () { |
| 72 | + client.assert(response.status === 204, "Response status is not 204"); |
| 73 | + }); |
| 74 | +%} |
| 75 | + |
| 76 | +### Correlate message |
| 77 | +< {% |
| 78 | + import {wait} from "wait"; |
| 79 | + console.log("waiting 5 secs"); |
| 80 | + wait(5); |
| 81 | +%} |
| 82 | +// @no-log |
| 83 | +POST http://localhost:8081/simple-service-tasks/correlate/{{ correlationKey }}?value=value-delivered-by-correlation |
| 84 | + |
| 85 | +> {% |
| 86 | + client.test("Request executed successfully", function () { |
| 87 | + client.assert(response.status === 204, "Response status is not 204"); |
| 88 | + }); |
| 89 | +%} |
0 commit comments