Merge "JUnit tests for MsoMulticloudUtils"
[so.git] / bpmn / so-bpmn-tasks / src / test / java / org / onap / so / client / sdnc / mapper / GCTopologyOperationRequestMapperTest.java
index f01eeae..302bb55 100644 (file)
@@ -24,9 +24,15 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.junit.Assert;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation;
 import org.onap.so.bpmn.common.data.TestDataSetup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -38,11 +44,14 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink;
 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
 import org.onap.so.client.sdnc.beans.SDNCSvcAction;
 
-import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation;
-
-
-public class GCTopologyOperationRequestMapperTest extends TestDataSetup{
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class GCTopologyOperationRequestMapperTest extends TestDataSetup {
 
+       
+       @Spy
+       private GeneralTopologyObjectMapper generalTopologyObjectMapper;
+       
+       @InjectMocks
     private GCTopologyOperationRequestMapper genObjMapper = new GCTopologyOperationRequestMapper();
 
     @Test
@@ -53,6 +62,7 @@ public class GCTopologyOperationRequestMapperTest extends TestDataSetup{
         serviceInstance.setServiceInstanceId("ServiceInstanceId");
         Configuration Configuration = new Configuration();
         Configuration.setConfigurationId("ConfigurationId");
+        Configuration.setConfigurationType("VLAN-NETWORK-RECEPTOR");
         GenericResourceApiGcTopologyOperationInformation genericInfo = genObjMapper.deactivateOrUnassignVnrReqMapper
                 (SDNCSvcAction.UNASSIGN, serviceInstance, requestContext, Configuration,"uuid",new URI("http://localhost"));
 
@@ -61,8 +71,11 @@ public class GCTopologyOperationRequestMapperTest extends TestDataSetup{
         Assert.assertNotNull(genericInfo.getSdncRequestHeader());
         Assert.assertNotNull(genericInfo.getClass());
         Assert.assertNotNull(genericInfo.getServiceInformation());
+        Assert.assertEquals("ConfigurationId", genericInfo.getConfigurationInformation().getConfigurationId());
+        Assert.assertEquals("VLAN-NETWORK-RECEPTOR", genericInfo.getConfigurationInformation().getConfigurationType());
         Assert.assertEquals("uuid",genericInfo.getSdncRequestHeader().getSvcRequestId()); 
         Assert.assertEquals("http://localhost",genericInfo.getSdncRequestHeader().getSvcNotificationUrl());
+        Assert.assertEquals("MsoRequestId",genericInfo.getRequestInformation().getRequestId()); 
     }
 
 
@@ -80,13 +93,13 @@ public class GCTopologyOperationRequestMapperTest extends TestDataSetup{
     private RequestContext getRequestContext() {
         RequestContext requestContext = new RequestContext();
         requestContext.setMsoRequestId("MsoRequestId");
-        HashMap<String, String> userParams = getUserParams();
+        Map<String, Object> userParams = getUserParams();
         requestContext.setUserParams(userParams);
         return requestContext;
     }
 
-    private HashMap<String, String> getUserParams() {
-        HashMap<String,String> userParams = new HashMap<>();
+    private Map<String, Object> getUserParams() {
+        Map<String,Object> userParams = new HashMap<>();
         userParams.put("lppCustomerId","lppCustomerId");
         return userParams;
     }