summaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/test/java
diff options
context:
space:
mode:
authorSmokowski, Steve (ss835w) <ss835w@us.att.com>2019-04-11 12:09:04 -0400
committerSmokowski, Steve (ss835w) <ss835w@us.att.com>2019-04-11 12:11:04 -0400
commit8b56e8d08070785152ba7c97e9a1878fa3652722 (patch)
tree0f5e016a62a9d81b9d38bb90dfd3475b355e8067 /asdc-controller/src/test/java
parent2aa56678b48362d87ae1eadfb9ab20737f83c3c6 (diff)
Fix vFW Distrobution
Missing check to not reprocess service Issue-ID: SO-1674 Change-Id: I152c61fb726eb8979eb30c8dcb5f4eed05fc4b8b Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
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);