Search in sources :

Example 1 with MergeJoinStepNode

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

the class MetaverseValidationIT method testMergeJoinStepNode_duplicateFieldNames.

@Test
public void testMergeJoinStepNode_duplicateFieldNames() throws Exception {
    MergeJoinStepNode node = root.getMergeJoinStepNode();
    MergeJoinMeta meta = (MergeJoinMeta) getStepMeta(node);
    assertEquals(meta.getJoinType(), node.getJoinType());
    assertEquals(meta.getKeyFields1().length, node.getJoinFieldsLeft().size());
    assertEquals(meta.getKeyFields2().length, node.getJoinFieldsRight().size());
    Iterable<StreamFieldNode> usedFields = node.getStreamFieldNodesUses();
    for (StreamFieldNode usedField : usedFields) {
        boolean isOnLeft = node.getJoinFieldsLeft().contains(usedField.getName());
        boolean isOnRight = node.getJoinFieldsRight().contains(usedField.getName());
        assertTrue(isOnLeft || isOnRight);
        assertTrue(usedField.getFieldNodesThatIJoinTo() != null);
        assertTrue(usedField.getFieldNodesThatJoinToMe() != null);
    }
    Iterable<StreamFieldNode> outputFields = node.getOutputStreamFields();
    assertEquals(getExpectedOutputFieldCount(meta), getIterableSize(outputFields));
    for (StreamFieldNode outputField : outputFields) {
        // these should have derives links
        assertTrue(outputField.getFieldNodesThatDeriveMe() != null);
    }
}
Also used : MergeJoinMeta(org.pentaho.di.trans.steps.mergejoin.MergeJoinMeta) StreamFieldNode(org.pentaho.metaverse.frames.StreamFieldNode) MergeJoinStepNode(org.pentaho.metaverse.frames.MergeJoinStepNode) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 MergeJoinMeta (org.pentaho.di.trans.steps.mergejoin.MergeJoinMeta)1 MergeJoinStepNode (org.pentaho.metaverse.frames.MergeJoinStepNode)1 StreamFieldNode (org.pentaho.metaverse.frames.StreamFieldNode)1