Search in sources :

Example 6 with ASDCElementInfo

use of org.onap.so.asdc.installer.ASDCElementInfo in project so by onap.

the class ASDCElementInfoTest method createASDCElementInfoFromArtifact.

@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());
        ASDCElementInfo elementInfoFromArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(artifactInfo);
        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(elementInfoFromArtifact.toString().contains("MyInfo3: someValue"));
        elementInfoFromArtifact.addElementInfo("MyInfo3", "someValue");
        assertTrue(elementInfoFromArtifact.toString().contains("MyInfo3: someValue"));
    }
}
Also used : ASDCElementInfo(org.onap.so.asdc.installer.ASDCElementInfo) IArtifactInfo(org.onap.sdc.api.notification.IArtifactInfo) UUID(java.util.UUID) Test(org.junit.Test)

Aggregations

ASDCElementInfo (org.onap.so.asdc.installer.ASDCElementInfo)6 Test (org.junit.Test)4 UUID (java.util.UUID)3 VfResourceStructure (org.onap.so.asdc.installer.VfResourceStructure)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 ArrayList (java.util.ArrayList)2 ConstraintViolationException (org.hibernate.exception.ConstraintViolationException)2 LockAcquisitionException (org.hibernate.exception.LockAcquisitionException)2 INotificationData (org.onap.sdc.api.notification.INotificationData)2 IResourceInstance (org.onap.sdc.api.notification.IResourceInstance)2 ArtifactInstallerException (org.onap.so.asdc.client.exceptions.ArtifactInstallerException)2 Service (org.onap.so.db.catalog.beans.Service)2 WatchdogComponentDistributionStatus (org.onap.so.db.request.beans.WatchdogComponentDistributionStatus)2 ObjectOptimisticLockingFailureException (org.springframework.orm.ObjectOptimisticLockingFailureException)2 IArtifactInfo (org.onap.sdc.api.notification.IArtifactInfo)1 IEntityDetails (org.onap.sdc.tosca.parser.api.IEntityDetails)1 Metadata (org.onap.sdc.toscaparser.api.elements.Metadata)1 IVfModuleData (org.onap.so.asdc.installer.IVfModuleData)1 VfModuleStructure (org.onap.so.asdc.installer.VfModuleStructure)1 Transactional (org.springframework.transaction.annotation.Transactional)1