Search in sources :

Example 1 with FixedFileInputStepNode

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

the class MetaverseValidationIT method testFixedFileInputStep.

@Test
public void testFixedFileInputStep() throws Exception {
    // this is testing a specific FixedFileInputStep instance
    FixedFileInputStepNode fixedFileInputStepNode = root.getFixedFileInputStepNode();
    assertNotNull(fixedFileInputStepNode);
    Iterable<FramedMetaverseNode> inputFiles = fixedFileInputStepNode.getInputFiles();
    int countInputFiles = getIterableSize(inputFiles);
    assertEquals(1, countInputFiles);
    for (FramedMetaverseNode inputFile : inputFiles) {
        assertTrue(inputFile.getName().endsWith("Textfile input - fixed length sample data.txt"));
    }
    assertEquals("Fixed file input", fixedFileInputStepNode.getStepType());
    int countFileFieldNode = getIterableSize(fixedFileInputStepNode.getFileFieldNodesUses());
    assertEquals(0, countFileFieldNode);
    int countOutputs = getIterableSize(fixedFileInputStepNode.getOutputStreamFields());
    int fileFieldCount = 0;
    Iterable<StreamFieldNode> outFields = fixedFileInputStepNode.getOutputStreamFields();
    for (StreamFieldNode outField : outFields) {
        assertNotNull(outField.getKettleType());
        FieldNode fieldPopulatesMe = outField.getFieldPopulatesMe();
        assertNotNull(fieldPopulatesMe);
        assertEquals(DictionaryConst.NODE_TYPE_FILE_FIELD, fieldPopulatesMe.getType());
        assertEquals(fixedFileInputStepNode, 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) FixedFileInputStepNode(org.pentaho.metaverse.frames.FixedFileInputStepNode) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 FieldNode (org.pentaho.metaverse.frames.FieldNode)1 FixedFileInputStepNode (org.pentaho.metaverse.frames.FixedFileInputStepNode)1 FramedMetaverseNode (org.pentaho.metaverse.frames.FramedMetaverseNode)1 StreamFieldNode (org.pentaho.metaverse.frames.StreamFieldNode)1