use of org.pentaho.metaverse.frames.TransExecutorStepNode in project pentaho-metaverse by pentaho.
the class MetaverseValidationIT method testTransExecutorStepNode.
@Test
public void testTransExecutorStepNode() throws Exception {
TransExecutorStepNode transExecutorStepNode = root.getTransExecutorStepNode();
assertNotNull(transExecutorStepNode);
TransExecutorMeta meta = (TransExecutorMeta) getStepMeta(transExecutorStepNode);
assertEquals(meta.getParentStepMeta().getName(), transExecutorStepNode.getName());
assertEquals(meta.getOutputRowsSourceStep(), transExecutorStepNode.getOutputRowsTargetStepName());
assertEquals(meta.getResultFilesTargetStep(), transExecutorStepNode.getResultFilesTargetStepName());
assertEquals(meta.getExecutionResultTargetStep(), transExecutorStepNode.getExecutionResultsTargetStepName());
assertNotNull(transExecutorStepNode.getOutputStepByName(meta.getOutputRowsSourceStep()));
assertNotNull(transExecutorStepNode.getOutputStepByName(meta.getResultFilesTargetStep()));
assertNotNull(transExecutorStepNode.getOutputStepByName(meta.getExecutionResultTargetStep()));
RowMetaInterface incomingRow = meta.getParentStepMeta().getParentTransMeta().getPrevStepFields(meta.getParentStepMeta());
int incomingFieldCount = incomingRow.size();
Iterable<StreamFieldNode> streamFieldNodes = transExecutorStepNode.getOutputStreamFields();
int countOutputStreamFieldNode = getIterableSize(streamFieldNodes);
List<String> outputFields = Arrays.asList(meta.getOutputRowsField());
for (StreamFieldNode streamFieldNode : streamFieldNodes) {
assertNotNull(streamFieldNode.getKettleType());
if (outputFields.contains(streamFieldNode.getName())) {
// this field came back to us from the sub trans via a result, lets make sure they link up
assertEquals(transExecutorStepNode.getTransToExecute(), streamFieldNode.getFieldNodesThatDeriveMe().iterator().next().getStepThatOutputsMe().getTransNode());
}
}
streamFieldNodes = transExecutorStepNode.getStreamFieldNodesDeletes();
int countDeletedStreamFieldNode = getIterableSize(streamFieldNodes);
for (StreamFieldNode streamFieldNode : streamFieldNodes) {
assertNotNull(streamFieldNode.getKettleType());
}
assertNotNull(transExecutorStepNode.getTransToExecute());
streamFieldNodes = transExecutorStepNode.getStreamFieldNodesUses();
int countUsedStreamFieldNode = getIterableSize(streamFieldNodes);
for (StreamFieldNode streamFieldNode : streamFieldNodes) {
assertNotNull(streamFieldNode.getKettleType());
// these should link up to stream fields in the sub trans via the "get rows from result" step
for (StreamFieldNode derived : streamFieldNode.getFieldNodesDerivedFromMe()) {
// the trans that is to be executed should contain the step that creates a field derived from the incoming field
assertEquals(transExecutorStepNode.getTransToExecute(), derived.getStepThatInputsMe().getTransNode());
}
}
assertEquals(incomingFieldCount, countUsedStreamFieldNode);
}
Aggregations