Search in sources :

Example 11 with StartWorkflowRequest

use of com.netflix.conductor.common.metadata.workflow.StartWorkflowRequest in project conductor by Netflix.

the class ExclusiveJoinEndToEndTest method testDecision1TrueAndDecision2True.

@Test
public void testDecision1TrueAndDecision2True() {
    workflowInput.put("decision_1", "true");
    workflowInput.put("decision_2", "true");
    StartWorkflowRequest startWorkflowRequest = new StartWorkflowRequest().withName(CONDUCTOR_WORKFLOW_DEF_NAME).withCorrelationId("").withInput(workflowInput).withVersion(1);
    String wfInstanceId = workflowClient.startWorkflow(startWorkflowRequest);
    String taskId = taskClient.getPendingTaskForWorkflow(wfInstanceId, "task1").getTaskId();
    taskOutput.put("taskReferenceName", "task1");
    TaskResult taskResult = setTaskResult(wfInstanceId, taskId, TaskResult.Status.COMPLETED, taskOutput);
    taskClient.updateTask(taskResult);
    taskId = taskClient.getPendingTaskForWorkflow(wfInstanceId, "task2").getTaskId();
    taskOutput.put("taskReferenceName", "task2");
    taskResult = setTaskResult(wfInstanceId, taskId, TaskResult.Status.COMPLETED, taskOutput);
    taskClient.updateTask(taskResult);
    taskId = taskClient.getPendingTaskForWorkflow(wfInstanceId, "task3").getTaskId();
    taskOutput.put("taskReferenceName", "task3");
    taskResult = setTaskResult(wfInstanceId, taskId, TaskResult.Status.COMPLETED, taskOutput);
    taskClient.updateTask(taskResult);
    Workflow workflow = workflowClient.getWorkflow(wfInstanceId, true);
    String taskReferenceName = workflow.getTaskByRefName("exclusiveJoin").getOutputData().get("taskReferenceName").toString();
    assertEquals("task3", taskReferenceName);
    assertEquals(Workflow.WorkflowStatus.COMPLETED, workflow.getStatus());
}
Also used : StartWorkflowRequest(com.netflix.conductor.common.metadata.workflow.StartWorkflowRequest) TaskResult(com.netflix.conductor.common.metadata.tasks.TaskResult) Workflow(com.netflix.conductor.common.run.Workflow) Test(org.junit.Test)

Aggregations

StartWorkflowRequest (com.netflix.conductor.common.metadata.workflow.StartWorkflowRequest)11 Test (org.junit.Test)9 TaskResult (com.netflix.conductor.common.metadata.tasks.TaskResult)7 Workflow (com.netflix.conductor.common.run.Workflow)7 WorkflowDef (com.netflix.conductor.common.metadata.workflow.WorkflowDef)3 Task (com.netflix.conductor.common.metadata.tasks.Task)2 WorkflowTask (com.netflix.conductor.common.metadata.workflow.WorkflowTask)2 WorkflowSummary (com.netflix.conductor.common.run.WorkflowSummary)2 HashMap (java.util.HashMap)2 Value (com.google.protobuf.Value)1 TaskDef (com.netflix.conductor.common.metadata.tasks.TaskDef)1 ApplicationException (com.netflix.conductor.core.execution.ApplicationException)1 Object (java.lang.Object)1 String (java.lang.String)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1 Mockito.anyString (org.mockito.Mockito.anyString)1