Junits for Interface-services 55/56455/6
authorDilip kumar Pampana <dilip.kumar.pampana@ibm.com>
Sun, 15 Jul 2018 05:49:23 +0000 (01:49 -0400)
committerPatrick Brady <pb071s@att.com>
Mon, 16 Jul 2018 18:56:32 +0000 (18:56 +0000)
Junit test for vf-module-id to check for scope overlap

Issue-ID: APPC-1079
Change-Id: I7345e709809f46df3532d8d8608ce5d53d04ed11
Signed-off-by: Dilip kumar Pampana <dilip.kumar.pampana@ibm.com>
appc-inbound/appc-interfaces-service/bundle/src/test/java/org/onap/appc/interfaceService/serviceExecutor/TestServiceExecutor.java

index e5bf0c0..4a88890 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Copyright (C) 2018 IBM
  * =============================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -28,6 +30,10 @@ import static org.junit.Assert.*;
 import org.junit.Test;
 
 import org.onap.appc.interfaces.service.executorImpl.ServiceExecutorImpl;
+import org.onap.appc.interfaces.service.data.ScopeOverlap;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.powermock.reflect.Whitebox;
 
 public class TestServiceExecutor {
 
@@ -37,4 +43,15 @@ public class TestServiceExecutor {
         String requestData = "{\"vnf-id\":\"ibcx8888v\",\"current-request\" :{\"action\" : \"Audit\",\"action-identifiers\" : {\"service-instance-id\" : \"service-instance-id\",\"vnf-id\" : \"vnf-id\",\"vnfc-name\" : \"vnfc-name\",\"vf-module-id\" : \"vf-module-id\",\"vserver-id\": \"vserver-id\"}},\"in-progress-requests\" :[{\"action\" : \"HealthCheck\",\"action-identifiers\" : {\"service-instance-id\" : \"service-instance-id1\",\"vnf-id\" : \"vnf-id1\",\"vnfc-name\" : \"vnfc-name1\",\"vf-module-id\" : \"vf-module-id\",\"vserver-id\": \"vserver-id1\"}},{\"action\" : \"CheckLock\",\"action-identifiers\" : {\"service-instance-id\" : \"service-instance-id2\",\"vnf-id\" : \"vnf-id2\",\"vnfc-name\" : \"vnfc-name2\",\"vf-module-id\" : \"vf-module-id2\",\"vserver-id\": \"vserver-id2\"}}]}";
         sei.isRequestOverLap(requestData);
     }
+
+    @Test
+    public void isVserverOrVnfcIdOverLapTest() throws Exception{
+        String requestData = "{\"vnf-id\":\"ibcx8888v\",\"current-request\" :{\"action\" : \"Audit\",\"action-identifiers\" : {\"vnf-id\" : \"vnf-id\",\"vf-module-id\" : \"vf-module-1234\"}},\"in-progress-requests\" :[{\"action\" : \"HealthCheck\",\"action-identifiers\" : {\"vnf-id\" : \"vnf-id1\",\"vf-module-id\":\"vf-module-1234\"}}]}";
+        ServiceExecutorImpl sei = new ServiceExecutorImpl();
+        ScopeOverlap scopeOverlap = new ScopeOverlap();
+        ObjectMapper mapper = new ObjectMapper();
+        scopeOverlap = mapper.readValue(requestData, ScopeOverlap.class);
+        boolean result = Whitebox.invokeMethod(sei, "isVserverOrVnfcIdOverLap",scopeOverlap);
+        assertEquals(true, result);
+    }
 }