use of org.pentaho.di.trans.steps.numberrange.NumberRangeMeta in project pentaho-metaverse by pentaho.
the class MetaverseValidationIT method testNumberRangeStepNode_newField.
@Test
public void testNumberRangeStepNode_newField() throws Exception {
TransformationStepNode numberRangeStepNode = root.getStepNode("number_range", "Number range");
assertEquals(1, getIterableSize(numberRangeStepNode.getStreamFieldNodesUses()));
StreamFieldNode usesNode = null;
for (StreamFieldNode node : numberRangeStepNode.getStreamFieldNodesUses()) {
usesNode = node;
break;
}
NumberRangeMeta meta = (NumberRangeMeta) getStepMeta(numberRangeStepNode);
assertEquals(meta.getInputField(), usesNode.getName());
assertNull(usesNode.getOperations());
Iterable<StreamFieldNode> outFields = numberRangeStepNode.getOutputStreamFields();
int countOutputs = getIterableSize(outFields);
assertEquals(2, countOutputs);
for (StreamFieldNode outField : outFields) {
assertNotNull(outField.getKettleType());
if (outField.getName().equals(meta.getOutputField())) {
Iterable<StreamFieldNode> fieldNodesThatDeriveMe = outField.getFieldNodesThatDeriveMe();
assertNotNull(fieldNodesThatDeriveMe);
int derivesCount = getIterableSize(outField.getFieldNodesThatDeriveMe());
assertEquals(1, derivesCount);
for (FieldNode derives : outField.getFieldNodesThatDeriveMe()) {
assertEquals(usesNode.getName(), derives.getName());
assertEquals(usesNode.getType(), derives.getType());
}
Operations ops = MetaverseUtil.convertOperationsStringToMap(outField.getOperations());
List<IOperation> dataOps = ops.get(ChangeType.DATA);
assertNotNull(dataOps);
assertEquals(3, dataOps.size());
for (IOperation dataOp : dataOps) {
assertEquals(Operation.MAPPING_CATEGORY, dataOp.getCategory());
assertEquals(DictionaryConst.PROPERTY_TRANSFORMS, dataOp.getName());
assertTrue(dataOp.toString().contains(meta.getInputField()));
}
// there should not be any metadata operations
assertNull(ops.get(ChangeType.METADATA));
}
}
}
Aggregations