diff options
author | Yulian Han <elaine.hanyulian@huawei.com> | 2020-01-02 00:31:28 +0800 |
---|---|---|
committer | Yulian Han <elaine.hanyulian@huawei.com> | 2020-01-02 00:31:28 +0800 |
commit | cd30f0cb0f6fe465d13a97e55359bd6bea158f08 (patch) | |
tree | 64ee6035397fceb3cb7b14138137d2cfd69e011e /mso-api-handlers/mso-api-handler-infra/src/test | |
parent | 6416fa05f3a54c0a95e9ab41927b74cb8e0e68f8 (diff) |
SO API to support custom PNF workflow
Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa5f064418
Issue-ID: SO-2071
Signed-off-by: Yulian Han <elaine.hanyulian@huawei.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test')
4 files changed, 54 insertions, 0 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java index 276f891eb2..8876f4ef21 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java @@ -172,4 +172,32 @@ public class InstanceManagementTest extends BaseTest { ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); } + + @Test + public void executePNFCustomWorkflow() throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/testingPNFWorkflow")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching( + ".*/workflow/search/findByArtifactUUID[?]artifactUUID=81526781-e55c-4cb7-adb3-97e09d9c76bf")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("workflow_pnf_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("v1", "32807a28-1a14-4b88-b7b3-2950918aa76d")); + expectedResponse.setRequestReferences(requestReferences); + uri = instanceManagementUri + "v1" + + "/serviceInstances/5df8b6de-2083-11e7-93ae-92361f002676/pnfs/testpnfcId/workflows/81526781-e55c-4cb7-adb3-97e09d9c76bf"; + ResponseEntity<String> response = + sendRequest(inputStream("/ExecutePNFCustomWorkflow.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")); + } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json new file mode 100644 index 0000000000..63021b611f --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json @@ -0,0 +1,20 @@ +{ + "requestDetails": { + "requestParameters": { + "userParams": [{ + "nrmObj": { + "EUtranGenericCell" : [ + {"cellLocalId":1, "pci":5}, + {"cellLocalId":2, "pci":6} + ], + "ExternalEUtranCell" : [ + {"cellLocalId":3, "eNBId": "x"}, + {"cellLocalId":4, "eNBId": "y"} + ], + "EUtranRelation": [{"scellLocalId":5, "tcellLocalId":6}] + } + }], + "payload": "[{\"GNBDUFunction\":{\"gNBId\":1,\"gNBDUId\":5}}]" + } + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/workflow_pnf_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/workflow_pnf_Response.json new file mode 100644 index 0000000000..133d8bed9b --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/workflow_pnf_Response.json @@ -0,0 +1,5 @@ +{ + "artifactUUID": "81526781-e55c-4cb7-adb3-97e09d9c76bf", + "artifactName": "testingPNFWorkflow.bpmn", + "name": "testingPNFWorkflow" +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql index 55db69b9d2..050780c9a2 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql @@ -1262,6 +1262,7 @@ CREATE TABLE `infra_active_requests` ( `END_TIME` datetime DEFAULT NULL, `SOURCE` varchar(45) DEFAULT NULL, `VNF_ID` varchar(45) DEFAULT NULL, + `PNF_ID` varchar(45) DEFAULT NULL, `VNF_NAME` varchar(80) DEFAULT NULL, `VNF_TYPE` varchar(200) DEFAULT NULL, `SERVICE_TYPE` varchar(45) DEFAULT NULL, |