Search in sources :

Example 1 with MemoryResultSet

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();
}
Also used : MemoryResultSet(org.pentaho.commons.connection.memory.MemoryResultSet)

Example 2 with MemoryResultSet

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();
    }
}
Also used : MemoryResultSet(org.pentaho.commons.connection.memory.MemoryResultSet)

Example 3 with MemoryResultSet

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);
}
Also used : MemoryResultSet(org.pentaho.commons.connection.memory.MemoryResultSet)

Example 4 with MemoryResultSet

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;
}
Also used : MemoryResultSet(org.pentaho.commons.connection.memory.MemoryResultSet)

Example 5 with MemoryResultSet

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));
    }
}
Also used : MemoryResultSet(org.pentaho.commons.connection.memory.MemoryResultSet)

Aggregations

MemoryResultSet (org.pentaho.commons.connection.memory.MemoryResultSet)31 MemoryMetaData (org.pentaho.commons.connection.memory.MemoryMetaData)24 IPentahoMetaData (org.pentaho.commons.connection.IPentahoMetaData)7 JavaScriptResultSet (org.pentaho.platform.plugin.services.connections.javascript.JavaScriptResultSet)7 Date (java.util.Date)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)2 StepMetaDataCombi (org.pentaho.di.trans.step.StepMetaDataCombi)2 SQLException (java.sql.SQLException)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 StringTokenizer (java.util.StringTokenizer)1 MimeHeaders (javax.xml.soap.MimeHeaders)1 Name (javax.xml.soap.Name)1 Node (javax.xml.soap.Node)1 SOAPBody (javax.xml.soap.SOAPBody)1 SOAPConnection (javax.xml.soap.SOAPConnection)1 SOAPElement (javax.xml.soap.SOAPElement)1