Search in sources :

Example 16 with FramedMetaverseNode

use of org.pentaho.metaverse.frames.FramedMetaverseNode in project pentaho-metaverse by pentaho.

the class MetaverseValidationIT method testCsvFileInputStep.

@Test
public void testCsvFileInputStep() throws Exception {
    // this is testing a specific CsvFileInputStep instance
    CsvFileInputStepNode csvFileInputStepNode = root.getCsvFileInputStepNode();
    assertNotNull(csvFileInputStepNode);
    Iterable<FramedMetaverseNode> inputFiles = csvFileInputStepNode.getInputFiles();
    int countInputFiles = getIterableSize(inputFiles);
    int countOutputs = getIterableSize(csvFileInputStepNode.getOutputStreamFields());
    assertEquals(1, countInputFiles);
    assertEquals(10, countOutputs);
    for (FramedMetaverseNode inputFile : inputFiles) {
        assertTrue(inputFile.getName().endsWith("customers-100.txt"));
    }
    assertEquals("CSV file input", csvFileInputStepNode.getStepType());
    int fileFieldCount = 0;
    Iterable<StreamFieldNode> outFields = csvFileInputStepNode.getOutputStreamFields();
    for (StreamFieldNode outField : outFields) {
        assertNotNull(outField.getKettleType());
        FieldNode fieldPopulatesMe = outField.getFieldPopulatesMe();
        assertNotNull(fieldPopulatesMe);
        assertEquals(DictionaryConst.NODE_TYPE_FILE_FIELD, fieldPopulatesMe.getType());
        assertEquals(csvFileInputStepNode, fieldPopulatesMe.getStepThatInputsMe());
        fileFieldCount++;
    }
    assertEquals(countOutputs, fileFieldCount);
}
Also used : FieldNode(org.pentaho.metaverse.frames.FieldNode) StreamFieldNode(org.pentaho.metaverse.frames.StreamFieldNode) StreamFieldNode(org.pentaho.metaverse.frames.StreamFieldNode) FramedMetaverseNode(org.pentaho.metaverse.frames.FramedMetaverseNode) CsvFileInputStepNode(org.pentaho.metaverse.frames.CsvFileInputStepNode) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)16 FramedMetaverseNode (org.pentaho.metaverse.frames.FramedMetaverseNode)16 StreamFieldNode (org.pentaho.metaverse.frames.StreamFieldNode)14 FieldNode (org.pentaho.metaverse.frames.FieldNode)4 HashSet (java.util.HashSet)3 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)3 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)3 TransMeta (org.pentaho.di.trans.TransMeta)3 HTTPMeta (org.pentaho.di.trans.steps.http.HTTPMeta)2 RestMeta (org.pentaho.di.trans.steps.rest.RestMeta)2 TextFileOutputMeta (org.pentaho.di.trans.steps.textfileoutput.TextFileOutputMeta)2 CsvFileInputStepNode (org.pentaho.metaverse.frames.CsvFileInputStepNode)2 FixedFileInputStepNode (org.pentaho.metaverse.frames.FixedFileInputStepNode)2 HttpClientStepNode (org.pentaho.metaverse.frames.HttpClientStepNode)2 HttpPostStepNode (org.pentaho.metaverse.frames.HttpPostStepNode)2 RestClientStepNode (org.pentaho.metaverse.frames.RestClientStepNode)2 TextFileOutputStepNode (org.pentaho.metaverse.frames.TextFileOutputStepNode)2 ExcelField (org.pentaho.di.trans.steps.exceloutput.ExcelField)1 ExcelOutputMeta (org.pentaho.di.trans.steps.exceloutput.ExcelOutputMeta)1 HTTPPOSTMeta (org.pentaho.di.trans.steps.httppost.HTTPPOSTMeta)1