Search in sources :

Example 1 with SelectValuesTransStepNode

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

the class MetaverseValidationIT method testSelectValuesStep.

@Test
public void testSelectValuesStep() throws Exception {
    // this tests a specific select values step. the one in trans "Populate Table From File"
    SelectValuesTransStepNode selectValues = root.getSelectValuesStepNode();
    assertNotNull(selectValues);
    int countUses = getIterableSize(selectValues.getStreamFieldNodesUses());
    int countOutputs = getIterableSize(selectValues.getOutputStreamFields());
    int countInputs = getIterableSize(selectValues.getInputStreamFields());
    assertEquals(9, countUses);
    SelectValuesMeta meta = (SelectValuesMeta) getStepMeta(selectValues);
    assertEquals(getExpectedOutputFieldCount(meta), countOutputs);
    assertEquals(9, countInputs);
    assertEquals("Select values", selectValues.getStepType());
    for (StreamFieldNode node : selectValues.getOutputStreamFields()) {
        // check for operations
        if (node.getOperations() != null) {
            Operations ops = MetaverseUtil.convertOperationsStringToMap(node.getOperations());
            assertNotNull(ops);
            List<IOperation> metadataOps = ops.get(ChangeType.METADATA);
            assertNotNull(metadataOps);
            assertTrue(metadataOps.size() > 0);
            // there should not be any data operations on nodes touched by this step
            assertNull(ops.get(ChangeType.DATA));
        }
        // check the created node is derived from something
        Iterable<StreamFieldNode> deriveNodes = node.getFieldNodesThatDeriveMe();
        for (StreamFieldNode deriveNode : deriveNodes) {
            assertNotNull(deriveNode);
        }
    }
}
Also used : IOperation(org.pentaho.metaverse.api.model.IOperation) SelectValuesMeta(org.pentaho.di.trans.steps.selectvalues.SelectValuesMeta) StreamFieldNode(org.pentaho.metaverse.frames.StreamFieldNode) Operations(org.pentaho.metaverse.api.model.Operations) SelectValuesTransStepNode(org.pentaho.metaverse.frames.SelectValuesTransStepNode) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 SelectValuesMeta (org.pentaho.di.trans.steps.selectvalues.SelectValuesMeta)1 IOperation (org.pentaho.metaverse.api.model.IOperation)1 Operations (org.pentaho.metaverse.api.model.Operations)1 SelectValuesTransStepNode (org.pentaho.metaverse.frames.SelectValuesTransStepNode)1 StreamFieldNode (org.pentaho.metaverse.frames.StreamFieldNode)1