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]);
}
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" });
}
Aggregations