use of com.netflix.conductor.common.metadata.workflow.WorkflowTask in project conductor by Netflix.
the class WorkflowDefValidatorTest method testWorkflowDefConstraintsWithMultipleEnvVariable.
@Test
public void testWorkflowDefConstraintsWithMultipleEnvVariable() {
WorkflowDef workflowDef = new WorkflowDef();
workflowDef.setSchemaVersion(2);
workflowDef.setName("test_env");
workflowDef.setOwnerEmail("owner@test.com");
WorkflowTask workflowTask_1 = new WorkflowTask();
workflowTask_1.setName("task_1");
workflowTask_1.setTaskReferenceName("task_1");
workflowTask_1.setType(TaskType.TASK_TYPE_SIMPLE);
Map<String, Object> inputParam = new HashMap<>();
inputParam.put("taskId", "${CPEWF_TASK_ID}");
inputParam.put("entryPoint", "${NETFLIX_ENVIRONMENT} ${NETFLIX_STACK} ${CPEWF_TASK_ID} ${workflow.input.status}");
workflowTask_1.setInputParameters(inputParam);
WorkflowTask workflowTask_2 = new WorkflowTask();
workflowTask_2.setName("task_2");
workflowTask_2.setTaskReferenceName("task_2");
workflowTask_2.setType(TaskType.TASK_TYPE_SIMPLE);
Map<String, Object> inputParam2 = new HashMap<>();
inputParam2.put("env", inputParam);
workflowTask_2.setInputParameters(inputParam2);
List<WorkflowTask> tasks = new ArrayList<>();
tasks.add(workflowTask_1);
tasks.add(workflowTask_2);
workflowDef.setTasks(tasks);
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Validator validator = factory.getValidator();
Set<ConstraintViolation<Object>> result = validator.validate(workflowDef);
assertEquals(0, result.size());
}
use of com.netflix.conductor.common.metadata.workflow.WorkflowTask in project conductor by Netflix.
the class WorkflowDefValidatorTest method testWorkflowDefConstraintsDualEnvVariable.
@Test
public void testWorkflowDefConstraintsDualEnvVariable() {
// name is null
WorkflowDef workflowDef = new WorkflowDef();
workflowDef.setSchemaVersion(2);
workflowDef.setName("test_env");
workflowDef.setOwnerEmail("owner@test.com");
WorkflowTask workflowTask_1 = new WorkflowTask();
workflowTask_1.setName("task_1");
workflowTask_1.setTaskReferenceName("task_1");
workflowTask_1.setType(TaskType.TASK_TYPE_SIMPLE);
Map<String, Object> inputParam = new HashMap<>();
inputParam.put("taskId", "${CPEWF_TASK_ID} ${NETFLIX_STACK}");
workflowTask_1.setInputParameters(inputParam);
List<WorkflowTask> tasks = new ArrayList<>();
tasks.add(workflowTask_1);
workflowDef.setTasks(tasks);
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Validator validator = factory.getValidator();
Set<ConstraintViolation<Object>> result = validator.validate(workflowDef);
assertEquals(0, result.size());
}
use of com.netflix.conductor.common.metadata.workflow.WorkflowTask in project conductor by Netflix.
the class WorkflowDefValidatorTest method testWorkflowOwnerValidEmail.
@Test
public void testWorkflowOwnerValidEmail() {
WorkflowDef workflowDef = new WorkflowDef();
workflowDef.setName("test_env");
workflowDef.setOwnerEmail("owner@test.com");
WorkflowTask workflowTask = new WorkflowTask();
workflowTask.setName("t1");
workflowTask.setWorkflowTaskType(TaskType.SIMPLE);
workflowTask.setTaskReferenceName("t1");
Map<String, Object> map = new HashMap<>();
map.put("blabla", "");
workflowTask.setInputParameters(map);
workflowDef.getTasks().add(workflowTask);
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Validator validator = factory.getValidator();
Set<ConstraintViolation<Object>> result = validator.validate(workflowDef);
assertEquals(0, result.size());
}
use of com.netflix.conductor.common.metadata.workflow.WorkflowTask in project conductor by Netflix.
the class WorkflowTaskTest method testOptional.
@Test
public void testOptional() {
WorkflowTask task = new WorkflowTask();
assertFalse(task.isOptional());
task.setOptional(Boolean.FALSE);
assertFalse(task.isOptional());
task.setOptional(Boolean.TRUE);
assertTrue(task.isOptional());
}
use of com.netflix.conductor.common.metadata.workflow.WorkflowTask in project conductor by Netflix.
the class Task method copy.
public Task copy() {
Task copy = new Task();
copy.setCallbackAfterSeconds(callbackAfterSeconds);
copy.setCallbackFromWorker(callbackFromWorker);
copy.setCorrelationId(correlationId);
copy.setInputData(inputData);
copy.setOutputData(outputData);
copy.setReferenceTaskName(referenceTaskName);
copy.setStartDelayInSeconds(startDelayInSeconds);
copy.setTaskDefName(taskDefName);
copy.setTaskType(taskType);
copy.setWorkflowInstanceId(workflowInstanceId);
copy.setWorkflowType(workflowType);
copy.setResponseTimeoutSeconds(responseTimeoutSeconds);
copy.setStatus(status);
copy.setRetryCount(retryCount);
copy.setPollCount(pollCount);
copy.setTaskId(taskId);
copy.setWorkflowTask(workflowTask);
copy.setDomain(domain);
copy.setInputMessage(inputMessage);
copy.setOutputMessage(outputMessage);
copy.setRateLimitPerFrequency(rateLimitPerFrequency);
copy.setRateLimitFrequencyInSeconds(rateLimitFrequencyInSeconds);
copy.setExternalInputPayloadStoragePath(externalInputPayloadStoragePath);
copy.setExternalOutputPayloadStoragePath(externalOutputPayloadStoragePath);
copy.setWorkflowPriority(workflowPriority);
copy.setIteration(iteration);
copy.setExecutionNameSpace(executionNameSpace);
copy.setIsolationGroupId(isolationGroupId);
copy.setSubWorkflowId(getSubWorkflowId());
return copy;
}
Aggregations