aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java')
-rw-r--r--asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java175
1 files changed, 87 insertions, 88 deletions
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java
index 6de04e2862..d322e7e0a8 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java
+++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java
@@ -22,7 +22,6 @@
package org.openecomp.mso.asdc.client.tests;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -46,129 +45,129 @@ import org.openecomp.mso.asdc.installer.IVfModuleData;
public class ASDCElementInfoTest {
- @Test
- public void createASDCElementInfoWithNullParameterTest() {
- ASDCElementInfo elementInfoFromNullVfArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(null);
- ASDCElementInfo elementInfoFromNullVfModuleStructure = ASDCElementInfo.createElementFromVfModuleStructure(null);
- ASDCElementInfo elementInfoFromNullVfResourceStructure = ASDCElementInfo.createElementFromVfResourceStructure(null);
+ @Test
+ public void createASDCElementInfoWithNullParameterTest() {
+ ASDCElementInfo elementInfoFromNullVfArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(null);
+ ASDCElementInfo elementInfoFromNullVfModuleStructure = ASDCElementInfo.createElementFromVfModuleStructure(null);
+ ASDCElementInfo elementInfoFromNullVfResourceStructure = ASDCElementInfo.createElementFromVfResourceStructure(null);
- elementInfoFromNullVfArtifact.addElementInfo(null, null);
- elementInfoFromNullVfModuleStructure.addElementInfo(null, "someValue");
- elementInfoFromNullVfResourceStructure.addElementInfo("someKey", null);
+ elementInfoFromNullVfArtifact.addElementInfo(null, null);
+ elementInfoFromNullVfModuleStructure.addElementInfo(null, "someValue");
+ elementInfoFromNullVfResourceStructure.addElementInfo("someKey", null);
- assertEquals(elementInfoFromNullVfArtifact.toString(), "");
- assertEquals(elementInfoFromNullVfModuleStructure.toString(), "");
- assertEquals(elementInfoFromNullVfResourceStructure.toString(), "");
+ assertEquals(elementInfoFromNullVfArtifact.toString(), "");
+ assertEquals(elementInfoFromNullVfModuleStructure.toString(), "");
+ assertEquals(elementInfoFromNullVfResourceStructure.toString(), "");
- assertNotNull(elementInfoFromNullVfArtifact);
- assertNotNull(elementInfoFromNullVfModuleStructure);
- assertNotNull(elementInfoFromNullVfResourceStructure);
+ assertNotNull(elementInfoFromNullVfArtifact);
+ assertNotNull(elementInfoFromNullVfModuleStructure);
+ assertNotNull(elementInfoFromNullVfResourceStructure);
- assertNotNull(ASDCElementInfo.EMPTY_INSTANCE);
+ assertNotNull(ASDCElementInfo.EMPTY_INSTANCE);
- assertEquals(elementInfoFromNullVfArtifact, ASDCElementInfo.EMPTY_INSTANCE);
- assertEquals(elementInfoFromNullVfModuleStructure, ASDCElementInfo.EMPTY_INSTANCE);
- assertEquals(elementInfoFromNullVfResourceStructure, ASDCElementInfo.EMPTY_INSTANCE);
+ assertEquals(elementInfoFromNullVfArtifact, ASDCElementInfo.EMPTY_INSTANCE);
+ assertEquals(elementInfoFromNullVfModuleStructure, ASDCElementInfo.EMPTY_INSTANCE);
+ assertEquals(elementInfoFromNullVfResourceStructure, ASDCElementInfo.EMPTY_INSTANCE);
- assertEquals(ASDCElementInfo.EMPTY_INSTANCE.getType(), "");
- assertEquals(ASDCElementInfo.EMPTY_INSTANCE.toString(), "");
+ assertEquals(ASDCElementInfo.EMPTY_INSTANCE.getType(), "");
+ assertEquals(ASDCElementInfo.EMPTY_INSTANCE.toString(), "");
- assertEquals(elementInfoFromNullVfArtifact.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
- assertEquals(elementInfoFromNullVfModuleStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
- assertEquals(elementInfoFromNullVfResourceStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
- }
+ assertEquals(elementInfoFromNullVfArtifact.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
+ assertEquals(elementInfoFromNullVfModuleStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
+ assertEquals(elementInfoFromNullVfResourceStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
+ }
- @Test
- public void createASDCElementInfoFromVfResourceTest() {
+ @Test
+ public void createASDCElementInfoFromVfResourceTest() {
- String resourceInstanceName = "Resource 1";
+ String resourceInstanceName = "Resource 1";
- UUID generatedUUID = UUID.randomUUID();
+ UUID generatedUUID = UUID.randomUUID();
- INotificationData notificationData = Mockito.mock(INotificationData.class);
- IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class);
+ INotificationData notificationData = Mockito.mock(INotificationData.class);
+ IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class);
- Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName);
- Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString());
+ Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName);
+ Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString());
- VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance);
+ VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance);
- ASDCElementInfo elementInfoFromVfResource = ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure);
+ ASDCElementInfo elementInfoFromVfResource = ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure);
- assertTrue(elementInfoFromVfResource.toString().contains(resourceInstanceName));
- assertTrue(elementInfoFromVfResource.toString().contains(generatedUUID.toString()));
+ assertTrue(elementInfoFromVfResource.toString().contains(resourceInstanceName));
+ assertTrue(elementInfoFromVfResource.toString().contains(generatedUUID.toString()));
- assertFalse(ASDCConfiguration.VF_MODULES_METADATA.equals(elementInfoFromVfResource.getType()));
- assertEquals(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name(), elementInfoFromVfResource.getType());
+ assertFalse(ASDCConfiguration.VF_MODULES_METADATA.equals(elementInfoFromVfResource.getType()));
+ assertEquals(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name(), elementInfoFromVfResource.getType());
- assertFalse(elementInfoFromVfResource.toString().contains("MyInfo1: someValue"));
- elementInfoFromVfResource.addElementInfo("MyInfo1", "someValue");
- assertTrue(elementInfoFromVfResource.toString().contains("MyInfo1: someValue"));
- }
+ assertFalse(elementInfoFromVfResource.toString().contains("MyInfo1: someValue"));
+ elementInfoFromVfResource.addElementInfo("MyInfo1", "someValue");
+ assertTrue(elementInfoFromVfResource.toString().contains("MyInfo1: someValue"));
+ }
- @Test
- public void createASDCElementInfoFromVfModuleTest() throws ArtifactInstallerException {
+ @Test
+ public void createASDCElementInfoFromVfModuleTest() throws ArtifactInstallerException {
- String resourceInstanceName = "Resource 1";
+ String resourceInstanceName = "Resource 1";
- UUID generatedUUID = UUID.randomUUID();
+ UUID generatedUUID = UUID.randomUUID();
- INotificationData notificationData = Mockito.mock(INotificationData.class);
- IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class);
+ INotificationData notificationData = Mockito.mock(INotificationData.class);
+ IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class);
- Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName);
- Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString());
+ Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName);
+ Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString());
- VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance);
+ VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance);
- // Create module structure now
+ // Create module structure now
- String vfModuleModelName = "Module Model XYZ";
+ String vfModuleModelName = "Module Model XYZ";
- UUID generatedUUIDForModule = UUID.randomUUID();
+ UUID generatedUUIDForModule = UUID.randomUUID();
- IVfModuleData moduleMetadata = Mockito.mock(IVfModuleData.class);
- Mockito.when(moduleMetadata.getVfModuleModelName()).thenReturn(vfModuleModelName);
- Mockito.when(moduleMetadata.getVfModuleModelInvariantUUID()).thenReturn(generatedUUIDForModule.toString());
- Mockito.when(moduleMetadata.getArtifacts()).thenReturn(Collections.<String> emptyList());
+ IVfModuleData moduleMetadata = Mockito.mock(IVfModuleData.class);
+ Mockito.when(moduleMetadata.getVfModuleModelName()).thenReturn(vfModuleModelName);
+ Mockito.when(moduleMetadata.getVfModuleModelInvariantUUID()).thenReturn(generatedUUIDForModule.toString());
+ Mockito.when(moduleMetadata.getArtifacts()).thenReturn(Collections.<String>emptyList());
- VfModuleStructure vfModuleStructure = new VfModuleStructure(vfResourceStructure, moduleMetadata);
+ VfModuleStructure vfModuleStructure = new VfModuleStructure(vfResourceStructure, moduleMetadata);
- ASDCElementInfo elementInfoFromVfModule = ASDCElementInfo.createElementFromVfModuleStructure(vfModuleStructure);
+ ASDCElementInfo elementInfoFromVfModule = ASDCElementInfo.createElementFromVfModuleStructure(vfModuleStructure);
- assertTrue(elementInfoFromVfModule.toString().contains(vfModuleModelName));
- assertTrue(elementInfoFromVfModule.toString().contains(generatedUUIDForModule.toString()));
+ assertTrue(elementInfoFromVfModule.toString().contains(vfModuleModelName));
+ assertTrue(elementInfoFromVfModule.toString().contains(generatedUUIDForModule.toString()));
- assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromVfModule.getType()));
- assertEquals(ASDCConfiguration.VF_MODULES_METADATA, elementInfoFromVfModule.getType());
+ assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromVfModule.getType()));
+ assertEquals(ASDCConfiguration.VF_MODULES_METADATA, elementInfoFromVfModule.getType());
- assertFalse(elementInfoFromVfModule.toString().contains("MyInfo2: someValue"));
- elementInfoFromVfModule.addElementInfo("MyInfo2", "someValue");
- assertTrue(elementInfoFromVfModule.toString().contains("MyInfo2: someValue"));
- }
+ assertFalse(elementInfoFromVfModule.toString().contains("MyInfo2: someValue"));
+ elementInfoFromVfModule.addElementInfo("MyInfo2", "someValue");
+ assertTrue(elementInfoFromVfModule.toString().contains("MyInfo2: someValue"));
+ }
- @Test
- public void createASDCElementInfoFromArtifact() {
- for (String eVal : ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST) {
- String generatedArtifactName = eVal + " 1";
- UUID generatedUUIDForArtifact = UUID.randomUUID();
+ @Test
+ public void createASDCElementInfoFromArtifact() {
+ for (String eVal : ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST) {
+ String generatedArtifactName = eVal + " 1";
+ UUID generatedUUIDForArtifact = UUID.randomUUID();
- IArtifactInfo artifactInfo = Mockito.mock(IArtifactInfo.class);
- Mockito.when(artifactInfo.getArtifactType()).thenReturn(eVal);
- Mockito.when(artifactInfo.getArtifactName()).thenReturn(generatedArtifactName);
- Mockito.when(artifactInfo.getArtifactUUID()).thenReturn(generatedUUIDForArtifact.toString());
+ IArtifactInfo artifactInfo = Mockito.mock(IArtifactInfo.class);
+ Mockito.when(artifactInfo.getArtifactType()).thenReturn(eVal);
+ Mockito.when(artifactInfo.getArtifactName()).thenReturn(generatedArtifactName);
+ Mockito.when(artifactInfo.getArtifactUUID()).thenReturn(generatedUUIDForArtifact.toString());
- ASDCElementInfo elementInfoFromArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(artifactInfo);
+ ASDCElementInfo elementInfoFromArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(artifactInfo);
- assertTrue(elementInfoFromArtifact.toString().contains(generatedArtifactName));
- assertTrue(elementInfoFromArtifact.toString().contains(generatedUUIDForArtifact.toString()));
+ assertTrue(elementInfoFromArtifact.toString().contains(generatedArtifactName));
+ assertTrue(elementInfoFromArtifact.toString().contains(generatedUUIDForArtifact.toString()));
- assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromArtifact.getType()));
- assertEquals(eVal, elementInfoFromArtifact.getType());
+ assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromArtifact.getType()));
+ assertEquals(eVal, elementInfoFromArtifact.getType());
- assertFalse(elementInfoFromArtifact.toString().contains("MyInfo3: someValue"));
- elementInfoFromArtifact.addElementInfo("MyInfo3", "someValue");
- assertTrue(elementInfoFromArtifact.toString().contains("MyInfo3: someValue"));
- }
- }
+ assertFalse(elementInfoFromArtifact.toString().contains("MyInfo3: someValue"));
+ elementInfoFromArtifact.addElementInfo("MyInfo3", "someValue");
+ assertTrue(elementInfoFromArtifact.toString().contains("MyInfo3: someValue"));
+ }
+ }
}