diff options
author | Plummer, Brittany <brittany.plummer@att.com> | 2020-04-27 14:40:36 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-04-27 21:53:38 -0400 |
commit | 593187e78b52cada60430d4006900a3b50da170c (patch) | |
tree | d15e63f4e77f843b5bbafde6a9e325a55ac256f3 /mso-api-handlers/mso-api-handler-infra/src/test | |
parent | 0151f5c120f7d325a337efd522f7b46b0f027a1f (diff) |
refactor camunda client in apih
Switched CamundaClient to use restTemplate
Combined clients into one CamundaClient
Initial setup of exception handling in camundaclient
Initial fix of compilation issues
Switched CamundaClient constructor
Updated how url is set in CamundaClient
Updated auth to fix tag mismatch warning
Added throwing ClientConnectionException to client
Updated ServiceInstancesTest cases
Updated error handling for CamundaClient
Updated how response is returned
Fixed failing unit tests in apih infra
Refactored response handler for responseentity
Fixed failing unit tests in apih
Removed old unit tests for client
Import cleanup for unneeded changes
Updated to use new CamundaClient
Updated CamundaClient and ResponseHandler tests
Removed unused RequestHandler
Issue-ID: SO-2834
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I82ff489c9c939a7e8ec0e48476daf7e45baa5f20
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test')
4 files changed, 12 insertions, 12 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java index 979aa8fbb1..86e847234b 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java @@ -103,7 +103,7 @@ public class E2EServiceInstancesTest extends BaseTest { String uri = e2eServInstancesUri + "v3"; ResponseEntity<String> response = sendRequest(inputStream("/Request.json"), uri, HttpMethod.POST); - assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); } @Test @@ -143,7 +143,7 @@ public class E2EServiceInstancesTest extends BaseTest { String uri = e2eServInstancesUri + "v5/9b9f02c0-298b-458a-bc9c-be3692e4f35e"; ResponseEntity<String> response = sendRequest(inputStream("/DeleteRequest.json"), uri, HttpMethod.DELETE); - assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); } @Test @@ -183,14 +183,14 @@ public class E2EServiceInstancesTest extends BaseTest { String uri = e2eServInstancesUri + "v5/9b9f02c0-298b-458a-bc9c-be3692e4f35e/scale"; ResponseEntity<String> response = sendRequest(inputStream("/ScaleRequest.json"), uri, HttpMethod.POST); - assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); } @Test public void updateE2EServiceInstance() throws IOException { String uri = e2eServInstancesUri + "v3/9b9f02c0-298b-458a-bc9c-be3692e4f35e"; ResponseEntity<String> response = sendRequest(inputStream("/Request.json"), uri, HttpMethod.PUT); - assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); } @Test @@ -240,8 +240,8 @@ public class E2EServiceInstancesTest extends BaseTest { RequestError expectedResponse = new RequestError(); ServiceException exception = new ServiceException(); exception.setMessageId("SVC1000"); - exception.setText( - "Failed calling bpmn localhost:" + env.getProperty("wiremock.server.port") + " failed to respond"); + exception.setText("Failed calling bpmn Client from http://localhost:" + env.getProperty("wiremock.server.port") + + "/mso/async/services/CompareModelofE2EServiceInstance failed to connect or respond"); expectedResponse.setServiceException(exception); String uri = e2eServInstancesUri + "v5/9b9f02c0-298b-458a-bc9c-be3692e4f35e/modeldifferences"; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java index fcf25b23e9..f4ff19f53d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java @@ -182,7 +182,8 @@ public class ManualTasksTest extends BaseTest { RequestError expectedResponse = new RequestError(); ServiceException se = new ServiceException(); se.setMessageId("SVC1000"); - se.setText("Request Failed due to BPEL error with HTTP Status = 502"); + se.setText("Client from http://localhost:" + env.getProperty("wiremock.server.port") + + "/sobpmnengine/task/55/complete failed to connect or respond"); expectedResponse.setServiceException(se); HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java index 1332ffd913..143c92861a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java @@ -2214,7 +2214,6 @@ public class ServiceInstancesTest extends BaseTest { wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) - .withBodyFile("Camunda/UnauthorizedResponse.json") .withStatus(org.apache.http.HttpStatus.SC_UNAUTHORIZED))); wireMockServer.stubFor(get(urlMatching(".*/service/.*")) @@ -2231,7 +2230,7 @@ public class ServiceInstancesTest extends BaseTest { assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); - assertEquals("Exception caught mapping Camunda JSON response to object", + assertEquals("Request Failed due to BPEL error with HTTP Status = 401 UNAUTHORIZED", realResponse.getServiceException().getText()); } @@ -2430,7 +2429,7 @@ public class ServiceInstancesTest extends BaseTest { ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers); - assertEquals(Response.Status.NOT_ACCEPTABLE.getStatusCode(), response.getStatusCode().value()); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); assertEquals("Exception caught mapping Camunda JSON response to object", realResponse.getServiceException().getText()); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml index 1d6722278c..1429ac9b52 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml @@ -55,8 +55,8 @@ mso: versions: apiMinorVersion: 0 apiPatchVersion: 0 - camundaURL: http://localhost:${wiremock.server.port}/ - camundaAuth: E8E19DD16CC90D2E458E8FF9A884CC0452F8F3EB8E321F96038DE38D5C1B0B02DFAE00B88E2CF6E2A4101AB2C011FC161212EE + camundaURL: http://localhost:${wiremock.server.port} + camundaAuth: 015E7ACF706C6BBF85F2079378BDD2896E226E09D13DC2784BA309E27D59AB9FAD3A5E039DF0BB8408 async: core-pool-size: 50 max-pool-size: 50 |