{
BuildIterationalClassifierActivity activity = new BuildIterationalClassifierActivity();
List<Object> input = buildInputTable();
MockInputPipe dataInput = new MockInputPipe(input.toArray());
activity.addInput(BuildIterationalClassifierActivity.INPUT_DATA, dataInput);
MockInputPipe classIndexInput = new MockInputPipe(new Object[] {4});
activity.addInput(BuildIterationalClassifierActivity.INPUT_CLASS_INDEX, classIndexInput);
MockInputPipe nominalColumnsInput = new MockInputPipe(new Object[] {
ControlBlock.LIST_BEGIN,
0, 1, 4,
ControlBlock.LIST_END
});
activity.addInput(BuildIterationalClassifierActivity.INPUT_COLUMN_INDICES, nominalColumnsInput);
MockInputPipe nominalValuesInput = new MockInputPipe(new Object[] {
ControlBlock.LIST_BEGIN,
ControlBlock.LIST_BEGIN, "sunny", "overcast", "rain", ControlBlock.LIST_END,
ControlBlock.LIST_BEGIN, "true", "false", ControlBlock.LIST_END,
ControlBlock.LIST_BEGIN, "yes", "no", ControlBlock.LIST_END,
ControlBlock.LIST_END
});
activity.addInput(BuildIterationalClassifierActivity.INPUT_NOMINAL_VALUES, nominalValuesInput);
MockOutputPipe output = new MockOutputPipe(new Object[] {});
activity.addOutput(BuildIterationalClassifierActivity.CLASSIFIER_OUTPUT, output);
activity.process();
TupleClassifier classifier = (TupleClassifier)output.getActualBlocks().get(0);
System.out.println(classifier);
ClassifyActivity classify = new ClassifyActivity();
MockInputPipe inputClassifier = new MockInputPipe(classifier);
classify.addInput(ClassifyActivity.INPUT_CLASSIFIER, inputClassifier);
MockInputPipe inputData = new MockInputPipe(buildInputTable().toArray());
classify.addInput(ClassifyActivity.INPUT_DATA, inputData);
MockOutputPipe outputClassify = new MockOutputPipe(new Object[] {});
classify.addOutput(ClassifyActivity.OUTPUT, outputClassify);
classify.process();