summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/test/groovy
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test/groovy')
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy30
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy26
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroupTest.groovy16
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy25
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy8
6 files changed, 53 insertions, 56 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy
index f0b1bfe047..7509233ffa 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy
@@ -20,30 +20,26 @@
package org.onap.so.bpmn.common.scripts
-import org.camunda.bpm.engine.delegate.DelegateExecution
+import static org.junit.Assert.assertEquals
+import static org.junit.Assert.assertTrue
+import static org.mockito.ArgumentMatchers.any
+import static org.mockito.Mockito.atLeastOnce
+import static org.mockito.Mockito.mock
+import static org.mockito.Mockito.spy
+import static org.mockito.Mockito.verify
+import static org.mockito.Mockito.when
+import javax.ws.rs.core.UriBuilder
import org.junit.Before
import org.junit.Ignore
import org.junit.Test
-import org.mockito.Mockito
import org.mockito.internal.stubbing.answers.DoesNothing
import org.onap.aai.domain.yang.AllottedResource
import org.onap.aaiclient.client.aai.AAIObjectType
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
-import javax.ws.rs.core.UriBuilder
-import static org.junit.Assert.assertEquals
-import static org.junit.Assert.assertTrue
-import static org.mockito.ArgumentMatchers.any
-import static org.mockito.ArgumentMatchers.anyObject
-import static org.mockito.ArgumentMatchers.isA
-import static org.mockito.Mockito.atLeastOnce
-import static org.mockito.Mockito.doNothing
-import static org.mockito.Mockito.doThrow
-import static org.mockito.Mockito.mock
-import static org.mockito.Mockito.spy
-import static org.mockito.Mockito.verify
-import static org.mockito.Mockito.when
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
class AllottedResourceUtilsTest extends MsoGroovyTest{
@@ -67,7 +63,7 @@ class AllottedResourceUtilsTest extends MsoGroovyTest{
expectedAllottedResource.setId("ID")
expectedAllottedResource.setResourceVersion("1.2")
when(client.get(any(AAIResourceUri.class))).thenReturn(new AAIResultWrapper(expectedAllottedResource))
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId)
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(Types.ALLOTTED_RESOURCE.getFragment(allottedResourceId))
when(allottedResourceUtils.setExecutionVariables(mockExecution,expectedAllottedResource,resourceUri)).thenAnswer(new DoesNothing())
boolean allottedResource = allottedResourceUtils.ifExistsAR(mockExecution,allottedResourceId)
assertTrue(allottedResource)
@@ -79,7 +75,7 @@ class AllottedResourceUtilsTest extends MsoGroovyTest{
AllottedResource expectedAllottedResource = new AllottedResource()
expectedAllottedResource.setId("ID")
- AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(ALLOTTED_RESOURSE_URI).build())
+ AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(Types.ALLOTTED_RESOURCE, UriBuilder.fromPath(ALLOTTED_RESOURSE_URI).build())
when(client.get(AllottedResource.class, uri)).thenReturn(Optional.of(expectedAllottedResource))
Optional<AllottedResource> allottedResource = allottedResourceUtils.getARbyLink(mockExecution, ALLOTTED_RESOURSE_URI,"")
assertEquals(expectedAllottedResource.getId(),allottedResource.get().getId())
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy
index 8a80d79cf9..df4d371fa5 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy
@@ -22,6 +22,13 @@
package org.onap.so.bpmn.common.scripts
+import static org.assertj.core.api.Assertions.catchThrowableOfType
+import static org.junit.Assert.assertEquals
+import static org.junit.Assert.assertFalse
+import static org.junit.Assert.assertTrue
+import static org.mockito.Mockito.spy
+import static org.mockito.Mockito.when
+import javax.ws.rs.core.UriBuilder
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake
@@ -31,29 +38,18 @@ import org.mockito.Mock
import org.mockito.MockitoAnnotations
import org.onap.aai.domain.yang.RelationshipList
import org.onap.aai.domain.yang.VolumeGroup
-import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupName
-import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupNameFactory
-import org.onap.so.bpmn.common.scripts.ExceptionUtil
-import org.onap.aaiclient.client.aai.AAIObjectType
import org.onap.aaiclient.client.aai.AAIResourcesClient
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
import org.onap.so.constants.Defaults
import org.springframework.http.HttpStatus
-import javax.ws.rs.core.UriBuilder
-
-import static org.assertj.core.api.Assertions.catchThrowableOfType
-import static org.junit.Assert.assertEquals
-import static org.junit.Assert.assertFalse
-import static org.junit.Assert.assertTrue
-import static org.mockito.Mockito.spy
-import static org.mockito.Mockito.when
-
class ConfirmVolumeGroupNameTest {
private static final AAIResourceUri RESOURCE_URI = AAIUriFactory.createResourceFromExistingURI(
- AAIObjectType.VOLUME_GROUP, UriBuilder.fromPath('/aai/test/volume-groups/volume-group/testVolumeGroup').build())
+ Types.VOLUME_GROUP, UriBuilder.fromPath('/aai/test/volume-groups/volume-group/testVolumeGroup').build())
private ConfirmVolumeGroupName confirmVolumeGroupName
@Mock
@@ -79,7 +75,7 @@ class ConfirmVolumeGroupNameTest {
String volumeGroupId = "volume-group-id-1"
String volumeGroupName = "volume-group-name-1"
String aicCloudRegion = "aic-cloud-region-1"
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER, aicCloudRegion, volumeGroupId)
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), aicCloudRegion).volumeGroup(volumeGroupId))
delegateExecution.setVariable("ConfirmVolumeGroupName_volumeGroupId", volumeGroupId)
delegateExecution.setVariable("ConfirmVolumeGroupName_volumeGroupName", volumeGroupName)
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy
index cd57434d5f..3b7179df6c 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy
@@ -40,6 +40,8 @@ import org.onap.aaiclient.client.aai.AAIObjectType
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
import org.onap.so.constants.Defaults
class ConfirmVolumeGroupTenantTest extends MsoGroovyTest {
@@ -79,7 +81,7 @@ class ConfirmVolumeGroupTenantTest extends MsoGroovyTest {
when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8')
when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner')
when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/')
- AAIResourceUri arURI = AAIUriFactory. createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), "aicCloudRegionId","volumeGroupId")
+ AAIResourceUri arURI = AAIUriFactory. createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), "aicCloudRegionId").volumeGroup("volumeGroupId"))
AAIResultWrapper wrapper = new AAIResultWrapper(expectedVolumeGroup)
when(client.get(arURI)).thenReturn(wrapper)
confirmVolumeGroupTenant.preProcessRequest(mockExecution)
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroupTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroupTest.groovy
index 4f36aec827..cd9061cd19 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroupTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroupTest.groovy
@@ -31,6 +31,8 @@ import org.mockito.Spy
import org.onap.aaiclient.client.aai.AAIObjectType
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
import org.onap.so.constants.Defaults
class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{
@@ -50,7 +52,7 @@ class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{
when(mockExecution.getVariable("CAAIVfModVG_vfModuleId")).thenReturn("VfModule123")
org.onap.aai.domain.yang.VfModule vfModuleExpected = new org.onap.aai.domain.yang.VfModule()
vfModuleExpected.setVfModuleId("VfModule123")
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "Vnf123", "VfModule123");
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("Vnf123").vfModule("VfModule123"));
when(client.get(org.onap.aai.domain.yang.VfModule.class,resourceUri)).thenReturn(Optional.of(vfModuleExpected))
createAAIVfModuleVolumeGroup.getVfModule(mockExecution)
Mockito.verify(mockExecution).setVariable("CAAIVfModVG_getVfModuleResponseCode", 200)
@@ -61,7 +63,7 @@ class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{
void testGetVfModuleNotFound (){
when(mockExecution.getVariable("CAAIVfModVG_vnfId")).thenReturn("Vnf123")
when(mockExecution.getVariable("CAAIVfModVG_vfModuleId")).thenReturn("VfModule123")
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "Vnf123", "VfModule123");
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("Vnf123").vfModule("VfModule123"));
when(client.get(org.onap.aai.domain.yang.VfModule.class,resourceUri)).thenReturn(Optional.empty())
createAAIVfModuleVolumeGroup.getVfModule(mockExecution)
Mockito.verify(mockExecution).setVariable("CAAIVfModVG_getVfModuleResponseCode", 404)
@@ -72,7 +74,7 @@ class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{
void testGetVfModuleException (){
when(mockExecution.getVariable("CAAIVfModVG_vnfId")).thenReturn("Vnf123")
when(mockExecution.getVariable("CAAIVfModVG_vfModuleId")).thenReturn("VfModule123")
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "Vnf123", "VfModule123");
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("Vnf123").vfModule("VfModule123"));
when(client.get(org.onap.aai.domain.yang.VfModule.class,resourceUri)).thenThrow(new NullPointerException("Error in AAI client"))
createAAIVfModuleVolumeGroup.getVfModule(mockExecution)
Mockito.verify(mockExecution).setVariable("CAAIVfModVG_getVfModuleResponseCode", 500)
@@ -90,8 +92,8 @@ class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{
vfModuleExpected.setVfModuleId("VfModule123")
vfModuleExpected.setResourceVersion("12345")
when(mockExecution.getVariable("CAAIVfModVG_getVfModuleResponse")).thenReturn(vfModuleExpected)
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "Vnf123", "VfModule123");
- AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(),"CloudRegion1", "VolumeGroup1")
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("Vnf123").vfModule("VfModule123"));
+ AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), "CloudRegion1").volumeGroup("VolumeGroup1"))
doNothing().when(client).connect(resourceUri ,resourceUri1 )
createAAIVfModuleVolumeGroup.updateVfModule(mockExecution)
Mockito.verify(mockExecution).setVariable("CAAIVfModVG_updateVfModuleResponseCode", 200)
@@ -109,8 +111,8 @@ class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{
vfModuleExpected.setResourceVersion("12345")
when(mockExecution.getVariable("CAAIVfModVG_cloudOwner")).thenReturn("cloudOwner")
when(mockExecution.getVariable("CAAIVfModVG_getVfModuleResponse")).thenReturn(vfModuleExpected)
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "Vnf123", "VfModule123");
- AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, 'cloudOwner',"CloudRegion1", "VolumeGroup1")
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("Vnf123").vfModule("VfModule123"));
+ AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion('cloudOwner', "CloudRegion1").volumeGroup("VolumeGroup1"))
doThrow(new NullPointerException("Error in AAI client")).when(client).connect(resourceUri ,resourceUri1 )
createAAIVfModuleVolumeGroup.updateVfModule(mockExecution)
Mockito.verify(mockExecution).setVariable("CAAIVfModVG_updateVfModuleResponseCode", 500)
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
index c8eeb0a957..77e4374921 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
@@ -31,16 +31,15 @@ import org.junit.rules.ExpectedException
import org.junit.runner.RunWith
import org.mockito.junit.MockitoJUnitRunner
import org.onap.aai.domain.yang.GenericVnf
-import org.onap.so.bpmn.mock.FileUtil
-import org.onap.so.client.HttpClient
-import org.onap.aaiclient.client.aai.AAIObjectPlurals
-import org.onap.aaiclient.client.aai.AAIObjectType
import org.onap.aaiclient.client.aai.AAIResourcesClient
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
import org.onap.aaiclient.client.graphinventory.entities.uri.Depth
+import org.onap.so.bpmn.mock.FileUtil
+import org.onap.so.client.HttpClient
import org.onap.so.constants.Defaults
@RunWith(MockitoJUnitRunner.Silent.class)
@@ -111,8 +110,8 @@ abstract class MsoGroovyTest {
}
protected Optional<GenericVnf> mockAAIGenericVnf(String vnfId,String file){
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
- AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
+ AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE)
Optional<GenericVnf> genericVnf = getAAIObjectFromJson(GenericVnf.class,file);
when(client.get(GenericVnf.class, resourceUri)).thenReturn(genericVnf)
when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(genericVnf)
@@ -120,8 +119,8 @@ abstract class MsoGroovyTest {
}
protected Optional<GenericVnf> mockAAIGenericVnfByName(String vnfName){
- AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)
- AAIPluralResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE)
+ AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam("vnf-name", vnfName)
+ AAIPluralResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam("vnf-name", vnfName).depth(Depth.ONE)
Optional<GenericVnf> genericVnf = getAAIObjectFromJson(GenericVnf.class,"__files/aai/GenericVnf.json");
when(client.get(GenericVnf.class, resourceUri)).thenReturn(genericVnf)
when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(genericVnf)
@@ -129,21 +128,21 @@ abstract class MsoGroovyTest {
}
protected void mockAAIGenericVnfNotFound(String vnfId){
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
- AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE)
+ AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE)
when(client.get(GenericVnf.class, resourceUri)).thenReturn(Optional.empty())
when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(Optional.empty())
}
protected void mockAAIGenericVnfByNameNotFound(String vnfName){
- AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)
- AAIPluralResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE)
+ AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam("vnf-name", vnfName)
+ AAIPluralResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam("vnf-name", vnfName).depth(Depth.ONE)
when(client.get(GenericVnf.class, resourceUri)).thenReturn(Optional.empty())
when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(Optional.empty())
}
protected AAIResultWrapper mockVolumeGroupWrapper(String region, String volumeGroupId, String file){
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, region,volumeGroupId)
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, region).volumeGroup(volumeGroupId))
String json = FileUtil.readResourceFile(file)
AAIResultWrapper resultWrapper = new AAIResultWrapper(json)
when(client.get(resourceUri)).thenReturn(resultWrapper)
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
index 1918d10fe7..94317f49ae 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
@@ -38,6 +38,8 @@ import org.mockito.Spy
import org.onap.aaiclient.client.aai.AAIObjectType
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
import org.onap.aai.domain.yang.VfModule
import com.github.tomakehurst.wiremock.junit.WireMockRule
@@ -67,7 +69,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest {
when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool")
VfModule vfModule = new VfModule()
vfModule.setVfModuleId("supercool")
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "skask", "supercool");
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("skask").vfModule("supercool"));
when(client.get(VfModule.class,resourceUri)).thenReturn(Optional.of(vfModule))
updateAAIVfModule.getVfModule(mockExecution)
verify(mockExecution).setVariable(prefix + "getVfModuleResponseCode", 200)
@@ -79,7 +81,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest {
when(mockExecution.getVariable("prefix")).thenReturn(prefix)
when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask")
when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool")
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "skask", "supercool");
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("skask").vfModule("supercool"));
when(client.get(VfModule.class,resourceUri)).thenReturn(Optional.empty())
updateAAIVfModule.getVfModule(mockExecution)
verify(mockExecution).setVariable(prefix + "getVfModuleResponseCode", 404)
@@ -91,7 +93,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest {
when(mockExecution.getVariable("prefix")).thenReturn(prefix)
when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask")
when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool")
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "skask", "supercool");
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("skask").vfModule("supercool"));
when(client.get(VfModule.class,resourceUri)).thenThrow(new NullPointerException("Error from AAI client"))
updateAAIVfModule.getVfModule(mockExecution)
verify(mockExecution).setVariable(prefix + "getVfModuleResponseCode", 500)