Search in sources :

Example 46 with Workflow

use of com.netflix.conductor.common.run.Workflow in project conductor by Netflix.

the class TestElasticSearchRestDAOV7 method shouldAsyncUpdateWorkflow.

@Test
public void shouldAsyncUpdateWorkflow() throws Exception {
    Workflow workflow = TestUtils.loadWorkflowSnapshot("workflow");
    WorkflowSummary summary = new WorkflowSummary(workflow);
    indexDAO.indexWorkflow(workflow);
    indexDAO.asyncUpdateWorkflow(workflow.getWorkflowId(), new String[] { "status" }, new Object[] { Workflow.WorkflowStatus.FAILED }).get();
    summary.setStatus(Workflow.WorkflowStatus.FAILED);
    assertWorkflowSummary(workflow.getWorkflowId(), summary);
}
Also used : WorkflowSummary(com.netflix.conductor.common.run.WorkflowSummary) Workflow(com.netflix.conductor.common.run.Workflow) Test(org.junit.Test)

Example 47 with Workflow

use of com.netflix.conductor.common.run.Workflow in project conductor by Netflix.

the class TestElasticSearchRestDAOV7 method shouldIndexTask.

@Test
public void shouldIndexTask() {
    Workflow workflow = TestUtils.loadWorkflowSnapshot("workflow");
    Task task = workflow.getTasks().get(0);
    TaskSummary summary = new TaskSummary(task);
    indexDAO.indexTask(task);
    List<String> tasks = tryFindResults(() -> searchTasks(workflow));
    assertEquals(summary.getTaskId(), tasks.get(0));
}
Also used : Task(com.netflix.conductor.common.metadata.tasks.Task) TaskSummary(com.netflix.conductor.common.run.TaskSummary) Workflow(com.netflix.conductor.common.run.Workflow) Test(org.junit.Test)

Example 48 with Workflow

use of com.netflix.conductor.common.run.Workflow in project conductor by Netflix.

the class TestElasticSearchRestDAOV7 method shouldIndexTaskAsync.

@Test
public void shouldIndexTaskAsync() throws Exception {
    Workflow workflow = TestUtils.loadWorkflowSnapshot("workflow");
    Task task = workflow.getTasks().get(0);
    TaskSummary summary = new TaskSummary(task);
    indexDAO.asyncIndexTask(task).get();
    List<String> tasks = tryFindResults(() -> searchTasks(workflow));
    assertEquals(summary.getTaskId(), tasks.get(0));
}
Also used : Task(com.netflix.conductor.common.metadata.tasks.Task) TaskSummary(com.netflix.conductor.common.run.TaskSummary) Workflow(com.netflix.conductor.common.run.Workflow) Test(org.junit.Test)

Example 49 with Workflow

use of com.netflix.conductor.common.run.Workflow in project conductor by Netflix.

the class TestElasticSearchRestDAOV7 method shouldIndexWorkflow.

@Test
public void shouldIndexWorkflow() {
    Workflow workflow = TestUtils.loadWorkflowSnapshot("workflow");
    WorkflowSummary summary = new WorkflowSummary(workflow);
    indexDAO.indexWorkflow(workflow);
    assertWorkflowSummary(workflow.getWorkflowId(), summary);
}
Also used : WorkflowSummary(com.netflix.conductor.common.run.WorkflowSummary) Workflow(com.netflix.conductor.common.run.Workflow) Test(org.junit.Test)

Example 50 with Workflow

use of com.netflix.conductor.common.run.Workflow in project conductor by Netflix.

the class TestElasticSearchRestDAOV7 method shouldAsyncRemoveWorkflow.

@Test
public void shouldAsyncRemoveWorkflow() throws Exception {
    Workflow workflow = TestUtils.loadWorkflowSnapshot("workflow");
    indexDAO.indexWorkflow(workflow);
    // wait for workflow to be indexed
    List<String> workflows = tryFindResults(() -> searchWorkflows(workflow.getWorkflowId()), 1);
    assertEquals(1, workflows.size());
    indexDAO.asyncRemoveWorkflow(workflow.getWorkflowId()).get();
    workflows = tryFindResults(() -> searchWorkflows(workflow.getWorkflowId()), 0);
    assertTrue("Workflow was not removed.", workflows.isEmpty());
}
Also used : Workflow(com.netflix.conductor.common.run.Workflow) Test(org.junit.Test)

Aggregations

Workflow (com.netflix.conductor.common.run.Workflow)360 Test (org.junit.Test)259 Task (com.netflix.conductor.common.metadata.tasks.Task)246 WorkflowTask (com.netflix.conductor.common.metadata.workflow.WorkflowTask)206 HashMap (java.util.HashMap)154 WorkflowDef (com.netflix.conductor.common.metadata.workflow.WorkflowDef)149 SubWorkflow (com.netflix.conductor.core.execution.tasks.SubWorkflow)130 TaskDef (com.netflix.conductor.common.metadata.tasks.TaskDef)97 UserTask (com.netflix.conductor.tests.utils.UserTask)73 LinkedList (java.util.LinkedList)57 Map (java.util.Map)55 List (java.util.List)54 ApplicationException (com.netflix.conductor.core.execution.ApplicationException)52 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)50 Collections (java.util.Collections)36 Collectors (java.util.stream.Collectors)35 Logger (org.slf4j.Logger)35 LoggerFactory (org.slf4j.LoggerFactory)35 TaskResult (com.netflix.conductor.common.metadata.tasks.TaskResult)34 WorkflowSystemTask (com.netflix.conductor.core.execution.tasks.WorkflowSystemTask)34