use of org.onap.so.asdc.client.test.emulators.NotificationDataImpl in project so by onap.
the class ASDCRestInterfaceTest method test_E2ESlicing_Distribution.
@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());
}
use of org.onap.so.asdc.client.test.emulators.NotificationDataImpl in project so by onap.
the class ASDCRestInterfaceTest method testServiceUbuntu16Test.
@Test
public void testServiceUbuntu16Test() 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/service-ubuntu16test/";
ObjectMapper mapper = new ObjectMapper();
NotificationDataImpl request = mapper.readValue(new File(resourceLocation + "service-ubuntu16test-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("ed0391da-b963-4c45-bf3a-b49cc7a94fab");
assertTrue(service.isPresent());
assertEquals("ubuntu16test", service.get().getModelName());
}
use of org.onap.so.asdc.client.test.emulators.NotificationDataImpl in project so by onap.
the class ASDCRestInterfaceTest method test_PublicNS_Distribution.
@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());
}
Aggregations