use of org.pentaho.metaverse.frames.StreamLookupStepNode in project pentaho-metaverse by pentaho.
the class MetaverseValidationIT method testStreamLookupStepNode.
@Test
public void testStreamLookupStepNode() throws Exception {
StreamLookupStepNode node = root.getStreamLookupStepNode();
assertEquals(6, getIterableSize(node.getInputStreamFields()));
assertEquals(3, getIterableSize(node.getStreamFieldNodesUses()));
assertEquals(5, getIterableSize(node.getOutputStreamFields()));
List<String> expectations = new ArrayList<>();
expectations.add("territory");
expectations.add("country_ref");
Iterator<StreamFieldNode> iter1 = node.getOutputStreamFields().iterator();
while (iter1.hasNext()) {
StreamFieldNode outField = iter1.next();
if (expectations.contains(outField.getName())) {
assertEquals(1, getIterableSize(outField.getFieldNodesThatDeriveMe()));
Iterator<StreamFieldNode> iter2 = outField.getFieldNodesThatDeriveMe().iterator();
while (iter2.hasNext()) {
StreamFieldNode derivedFromNode = iter2.next();
assertTrue(expectations.contains(derivedFromNode.getName()));
}
}
}
iter1 = node.getStreamFieldNodesUses().iterator();
while (iter1.hasNext()) {
StreamFieldNode usesNode = iter1.next();
if (usesNode.getName().equals("country_code") || usesNode.getName().equals("country_code")) {
assertEquals(1, getIterableSize(usesNode.getFieldNodesThatJoinToMe()));
StreamFieldNode joinField = usesNode.getFieldNodesThatJoinToMe().iterator().next();
if (usesNode.getName().equals("country_code")) {
assertEquals("code", joinField.getName());
} else {
assertEquals("country_code", joinField.getName());
}
}
}
}
Aggregations