use of com.netflix.conductor.common.run.Workflow in project conductor by Netflix.
the class TestElasticSearchRestDAOV6 method shouldIndexWorkflow.
@Test
public void shouldIndexWorkflow() {
Workflow workflow = TestUtils.loadWorkflowSnapshot("workflow");
WorkflowSummary summary = new WorkflowSummary(workflow);
indexDAO.indexWorkflow(workflow);
assertWorkflowSummary(workflow.getWorkflowId(), summary);
}
use of com.netflix.conductor.common.run.Workflow in project conductor by Netflix.
the class TestElasticSearchRestDAOV6 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));
}
use of com.netflix.conductor.common.run.Workflow in project conductor by Netflix.
the class TestElasticSearchDAOV6 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());
}
use of com.netflix.conductor.common.run.Workflow in project conductor by Netflix.
the class TestElasticSearchDAOV6 method shouldSearchRecentRunningWorkflows.
@Test
public void shouldSearchRecentRunningWorkflows() throws Exception {
Workflow oldWorkflow = TestUtils.loadWorkflowSnapshot("workflow");
oldWorkflow.setStatus(Workflow.WorkflowStatus.RUNNING);
oldWorkflow.setUpdateTime(new DateTime().minusHours(2).toDate().getTime());
Workflow recentWorkflow = TestUtils.loadWorkflowSnapshot("workflow");
recentWorkflow.setStatus(Workflow.WorkflowStatus.RUNNING);
recentWorkflow.setUpdateTime(new DateTime().minusHours(1).toDate().getTime());
Workflow tooRecentWorkflow = TestUtils.loadWorkflowSnapshot("workflow");
tooRecentWorkflow.setStatus(Workflow.WorkflowStatus.RUNNING);
tooRecentWorkflow.setUpdateTime(new DateTime().toDate().getTime());
indexDAO.indexWorkflow(oldWorkflow);
indexDAO.indexWorkflow(recentWorkflow);
indexDAO.indexWorkflow(tooRecentWorkflow);
Thread.sleep(1000);
List<String> ids = indexDAO.searchRecentRunningWorkflows(2, 1);
assertEquals(1, ids.size());
assertEquals(recentWorkflow.getWorkflowId(), ids.get(0));
}
use of com.netflix.conductor.common.run.Workflow in project conductor by Netflix.
the class TestElasticSearchDAOV6 method shouldRemoveWorkflow.
@Test
public void shouldRemoveWorkflow() {
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.removeWorkflow(workflow.getWorkflowId());
workflows = tryFindResults(() -> searchWorkflows(workflow.getWorkflowId()), 0);
assertTrue("Workflow was not removed.", workflows.isEmpty());
}
Aggregations