summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGamboa, Gilbert <gilbert.g.gamboa@att.com>2019-06-26 10:53:51 -0400
committerMax Benjamin <max.benjamin@att.com>2019-06-27 15:10:48 +0000
commitd178938c12d54bc17c3c674b29d4c464f059de33 (patch)
tree6acedeec5f9b75834c07d72d5aca871709657d7a
parent5c58eeca5ffd8b080b9af7619a903eb0acff3a0d (diff)
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) <mb388a@us.att.com>
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java36
4 files changed, 27 insertions, 23 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
index 9e10058ec8..e9d8a5dee9 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
@@ -516,6 +516,11 @@ public class BuildingBlockTestDataSetup {
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/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, String>(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.");