Package uk.org.ogsadai.activity

Examples of uk.org.ogsadai.activity.MockOutputPipe


        });
        activity.addInput(BuildClassifierMultiInputActivity.INPUT_NOMINAL_VALUES, nominalValuesInput0);
        activity.addInput(BuildClassifierMultiInputActivity.INPUT_NOMINAL_VALUES, nominalValuesInput1);
        activity.addInput(BuildClassifierMultiInputActivity.INPUT_NOMINAL_VALUES, nominalValuesInput4);

        MockOutputPipe output = new MockOutputPipe(new Object[] {});
        activity.addOutput(BuildClassifierMultiInputActivity.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();
       
        List actualBlocks = outputClassify.getActualBlocks();
        assertEquals(input.size(), actualBlocks.size());
        assertEquals(ControlBlock.LIST_BEGIN, actualBlocks.get(0));
        for (int i=2; i<actualBlocks.size()-1; i++)
        {
            assertEquals("Unexpected class",
View Full Code Here


        });
        activity.addInput(BuildClassifierMultiInputActivity.INPUT_NOMINAL_VALUES, nominalValuesInput0);
        activity.addInput(BuildClassifierMultiInputActivity.INPUT_NOMINAL_VALUES, nominalValuesInput1);
        activity.addInput(BuildClassifierMultiInputActivity.INPUT_NOMINAL_VALUES, nominalValuesInput4);

        MockOutputPipe output = new MockOutputPipe(new Object[] {});
        activity.addOutput(BuildClassifierMultiInputActivity.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();
       
        List actualBlocks = outputClassify.getActualBlocks();
        assertEquals(input.size(), actualBlocks.size());
        assertEquals(ControlBlock.LIST_BEGIN, actualBlocks.get(0));
        for (int i=2; i<actualBlocks.size()-1; i++)
        {
            assertEquals("Unexpected class",
View Full Code Here

                new SimpleTuple(Arrays.asList(new Object[] {1, "90"})),
                new SimpleTuple(Arrays.asList(new Object[] {2, "10 20"})),
                ControlBlock.LIST_END
        });
       
        MockOutputPipe output = new MockOutputPipe(new Object[] {});
        activity.addInput("data", input);
        activity.addOutput("data", output);
       
        activity.process();

        System.out.println(output.getActualBlocks());
        List actual = output.getActualBlocks();
        assertEquals(ControlBlock.LIST_BEGIN, actual.get(0));
        Tuple tuple = (Tuple)actual.get(2);
        assertEquals(1, tuple.getInt(0));
        List list = (List)tuple.getObject(1);
        assertEquals(2, list.size());
View Full Code Here

                  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();
         
          List actualBlocks = outputClassify.getActualBlocks();
          assertEquals(input.size(), actualBlocks.size());
          assertEquals(ControlBlock.LIST_BEGIN, actualBlocks.get(0));
          for (int i=2; i<actualBlocks.size()-1; i++)
          {
              assertEquals("Unexpected class",
View Full Code Here

                ControlBlock.LIST_END
            });
        EvaluateActivity activity = new EvaluateActivity();
        activity.addInput(EvaluateActivity.INPUT_EXPECTED, inputExpected);
        activity.addInput(EvaluateActivity.INPUT_PREDICTED, inputPredicted);
        MockOutputPipe output = new MockOutputPipe(new Object[]{});
        activity.addOutput(EvaluateActivity.OUTPUT, output);
        activity.process();
       
        List actualBlocks = output.getActualBlocks();
        System.out.println(actualBlocks);
        assertEquals(ControlBlock.LIST_BEGIN, actualBlocks.get(0));
        assertEquals(ControlBlock.LIST_END, actualBlocks.get(actualBlocks.size()-1));
        Tuple tuple1 = (Tuple)actualBlocks.get(2);
        assertEquals("no", tuple1.getString(0));
View Full Code Here

                ControlBlock.LIST_END
            });
        EvaluateActivity activity = new EvaluateActivity();
        activity.addInput(EvaluateActivity.INPUT_EXPECTED, inputExpected);
        activity.addInput(EvaluateActivity.INPUT_PREDICTED, inputPredicted);
        MockOutputPipe output = new MockOutputPipe(new Object[]{});
        activity.addOutput(EvaluateActivity.OUTPUT, output);
        try
        {
            activity.process();
            fail("UnmatchedActivityInputsException expected");
View Full Code Here

                new SimpleTuple(Arrays.asList(new Object[] {1, v1})),               
                new SimpleTuple(Arrays.asList(new Object[] {2, v2})),
                ControlBlock.LIST_END
        });
       
        MockOutputPipe output = new MockOutputPipe(new Object[] {});
        activity.addInput("data", input);
        activity.addOutput("data", output);
       
        activity.process();

        System.out.println(output.getActualBlocks());
    }
View Full Code Here

                "MAX(B)",
                "MIN(B)",
                ControlBlock.LIST_END
        });
        activity.addInput(GroupByActivity.INPUT_AGGREGATES, aggregatesInput);
        MockOutputPipe output = new MockOutputPipe(new Object[] {});
        activity.addOutput(GroupByActivity.OUTPUT_DATA, output);
       
        activity.process();
        List actual = output.getActualBlocks();
        Iterator iterator = actual.iterator();
        assertTrue(iterator.hasNext());
        assertEquals(ControlBlock.LIST_BEGIN, iterator.next());
        assertTrue(iterator.hasNext());
        assertTrue(iterator.next() instanceof MetadataWrapper);
View Full Code Here

       
        activity.addInput(ConvertToTupleActivity.INPUT_NAME, nameInput);
        activity.addInput(ConvertToTupleActivity.INPUT_TYPE, typeInput);
        activity.addInput(ConvertToTupleActivity.INPUT_DATA, dataInput);
       
        MockOutputPipe output = new MockOutputPipe(new Object[] {});
        activity.addOutput(ConvertToTupleActivity.OUTPUT, output);
       
        activity.process();
              
        List blocks = output.getActualBlocks();
        TupleMetadata meta = (TupleMetadata) ((MetadataWrapper) blocks.get(1)).getMetadata();
       
        assertEquals("column name is different", name, meta.getColumnMetadata(0).getName());
        assertEquals("column type is different", type, meta.getColumnMetadata(0).getType());
       
View Full Code Here

       
        activity.addInput(ConvertToTupleActivity.INPUT_NAME, nameInput);
        activity.addInput(ConvertToTupleActivity.INPUT_TYPE, typeInput);
        activity.addInput(ConvertToTupleActivity.INPUT_DATA, dataInput);
       
        MockOutputPipe output = new MockOutputPipe(new Object[] {});
        activity.addOutput(ConvertToTupleActivity.OUTPUT, output);
       
        activity.process();
              
        List blocks = output.getActualBlocks();
        TupleMetadata meta = (TupleMetadata) ((MetadataWrapper) blocks.get(1)).getMetadata();
       
        assertEquals("column name is different", name, meta.getColumnMetadata(0).getName());
        assertEquals("column type is different", type, meta.getColumnMetadata(0).getType());
       
View Full Code Here

TOP

Related Classes of uk.org.ogsadai.activity.MockOutputPipe

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.