diff options
author | Smokowski, Steve (ss835w) <ss835w@us.att.com> | 2018-12-04 13:08:35 -0500 |
---|---|---|
committer | Smokowski, Steve (ss835w) <ss835w@us.att.com> | 2018-12-04 13:11:52 -0500 |
commit | 0f8c365d5585875e7647e5863ea92dc5737e63b7 (patch) | |
tree | f96f956cbf49dd4f9a572fc22962b4bda1803827 | |
parent | 9a3841eadc588c3b3f50f2351b741edd139ca13c (diff) |
Fix Bux
Fix Bug with mapping of VNFC Instance Groups
Change-Id: Idb35d33f47f9e4854d68590d665553f8385123ab
Issue-ID: SO-1267
Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
2 files changed, 29 insertions, 2 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index 5296d5995f..7edf39df14 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -609,8 +609,9 @@ public class BBInputSetup implements JavaDelegate { .getVnfcInstanceGroupCustomizations(); for (VnfcInstanceGroupCustomization vnfcInstanceGroupCust : vnfcInstanceGroups) { InstanceGroup instanceGroup = this.createInstanceGroup(); - instanceGroup.setModelInfoInstanceGroup(this.mapperLayer - .mapCatalogInstanceGroupToInstanceGroup(null, vnfcInstanceGroupCust.getInstanceGroup())); + org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = bbInputSetupUtils.getCatalogInstanceGroup(vnfcInstanceGroupCust.getModelUUID()); + instanceGroup.setModelInfoInstanceGroup(this.mapperLayer + .mapCatalogInstanceGroupToInstanceGroup(null, catalogInstanceGroup)); instanceGroup.getModelInfoInstanceGroup().setFunction(vnfcInstanceGroupCust.getFunction()); instanceGroup.setDescription(vnfcInstanceGroupCust.getDescription()); genericVnf.getInstanceGroups().add(instanceGroup); 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 e32362d1b0..b36d6d43f8 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 @@ -99,6 +99,7 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; @@ -1203,6 +1204,31 @@ public class BBInputSetupTest { } @Test + public void testMapVnfcCollectionInstanceGroup() { + VnfResourceCustomization vnfResourceCust = Mockito.mock(VnfResourceCustomization.class); + GenericVnf genericVnf = new GenericVnf(); + ModelInfo modelInfo = Mockito.mock(ModelInfo.class); + Service service = Mockito.mock(Service.class); + List<VnfcInstanceGroupCustomization> vnfcInstanceGroups = new ArrayList<>(); + VnfcInstanceGroupCustomization vnfcInstanceGroupCust = new VnfcInstanceGroupCustomization(); + vnfcInstanceGroupCust.setModelUUID("modelUUID"); + vnfcInstanceGroupCust.setFunction("function"); + vnfcInstanceGroupCust.setDescription("description"); + vnfcInstanceGroups.add(vnfcInstanceGroupCust); + org.onap.so.db.catalog.beans.InstanceGroup instanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup(); + instanceGroup.setModelUUID("modelUUID"); + ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup(); + modelInfoInstanceGroup.setModelUUID("modelUUID"); + doReturn(vnfResourceCust).when(SPY_bbInputSetup).getVnfResourceCustomizationFromService(modelInfo, service); + doReturn(vnfcInstanceGroups).when(vnfResourceCust).getVnfcInstanceGroupCustomizations(); + doReturn(instanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup("modelUUID"); + doReturn(modelInfoInstanceGroup).when(bbInputSetupMapperLayer).mapCatalogInstanceGroupToInstanceGroup(null, instanceGroup); + + SPY_bbInputSetup.mapVnfcCollectionInstanceGroup(genericVnf, modelInfo, service); + + assertEquals("Instance Group was created", true, genericVnf.getInstanceGroups().size() == 1); + } + @Test public void testPopulateGenericVnfWhereVnfTypeIsNull() throws JsonParseException, JsonMappingException, IOException { org.onap.so.serviceinstancebeans.Platform platform = new org.onap.so.serviceinstancebeans.Platform(); |