aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/test/java/org/onap
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2019-09-05 04:11:11 +0000
committerGerrit Code Review <gerrit@onap.org>2019-09-05 04:11:11 +0000
commitedaf71b6d2988253d2f0b43273268c14c14d788d (patch)
tree70149aaebcb74d8942dd96768748a495958c7ea2 /asdc-controller/src/test/java/org/onap
parent4c81727a226d80c4ac07df61302dca3540f507d0 (diff)
parent073d731620daa5dd08e41fcabfe7f5a463485e22 (diff)
Merge "fix public NS distribution issue"
Diffstat (limited to 'asdc-controller/src/test/java/org/onap')
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java24
1 files changed, 24 insertions, 0 deletions
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<NotificationDataImpl> entity = new HttpEntity<NotificationDataImpl>(request, headers);
+ ResponseEntity<String> response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"),
+ HttpMethod.POST, entity, String.class);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+
+ Optional<Service> 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;
}