Search in sources :

Example 76 with StepMetaInterface

use of org.pentaho.di.trans.step.StepMetaInterface 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)

Example 77 with StepMetaInterface

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

the class RepositoryImporterTest method testImportJob_patchJobEntries_when_directory_path_starts_with_variable.

@Test
public void testImportJob_patchJobEntries_when_directory_path_starts_with_variable() throws KettleException {
    JobEntryInterface jobEntryInterface = createJobEntry("${USER_VARIABLE}/myDir");
    StepMetaInterface stepMeta = createStepMeta("");
    RepositoryImporter importer = createRepositoryImporter(jobEntryInterface, stepMeta, true);
    importer.setBaseDirectory(baseDirectory);
    importer.importJob(entityNode, feedback);
    verify((HasRepositoryDirectories) jobEntryInterface).setDirectories(new String[] { "${USER_VARIABLE}/myDir" });
    JobEntryInterface jobEntryInterface2 = createJobEntry("${USER_VARIABLE}/myDir");
    RepositoryImporter importerWithCompatibilityImportPath = createRepositoryImporter(jobEntryInterface2, stepMeta, false);
    importerWithCompatibilityImportPath.setBaseDirectory(baseDirectory);
    importerWithCompatibilityImportPath.importJob(entityNode, feedback);
    verify((HasRepositoryDirectories) jobEntryInterface2).setDirectories(new String[] { ROOT_PATH + "/${USER_VARIABLE}/myDir" });
}
Also used : JobEntryInterface(org.pentaho.di.job.entry.JobEntryInterface) StepMetaInterface(org.pentaho.di.trans.step.StepMetaInterface) Test(org.junit.Test)

Aggregations

StepMetaInterface (org.pentaho.di.trans.step.StepMetaInterface)77 StepMeta (org.pentaho.di.trans.step.StepMeta)40 KettleException (org.pentaho.di.core.exception.KettleException)31 Test (org.junit.Test)22 ArrayList (java.util.ArrayList)21 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)20 TransMeta (org.pentaho.di.trans.TransMeta)16 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)16 TableItem (org.eclipse.swt.widgets.TableItem)15 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)15 SourceToTargetMapping (org.pentaho.di.core.SourceToTargetMapping)14 Trans (org.pentaho.di.trans.Trans)14 EnterMappingDialog (org.pentaho.di.ui.core.dialog.EnterMappingDialog)14 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)12 Point (org.pentaho.di.core.gui.Point)12 TransHopMeta (org.pentaho.di.trans.TransHopMeta)11 BaseStepMeta (org.pentaho.di.trans.step.BaseStepMeta)11 NotePadMeta (org.pentaho.di.core.NotePadMeta)8 KettleStepException (org.pentaho.di.core.exception.KettleStepException)8 JobEntryInterface (org.pentaho.di.job.entry.JobEntryInterface)8