Search in sources :

Example 1 with CsvFileInputStepNode

use of org.pentaho.metaverse.frames.CsvFileInputStepNode 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)1 CsvFileInputStepNode (org.pentaho.metaverse.frames.CsvFileInputStepNode)1 FieldNode (org.pentaho.metaverse.frames.FieldNode)1 FramedMetaverseNode (org.pentaho.metaverse.frames.FramedMetaverseNode)1 StreamFieldNode (org.pentaho.metaverse.frames.StreamFieldNode)1