use of com.netflix.conductor.common.metadata.workflow.WorkflowTask in project conductor by Netflix.
the class WorkflowTaskTypeConstraintTest method testWorkflowTaskTypeForJoinDynamicWithForJoinTaskParamAndInputTaskParam.
@Test
public void testWorkflowTaskTypeForJoinDynamicWithForJoinTaskParamAndInputTaskParam() {
WorkflowTask workflowTask = createSampleWorkflowTask();
workflowTask.setType("FORK_JOIN_DYNAMIC");
workflowTask.setDynamicForkJoinTasksParam("taskList");
workflowTask.setDynamicForkTasksInputParamName("ForkTaskInputParam");
workflowTask.setDynamicForkTasksParam("ForkTasksParam");
when(mockMetadataDao.getTaskDef(anyString())).thenReturn(new TaskDef());
Set<ConstraintViolation<WorkflowTask>> result = validator.validate(workflowTask);
assertEquals(1, result.size());
List<String> validationErrors = new ArrayList<>();
result.forEach(e -> validationErrors.add(e.getMessage()));
assertTrue(validationErrors.contains("dynamicForkJoinTasksParam or combination of dynamicForkTasksInputParamName and dynamicForkTasksParam cam be used for taskType: FORK_JOIN_DYNAMIC taskName: encode"));
}
use of com.netflix.conductor.common.metadata.workflow.WorkflowTask in project conductor by Netflix.
the class WorkflowTaskTypeConstraintTest method testWorkflowTaskTypeHTTPWithHttpParamMissing.
@Test
public void testWorkflowTaskTypeHTTPWithHttpParamMissing() {
WorkflowTask workflowTask = createSampleWorkflowTask();
workflowTask.setType("HTTP");
when(mockMetadataDao.getTaskDef(anyString())).thenReturn(new TaskDef());
Set<ConstraintViolation<WorkflowTask>> result = validator.validate(workflowTask);
assertEquals(1, result.size());
List<String> validationErrors = new ArrayList<>();
result.forEach(e -> validationErrors.add(e.getMessage()));
assertTrue(validationErrors.contains("inputParameters.http_request field is required for taskType: HTTP taskName: encode"));
}
use of com.netflix.conductor.common.metadata.workflow.WorkflowTask in project conductor by Netflix.
the class WorkflowTaskTypeConstraintTest method testWorkflowTaskTypeTerminateWithInvalidStatus.
@Test
public void testWorkflowTaskTypeTerminateWithInvalidStatus() {
WorkflowTask workflowTask = createSampleWorkflowTask();
workflowTask.setType(TaskType.TASK_TYPE_TERMINATE);
workflowTask.setName("terminate_task");
workflowTask.setInputParameters(Collections.singletonMap(Terminate.getTerminationStatusParameter(), "blah"));
List<String> validationErrors = getErrorMessages(workflowTask);
Assert.assertEquals(1, validationErrors.size());
Assert.assertEquals("terminate task must have an terminationStatus parameter and must be set to COMPLETED or FAILED, taskName: terminate_task", validationErrors.get(0));
}
use of com.netflix.conductor.common.metadata.workflow.WorkflowTask in project conductor by Netflix.
the class WorkflowTaskTypeConstraintTest method createSampleWorkflowTask.
private WorkflowTask createSampleWorkflowTask() {
WorkflowTask workflowTask = new WorkflowTask();
workflowTask.setName("encode");
workflowTask.setTaskReferenceName("encode");
workflowTask.setType("FORK_JOIN_DYNAMIC");
Map<String, Object> inputParam = new HashMap<>();
inputParam.put("fileLocation", "${workflow.input.fileLocation}");
workflowTask.setInputParameters(inputParam);
return workflowTask;
}
use of com.netflix.conductor.common.metadata.workflow.WorkflowTask in project conductor by Netflix.
the class WorkflowTaskTypeConstraintTest method testWorkflowTaskTypeEvent.
@Test
public void testWorkflowTaskTypeEvent() {
WorkflowTask workflowTask = createSampleWorkflowTask();
workflowTask.setType("EVENT");
when(mockMetadataDao.getTaskDef(anyString())).thenReturn(new TaskDef());
Set<ConstraintViolation<WorkflowTask>> result = validator.validate(workflowTask);
assertEquals(1, result.size());
assertEquals(result.iterator().next().getMessage(), "sink field is required for taskType: EVENT taskName: encode");
}
Aggregations