use of org.pentaho.metaverse.frames.ExcelOutputStepNode in project pentaho-metaverse by pentaho.
the class MetaverseValidationIT method testExcelOutputStepNode.
@Test
public void testExcelOutputStepNode() throws Exception {
ExcelOutputStepNode excelOutputStepNode = root.getExcelOutputStepNode();
assertNotNull(excelOutputStepNode);
ExcelOutputMeta meta = (ExcelOutputMeta) getStepMeta(excelOutputStepNode);
TransMeta tm = meta.getParentStepMeta().getParentTransMeta();
String[] fileNames = meta.getFiles(tm);
RowMetaInterface incomingFields = tm.getStepFields(meta.getParentStepMeta());
ExcelField[] outputFields = meta.getOutputFields();
// should write to one file
Iterable<FramedMetaverseNode> outputFiles = excelOutputStepNode.getOutputFiles();
assertEquals(fileNames.length, getIterableSize(outputFiles));
int i = 0;
for (FramedMetaverseNode node : outputFiles) {
assertEquals(normalizeFilePath(fileNames[i++]), normalizeFilePath(node.getName()));
}
Iterable<StreamFieldNode> outFields = excelOutputStepNode.getOutputStreamFields();
int outFieldCount = getIterableSize(outFields);
// should have output stream nodes as well as file nodes
assertEquals(outputFields.length * 2, outFieldCount);
int fileFieldCount = 0;
for (StreamFieldNode outField : outFields) {
if (DictionaryConst.NODE_TYPE_FILE_FIELD.equals(outField.getType())) {
ValueMetaInterface vmi = incomingFields.searchValueMeta(outField.getName());
assertEquals(vmi.getName(), outField.getFieldPopulatesMe().getName());
fileFieldCount++;
}
}
assertEquals(fileFieldCount, outFieldCount / 2);
}
Aggregations