use of org.onap.so.db.catalog.beans.Workflow in project so by onap.
the class MSOInfrastructureApplication method deployCustomWorkflows.
public void deployCustomWorkflows(DeploymentBuilder deploymentBuilder) {
logger.debug("Attempting to deploy custom workflows");
try {
List<Workflow> workflows = catalogDbClient.findWorkflowBySource(SDC_SOURCE);
if (workflows != null && !workflows.isEmpty()) {
for (Workflow workflow : workflows) {
String workflowName = workflow.getName();
String workflowBody = workflow.getBody();
if (!workflowName.endsWith(BPMN_SUFFIX)) {
workflowName += BPMN_SUFFIX;
}
if (workflowBody != null) {
logger.info(LoggingAnchor.TWO, "Deploying custom workflow", workflowName);
deploymentBuilder.addString(workflowName, workflowBody);
}
deploymentBuilder.enableDuplicateFiltering(true);
}
deploymentBuilder.deploy();
}
} catch (Exception e) {
logger.warn("Unable to deploy custom workflows ", e);
}
}
use of org.onap.so.db.catalog.beans.Workflow in project so by onap.
the class WorkflowResourceTest method installWorkflowResource_Test.
@Transactional
@Test
public void installWorkflowResource_Test() throws Exception {
Workflow workflow = new Workflow();
workflow.setArtifactChecksum("12345");
workflow.setArtifactName("myTestWorkflow1");
workflow.setArtifactUUID("a5c59864-8407-4175-8060-de8ff95eab41");
workflow.setBody("my body");
workflow.setDescription("testing workflow");
workflow.setName("myTestWorkflow1");
workflow.setResourceTarget("vnf");
workflow.setSource("sdc");
workflow.setTimeoutMinutes(5000);
workflow.setOperationName("myTestWorkflow");
workflow.setVersion(1.0);
VnfResourceWorkflow vnfResourceWorkflow = new VnfResourceWorkflow();
vnfResourceWorkflow.setVnfResourceModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
vnfResourceWorkflow.setWorkflow(workflow);
List<VnfResourceWorkflow> vnfResourceWorkflows = new ArrayList<VnfResourceWorkflow>();
vnfResourceWorkflows.add(vnfResourceWorkflow);
workflow.setVnfResourceWorkflow(vnfResourceWorkflows);
WorkflowActivitySpecSequence wfss1 = new WorkflowActivitySpecSequence();
wfss1.setActivitySpecId(1);
wfss1.setWorkflow(workflow);
wfss1.setSeqNo(1);
List<WorkflowActivitySpecSequence> wfss = new ArrayList<WorkflowActivitySpecSequence>();
wfss.add(wfss1);
workflow.setWorkflowActivitySpecSequence(wfss);
workflowRepo.save(workflow);
assertNotNull(workflow);
}
use of org.onap.so.db.catalog.beans.Workflow in project so by onap.
the class ServiceLevelPreparationTest method setUpPnfUpgradeTest.
@Before
public void setUpPnfUpgradeTest() {
execution.setVariable(RESOURCE_TYPE, TEST_PNF_SCOPE);
execution.setVariable(TEST_PROCESS_KEY, PROCESS_KEY_VALUE);
execution.setVariable(BPMN_REQUEST, "bpmnRequestValue");
execution.setVariable(SERVICE_INSTANCE_ID, "serviceInstanceIdValue");
execution.setVariable(PNF_NAME, "PnfDemo");
invalidExecution.setVariables(execution.getVariables());
Workflow pnfWorkflow = new Workflow();
pnfWorkflow.setName(PNF_HEALTH_CHECK_WORKFLOW);
pnfWorkflow.setOperationName(HEALTH_CHECK_OPERATION);
pnfWorkflow.setResourceTarget(TEST_PNF_SCOPE);
workflowList.add(pnfWorkflow);
when(catalogDbClient.findWorkflowByOperationName(HEALTH_CHECK_OPERATION)).thenReturn(workflowList);
}
use of org.onap.so.db.catalog.beans.Workflow in project so by onap.
the class ServiceLevelTest method fetchWorkflowUsingScope_catalogDBReturnsNotEmpty.
@Test
public void fetchWorkflowUsingScope_catalogDBReturnsNotEmpty() {
// given
Workflow workflow = new Workflow();
workflow.setResourceTarget(SCOPE);
workflow.setName(WORKFLOW_NAME);
List<Workflow> workflowList = new ArrayList<>();
workflowList.add(workflow);
when(catalogDbClientMock.findWorkflowByOperationName(OPERATION_NAME)).thenReturn(workflowList);
// when
String workflowResult = testedObject.fetchWorkflowUsingScope(SCOPE, OPERATION_NAME);
// then
assertThat(workflowResult).isEqualTo(WORKFLOW_NAME);
}
use of org.onap.so.db.catalog.beans.Workflow in project so by onap.
the class CatalogDbClientTest method getWorkflowByArtifactUUID_invalidUuid_nullOutput.
@Test
public void getWorkflowByArtifactUUID_invalidUuid_nullOutput() {
Workflow workflow = client.findWorkflowByArtifactUUID(UUID.randomUUID().toString());
assertNull(workflow);
}
Aggregations