use of com.netflix.conductor.common.metadata.workflow.WorkflowDef in project conductor by Netflix.
the class ConstraintParamUtilTest method testExtractParamPathComponentsWithValidMap.
@Test
public void testExtractParamPathComponentsWithValidMap() {
WorkflowDef workflowDef = constructWorkflowDef();
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} ${workflow.input.status}");
Map<String, Object> envInputParam = new HashMap<>();
envInputParam.put("packageId", "${workflow.input.packageId}");
envInputParam.put("taskId", "${CPEWF_TASK_ID}");
envInputParam.put("NETFLIX_STACK", "${NETFLIX_STACK}");
envInputParam.put("NETFLIX_ENVIRONMENT", "${NETFLIX_ENVIRONMENT}");
envInputParam.put("TEST_ENV", "${TEST_ENV}");
inputParam.put("env", envInputParam);
workflowTask_1.setInputParameters(inputParam);
List<WorkflowTask> tasks = new ArrayList<>();
tasks.add(workflowTask_1);
workflowDef.setTasks(tasks);
List<String> results = ConstraintParamUtil.validateInputParam(inputParam, "task_1", workflowDef);
assertEquals(results.size(), 0);
}
use of com.netflix.conductor.common.metadata.workflow.WorkflowDef in project conductor by Netflix.
the class ConstraintParamUtilTest method testExtractParamPathComponentsWithValidEnvVariable.
@Test
public void testExtractParamPathComponentsWithValidEnvVariable() {
WorkflowDef workflowDef = constructWorkflowDef();
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} ${workflow.input.status}");
workflowTask_1.setInputParameters(inputParam);
List<WorkflowTask> tasks = new ArrayList<>();
tasks.add(workflowTask_1);
workflowDef.setTasks(tasks);
List<String> results = ConstraintParamUtil.validateInputParam(inputParam, "task_1", workflowDef);
assertEquals(results.size(), 0);
}
use of com.netflix.conductor.common.metadata.workflow.WorkflowDef in project conductor by Netflix.
the class ConstraintParamUtilTest method testExtractParamPathComponentsWithListInputParamWithEmptyString.
@Test
public void testExtractParamPathComponentsWithListInputParamWithEmptyString() {
WorkflowDef workflowDef = constructWorkflowDef();
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", new String[] { "" });
workflowTask_1.setInputParameters(inputParam);
List<WorkflowTask> tasks = new ArrayList<>();
tasks.add(workflowTask_1);
workflowDef.setTasks(tasks);
List<String> results = ConstraintParamUtil.validateInputParam(inputParam, "task_1", workflowDef);
assertEquals(results.size(), 0);
}
use of com.netflix.conductor.common.metadata.workflow.WorkflowDef in project conductor by Netflix.
the class ConstraintParamUtilTest method testExtractParamPathComponentsWithInvalidEnv.
@Test
public void testExtractParamPathComponentsWithInvalidEnv() {
WorkflowDef workflowDef = constructWorkflowDef();
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} ${workflow.input.status}");
Map<String, Object> envInputParam = new HashMap<>();
envInputParam.put("packageId", "${workflow.input.packageId}");
envInputParam.put("taskId", "${CPEWF_TASK_ID}");
envInputParam.put("TEST_ENV1", "${TEST_ENV1}");
inputParam.put("env", envInputParam);
workflowTask_1.setInputParameters(inputParam);
List<WorkflowTask> tasks = new ArrayList<>();
tasks.add(workflowTask_1);
workflowDef.setTasks(tasks);
List<String> results = ConstraintParamUtil.validateInputParam(inputParam, "task_1", workflowDef);
assertEquals(results.size(), 1);
}
use of com.netflix.conductor.common.metadata.workflow.WorkflowDef in project conductor by Netflix.
the class ConstraintParamUtilTest method testExtractParamPathComponentsWithMissingEnvVariable.
@Test
public void testExtractParamPathComponentsWithMissingEnvVariable() {
WorkflowDef workflowDef = constructWorkflowDef();
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);
List<String> results = ConstraintParamUtil.validateInputParam(inputParam, "task_1", workflowDef);
assertEquals(results.size(), 0);
}
Aggregations