use of org.pentaho.metaverse.frames.FilterRowsStepNode in project pentaho-metaverse by pentaho.
the class MetaverseValidationIT method testFilterRowsStepNode.
@Test
public void testFilterRowsStepNode() throws Exception {
FilterRowsStepNode node = root.getFilterRowsStepNode("Filter rows");
assertNotNull(node);
assertEquals("Filter rows", node.getStepType());
FilterRowsMeta meta = (FilterRowsMeta) getStepMeta(node);
Operations ops = MetaverseUtil.convertOperationsStringToMap(node.getOperations());
assertEquals(1, ops.get(ChangeType.DATA_FLOW).size());
assertEquals(meta.getCondition().toString(), ops.get(ChangeType.DATA_FLOW).get(0).getDescription());
// should not be any created nodes
Iterable<StreamFieldNode> streamFieldNodes = node.getStreamFieldNodesCreates();
int countCreatedStreamFieldNode = getIterableSize(streamFieldNodes);
assertEquals(0, countCreatedStreamFieldNode);
// should not be any deleted nodes
streamFieldNodes = node.getStreamFieldNodesCreates();
int countDeletedStreamFieldNode = getIterableSize(streamFieldNodes);
assertEquals(0, countDeletedStreamFieldNode);
// should use all of the fields that are used in the condition of the step
List<String> expectedUses = Arrays.asList(meta.getCondition().getUsedFields());
streamFieldNodes = node.getStreamFieldNodesUses();
int countUsedStreamFieldNode = getIterableSize(streamFieldNodes);
assertEquals(expectedUses.size(), countUsedStreamFieldNode);
for (StreamFieldNode streamFieldNode : streamFieldNodes) {
assertTrue(expectedUses.contains(streamFieldNode.getName()));
}
}
Aggregations