From ab81da403ee528ad97035c2a4e3448aa483d5386 Mon Sep 17 00:00:00 2001 From: Paulo Gomes da Cruz Junior Date: Mon, 28 Oct 2024 14:10:43 -0700 Subject: [PATCH] chore: adding stub for forest client --- docker-compose.yml | 10 +++++++++- .../findByClientNumber_00012797.json | 7 +++++++ .../findByClientNumber_00132184.json | 7 +++++++ stub/mappings/forestclient_mapping.json | 18 ++++++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 stub/__files/forestclient/findByClientNumber_00012797.json create mode 100644 stub/__files/forestclient/findByClientNumber_00132184.json create mode 100644 stub/mappings/forestclient_mapping.json diff --git a/docker-compose.yml b/docker-compose.yml index b66f85db..d85fd7a3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -85,4 +85,12 @@ services: profiles: ["native"] build: ./backend ports: ["8080:8080"] - <<: *backend \ No newline at end of file + <<: *backend + + wiremock: + image: "wiremock/wiremock:latest" + container_name: forest-client-api-stub + ports: ["9000:9000","9001:9001"] + volumes: + - ./stub/:/home/wiremock/ + entrypoint: ["/docker-entrypoint.sh", "--enable-stub-cors","--global-response-templating","--port","9000","--https-port","9001","--verbose"] \ No newline at end of file diff --git a/stub/__files/forestclient/findByClientNumber_00012797.json b/stub/__files/forestclient/findByClientNumber_00012797.json new file mode 100644 index 00000000..def97ebe --- /dev/null +++ b/stub/__files/forestclient/findByClientNumber_00012797.json @@ -0,0 +1,7 @@ +{ + "clientNumber": "00012797", + "clientName": "MINISTRY OF FORESTS", + "clientStatusCode": "ACT", + "clientTypeCode": "F", + "acronym": "MOF" +} \ No newline at end of file diff --git a/stub/__files/forestclient/findByClientNumber_00132184.json b/stub/__files/forestclient/findByClientNumber_00132184.json new file mode 100644 index 00000000..70f1966e --- /dev/null +++ b/stub/__files/forestclient/findByClientNumber_00132184.json @@ -0,0 +1,7 @@ +{ + "clientNumber": "00132184", + "clientName": "TIMBER SALES MANAGER BABINE", + "clientStatusCode": "ACT", + "clientTypeCode": "F", + "acronym": "TBA" +} \ No newline at end of file diff --git a/stub/mappings/forestclient_mapping.json b/stub/mappings/forestclient_mapping.json new file mode 100644 index 00000000..47cfb36b --- /dev/null +++ b/stub/mappings/forestclient_mapping.json @@ -0,0 +1,18 @@ +{ + "mappings": [ + { + "name": "Find by client number", + "request": { + "urlPattern": "/api/clients/findByClientNumber/([0-9]*)", + "method": "GET" + }, + "response": { + "status": 200, + "transformers": [ + "response-template" + ], + "bodyFileName": "forestclient/{{request.path.[2]}}_{{request.path.[3]}}.json" + } + } + ] +}