TaskStep extends Step implements ProvidesValidations, InstantiatesComponents { public void run(Map<String, Dataset<Row>> dependencies) { Task task = ComponentFactory.create(Task.class, getTaskConfig(config), true); task.run(dependencies); this.setState(StepState.FINISHED); } TaskStep(String name); void run(Map<String, Dataset<Row>> dependencies); @Override Step copy(); @Override Validations getValidations(); @Override Set<InstantiatedComponent> getComponents(Config config, boolean configure); static final String TASK_CONFIG; }
@Test public void testCustomTask() { customTaskGlobal = ""; Map<String, Object> taskStepConfigMap = Maps.newHashMap(); taskStepConfigMap.put(ComponentFactory.TYPE_CONFIG_NAME, "task"); taskStepConfigMap.put(TaskStep.TASK_CONFIG + "." + ComponentFactory.TYPE_CONFIG_NAME, CustomTask.class.getName()); taskStepConfigMap.put(TaskStep.TASK_CONFIG + "." + "value", "hello"); Config taskStepConfig = ConfigFactory.parseMap(taskStepConfigMap); TaskStep taskStep = new TaskStep("task_step"); ValidationAssert.assertNoValidationFailures(taskStep, taskStepConfig); taskStep.configure(taskStepConfig); taskStep.run(Maps.<String, Dataset<Row>>newHashMap()); assertEquals(customTaskGlobal, "hello"); }