Search in sources :

Example 11 with StepDataInterface

use of org.pentaho.di.trans.step.StepDataInterface in project pentaho-kettle by pentaho.

the class PDI5436Test method testCacheAllTable.

@Test
public void testCacheAllTable() throws KettleException {
    DatabaseLookup stepSpy = spy(new DatabaseLookup(smh.stepMeta, smh.stepDataInterface, 0, smh.transMeta, smh.trans));
    Database database = mockDatabase();
    doReturn(database).when(stepSpy).getDatabase(any(DatabaseMeta.class));
    stepSpy.addRowSetToInputRowSets(mockInputRowSet());
    stepSpy.setInputRowMeta(mockInputRowMeta());
    RowSet outputRowSet = new QueueRowSet();
    stepSpy.addRowSetToOutputRowSets(outputRowSet);
    StepMetaInterface meta = mockStepMeta();
    StepDataInterface data = smh.initStepDataInterface;
    Assert.assertTrue("Step init failed", stepSpy.init(meta, data));
    Assert.assertTrue("Error processing row", stepSpy.processRow(meta, data));
    Assert.assertEquals("Cache lookup failed", "value", outputRowSet.getRow()[2]);
}
Also used : QueueRowSet(org.pentaho.di.core.QueueRowSet) Database(org.pentaho.di.core.database.Database) RowSet(org.pentaho.di.core.RowSet) QueueRowSet(org.pentaho.di.core.QueueRowSet) StepMetaInterface(org.pentaho.di.trans.step.StepMetaInterface) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) StepDataInterface(org.pentaho.di.trans.step.StepDataInterface) Test(org.junit.Test)

Aggregations

StepDataInterface (org.pentaho.di.trans.step.StepDataInterface)11 StepMeta (org.pentaho.di.trans.step.StepMeta)8 Trans (org.pentaho.di.trans.Trans)7 TransMeta (org.pentaho.di.trans.TransMeta)7 Test (org.junit.Test)6 StepMetaInterface (org.pentaho.di.trans.step.StepMetaInterface)5 QueueRowSet (org.pentaho.di.core.QueueRowSet)2 RowSet (org.pentaho.di.core.RowSet)2 KettleException (org.pentaho.di.core.exception.KettleException)2 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)2 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Preconditions (com.google.common.base.Preconditions)1 Throwables (com.google.common.base.Throwables)1 OutputStreamWriter (java.io.OutputStreamWriter)1 PrintWriter (java.io.PrintWriter)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Field (java.lang.reflect.Field)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1