use of com.netflix.conductor.common.run.SearchResult in project conductor by Netflix.
the class WorkflowServiceTest method testSearchWorkflowsByTasksV2.
@Test
public void testSearchWorkflowsByTasksV2() {
Workflow workflow = new Workflow();
workflow.setCorrelationId("c123");
List<Workflow> listOfWorkflow = Collections.singletonList(workflow);
SearchResult<Workflow> searchResult = new SearchResult<>(1, listOfWorkflow);
when(mockExecutionService.searchWorkflowByTasksV2("*", "*", 0, 100, Collections.singletonList("asc"))).thenReturn(searchResult);
assertEquals(searchResult, workflowService.searchWorkflowsByTasksV2(0, 100, "asc", "*", "*"));
when(mockExecutionService.searchWorkflowByTasksV2("*", "*", 0, 100, Collections.singletonList("asc"))).thenReturn(searchResult);
assertEquals(searchResult, workflowService.searchWorkflowsByTasksV2(0, 100, Collections.singletonList("asc"), "*", "*"));
}
use of com.netflix.conductor.common.run.SearchResult in project conductor by Netflix.
the class WorkflowServiceTest method testSearchWorkflows.
@Test
public void testSearchWorkflows() {
Workflow workflow = new Workflow();
workflow.setCorrelationId("c123");
WorkflowSummary workflowSummary = new WorkflowSummary(workflow);
List<WorkflowSummary> listOfWorkflowSummary = new ArrayList<WorkflowSummary>() {
{
add(workflowSummary);
}
};
SearchResult<WorkflowSummary> searchResult = new SearchResult<WorkflowSummary>(100, listOfWorkflowSummary);
when(mockExecutionService.search("*", "*", 0, 100, Collections.singletonList("asc"))).thenReturn(searchResult);
assertEquals(searchResult, workflowService.searchWorkflows(0, 100, "asc", "*", "*"));
when(mockExecutionService.search("*", "*", 0, 100, Collections.singletonList("asc"))).thenReturn(searchResult);
assertEquals(searchResult, workflowService.searchWorkflows(0, 100, Collections.singletonList("asc"), "*", "*"));
}
use of com.netflix.conductor.common.run.SearchResult in project conductor by Netflix.
the class WorkflowServiceTest method testSearchWorkflowsV2.
@Test
public void testSearchWorkflowsV2() {
Workflow workflow = new Workflow();
workflow.setCorrelationId("c123");
List<Workflow> listOfWorkflow = Collections.singletonList(workflow);
SearchResult<Workflow> searchResult = new SearchResult<>(1, listOfWorkflow);
when(mockExecutionService.searchV2("*", "*", 0, 100, Collections.singletonList("asc"))).thenReturn(searchResult);
assertEquals(searchResult, workflowService.searchWorkflowsV2(0, 100, "asc", "*", "*"));
when(mockExecutionService.searchV2("*", "*", 0, 100, Collections.singletonList("asc"))).thenReturn(searchResult);
assertEquals(searchResult, workflowService.searchWorkflowsV2(0, 100, Collections.singletonList("asc"), "*", "*"));
}
use of com.netflix.conductor.common.run.SearchResult in project conductor by Netflix.
the class ExecutionService method searchWorkflowByTasks.
public SearchResult<WorkflowSummary> searchWorkflowByTasks(String query, String freeText, int start, int size, List<String> sortOptions) {
SearchResult<TaskSummary> taskSummarySearchResult = searchTasks(query, freeText, start, size, sortOptions);
List<WorkflowSummary> workflowSummaries = taskSummarySearchResult.getResults().stream().parallel().map(taskSummary -> {
try {
String workflowId = taskSummary.getWorkflowId();
return new WorkflowSummary(executionDAOFacade.getWorkflowById(workflowId, false));
} catch (Exception e) {
logger.error("Error fetching workflow by id: {}", taskSummary.getWorkflowId(), e);
return null;
}
}).filter(Objects::nonNull).distinct().collect(Collectors.toList());
int missing = taskSummarySearchResult.getResults().size() - workflowSummaries.size();
long totalHits = taskSummarySearchResult.getTotalHits() - missing;
return new SearchResult<>(totalHits, workflowSummaries);
}
use of com.netflix.conductor.common.run.SearchResult in project conductor by Netflix.
the class WorkflowServiceTest method testSearchWorkflowsByTasks.
@Test
public void testSearchWorkflowsByTasks() {
Workflow workflow = new Workflow();
workflow.setCorrelationId("c123");
WorkflowSummary workflowSummary = new WorkflowSummary(workflow);
List<WorkflowSummary> listOfWorkflowSummary = new ArrayList<WorkflowSummary>() {
{
add(workflowSummary);
}
};
SearchResult<WorkflowSummary> searchResult = new SearchResult<>(100, listOfWorkflowSummary);
when(mockExecutionService.searchWorkflowByTasks("*", "*", 0, 100, Collections.singletonList("asc"))).thenReturn(searchResult);
assertEquals(searchResult, workflowService.searchWorkflowsByTasks(0, 100, "asc", "*", "*"));
when(mockExecutionService.searchWorkflowByTasks("*", "*", 0, 100, Collections.singletonList("asc"))).thenReturn(searchResult);
assertEquals(searchResult, workflowService.searchWorkflowsByTasks(0, 100, Collections.singletonList("asc"), "*", "*"));
}
Aggregations