aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-openstack-adapters/src/test/java')
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java5
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java78
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java21
3 files changed, 56 insertions, 48 deletions
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java
index 76bc8d2456..9d5a4c62b9 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java
@@ -17,10 +17,10 @@ import org.mockito.Mockito;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.CloudRegion;
-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.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.catalog.data.repository.NetworkTechnologyReferenceRepository;
@@ -94,7 +94,8 @@ public class CloudRegionRestImplTest {
public void createCloudRegionTest() {
when(catalogDbClientMock.getCloudSite("region1")).thenReturn(null);
when(catalogDbClientMock.postCloudSite(cloudSite)).thenReturn(cloudSite);
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, "bob", "region1");
+ AAIResourceUri uri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion("bob", "region1"));
cloudRestImpl.createCloudRegion(cloudSite);
ArgumentCaptor<AAIResourceUri> actualURI = ArgumentCaptor.forClass(AAIResourceUri.class);
ArgumentCaptor<Optional<Object>> actualCloudRegion = ArgumentCaptor.forClass(Optional.class);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java
index e70b56dfc5..2e496c50cd 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java
@@ -41,12 +41,12 @@ import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VfModules;
import org.onap.aai.domain.yang.Vserver;
-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.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.skyscreamer.jsonassert.JSONAssert;
@@ -70,35 +70,43 @@ public class AuditVServerTest extends AuditVServer {
private String cloudRegion = "cloudRegion";
private String tenantId = "tenantId";
- private AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion,
- tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db");
+ private AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db"));
- private AAIResourceUri vserverURI2 = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion,
- tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz");
+ private AAIResourceUri vserverURI2 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"));
- private AAIResourceUri ssc_1_trusted_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_trusted_port_0");
+ private AAIResourceUri ssc_1_trusted_port_0_uri = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)
+ .vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_trusted_port_0"));
- private AAIResourceUri ssc_1_service1_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_service1_port_0");
+ private AAIResourceUri ssc_1_service1_port_0_uri = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)
+ .vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_service1_port_0"));
- private AAIResourceUri ssc_1_mgmt_port_1_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_mgmt_port_1");
+ private AAIResourceUri ssc_1_mgmt_port_1_uri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
+ .tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_mgmt_port_1"));
- private AAIResourceUri ssc_1_mgmt_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_mgmt_port_0");
+ private AAIResourceUri ssc_1_mgmt_port_0_uri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
+ .tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_mgmt_port_0"));
- private AAIResourceUri ssc_1_service2_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_service2_port_0");
+ private AAIResourceUri ssc_1_service2_port_0_uri = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)
+ .vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_service2_port_0"));
- private AAIResourceUri ssc_1_int_ha_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_int_ha_port_0");
+ private AAIResourceUri ssc_1_int_ha_port_0_uri = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)
+ .vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_int_ha_port_0"));
- private AAIResourceUri test_port_1_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner,
- cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz", "test_port_1");
+ private AAIResourceUri test_port_1_uri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
+ .tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4dz").lInterface("test_port_1"));
- private AAIResourceUri test_port_2_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner,
- cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz", "test_port_2");
+ private AAIResourceUri test_port_2_uri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
+ .tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4dz").lInterface("test_port_2"));
private AAIResourceUri service2_sub_1_uri =
AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, cloudOwner, cloudRegion, tenantId,
@@ -368,17 +376,20 @@ public class AuditVServerTest extends AuditVServer {
Vserver vserver = new Vserver();
vserver.setVserverId("testVserverId");
obj1.setAaiObject(vserver);
- obj1.setResourceURI(AAIUriFactory
- .createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, tenantId, "testVserverId").build());
+ obj1.setResourceURI(
+ AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("testVserverId"))
+ .build());
auditList.getAuditList().add(obj1);
- doReturn(false).when(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner,
- cloudRegion, tenantId, "testVserverId"));
+ doReturn(false).when(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder
+ .cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("testVserverId")));
auditNova.auditVservers(auditList);
- Mockito.verify(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner,
- cloudRegion, tenantId, "testVserverId"));
+ Mockito.verify(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder
+ .cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("testVserverId")));
Assert.assertEquals(false, auditList.getAuditList().get(0).isDoesObjectExist());
}
@@ -392,8 +403,8 @@ public class AuditVServerTest extends AuditVServer {
AAIResultWrapper wrapper = new AAIResultWrapper(vfModule);
doReturn(Optional.of(wrapper)).when(aaiResourcesMock).getFirstWrapper(VfModules.class, VfModule.class,
- AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId").queryParam("vf-module-name",
- "vfModuleName"));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("genericVnfId").vfModules())
+ .queryParam("vf-module-name", "vfModuleName"));
Optional<AAIObjectAuditList> auditList =
auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName");
@@ -410,11 +421,12 @@ public class AuditVServerTest extends AuditVServer {
AAIResultWrapper vserverWrapper = new AAIResultWrapper(new Vserver());
doReturn(Optional.of(wrapper)).when(aaiResourcesMock).getFirstWrapper(VfModules.class, VfModule.class,
- AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId").queryParam("vf-module-name",
- "vfModuleName"));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("genericVnfId").vfModules())
+ .queryParam("vf-module-name", "vfModuleName"));
- doReturn(vserverWrapper).when(aaiResourcesMock).get(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER,
- "cloud-owner", "cloud-region-id", "tenant-id", "VUSCHGA1"));
+ doReturn(vserverWrapper).when(aaiResourcesMock)
+ .get(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion("cloud-owner", "cloud-region-id").tenant("tenant-id").vserver("VUSCHGA1")));
Optional<AAIObjectAuditList> auditList =
auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName");
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
index cea436b799..110faaf8ab 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
@@ -45,7 +45,6 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.doReturn;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
@@ -66,20 +65,17 @@ import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.L3InterfaceIpv6AddressList;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.PInterface;
import org.onap.aai.domain.yang.SriovPf;
import org.onap.aaiclient.client.aai.AAIDSLQueryClient;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.AAISingleTransactionClient;
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.GraphInventoryCommonObjectMapperProvider;
import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed;
import org.onap.so.cloud.resource.beans.NodeType;
import org.onap.so.db.catalog.beans.CloudIdentity;
@@ -105,7 +101,6 @@ import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableMap;
-import inet.ipaddr.IPAddressString;
@RunWith(MockitoJUnitRunner.Silent.class)
@@ -202,10 +197,10 @@ public class HeatBridgeImplTest {
verify(transaction, times(2)).createIfNotExists(captor.capture(), any(Optional.class));
List<AAIResourceUri> uris = captor.getAllValues();
- assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID,
- server1.getId()), uris.get(0));
- assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID,
- server2.getId()), uris.get(1));
+ assertEquals(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(CLOUD_OWNER, REGION_ID).tenant(TENANT_ID).vserver(server1.getId())), uris.get(0));
+ assertEquals(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(CLOUD_OWNER, REGION_ID).tenant(TENANT_ID).vserver(server2.getId())), uris.get(1));
}
@@ -246,10 +241,10 @@ public class HeatBridgeImplTest {
verify(transaction, times(2)).createIfNotExists(captor.capture(), any(Optional.class));
List<AAIResourceUri> uris = captor.getAllValues();
- assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID,
- server1.getId()), uris.get(0));
- assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID,
- server2.getId()), uris.get(1));
+ assertEquals(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(CLOUD_OWNER, REGION_ID).tenant(TENANT_ID).vserver(server1.getId())), uris.get(0));
+ assertEquals(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(CLOUD_OWNER, REGION_ID).tenant(TENANT_ID).vserver(server2.getId())), uris.get(1));
}
@Test