From 073d731620daa5dd08e41fcabfe7f5a463485e22 Mon Sep 17 00:00:00 2001 From: sarada prasad sahoo Date: Tue, 3 Sep 2019 15:27:13 +0530 Subject: fix public NS distribution issue Fix Multiple VFModule under single service distribution Issue-ID: SO-2275 Change-Id: I7a4a7dbb68d23c0e44f9985b3fdc89816dbfd232 Signed-off-by: sarada prasad sahoo --- .../client/test/rest/ASDCRestInterfaceTest.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'asdc-controller/src/test/java') 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 2a4b3aa6fb..fc72f9bc6e 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 @@ -319,6 +319,30 @@ public class ASDCRestInterfaceTest extends BaseTest { assertEquals("CCVPNService", service.get().getModelName()); } + @Test + public void test_PublicNS_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/public-ns/"; + ObjectMapper mapper = new ObjectMapper(); + NotificationDataImpl request = mapper.readValue(new File(resourceLocation + "demo-public-ns-notification.json"), + NotificationDataImpl.class); + headers.add("resource-location", resourceLocation); + HttpEntity entity = new HttpEntity(request, headers); + ResponseEntity response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), + HttpMethod.POST, entity, String.class); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + Optional service = serviceRepo.findById("da28696e-d4c9-4df4-9f91-465c6c09a81e"); + assertTrue(service.isPresent()); + assertEquals("PublicNS", service.get().getModelName()); + } + protected String createURLWithPort(String uri) { return "http://localhost:" + port + uri; } -- cgit 1.2.3-korg