Update nf_type for PNF in AAI
[so.git] / bpmn / MSOCommonBPMN / src / test / java / org / onap / so / bpmn / servicedecomposition / tasks / BBInputSetupTest.java
index d405cff..bc751c3 100644 (file)
@@ -97,6 +97,7 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf;
 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy;
 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
 import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException;
@@ -113,6 +114,7 @@ import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
 import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
 import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
 import org.onap.so.db.catalog.beans.VfModuleCustomization;
 import org.onap.so.db.catalog.beans.VnfResourceCustomization;
@@ -1734,6 +1736,28 @@ public class BBInputSetupTest {
         assertEquals(modelInfoGenericVnf, genericVnf.getModelInfoGenericVnf());
     }
 
+    @Test
+    public void testMapCatalogPnf() {
+        ModelInfoPnf modelInfoPnf = new ModelInfoPnf();
+        Pnf pnf = new Pnf();
+        RequestDetails requestDetails = new RequestDetails();
+        ModelInfo modelInfo = new ModelInfo();
+        modelInfo.setModelCustomizationUuid("modelCustomizationUUID");
+        requestDetails.setModelInfo(modelInfo);
+        Service service = new Service();
+
+        PnfResourceCustomization resourceCust = new PnfResourceCustomization();
+        resourceCust.setModelCustomizationUUID("pnfModelCustomizationUUID");
+        service.getPnfCustomizations().add(resourceCust);
+        resourceCust.setModelCustomizationUUID("modelCustomizationUUID");
+
+        doReturn(modelInfoPnf).when(bbInputSetupMapperLayer).mapCatalogPnfToPnf(resourceCust);
+
+        SPY_bbInputSetup.mapCatalogPnf(pnf, modelInfo, service);
+
+        assertEquals(modelInfoPnf, pnf.getModelInfoPnf());
+    }
+
     @Test
     public void testMapCatalogCollectionAndInstanceGroup() {
         ModelInfoCollection modelInfoCollection = new ModelInfoCollection();
@@ -2121,6 +2145,9 @@ public class BBInputSetupTest {
         String instanceGroupId = "instancegroupId";
         String vnfInstanceName = "vnfInstanceName";
         String vfModuleInstanceName = "vfModuleInstanceName";
+        String childServiceInstanceId = "childServiceInstanceId";
+        String childServiceInstanceName = "childServiceInstanceName";
+        String pnfInstanceName = "pnfInstanceName";
 
         expected.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId);
         expected.put(ResourceKey.NETWORK_ID, networkId);
@@ -2132,6 +2159,9 @@ public class BBInputSetupTest {
         expected.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroupId);
         expected.put(ResourceKey.VNF_INSTANCE_NAME, vnfInstanceName);
         expected.put(ResourceKey.VF_MODULE_INSTANCE_NAME, vfModuleInstanceName);
+        expected.put(ResourceKey.CHILD_SERVICE_INSTANCE_ID, childServiceInstanceId);
+        expected.put(ResourceKey.CHILD_SERVICE_INSTANCE_NAME, childServiceInstanceName);
+        expected.put(ResourceKey.PNF_INSTANCE_NAME, pnfInstanceName);
 
         WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
         workflowResourceIds.setServiceInstanceId(serviceInstanceId);
@@ -2144,6 +2174,9 @@ public class BBInputSetupTest {
         workflowResourceIds.setInstanceGroupId(instanceGroupId);
         workflowResourceIds.setVnfInstanceName(vnfInstanceName);
         workflowResourceIds.setVfModuleInstanceName(vfModuleInstanceName);
+        workflowResourceIds.setChildServiceInstanceId(childServiceInstanceId);
+        workflowResourceIds.setChildServiceInstanceName(childServiceInstanceName);
+        workflowResourceIds.setPnfInstanceName(pnfInstanceName);
 
         SPY_bbInputSetup.populateLookupKeyMapWithIds(workflowResourceIds, actual);