use of com.netflix.conductor.common.metadata.tasks.TaskDef in project conductor by Netflix.
the class WorkflowTaskTypeConstraintTest method testWorkflowTaskTypeDecisionWithCaseParam.
@Test
public void testWorkflowTaskTypeDecisionWithCaseParam() {
WorkflowTask workflowTask = createSampleWorkflowTask();
workflowTask.setType("DECISION");
workflowTask.setCaseExpression("$.valueCheck == null ? 'true': 'false'");
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("decisionCases should have atleast one task for taskType: DECISION taskName: encode"));
}
use of com.netflix.conductor.common.metadata.tasks.TaskDef in project conductor by Netflix.
the class WorkflowTaskTypeConstraintTest method testWorkflowTaskTypeKafkaPublish.
@Test
public void testWorkflowTaskTypeKafkaPublish() {
WorkflowTask workflowTask = createSampleWorkflowTask();
workflowTask.setType("KAFKA_PUBLISH");
workflowTask.getInputParameters().put("kafka_request", "testInput");
when(mockMetadataDao.getTaskDef(anyString())).thenReturn(new TaskDef());
Set<ConstraintViolation<WorkflowTask>> result = validator.validate(workflowTask);
assertEquals(0, result.size());
}
use of com.netflix.conductor.common.metadata.tasks.TaskDef 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.tasks.TaskDef 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.tasks.TaskDef 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