aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy5
2 files changed, 9 insertions, 4 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
index 93379c72be..ee634c891a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
@@ -24,6 +24,7 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.GenericVnf
import org.onap.aai.domain.yang.VolumeGroup
+import org.onap.aai.domain.yang.VolumeGroups
import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
@@ -216,10 +217,11 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
try {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName)
- Optional<VolumeGroup> volumeGroup = getAAIClient().get(VolumeGroup.class,uri)
- if(volumeGroup.isPresent()){
+ Optional<VolumeGroups> volumeGroups = getAAIClient().get(VolumeGroups.class,uri)
+ if(volumeGroups.isPresent()){
+ VolumeGroup volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
execution.setVariable(prefix+'AaiReturnCode', 200)
- execution.setVariable("queriedVolumeGroupId",volumeGroup.get().getVolumeGroupId())
+ execution.setVariable("queriedVolumeGroupId",volumeGroup.getVolumeGroupId())
msoLogger.debug("Volume Group Name $volumeGroupName exists in AAI.")
}else{
execution.setVariable(prefix+'AaiReturnCode', 404)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy
index 26d3ab8d9d..2832377cdd 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy
@@ -35,6 +35,7 @@ import org.mockito.runners.MockitoJUnitRunner
import org.onap.aai.domain.yang.GenericVnf
import org.onap.aai.domain.yang.Volume
import org.onap.aai.domain.yang.VolumeGroup
+import org.onap.aai.domain.yang.VolumeGroups
import org.onap.so.bpmn.common.scripts.MsoGroovyTest
import org.onap.so.bpmn.core.RollbackData
import org.onap.so.client.aai.AAIObjectPlurals
@@ -160,9 +161,11 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest {
when(mockExecution.getVariable(volumeGroupName)).thenReturn(volumeGroupName)
when(mockExecution.getVariable(lcpCloudRegionId)).thenReturn(lcpCloudRegionId)
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).queryParam("volume-group-name", volumeGroupName)
+ VolumeGroups volumeGroups = new VolumeGroups();
VolumeGroup volumeGroup = new VolumeGroup()
volumeGroup.setVolumeGroupId("volumeGroupId")
- when(client.get(VolumeGroup.class,uri)).thenReturn(Optional.of(volumeGroup))
+ volumeGroups.getVolumeGroup().add(volumeGroup);
+ when(client.get(VolumeGroups.class,uri)).thenReturn(Optional.of(volumeGroups))
doCreateVfModuleVolumeV2.callRESTQueryAAIVolGrpName(mockExecution,null)
verify(mockExecution).setVariable("DCVFMODVOLV2_AaiReturnCode",200)
}