diff options
author | Kalkere Ramesh, Sharan (sk720x) <sk720x@att.com> | 2018-12-07 12:00:08 -0500 |
---|---|---|
committer | Kalkere Ramesh, Sharan (sk720x) <sk720x@att.com> | 2018-12-07 12:00:51 -0500 |
commit | 5906438d1cff0126e4289b57827adba6e8e76729 (patch) | |
tree | 30ca66b6f8775e181179f7871c31a0e1d0a785e6 /bpmn/MSOCommonBPMN/src/test/java | |
parent | 3b56cf0c1763c45b7673a087107c5e1553dd4f40 (diff) |
fix volume group model info retrieval
fixed the broken unit test with updated mocks
fix the if statement where its supposed to take in cloudRegion
Change-Id: I0a1f349ff8d64dfec7ad98b351c8701f9cb828bb
Issue-ID: SO-1297
Signed-off-by: Kalkere Ramesh, Sharan (sk720x) <sk720x@att.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test/java')
-rw-r--r-- | bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java | 16 |
1 files changed, 12 insertions, 4 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 8399fe15a3..1654aa06de 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 @@ -40,6 +40,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.junit.Before; @@ -130,6 +131,9 @@ public class BBInputSetupTest { @Mock private BBInputSetupUtils SPY_bbInputSetupUtils; + @Mock + private CloudInfoFromAAI SPY_cloudInfoFromAAI; + @Spy private BBInputSetupMapperLayer bbInputSetupMapperLayer; @@ -137,6 +141,7 @@ public class BBInputSetupTest { public void setup(){ SPY_bbInputSetup.setBbInputSetupUtils(SPY_bbInputSetupUtils); SPY_bbInputSetup.setMapperLayer(bbInputSetupMapperLayer); + SPY_bbInputSetup.setCloudInfoFromAAI(SPY_cloudInfoFromAAI); } @Test @@ -2270,19 +2275,22 @@ public class BBInputSetupTest { verify(SPY_bbInputSetup, times(1)).mapCatalogVfModule(any(VfModule.class), any(ModelInfo.class), any(Service.class), any(String.class)); - org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setCloudOwner("CloudOwner"); + doReturn(Optional.of(cloudRegion)).when(SPY_cloudInfoFromAAI).getCloudInfoFromAAI(gBB.getServiceInstance()); VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setVolumeGroupId("volumeGroupId"); gBB.getServiceInstance().getVnfs().get(0).getVolumeGroups().add(volumeGroup); org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = new org.onap.aai.domain.yang.VolumeGroup(); aaiVolumeGroup.setModelCustomizationId("modelCustId"); - doReturn(aaiVolumeGroup).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(Defaults.CLOUD_OWNER.toString(), - cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + doReturn(aaiVolumeGroup).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(cloudRegion.getCloudOwner(), + cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); executeBB.getBuildingBlock().setBpmnFlowName("UnassignVolumeGroupBB"); executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, - executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration); + executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, null); verify(SPY_bbInputSetup, times(3)).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class), any(Service.class)); verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(isA(VolumeGroup.class), isA(ModelInfo.class), |