summaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/test
diff options
context:
space:
mode:
authorSmokowski, Steven <steve.smokowski@att.com>2020-04-01 10:41:17 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-04-17 12:05:16 -0400
commitfbb984e6a8823ca26eae20a65c6d261feac02b7b (patch)
tree00e6f3c385587a351ab644112ffca733f77465e7 /adapters/mso-openstack-adapters/src/test
parenteceef88af7a5e13a7840059004116e8b6cbf35ac (diff)
openstack inventory capture
Begin heatbridge refactor initial check in of heatbridge Additional commits of heatbridge Update Heat bridge to write more AAI data Update to utlize HeatBrdige to populate AAI Adjust simulator endpoints to work again Remove not needed BB Test case, fix tc Refactor how AAI relationships are being built Issue-ID: SO-2777 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: Iffccc24e18b278188c3fe98bcb1ad9685229d0a2
Diffstat (limited to 'adapters/mso-openstack-adapters/src/test')
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java47
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java1
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java8
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java7
4 files changed, 5 insertions, 58 deletions
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java
index e822f65072..583bfbadb2 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java
@@ -20,30 +20,17 @@
package org.onap.so.adapters.tasks.inventory;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
import java.io.File;
import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
import org.camunda.bpm.client.task.ExternalTask;
-import org.hamcrest.Matchers;
import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.onap.so.adapters.tasks.inventory.CreateAAIInventory;
import org.onap.so.audit.beans.AuditInventory;
-import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.objects.audit.AAIObjectAuditList;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
@@ -86,38 +73,4 @@ public class CreateAAIInventoryTest extends CreateAAIInventory {
doReturn(auditInventory).when(mockExternalTask).getVariable("auditInventory");
}
- @Test
- public void determineAuditResult_Test() throws Exception {
- boolean actual = createAAIInventory.didAuditFailVserverLInterfaces(auditListSuccess);
- assertEquals(false, actual);
- }
-
- @Test
- public void determineAuditResult_Failure_Test() throws Exception {
- boolean actual = createAAIInventory.didAuditFailVserverLInterfaces(auditListFailure);
- assertEquals(true, actual);
- }
-
- @Test
- public void missing_Sub_Interfaces_Test() throws Exception {
- AAIResourceUri aaiURI2 = AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, "cloudOwner",
- "regionOne", "0422ffb57ba042c0800a29dc85ca70f8", "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
- "tsbc0005v_tsbc0005vm002_svc1_port_0", "tsbc0005v_tsbc0005vm002_subint_untrusted_svc1_81");
- AAIResourceUri aaiURI1 = AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, "cloudOwner",
- "regionOne", "0422ffb57ba042c0800a29dc85ca70f8", "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
- "tsbc0005v_tsbc0005vm002_svc2_port_0", "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_103");
- ArgumentCaptor<Optional> captor = ArgumentCaptor.forClass(Optional.class);
- ArgumentCaptor<AAIResourceUri> uriCaptor = ArgumentCaptor.forClass(AAIResourceUri.class);
-
- createAAIInventory.setAaiClient(mockClient);
- createAAIInventory.createInventory(missingSubInterfaces);
- Mockito.verify(mockClient, times(2)).createIfNotExists(uriCaptor.capture(), captor.capture());
-
- List<AAIResourceUri> capturedURI = uriCaptor.getAllValues();
- assertTrue(capturedURI.stream().anyMatch(item -> aaiURI1.build().toString().equals(item.build().toString())));
- assertTrue(capturedURI.stream().anyMatch(item -> aaiURI2.build().toString().equals(item.build().toString())));
-
-
-
- }
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java
index fc2baefcd5..653099a0ea 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java
@@ -76,7 +76,6 @@ public class CreateInventoryTaskTest {
object.getAuditList().add(e);
GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
doReturn(objectMapper.getMapper().writeValueAsString(e)).when(externalTask).getVariable("auditInventoryResult");
- Mockito.doThrow(InventoryException.class).when(createAAIInventory).createInventory(Mockito.any());
inventoryTask.executeExternalTask(externalTask, externalTaskService);
Mockito.verify(externalTaskService, times(1)).handleBpmnError(externalTask, "AAIInventoryFailure");
}
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 e2f5531280..6ecdcf9f28 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
@@ -308,13 +308,7 @@ public class HeatBridgeImplTest {
heatbridge.buildAddFlavorsToAaiAction(flavors);
// Assert #1
- verify(transaction, times(2)).create(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Flavor.class));
-
- // Act #2
- heatbridge.buildAddFlavorsToAaiAction(flavors);
-
- // Assert #2
- verify(transaction, times(4)).create(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Flavor.class));
+ verify(transaction, times(2)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
}
@Ignore
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java
index 4eeb1c03a3..86400c2190 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java
@@ -52,19 +52,20 @@ public class MsoCloudClientFactoryImplTest {
@Test
public void getOpenstackClientWithVersion2() throws Exception {
- testedObject.getOpenstackClient(URL_V2, MSO_ID, ENCRYPTED_PASSWORD, REGION_ID, TENANT_ID);
+ testedObject.getOpenstackClient(URL_V2, MSO_ID, ENCRYPTED_PASSWORD, REGION_ID, TENANT_ID, "v2.0");
verify(openstackClientFactoryMock).createOpenstackV2Client(any(OpenstackAccess.class));
}
@Test
public void getOpenstackClientWithVersion3() throws Exception {
- testedObject.getOpenstackClient(URL_V3, MSO_ID, ENCRYPTED_PASSWORD, REGION_ID, TENANT_ID);
+ testedObject.getOpenstackClient(URL_V3, MSO_ID, ENCRYPTED_PASSWORD, REGION_ID, TENANT_ID, "v3");
verify(openstackClientFactoryMock).createOpenstackV3Client(any(OpenstackAccess.class));
}
@Test(expected = HeatBridgeException.class)
public void getOpenstackClient_unsupportedVersion() throws Exception {
- testedObject.getOpenstackClient(URL_WITH_UNSUPPORTED_VERSION, MSO_ID, ENCRYPTED_PASSWORD, REGION_ID, TENANT_ID);
+ testedObject.getOpenstackClient(URL_WITH_UNSUPPORTED_VERSION, MSO_ID, ENCRYPTED_PASSWORD, REGION_ID, TENANT_ID,
+ "UNKNOWN");
}
}