From d178938c12d54bc17c3c674b29d4c464f059de33 Mon Sep 17 00:00:00 2001 From: "Gamboa, Gilbert" Date: Wed, 26 Jun 2019 10:53:51 -0400 Subject: Fix macro delete instance bug. Fix macro delete instance bug. vf-modules not being sorted correctly because isbaseboolean field is not being set. Change-Id: Id196e152977d922bee6c9bb797ad240bb70fbf47 Issue-ID: SO-2053 Signed-off-by: Benjamin, Max (mb388a) --- .../workflow/tasks/WorkflowAction.java | 4 ++- .../onap/so/bpmn/common/data/TestDataSetup.java | 5 +++ .../workflow/tasks/WorkflowActionTest.java | 36 +++++++++------------- 3 files changed, 22 insertions(+), 23 deletions(-) (limited to 'bpmn/so-bpmn-tasks/src') diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index fffaee0f7c..0553afb318 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -811,7 +811,9 @@ public class WorkflowAction { for (VfModule vfModule : vnf.getVfModules()) { aaiResourceIds.add( new Pair(WorkflowType.VFMODULE, vfModule.getVfModuleId())); - resourceCounter.add(new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false)); + Resource resource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false); + resource.setBaseVfModule(vfModule.getModelInfoVfModule().getIsBaseBoolean()); + resourceCounter.add(resource); } } if (vnf.getVolumeGroups() != null) { diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java index ff6426d351..825c703b74 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java @@ -542,6 +542,11 @@ public class TestDataSetup { modelInfoVfModule.setModelUUID("testModelUUID" + vfModuleCounter); modelInfoVfModule.setModelName("testModelName" + vfModuleCounter); modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID" + vfModuleCounter); + if (vfModuleCounter == 1) { + modelInfoVfModule.setIsBaseBoolean(Boolean.TRUE); + } else { + modelInfoVfModule.setIsBaseBoolean(Boolean.FALSE); + } vfModule.setModelInfoVfModule(modelInfoVfModule); return vfModule; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index 09ba55aac0..dadae178fc 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -29,6 +29,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.anyObject; import static org.mockito.ArgumentMatchers.anyString; @@ -73,6 +74,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.Relationships; @@ -347,13 +349,10 @@ public class WorkflowActionTest extends BaseTaskTest { new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf(); vnf.setVnfId("vnf0"); - org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = - new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); - vfModule.setVfModuleId("vfModule0"); + + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = buildVfModule(); vnf.getVfModules().add(vfModule); - org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = - new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); - vfModule2.setVfModuleId("vfModule1"); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = buildVfModule(); vnf.getVfModules().add(vfModule2); org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = @@ -374,10 +373,10 @@ public class WorkflowActionTest extends BaseTaskTest { "ActivateServiceInstanceBB"); assertEquals("volumeGroup0", ebbs.get(0).getWorkflowResourceIds().getVolumeGroupId()); assertEquals("volumeGroup0", ebbs.get(1).getWorkflowResourceIds().getVolumeGroupId()); - assertEquals("vfModule0", ebbs.get(2).getWorkflowResourceIds().getVfModuleId()); - assertEquals("vfModule1", ebbs.get(3).getWorkflowResourceIds().getVfModuleId()); - assertEquals("vfModule0", ebbs.get(4).getWorkflowResourceIds().getVfModuleId()); - assertEquals("vfModule1", ebbs.get(5).getWorkflowResourceIds().getVfModuleId()); + assertEquals("testVfModuleId1", ebbs.get(2).getWorkflowResourceIds().getVfModuleId()); + assertEquals("testVfModuleId2", ebbs.get(3).getWorkflowResourceIds().getVfModuleId()); + assertEquals("testVfModuleId1", ebbs.get(4).getWorkflowResourceIds().getVfModuleId()); + assertEquals("testVfModuleId2", ebbs.get(5).getWorkflowResourceIds().getVfModuleId()); assertEquals("vnf0", ebbs.get(6).getWorkflowResourceIds().getVnfId()); assertEquals("si0", ebbs.get(7).getWorkflowResourceIds().getServiceInstanceId()); @@ -682,13 +681,9 @@ public class WorkflowActionTest extends BaseTaskTest { new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf(); vnf.setVnfId("vnfId123"); - org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = - new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); - vfModule.setVfModuleId("vfModule1"); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = buildVfModule(); vnf.getVfModules().add(vfModule); - org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = - new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); - vfModule2.setVfModuleId("vfModule2"); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = buildVfModule(); vnf.getVfModules().add(vfModule2); org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = @@ -737,13 +732,9 @@ public class WorkflowActionTest extends BaseTaskTest { new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf(); vnf.setVnfId("vnfId123"); - org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = - new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); - vfModule.setVfModuleId("vfModule1"); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = buildVfModule(); vnf.getVfModules().add(vfModule); - org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = - new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); - vfModule2.setVfModuleId("vfModule2"); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = buildVfModule(); vnf.getVfModules().add(vfModule2); org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = @@ -1726,6 +1717,7 @@ public class WorkflowActionTest extends BaseTaskTest { .getConfiguration("testConfigurationId2"); workflowAction.traverseAAIService(execution, resourceCounter, resourceId, aaiResourceIds); assertEquals(8, resourceCounter.size()); + assertTrue(resourceCounter.get(2).isBaseVfModule()); assertThat(aaiResourceIds, sameBeanAs(getExpectedResourceIds())); } catch (Exception e) { fail("Unexpected exception was thrown."); -- cgit 1.2.3-korg