use of org.pentaho.commons.connection.memory.MemoryResultSet in project pentaho-platform by pentaho.
the class JavaScriptResultSet method setMetaData.
public void setMetaData(final IPentahoMetaData metaData) {
results = new MemoryResultSet(metaData);
writeableResults = (MemoryResultSet) results;
// this.metaData = metaData;
// rows = new ArrayList();
}
use of org.pentaho.commons.connection.memory.MemoryResultSet in project pentaho-platform by pentaho.
the class SQLResultSet method memoryCopy.
/**
* <b>Attention: </b> It does not clone data! It is create the shallow copy of metadata!
* It is create the shallow copy of data. You must avoid to use this method.
* @return new instance the {@link MemoryResultSet} with same metadata
*/
public IPentahoResultSet memoryCopy() {
try {
// we have the {@link #setMetaData(IPentahoMetaData)} so the metadata can be any
// class which implements IPentahoMetaData, we should not lost data from metadata, so we must use metadata from original result set,
// or clone metadata. The IPentahoMetaData does not implement Cloneable and we unable to clone data. So keep the shallow copy of metadata.
MemoryResultSet cachedResultSet = new MemoryResultSet(getMetaData());
Object[] rowObjects = next();
while (rowObjects != null) {
cachedResultSet.addRow(rowObjects);
rowObjects = next();
}
return cachedResultSet;
} finally {
close();
}
}
use of org.pentaho.commons.connection.memory.MemoryResultSet in project pentaho-platform by pentaho.
the class KettleIT method assertFailResult.
private void assertFailResult(IRuntimeContext context) {
MemoryResultSet result = getResult(context);
assertNull(result);
}
use of org.pentaho.commons.connection.memory.MemoryResultSet in project pentaho-platform by pentaho.
the class KettleIT method getResult.
private MemoryResultSet getResult(IRuntimeContext context) {
assertNotNull(context.getOutputNames());
assertEquals(1, context.getOutputNames().size());
String outputName = (String) context.getOutputNames().iterator().next();
assertEquals("rule-result", outputName);
MemoryResultSet result = (MemoryResultSet) context.getOutputParameter(outputName).getValue();
return result;
}
use of org.pentaho.commons.connection.memory.MemoryResultSet in project pentaho-platform by pentaho.
the class KettleIT method assertSuccessResult.
private void assertSuccessResult(IRuntimeContext context, Object[][] data) {
MemoryResultSet result = getResult(context);
assertNotNull(result);
assertEquals(data.length, result.getRowCount());
for (int rowIndex = 0; rowIndex < data.length; rowIndex++) {
Object[] row = data[rowIndex];
assertArrayEquals(row, result.getDataRow(rowIndex));
}
}
Aggregations