use of org.pentaho.metaverse.frames.TextFileOutputStepNode in project pentaho-metaverse by pentaho.
the class MetaverseValidationIT method testTextFileOutputStepNode.
@Test
public void testTextFileOutputStepNode() throws Exception {
TextFileOutputStepNode textFileOutputStepNode = root.getTextFileOutputStepNode("textFileOutput", "Text file output");
TextFileOutputMeta meta = (TextFileOutputMeta) getStepMeta(textFileOutputStepNode);
TransMeta tm = meta.getParentStepMeta().getParentTransMeta();
String[] fileNames = meta.getFiles(tm);
RowMetaInterface incomingFields = tm.getPrevStepFields(meta.getParentStepMeta());
int outputFields = getExpectedOutputFieldCount(meta);
assertNotNull(textFileOutputStepNode);
Iterable<StreamFieldNode> outFields = textFileOutputStepNode.getOutputStreamFields();
int outFieldCount = getIterableSize(outFields);
// should have output stream nodes as well as file nodes
assertEquals(outputFields + meta.getOutputFields().length, 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);
}
use of org.pentaho.metaverse.frames.TextFileOutputStepNode in project pentaho-metaverse by pentaho.
the class MetaverseValidationIT method testTextFileOutputStepNode_FileFromStreamField.
@Test
public void testTextFileOutputStepNode_FileFromStreamField() throws Exception {
TextFileOutputStepNode textFileOutputStepNode = root.getTextFileOutputStepNode("textFileOutput", "Text file output - file from field");
TextFileOutputMeta meta = (TextFileOutputMeta) getStepMeta(textFileOutputStepNode);
TransMeta tm = meta.getParentStepMeta().getParentTransMeta();
RowMetaInterface incomingFields = tm.getPrevStepFields(meta.getParentStepMeta());
int outputFields = getExpectedOutputFieldCount(meta);
assertNotNull(textFileOutputStepNode);
// should write to one file
Iterable<FramedMetaverseNode> outputFiles = textFileOutputStepNode.getOutputFiles();
assertEquals(0, getIterableSize(outputFiles));
Iterable<StreamFieldNode> usedFields = textFileOutputStepNode.getStreamFieldNodesUses();
int usedFieldCount = getIterableSize(usedFields);
assertEquals(1, usedFieldCount);
Iterable<StreamFieldNode> outFields = textFileOutputStepNode.getOutputStreamFields();
int outFieldCount = getIterableSize(outFields);
// should have output stream nodes as well as file nodes
assertEquals(outputFields + meta.getOutputFields().length, 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