use of org.pentaho.di.core.Result in project pentaho-kettle by pentaho.
the class JobEntryCopyFilesTest method fileNotCopied.
@Test
public void fileNotCopied() throws Exception {
entry.source_filefolder = new String[] { EMPTY };
entry.destination_filefolder = new String[] { EMPTY };
entry.wildcard = new String[] { EMPTY };
entry.execute(new Result(), 0);
verify(entry, never()).processFileFolder(anyString(), anyString(), anyString(), any(Job.class), any(Result.class));
}
use of org.pentaho.di.core.Result in project pentaho-kettle by pentaho.
the class JobEntryDeleteFilesTest method filesPath_AreProcessed_ArgsOfPreviousMeta.
@Test
public void filesPath_AreProcessed_ArgsOfPreviousMeta() throws Exception {
jobEntry.setArgFromPrevious(true);
Result prevMetaResult = new Result();
List<RowMetaAndData> metaAndDataList = new ArrayList<>();
metaAndDataList.add(constructRowMetaAndData(PATH_TO_FILE, null));
prevMetaResult.setRows(metaAndDataList);
jobEntry.execute(prevMetaResult, 0);
verify(jobEntry, times(metaAndDataList.size())).processFile(anyString(), anyString(), any(Job.class));
}
use of org.pentaho.di.core.Result in project pentaho-kettle by pentaho.
the class JobEntryDeleteFilesTest method filesWithNoPath_AreNotProcessed_ArgsOfPreviousMeta.
@Test
public void filesWithNoPath_AreNotProcessed_ArgsOfPreviousMeta() throws Exception {
jobEntry.setArgFromPrevious(true);
Result prevMetaResult = new Result();
List<RowMetaAndData> metaAndDataList = new ArrayList<>();
metaAndDataList.add(constructRowMetaAndData(Const.EMPTY_STRING, null));
metaAndDataList.add(constructRowMetaAndData(STRING_SPACES_ONLY, null));
prevMetaResult.setRows(metaAndDataList);
jobEntry.execute(prevMetaResult, 0);
verify(jobEntry, never()).processFile(anyString(), anyString(), any(Job.class));
}
use of org.pentaho.di.core.Result in project pentaho-kettle by pentaho.
the class JobEntryDeleteFilesTest method filesPathVariables_AreProcessed_OnlyIfValueIsNotBlank.
@Test
public void filesPathVariables_AreProcessed_OnlyIfValueIsNotBlank() throws Exception {
final String pathToFileBlankValue = "pathToFileBlankValue";
final String pathToFileValidValue = "pathToFileValidValue";
jobEntry.setVariable(pathToFileBlankValue, Const.EMPTY_STRING);
jobEntry.setVariable(pathToFileValidValue, PATH_TO_FILE);
jobEntry.setArguments(new String[] { asVariable(pathToFileBlankValue), asVariable(pathToFileValidValue) });
jobEntry.setFilemasks(new String[] { null, null });
jobEntry.setArgFromPrevious(false);
jobEntry.execute(new Result(), 0);
verify(jobEntry).processFile(eq(PATH_TO_FILE), anyString(), any(Job.class));
}
use of org.pentaho.di.core.Result in project pentaho-kettle by pentaho.
the class JobEntryEvalTableContentTest method testNrErrorsFailureOldBehavior.
@Test
public void testNrErrorsFailureOldBehavior() throws Exception {
entry.setLimit("1");
entry.setSuccessCondition(JobEntryEvalTableContent.SUCCESS_CONDITION_ROWS_COUNT_EQUAL);
entry.setTablename("table");
entry.setVariable(Const.KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES, "Y");
Result res = entry.execute(new Result(), 0);
assertFalse("Eval number of rows should fail", res.getResult());
assertEquals("An error should be reported in result object accoding to the old behavior", res.getNrErrors(), 1);
}
Aggregations