aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-12-10 13:55:13 +0000
committerGerrit Code Review <gerrit@onap.org>2018-12-10 13:55:13 +0000
commit89b5235a109db02fd2d55697e40e306a02f11b59 (patch)
treee3a4c1832b5ec6e5ad5047c3e65da78894ca6a6b
parent5028195e9c987765979c46d304c242b1a3b2ca06 (diff)
parent5906438d1cff0126e4289b57827adba6e8e76729 (diff)
Merge "fix volume group model info retrieval"
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java14
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java16
2 files changed, 21 insertions, 9 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index c0f1c48b76..b1e5d0d208 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -115,7 +115,7 @@ public class BBInputSetup implements JavaDelegate {
private BBInputSetupMapperLayer mapperLayer;
@Autowired
- private CloudInfoFromAAI bbInputSetupHelper;
+ private CloudInfoFromAAI cloudInfoFromAAI;
@Autowired
private ExceptionBuilder exceptionUtil;
@@ -125,6 +125,10 @@ public class BBInputSetup implements JavaDelegate {
public BBInputSetupUtils getBbInputSetupUtils() {
return bbInputSetupUtils;
}
+
+ public void setCloudInfoFromAAI(CloudInfoFromAAI cloudInfoFromAAI) {
+ this.cloudInfoFromAAI = cloudInfoFromAAI;
+ }
public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) {
this.bbInputSetupUtils = bbInputSetupUtils;
@@ -987,7 +991,7 @@ public class BBInputSetup implements JavaDelegate {
ServiceInstance serviceInstance = gBB.getServiceInstance();
CloudRegion cloudRegion = null;
if(cloudConfiguration == null) {
- Optional<CloudRegion> cloudRegionOp = bbInputSetupHelper.getCloudInfoFromAAI(serviceInstance);
+ Optional<CloudRegion> cloudRegionOp = cloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance);
if(cloudRegionOp.isPresent()) {
cloudRegion = cloudRegionOp.get();
}
@@ -1040,9 +1044,9 @@ public class BBInputSetup implements JavaDelegate {
vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
this.mapCatalogVnf(vnf, vnfModelInfo, service);
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnf.getVnfId());
- if (cloudConfiguration != null) {
- String volumeGroupCustomizationUUID = this.bbInputSetupUtils.getAAIVolumeGroup(cloudConfiguration.getCloudOwner(),
- cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId())
+ if (cloudRegion != null) {
+ String volumeGroupCustomizationUUID = this.bbInputSetupUtils.getAAIVolumeGroup(cloudRegion.getCloudOwner(),
+ cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId())
.getModelCustomizationId();
ModelInfo volumeGroupModelInfo = new ModelInfo();
volumeGroupModelInfo.setModelCustomizationId(volumeGroupCustomizationUUID);
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),