From 167c472d93e9d6bbe8ddcb7990e1944800b27c44 Mon Sep 17 00:00:00 2001 From: zm330 Date: Tue, 7 Apr 2020 18:03:42 +0800 Subject: Add notification test for e2eSlicing Issue-ID: SO-2758 Signed-off-by: zm330 Change-Id: Ib1ce0f4fd210f083a2293d1d1362447a9fdf1804 --- .../client/test/rest/ASDCRestInterfaceTest.java | 37 +++++++++++++++++++++ .../resource-examples/e2eSlicing/eMBB.zip | Bin 0 -> 635 bytes .../e2eSlicing/nsst-notification.json | 32 ++++++++++++++++++ .../e2eSlicing/nst-notification.json | 35 +++++++++++++++++++ .../e2eSlicing/service-Embbcn-csar.csar | Bin 0 -> 46372 bytes .../e2eSlicing/service-Embbnst-csar.csar | Bin 0 -> 47976 bytes 6 files changed, 104 insertions(+) create mode 100644 asdc-controller/src/test/resources/resource-examples/e2eSlicing/eMBB.zip create mode 100644 asdc-controller/src/test/resources/resource-examples/e2eSlicing/nsst-notification.json create mode 100644 asdc-controller/src/test/resources/resource-examples/e2eSlicing/nst-notification.json create mode 100644 asdc-controller/src/test/resources/resource-examples/e2eSlicing/service-Embbcn-csar.csar create mode 100644 asdc-controller/src/test/resources/resource-examples/e2eSlicing/service-Embbnst-csar.csar (limited to 'asdc-controller/src') diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java index 9294677b95..3d6fbb21ef 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java @@ -342,6 +342,43 @@ public class ASDCRestInterfaceTest extends BaseTest { assertEquals("CCVPNService", service.get().getModelName()); } + @Test + public void test_E2ESlicing_Distribution() throws Exception { + wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) + .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); + + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value()))); + String resourceLocation = "src/test/resources/resource-examples/e2eSlicing/"; + ObjectMapper mapper = new ObjectMapper(); + + NotificationDataImpl request; + HttpEntity entity; + ResponseEntity response; + headers.add("resource-location", resourceLocation); + + request = mapper.readValue(new File(resourceLocation + "nsst-notification.json"), NotificationDataImpl.class); + entity = new HttpEntity(request, headers); + response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), HttpMethod.POST, entity, + String.class); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + request = mapper.readValue(new File(resourceLocation + "nst-notification.json"), NotificationDataImpl.class); + entity = new HttpEntity(request, headers); + response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), HttpMethod.POST, entity, + String.class); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + Optional service = serviceRepo.findById("7981375e-5e0a-4bf5-93fa-f3e3c02f2b11"); + assertTrue(service.isPresent()); + assertEquals("EmbbNst", service.get().getModelName()); + + service = serviceRepo.findById("637e9b93-208b-4b06-80f2-a2021c228174"); + assertTrue(service.isPresent()); + assertEquals("EmbbCn", service.get().getModelName()); + } + @Test public void test_PublicNS_Distribution() throws Exception { wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) diff --git a/asdc-controller/src/test/resources/resource-examples/e2eSlicing/eMBB.zip b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/eMBB.zip new file mode 100644 index 0000000000..ce0b901fdd Binary files /dev/null and b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/eMBB.zip differ diff --git a/asdc-controller/src/test/resources/resource-examples/e2eSlicing/nsst-notification.json b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/nsst-notification.json new file mode 100644 index 0000000000..49b1c10124 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/nsst-notification.json @@ -0,0 +1,32 @@ +{ + "distributionID": "28ffbae6-f44a-408c-9ec1-e329c4a48e77", + "serviceName": "EmbbCn", + "serviceVersion": "1.0", + "serviceUUID": "2763777c-27bd-4df7-93b8-c690e23f4d3f", + "serviceDescription": "EmbbCn", + "serviceInvariantUUID": "0402fb4c-4a0c-4ff2-ad2b-29218ea1d629", + "resources": [], + "serviceArtifacts": [ + { + "artifactName": "eMBB.zip", + "artifactType": "OTHER", + "artifactURL": "/eMBB.zip", + "artifactChecksum": "ZWRkMGM3NzNjMmE3NzliYTFiZGNmZjVlMDE4OWEzMTA\u003d", + "artifactDescription": "EmbbCn", + "artifactTimeout": 0, + "artifactVersion": "1", + "artifactUUID": "3f669cc1-dbe7-48ea-b606-42f497b2ac46" + }, + { + "artifactName": "service-Embbcn-csar.csar", + "artifactType": "TOSCA_CSAR", + "artifactURL": "/service-Embbcn-csar.csar", + "artifactChecksum": "NTk5MDZhNzJkOWIwZDQ0YTNlNWM0Y2MyODI5Mzk0ZWU\u003d", + "artifactDescription": "TOSCA definition package of the asset", + "artifactTimeout": 0, + "artifactVersion": "1", + "artifactUUID": "dc0f2a41-4f71-452f-91c7-0444e4d8c33b" + } + ], + "workloadContext": "Production" +} \ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/e2eSlicing/nst-notification.json b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/nst-notification.json new file mode 100644 index 0000000000..8471a28b70 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/nst-notification.json @@ -0,0 +1,35 @@ +{ + "distributionID": "ece2fb37-6e4e-4989-b54e-9b0e00afb7cc", + "serviceName": "EmbbNst", + "serviceVersion": "1.0", + "serviceUUID": "e3958a85-65e0-4a77-8981-a51755aa9d39", + "serviceDescription": "Embb Nst Template", + "serviceInvariantUUID": "1899e5c1-df4e-43a8-a889-48c157dad7bc", + "resources": [ + { + "resourceInstanceName": "embbcn_proxy 0", + "resourceCustomizationUUID": "dd6f6ce9-1a23-4303-9466-22abf2a889dc", + "resourceName": "serviceProxy", + "resourceVersion": "1.0", + "resoucreType": "Service Proxy", + "resourceUUID": "4e8212a4-2a7a-4e76-9e0f-54411bc1c17d", + "resourceInvariantUUID": "b1fc926c-8cc3-4bda-8e50-27ba3536c47f", + "category": "Generic", + "subcategory": "Abstract", + "artifacts": [] + } + ], + "serviceArtifacts": [ + { + "artifactName": "service-Embbnst-csar.csar", + "artifactType": "TOSCA_CSAR", + "artifactURL": "/service-Embbnst-csar.csar", + "artifactChecksum": "YmEzMGFlOGY1MDBhMTg4MmFlYjkwODU1YjYzOTA5NDU\u003d", + "artifactDescription": "TOSCA definition package of the asset", + "artifactTimeout": 0, + "artifactVersion": "1", + "artifactUUID": "2a690bd3-4529-4437-9e9f-805eaaa25b4a" + } + ], + "workloadContext": "Production" +} \ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/e2eSlicing/service-Embbcn-csar.csar b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/service-Embbcn-csar.csar new file mode 100644 index 0000000000..775f35046a Binary files /dev/null and b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/service-Embbcn-csar.csar differ diff --git a/asdc-controller/src/test/resources/resource-examples/e2eSlicing/service-Embbnst-csar.csar b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/service-Embbnst-csar.csar new file mode 100644 index 0000000000..e6e42e489f Binary files /dev/null and b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/service-Embbnst-csar.csar differ -- cgit 1.2.3-korg