aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/test/java/org
diff options
context:
space:
mode:
authorBenjamin, Max <max.benjamin@att.com>2020-09-21 11:38:23 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-09-23 16:32:42 -0400
commit2505a543b0e45c1c3c2fe2fb8b85664b08bf2fca (patch)
tree5f1593d45f8c9a2fb2d400b8fa58dbb3e29ef671 /mso-api-handlers/mso-api-handler-infra/src/test/java/org
parent8d68a316f303d0fc57eb7da4fef881a26d39d439 (diff)
removed references to AAIObjectType
removed references to AAIObjectType and AAIObjectPlurals additional corrections for removal of aai object type corrected additional java files updated groovy files to match aai fluent builder style Issue-ID: SO-3259 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: Ifdf12fcacb34cc648548eb18b638afd06dad67a9
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test/java/org')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrievalTest.java20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java20
3 files changed, 36 insertions, 23 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrievalTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrievalTest.java
index 9d5d80592d..61ac542810 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrievalTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrievalTest.java
@@ -24,22 +24,20 @@ import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doReturn;
import java.util.List;
import java.util.Optional;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VfModules;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.aai.domain.yang.VolumeGroups;
-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.uri.AAIPluralResourceUri;
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;
@RunWith(MockitoJUnitRunner.class)
public class AAIDataRetrievalTest {
@@ -52,7 +50,8 @@ public class AAIDataRetrievalTest {
@Test
public void getVfModulesOfVnfTest() {
VfModules vfModules = getVfModules();
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "vnfId");
+ AAIPluralResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId").vfModules());
doReturn(Optional.of(vfModules)).when(aaiResourcesClient).get(VfModules.class, uri);
List<VfModule> vfModulesList = aaiDataRetrieval.getVfModulesOfVnf("vnfId");
assertEquals("vfm1", vfModulesList.get(0).getVfModuleId());
@@ -64,7 +63,8 @@ public class AAIDataRetrievalTest {
@Test
public void getVfModulesOfVnfWhenNoneTest() {
VfModules vfModules = new VfModules();
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "vnfId");
+ AAIPluralResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId").vfModules());
doReturn(Optional.of(vfModules)).when(aaiResourcesClient).get(VfModules.class, uri);
List<VfModule> vfModulesList = aaiDataRetrieval.getVfModulesOfVnf("vnfId");
assertEquals(true, vfModulesList.isEmpty());
@@ -76,8 +76,8 @@ public class AAIDataRetrievalTest {
@Test
public void getVolumeGroupsOfVnfTest() throws Exception {
VolumeGroups volumeGroups = getVolumeGroups();
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId")
- .relatedTo(AAIObjectPlurals.VOLUME_GROUP);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId"))
+ .relatedTo(Types.VOLUME_GROUPS.getFragment());
doReturn(Optional.of(volumeGroups)).when(aaiResourcesClient).get(VolumeGroups.class, uri);
List<VolumeGroup> volumeGroupList = aaiDataRetrieval.getVolumeGroupsOfVnf("vnfId");
assertEquals("vg1", volumeGroupList.get(0).getVolumeGroupId());
@@ -88,8 +88,8 @@ public class AAIDataRetrievalTest {
@Test
public void getVolumeGroupsOfVnfWhenNoneTest() throws Exception {
VolumeGroups volumeGroups = new VolumeGroups();
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId")
- .relatedTo(AAIObjectPlurals.VOLUME_GROUP);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId"))
+ .relatedTo(Types.VOLUME_GROUPS.getFragment());
doReturn(Optional.of(volumeGroups)).when(aaiResourcesClient).get(VolumeGroups.class, uri);
List<VolumeGroup> volumeGroupList = aaiDataRetrieval.getVolumeGroupsOfVnf("vnfId");
assertEquals(true, volumeGroupList.isEmpty());
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java
index 389ff28dbd..912c026203 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java
@@ -41,10 +41,11 @@ import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VolumeGroup;
-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.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.constants.Status;
import org.onap.so.db.request.client.RequestsDbClient;
@@ -104,7 +105,7 @@ public class BpmnRequestBuilderTest {
GenericVnf vnf = provider.getMapper().readValue(new File(RESOURCE_PATH + "Vnf.json"), GenericVnf.class);
doReturn(Optional.of(vnf)).when(aaiResourcesClient).get(GenericVnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId"));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")));
ServiceInstancesRequest expectedRequest =
mapper.readValue(new File(RESOURCE_PATH + "ExpectedVnfRequest.json"), ServiceInstancesRequest.class);
@@ -117,11 +118,11 @@ public class BpmnRequestBuilderTest {
GenericVnf vnf = provider.getMapper().readValue(new File(RESOURCE_PATH + "Vnf.json"), GenericVnf.class);
doReturn(Optional.of(vnf)).when(aaiResourcesClient).get(GenericVnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId"));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")));
VfModule vfModule = provider.getMapper().readValue(new File(RESOURCE_PATH + "VfModule.json"), VfModule.class);
- doReturn(Optional.of(vfModule)).when(aaiResourcesClient).get(VfModule.class,
- AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "vnfId", "vfModuleId"));
+ doReturn(Optional.of(vfModule)).when(aaiResourcesClient).get(VfModule.class, AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId").vfModule("vfModuleId")));
ServiceInstancesRequest expectedRequest = mapper
.readValue(new File(RESOURCE_PATH + "ExpectedVfModuleRequest.json"), ServiceInstancesRequest.class);
@@ -135,13 +136,13 @@ public class BpmnRequestBuilderTest {
GenericVnf vnf = provider.getMapper().readValue(new File(RESOURCE_PATH + "Vnf.json"), GenericVnf.class);
doReturn(Optional.of(vnf)).when(aaiResourcesClient).get(GenericVnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId"));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")));
VolumeGroup volumeGroup =
provider.getMapper().readValue(new File(RESOURCE_PATH + "VolumeGroup.json"), VolumeGroup.class);
AAIResultWrapper wrapper = new AAIResultWrapper(volumeGroup);
doReturn(wrapper).when(aaiResourcesClient)
- .get(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId")
- .relatedTo(AAIObjectType.VOLUME_GROUP, "volumeGroupId"));
+ .get(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId"))
+ .relatedTo(Types.VOLUME_GROUP.getFragment("volumeGroupId")));
ServiceInstancesRequest expectedRequest = mapper
.readValue(new File(RESOURCE_PATH + "ExpectedVolumeGroupRequest.json"), ServiceInstancesRequest.class);
@@ -157,7 +158,7 @@ public class BpmnRequestBuilderTest {
GenericVnf vnf = provider.getMapper().readValue(new File(RESOURCE_PATH + "Vnf.json"), GenericVnf.class);
doReturn(Optional.of(vnf)).when(aaiResourcesClient).get(GenericVnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)));
CloudConfiguration result = reqBuilder.getCloudConfigurationVfModuleReplace(vnfId, vfModuleId);
assertEquals("0422ffb57ba042c0800a29dc85ca70f8", result.getTenantId());
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java
index 7aa12a61a6..1023408088 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java
@@ -1,6 +1,8 @@
package org.onap.so.apihandlerinfra.infra.rest.validator;
import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
import java.util.HashMap;
import java.util.Map;
@@ -14,6 +16,8 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
import org.onap.so.apihandlerinfra.infra.rest.validators.VolumeGroupDeleteValidator;
+import org.onap.so.serviceinstancebeans.CloudConfiguration;
+import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
@@ -53,16 +57,24 @@ public class VolumeGroupDeleteValidatorTest {
@Test
public void validateSuccessTest() {
instanceIdMap.put("volumeGroupInstanceId", "1");
- when(aaiDataRetrieval.isVolumeGroupRelatedToVFModule("1")).thenReturn(false);
- Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, null, null, null);
+ ServiceInstancesRequest request = new ServiceInstancesRequest();
+ RequestDetails details = new RequestDetails();
+ details.setCloudConfiguration(new CloudConfiguration());
+ request.setRequestDetails(details);
+ when(aaiDataRetrieval.isVolumeGroupRelatedToVFModule(any(CloudConfiguration.class), eq("1"))).thenReturn(false);
+ Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, request, null, null);
assertEquals(false, result.isPresent());
}
@Test
public void validateFailureVnfTest() {
instanceIdMap.put("volumeGroupInstanceId", "1");
- when(aaiDataRetrieval.isVolumeGroupRelatedToVFModule("1")).thenReturn(true);
- Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, null, null, null);
+ ServiceInstancesRequest request = new ServiceInstancesRequest();
+ RequestDetails details = new RequestDetails();
+ details.setCloudConfiguration(new CloudConfiguration());
+ request.setRequestDetails(details);
+ when(aaiDataRetrieval.isVolumeGroupRelatedToVFModule(any(CloudConfiguration.class), eq("1"))).thenReturn(true);
+ Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, request, null, null);
assertEquals(true, result.isPresent());
}