aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/test/java
diff options
context:
space:
mode:
authorByung-Woo Jun <byung-woo.jun@est.tech>2019-04-11 18:03:42 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-11 18:03:42 +0000
commit70ab72a08c6d0a9976748806546c6ef04bc49f8e (patch)
tree5bd40f6b7e1dfc8edf849edeb7e2b62e02ed3a90 /asdc-controller/src/test/java
parent8e97a15510366a8348e60aeae367f5c75cf82aac (diff)
parent8b56e8d08070785152ba7c97e9a1878fa3652722 (diff)
Merge "Fix vFW Distrobution"
Diffstat (limited to 'asdc-controller/src/test/java')
-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 815f419c40..2e5ad13c21 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
@@ -42,6 +42,7 @@ import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator;
import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
import org.onap.so.db.catalog.beans.AllottedResource;
import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
+import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.data.repository.AllottedResourceRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
@@ -139,6 +140,42 @@ public class ASDCRestInterfaceTest extends BaseTest {
}
@Test
+ @Transactional
+ public void test_VFW_Distrobution() throws Exception {
+
+ wireMockServer.stubFor(post(urlPathMatching("/aai/.*"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")));
+
+ ObjectMapper mapper = new ObjectMapper();
+ NotificationDataImpl request = mapper.readValue(
+ new File("src/test/resources/resource-examples/vFW/notification.json"), NotificationDataImpl.class);
+ headers.add("resource-location", "src/test/resources/resource-examples/vFW/");
+ 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());
+
+ Service expectedService = new Service();
+ expectedService.setDescription("catalog service description");
+ expectedService.setModelInvariantUUID("3164f9ff-d7e7-4813-ab32-6be7e1cacb18");
+ expectedService.setModelName("vFW 2019-04-10 21:53:05");
+ expectedService.setModelUUID("e16e4ed9-3429-423a-bc3c-1389ae91491c");
+ expectedService.setModelVersion("1.0");
+
+
+
+ Service actualService = serviceRepo.findOneByModelUUID("e16e4ed9-3429-423a-bc3c-1389ae91491c");
+
+
+ if (actualService == null)
+ throw new Exception("No Allotted Resource Written to database");
+
+ assertEquals(expectedService.getModelName(), actualService.getModelName());
+ }
+
+ @Test
public void invokeASDCStatusDataNullTest() {
String request = "";
Response response = asdcRestInterface.invokeASDCStatusData(request);