diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test/java/org/onap')
2 files changed, 47 insertions, 0 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java index 9195df0955..6f091304ef 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java @@ -61,6 +61,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.ModelInfoVfModule; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResource; @@ -74,6 +75,8 @@ import org.onap.so.db.catalog.beans.InstanceGroup; 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.PnfResource; +import org.onap.so.db.catalog.beans.PnfResourceCustomization; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.beans.VnfcCustomization; @@ -508,6 +511,26 @@ public class BBInputSetupMapperLayerTest { } @Test + public void testMapCatalogPnfToPnf() throws IOException { + PnfResourceCustomization pnfResourceCustomization = mapper.readValue( + new File(RESOURCE_PATH + "PnfResourceCustomizationInput.json"), PnfResourceCustomization.class); + + PnfResource pnfResource = new PnfResource(); + pnfResource.setModelUUID("modelUuid"); + pnfResource.setModelInvariantUUID("modelInvariantUuid"); + pnfResource.setModelVersion("modelVersion"); + + pnfResourceCustomization.setPnfResources(pnfResource); + + ModelInfoPnf expectedModelInfoPnf = + mapper.readValue(new File(RESOURCE_PATH + "ModelInfoPnfExpected.json"), ModelInfoPnf.class); + + ModelInfoPnf actualModelInfoPnf = bbInputSetupMapperLayer.mapCatalogPnfToPnf(pnfResourceCustomization); + + assertThat(actualModelInfoPnf, sameBeanAs(expectedModelInfoPnf)); + } + + @Test public void testMapCatalogVfModuleToVfModule() throws JsonParseException, JsonMappingException, IOException { VfModuleCustomization vfResourceCustomization = mapper .readValue(new File(RESOURCE_PATH + "VfModuleCustomizationInput.json"), VfModuleCustomization.class); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index 803d2bf8a3..bc751c3b3c 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -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; @@ -1735,6 +1737,28 @@ public class BBInputSetupTest { } @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(); modelInfoCollection.setCollectionFunction("collectionFunction"); |