Search in sources :

Example 1 with Workflow

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);
    }
}
Also used : Workflow(org.onap.so.db.catalog.beans.Workflow)

Example 2 with Workflow

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);
}
Also used : VnfResourceWorkflow(org.onap.so.db.catalog.beans.VnfResourceWorkflow) ArrayList(java.util.ArrayList) Workflow(org.onap.so.db.catalog.beans.Workflow) VnfResourceWorkflow(org.onap.so.db.catalog.beans.VnfResourceWorkflow) WorkflowActivitySpecSequence(org.onap.so.db.catalog.beans.WorkflowActivitySpecSequence) BaseTest(org.onap.so.asdc.BaseTest) Test(org.junit.Test) Transactional(javax.transaction.Transactional)

Example 3 with 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);
}
Also used : Workflow(org.onap.so.db.catalog.beans.Workflow) Before(org.junit.Before)

Example 4 with Workflow

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);
}
Also used : ArrayList(java.util.ArrayList) Workflow(org.onap.so.db.catalog.beans.Workflow) Test(org.junit.Test)

Example 5 with Workflow

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);
}
Also used : Workflow(org.onap.so.db.catalog.beans.Workflow) Test(org.junit.Test) CatalogDbAdapterBaseTest(org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest)

Aggregations

Workflow (org.onap.so.db.catalog.beans.Workflow)14 Test (org.junit.Test)9 ArrayList (java.util.ArrayList)4 CatalogDbAdapterBaseTest (org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest)3 Transactional (javax.transaction.Transactional)2 BaseTest (org.onap.so.asdc.BaseTest)2 VnfResourceWorkflow (org.onap.so.db.catalog.beans.VnfResourceWorkflow)2 WorkflowActivitySpecSequence (org.onap.so.db.catalog.beans.WorkflowActivitySpecSequence)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 File (java.io.File)1 Before (org.junit.Before)1 IArtifactInfo (org.onap.sdc.api.notification.IArtifactInfo)1 NotificationDataImpl (org.onap.so.asdc.client.test.emulators.NotificationDataImpl)1 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)1 BaseTest (org.onap.so.db.catalog.BaseTest)1 HttpEntity (org.springframework.http.HttpEntity)1 Client (uk.co.blackpepper.bowman.Client)1