From 96398c62d336223604982a9709cdf068a4fb5729 Mon Sep 17 00:00:00 2001 From: rathnapandi Date: Tue, 19 Dec 2023 12:16:21 -0700 Subject: [PATCH] - Enabled log for wiremock --- .../src/main/resources/log4j2.xml | 5 ----- .../java/com/axway/apim/WiremockWrapper.java | 7 ++++--- .../__files/grantApplicationToAccessApis.json | 8 ++++++++ .../mappings/getApplicationToAccessApi.json | 6 +++--- .../mappings/grantApiAccessToAllOrg.json | 17 ++++++++++++++++ .../mappings/grantApiAccessToOrg.json | 20 +++++++++++++++++++ .../mappings/grantApplicationToAccessApi.json | 2 +- 7 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 modules/apim-cli-tests/src/main/resources/wiremock_apim/__files/grantApplicationToAccessApis.json create mode 100644 modules/apim-cli-tests/src/main/resources/wiremock_apim/mappings/grantApiAccessToAllOrg.json create mode 100644 modules/apim-cli-tests/src/main/resources/wiremock_apim/mappings/grantApiAccessToOrg.json diff --git a/modules/apim-adapter/src/main/resources/log4j2.xml b/modules/apim-adapter/src/main/resources/log4j2.xml index 29858d0e5..b45c39b4a 100644 --- a/modules/apim-adapter/src/main/resources/log4j2.xml +++ b/modules/apim-adapter/src/main/resources/log4j2.xml @@ -5,11 +5,6 @@ - - - - - diff --git a/modules/apim-cli-tests/src/main/java/com/axway/apim/WiremockWrapper.java b/modules/apim-cli-tests/src/main/java/com/axway/apim/WiremockWrapper.java index 9751f6a34..f802fed6a 100644 --- a/modules/apim-cli-tests/src/main/java/com/axway/apim/WiremockWrapper.java +++ b/modules/apim-cli-tests/src/main/java/com/axway/apim/WiremockWrapper.java @@ -13,10 +13,11 @@ public class WiremockWrapper { WireMockServer wireMockServer; - public void initWiremock(){ + public void initWiremock() { - wireMockServer = new WireMockServer(options().httpsPort(8075).jettyIdleTimeout(30000L).jettyStopTimeout(10000L) - .usingFilesUnderClasspath("wiremock_apim")); + wireMockServer = new WireMockServer(options().httpsPort(8075).jettyIdleTimeout(30000L).jettyStopTimeout(10000L).httpDisabled(true) + .templatingEnabled(false) + .usingFilesUnderClasspath("wiremock_apim")); System.setProperty("http.keepAlive", "false"); wireMockServer.start(); LOG.info("Wiremock server started"); diff --git a/modules/apim-cli-tests/src/main/resources/wiremock_apim/__files/grantApplicationToAccessApis.json b/modules/apim-cli-tests/src/main/resources/wiremock_apim/__files/grantApplicationToAccessApis.json new file mode 100644 index 000000000..d9110e2a8 --- /dev/null +++ b/modules/apim-cli-tests/src/main/resources/wiremock_apim/__files/grantApplicationToAccessApis.json @@ -0,0 +1,8 @@ +[{ + "id": "82977615-7454-4cac-8b7e-60ce8337879a", + "apiId": "e4ded8c8-0a40-4b50-bc13-552fb7209150", + "createdBy": "40dd53a4-0b13-4485-82e8-63c687404c2f", + "state": "approved", + "createdOn": 1690513519490, + "enabled": true +}] diff --git a/modules/apim-cli-tests/src/main/resources/wiremock_apim/mappings/getApplicationToAccessApi.json b/modules/apim-cli-tests/src/main/resources/wiremock_apim/mappings/getApplicationToAccessApi.json index bb16d57a2..f511e5188 100644 --- a/modules/apim-cli-tests/src/main/resources/wiremock_apim/mappings/getApplicationToAccessApi.json +++ b/modules/apim-cli-tests/src/main/resources/wiremock_apim/mappings/getApplicationToAccessApi.json @@ -1,11 +1,11 @@ { "request": { "method": "GET", - "url": "/api/portal/v1.4/applications/3be01ec6-7254-4ce3-a3f1-87636d59c614/apis" + "urlPath": "/api/portal/v1.4/applications/3be01ec6-7254-4ce3-a3f1-87636d59c614/apis" }, "response": { - "status": 201, - "bodyFileName": "grantApplicationToAccessApi.json", + "status": 200, + "bodyFileName": "grantApplicationToAccessApis.json", "headers": { "Content-Type": "application/json" } diff --git a/modules/apim-cli-tests/src/main/resources/wiremock_apim/mappings/grantApiAccessToAllOrg.json b/modules/apim-cli-tests/src/main/resources/wiremock_apim/mappings/grantApiAccessToAllOrg.json new file mode 100644 index 000000000..584ac36b8 --- /dev/null +++ b/modules/apim-cli-tests/src/main/resources/wiremock_apim/mappings/grantApiAccessToAllOrg.json @@ -0,0 +1,17 @@ +{ + "request": { + "method": "POST", + "urlPath": "/api/portal/v1.4/proxies/grantaccess", + "formParameters": { + "action": { + "equalTo": "all_orgs" + }, + "apiId": { + "equalTo": "e4ded8c8-0a40-4b50-bc13-552fb7209150" + } + } + }, + "response": { + "status": 204 + } +} diff --git a/modules/apim-cli-tests/src/main/resources/wiremock_apim/mappings/grantApiAccessToOrg.json b/modules/apim-cli-tests/src/main/resources/wiremock_apim/mappings/grantApiAccessToOrg.json new file mode 100644 index 000000000..64c15431e --- /dev/null +++ b/modules/apim-cli-tests/src/main/resources/wiremock_apim/mappings/grantApiAccessToOrg.json @@ -0,0 +1,20 @@ +{ + "request": { + "method": "POST", + "urlPath": "/api/portal/v1.4/proxies/grantaccess", + "formParameters": { + "action": { + "equalTo": "orgs" + }, + "apiId": { + "equalTo": "e4ded8c8-0a40-4b50-bc13-552fb7209150" + }, + "grantOrgId": { + "equalTo": "987b2afc-b027-41fd-a920-bef182eb4a94" + } + } + }, + "response": { + "status": 204 + } +} diff --git a/modules/apim-cli-tests/src/main/resources/wiremock_apim/mappings/grantApplicationToAccessApi.json b/modules/apim-cli-tests/src/main/resources/wiremock_apim/mappings/grantApplicationToAccessApi.json index eea270f12..6e7924aa1 100644 --- a/modules/apim-cli-tests/src/main/resources/wiremock_apim/mappings/grantApplicationToAccessApi.json +++ b/modules/apim-cli-tests/src/main/resources/wiremock_apim/mappings/grantApplicationToAccessApi.json @@ -1,7 +1,7 @@ { "request": { "method": "POST", - "url": "/api/portal/v1.4/applications/3be01ec6-7254-4ce3-a3f1-87636d59c614/apis" + "urlPath": "/api/portal/v1.4/applications/3be01ec6-7254-4ce3-a3f1-87636d59c614/apis" }, "response": { "status": 201,