aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test')
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java12
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java46
2 files changed, 58 insertions, 0 deletions
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 ffbf673cdb..483b626f95 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
@@ -888,6 +888,18 @@ public class BBInputSetupTest {
lookupKeyMap, resourceId, relatedInstanceList, instanceName, null, cloudConfiguration, false);
assertEquals("VfModuleId populated", true,
lookupKeyMap.get(ResourceKey.VF_MODULE_ID).equalsIgnoreCase(resourceId));
+
+ String bbNameAssignVolume = AssignFlows.VOLUME_GROUP.toString();
+ doReturn(ModelType.vfModule).when(modelInfo).getModelType();
+ resourceId = "vfModuleId";
+ doNothing().when(SPY_bbInputSetup).populateVolumeGroup(REQUEST_ID, modelInfo, service, bbNameAssignVolume,
+ serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
+ SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(REQUEST_ID, requestDetails, service, bbNameAssignVolume,
+ serviceInstance, lookupKeyMap, resourceId, vnfType, null, null, false);
+ verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(REQUEST_ID, modelInfo, service, bbNameAssignVolume,
+ serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
+ assertEquals("VolumeGroupId populated", true,
+ lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID).equalsIgnoreCase(resourceId));
}
@Test
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
index 2b78690e27..3fdbf39756 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
@@ -815,6 +815,51 @@ public class BBInputSetupUtilsTest {
}
@Test
+ public void getRelatedVolumeGroupFromVfModuleMultipleVolumeGroupsExceptionTest() throws Exception {
+ expectedException.expect(Exception.class);
+
+ String vnfId = "vnfId";
+ String volumeGroupId = "volumeGroupId";
+
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("id123");
+ volumeGroup.setVolumeGroupName("name123");
+
+ VolumeGroups expectedVolumeGroup = new VolumeGroups();
+ expectedVolumeGroup.getVolumeGroup().add(volumeGroup);
+ expectedVolumeGroup.getVolumeGroup().add(volumeGroup);
+
+ doReturn(expectedVolumeGroup).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class),
+ any(AAIResourceUri.class));
+
+ bbInputSetupUtils.getRelatedVolumeGroupFromVfModule(vnfId, volumeGroupId);
+ }
+
+ @Test
+ public void getRelatedVolumeGroupFromVfModuleNotFoundTest() throws Exception {
+ String vnfId = "vnfId";
+ String volumeGroupId = "volumeGroupId";
+
+ doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class));
+
+ Optional<VolumeGroup> actualVolumeGroup =
+ bbInputSetupUtils.getRelatedVolumeGroupFromVfModule(vnfId, volumeGroupId);
+
+ assertEquals(actualVolumeGroup, Optional.empty());
+ }
+
+ @Test
+ public void getRelatedVolumeGroupFromVfModuleTest() throws Exception {
+ Optional<VolumeGroups> expected = Optional.of(new VolumeGroups());
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("id123");
+ expected.get().getVolumeGroup().add(volumeGroup);
+ doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class));
+ Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupFromVfModule("id123", "id123");
+ assertEquals(actual.get().getVolumeGroupId(), expected.get().getVolumeGroup().get(0).getVolumeGroupId());
+ }
+
+ @Test
public void getRelatedVolumeGroupByNameFromVfModuleMultipleVolumeGroupsExceptionTest() throws Exception {
expectedException.expect(MultipleObjectsFoundException.class);
expectedException.expectMessage(containsString(
@@ -852,6 +897,7 @@ public class BBInputSetupUtilsTest {
assertEquals(actualVolumeGroup, Optional.empty());
}
+
@Test
public void loadOriginalFlowExecutionPathTest() throws Exception {