Search in sources :

Example 6 with SingleRowRowSet

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]);
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) SingleRowRowSet(org.pentaho.di.core.SingleRowRowSet) RowMeta(org.pentaho.di.core.row.RowMeta) RowSet(org.pentaho.di.core.RowSet) SingleRowRowSet(org.pentaho.di.core.SingleRowRowSet) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString)

Example 7 with SingleRowRowSet

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;
}
Also used : SingleRowRowSet(org.pentaho.di.core.SingleRowRowSet) RowSet(org.pentaho.di.core.RowSet) SingleRowRowSet(org.pentaho.di.core.SingleRowRowSet)

Aggregations

RowSet (org.pentaho.di.core.RowSet)7 SingleRowRowSet (org.pentaho.di.core.SingleRowRowSet)7 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)5 QueueRowSet (org.pentaho.di.core.QueueRowSet)4 RowMeta (org.pentaho.di.core.row.RowMeta)4 Test (org.junit.Test)3 BlockingRowSet (org.pentaho.di.core.BlockingRowSet)3 BlockingBatchingRowSet (org.pentaho.di.core.BlockingBatchingRowSet)2 KettleException (org.pentaho.di.core.exception.KettleException)2 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)2 StepInterface (org.pentaho.di.trans.step.StepInterface)2 OutputStreamWriter (java.io.OutputStreamWriter)1 PrintWriter (java.io.PrintWriter)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 FileObject (org.apache.commons.vfs2.FileObject)1 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)1 KettleFileException (org.pentaho.di.core.exception.KettleFileException)1 KettleTransException (org.pentaho.di.core.exception.KettleTransException)1 KettleValueException (org.pentaho.di.core.exception.KettleValueException)1