use of org.pentaho.di.core.SingleRowRowSet in project pentaho-kettle by pentaho.
the class XMLInputStreamTest method testCorrectFileSelected.
private void testCorrectFileSelected(String filenameParam, int xmlTagsStartPosition) throws KettleException {
xmlInputStreamMeta.sourceFromInput = false;
xmlInputStreamMeta.setFilename(filenameParam);
xmlInputStreamData.outputRowMeta = new RowMeta();
RowMeta rm = new RowMeta();
String pathValue = getFile("default.xml");
ValueMetaString ms = new ValueMetaString("filename");
RowSet rs = new SingleRowRowSet();
rs.putRow(rm, new Object[] { pathValue });
rs.setDone();
when(stepMockHelper.transMeta.findNrPrevSteps(stepMockHelper.stepMeta)).thenReturn(1);
XMLInputStream xmlInputStream = new XMLInputStream(stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper.transMeta, stepMockHelper.trans);
xmlInputStream.setInputRowMeta(rm);
xmlInputStream.getInputRowMeta().addValueMeta(ms);
xmlInputStream.addRowSetToInputRowSets(rs);
xmlInputStream.setOutputRowSets(new ArrayList<>());
xmlInputStream.init(xmlInputStreamMeta, xmlInputStreamData);
xmlInputStream.addRowListener(rl);
boolean haveRowsToRead;
do {
haveRowsToRead = !xmlInputStream.processRow(xmlInputStreamMeta, xmlInputStreamData);
} while (!haveRowsToRead);
assertEquals(INCORRECT_XML_DATA_TYPE_DESCRIPTION_MESSAGE, "START_ELEMENT", rl.getWritten().get(1)[xmlTagsStartPosition]);
}
use of org.pentaho.di.core.SingleRowRowSet in project pentaho-kettle by pentaho.
the class FastJsonReader method getEmptyResponse.
private RowSet getEmptyResponse() {
RowSet nullInputResponse = new SingleRowRowSet();
nullInputResponse.putRow(null, new Object[fields.length]);
nullInputResponse.setDone();
return nullInputResponse;
}
Aggregations