From fa660d2d8a9b2b6f3190bf5c3c26dcf4fa15c146 Mon Sep 17 00:00:00 2001 From: "raviteja.karumuri" Date: Tue, 31 Jan 2023 11:13:01 +0000 Subject: [SO] Pending Create changes for SO-API and BPMN-INFRA to support CNF's through ASD Issue-ID: SO-4069 Signed-off-by: raviteja.karumuri Change-Id: I91e6d2dfc3ce84f7fe496b9b87c2a4ac6f521673 --- .../so/apihandlerinfra/ServiceInstancesTest.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap') 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 b358f26cb2..cb48d007b5 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 @@ -1131,6 +1131,34 @@ public class ServiceInstancesTest extends BaseTest { assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); } + @Test + public void createCnfInstanceNoALaCarte() throws IOException { + + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching(".*/service/5df8b6de-2083-11e7-93ae-92361f002672")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("serviceCnf_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + // expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7", "32807a28-1a14-4b88-b7b3-2950918aa76d")); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/cnfs"; + ResponseEntity response = + sendRequest(inputStream("/CnfWithServiceRelatedInstance.json"), uri, HttpMethod.POST, headers); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + assertTrue(response.getBody().contains("1882939")); + } + @Test public void createVfModuleInstance() throws IOException { wireMockServer.stubFor(get(urlMatching( -- cgit 1.2.3-korg