From 0f8c365d5585875e7647e5863ea92dc5737e63b7 Mon Sep 17 00:00:00 2001 From: "Smokowski, Steve (ss835w)" Date: Tue, 4 Dec 2018 13:08:35 -0500 Subject: Fix Bux Fix Bug with mapping of VNFC Instance Groups Change-Id: Idb35d33f47f9e4854d68590d665553f8385123ab Issue-ID: SO-1267 Signed-off-by: Smokowski, Steve (ss835w) --- .../servicedecomposition/tasks/BBInputSetup.java | 5 +++-- .../tasks/BBInputSetupTest.java | 26 ++++++++++++++++++++++ 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; @@ -1202,6 +1203,31 @@ public class BBInputSetupTest { verify(SPY_bbInputSetup, times(2)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); } + @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 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 { -- cgit 1.2.3-korg