diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test')
2 files changed, 61 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..8ee3979386 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 @@ -1922,6 +1934,7 @@ public class BBInputSetupTest { String serviceInstanceId = "serviceInstanceId"; String networkId = "networkId"; String vnfId = "vnfId"; + String pnfId = "pnfId"; String vfModuleId = "vfModuleId"; String volumeGroupId = "volumeGroupId"; String configurationId = "configurationId"; @@ -1930,6 +1943,7 @@ public class BBInputSetupTest { expected.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId); expected.put(ResourceKey.NETWORK_ID, networkId); expected.put(ResourceKey.GENERIC_VNF_ID, vnfId); + expected.put(ResourceKey.PNF, pnfId); expected.put(ResourceKey.VF_MODULE_ID, vfModuleId); expected.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupId); expected.put(ResourceKey.CONFIGURATION_ID, configurationId); @@ -1939,6 +1953,7 @@ public class BBInputSetupTest { workflowResourceIds.setServiceInstanceId(serviceInstanceId); workflowResourceIds.setNetworkId(networkId); workflowResourceIds.setVnfId(vnfId); + workflowResourceIds.setPnfId(pnfId); workflowResourceIds.setVfModuleId(vfModuleId); workflowResourceIds.setVolumeGroupId(volumeGroupId); workflowResourceIds.setConfigurationId(configurationId); 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 { |