use of org.onap.sdc.api.notification.IArtifactInfo in project so by onap.
the class WorkflowResource method installWorkflowResource.
protected void installWorkflowResource(WorkflowArtifact artifact, String vfResourceModelUuid) throws Exception {
IArtifactInfo artifactInfo = artifact.getArtifactInfo();
Workflow workflow = new Workflow();
workflow.setArtifactChecksum(artifactInfo.getArtifactChecksum());
workflow.setArtifactName(artifactInfo.getArtifactName());
workflow.setArtifactUUID(artifactInfo.getArtifactUUID());
workflow.setBody(artifact.getResult());
workflow.setDescription(artifactInfo.getArtifactDescription());
workflow.setName(getWorkflowNameFromArtifactName(artifactInfo.getArtifactName()));
workflow.setResourceTarget(TARGET_RESOURCE_VNF);
workflow.setSource(SOURCE_SDC);
workflow.setTimeoutMinutes(artifactInfo.getArtifactTimeout());
workflow.setOperationName(getWorkflowNameFromArtifactName(artifactInfo.getArtifactName()));
workflow.setVersion(getWorkflowVersionFromArtifactName(artifactInfo.getArtifactName()));
VnfResourceWorkflow vnfResourceWorkflow = new VnfResourceWorkflow();
vnfResourceWorkflow.setVnfResourceModelUUID(vfResourceModelUuid);
vnfResourceWorkflow.setWorkflow(workflow);
List<VnfResourceWorkflow> vnfResourceWorkflows = new ArrayList<>();
vnfResourceWorkflows.add(vnfResourceWorkflow);
workflow.setVnfResourceWorkflow(vnfResourceWorkflows);
List<String> activityNames = getActivityNameList(artifact.getResult());
List<WorkflowActivitySpecSequence> wfss = getWorkflowActivitySpecSequence(activityNames, workflow);
workflow.setWorkflowActivitySpecSequence(wfss);
workflowRepo.save(workflow);
}
use of org.onap.sdc.api.notification.IArtifactInfo 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"));
}
}
Aggregations