aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/test/java/org
diff options
context:
space:
mode:
authorzm330 <zhangminyj@chinamobile.com>2020-04-07 18:03:42 +0800
committerzm330 <zhangminyj@chinamobile.com>2020-04-07 18:03:52 +0800
commit167c472d93e9d6bbe8ddcb7990e1944800b27c44 (patch)
treebc07ca1b576bb7d995ea39fbfdf72412169e4e04 /asdc-controller/src/test/java/org
parent09bfbad28efde55b8ac83d35ac992be18d42607e (diff)
Add notification test for e2eSlicing
Issue-ID: SO-2758 Signed-off-by: zm330 <zhangminyj@chinamobile.com> Change-Id: Ib1ce0f4fd210f083a2293d1d1362447a9fdf1804
Diffstat (limited to 'asdc-controller/src/test/java/org')
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java37
1 files changed, 37 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 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
@@ -343,6 +343,43 @@ public class ASDCRestInterfaceTest extends BaseTest {
}
@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<NotificationDataImpl> entity;
+ ResponseEntity<String> response;
+ headers.add("resource-location", resourceLocation);
+
+ request = mapper.readValue(new File(resourceLocation + "nsst-notification.json"), NotificationDataImpl.class);
+ entity = new HttpEntity<NotificationDataImpl>(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<NotificationDataImpl>(request, headers);
+ 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("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/.*"))
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")));