use of com.netflix.conductor.common.metadata.workflow.WorkflowTask in project conductor by Netflix.
the class MetadataMapperServiceTest method testExceptionWhenWorkflowDefinitionNotAvailable.
@Test(expected = TerminateWorkflowException.class)
public void testExceptionWhenWorkflowDefinitionNotAvailable() {
String nameTaskDefinition = "taskSubworkflow8";
String workflowDefinitionName = "subworkflow";
WorkflowTask workflowTask = createWorkflowTask(nameTaskDefinition);
workflowTask.setWorkflowTaskType(TaskType.SUB_WORKFLOW);
SubWorkflowParams subWorkflowParams = new SubWorkflowParams();
subWorkflowParams.setName(workflowDefinitionName);
workflowTask.setSubWorkflowParam(subWorkflowParams);
WorkflowDef workflowDefinition = createWorkflowDefinition("testMetadataPopulation");
workflowDefinition.setTasks(ImmutableList.of(workflowTask));
when(metadataDAO.getLatestWorkflowDef(workflowDefinitionName)).thenReturn(Optional.empty());
metadataMapperService.populateTaskDefinitions(workflowDefinition);
verify(metadataDAO).getLatestWorkflowDef(workflowDefinitionName);
}
use of com.netflix.conductor.common.metadata.workflow.WorkflowTask in project conductor by Netflix.
the class WorkflowTaskTypeConstraintTest method testWorkflowTaskTypeDecision.
@Test
public void testWorkflowTaskTypeDecision() {
WorkflowTask workflowTask = createSampleWorkflowTask();
workflowTask.setType("DECISION");
when(mockMetadataDao.getTaskDef(anyString())).thenReturn(new TaskDef());
Set<ConstraintViolation<WorkflowTask>> result = validator.validate(workflowTask);
assertEquals(2, 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"));
assertTrue(validationErrors.contains("caseValueParam or caseExpression field is required for taskType: DECISION taskName: encode"));
}
use of com.netflix.conductor.common.metadata.workflow.WorkflowTask in project conductor by Netflix.
the class WorkflowTaskTypeConstraintTest method testWorkflowTaskTypeKafkaPublishWithRequestParamMissing.
@Test
public void testWorkflowTaskTypeKafkaPublishWithRequestParamMissing() {
WorkflowTask workflowTask = createSampleWorkflowTask();
workflowTask.setType("KAFKA_PUBLISH");
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.kafka_request field is required for taskType: KAFKA_PUBLISH taskName: encode"));
}
use of com.netflix.conductor.common.metadata.workflow.WorkflowTask 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.workflow.WorkflowTask 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());
}
Aggregations