use of org.pentaho.di.core.Result in project pentaho-kettle by pentaho.
the class JobEntryEvalTableContentTest method testNrErrorsNoCustomSql.
@Test
public void testNrErrorsNoCustomSql() throws Exception {
entry.setLimit("5");
entry.setSuccessCondition(JobEntryEvalTableContent.SUCCESS_CONDITION_ROWS_COUNT_EQUAL);
entry.setUseCustomSQL(true);
entry.setCustomSQL(null);
Result res = entry.execute(new Result(), 0);
assertFalse("Eval number of rows should fail", res.getResult());
assertEquals("Apparently there should be an error", res.getNrErrors(), 1);
// that should work regardless of old/new behavior flag
entry.setVariable(Const.KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES, "Y");
res = entry.execute(new Result(), 0);
assertFalse("Eval number of rows should fail", res.getResult());
assertEquals("Apparently there should be an error", res.getNrErrors(), 1);
}
use of org.pentaho.di.core.Result in project pentaho-kettle by pentaho.
the class JobEntryEvalTableContentTest method testNrErrorsFailureNewBehavior.
@Test
public void testNrErrorsFailureNewBehavior() throws Exception {
entry.setLimit("1");
entry.setSuccessCondition(JobEntryEvalTableContent.SUCCESS_CONDITION_ROWS_COUNT_EQUAL);
entry.setTablename("table");
Result res = entry.execute(new Result(), 0);
assertFalse("Eval number of rows should fail", res.getResult());
assertEquals("No errors should be reported in result object accoding to the new behavior", res.getNrErrors(), 0);
}
use of org.pentaho.di.core.Result in project pentaho-kettle by pentaho.
the class JobEntryFilesExistTest method testSetNrErrorsOldBehaviorFalseResult.
@Test
public void testSetNrErrorsOldBehaviorFalseResult() throws Exception {
// this tests backward compatibility settings for PDI-10270
entry.setArguments(new String[] { "nonExistingFile1.ext", "nonExistingFile2.ext" });
entry.setVariable(Const.KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES, "Y");
Result res = entry.execute(new Result(), 0);
assertFalse("Entry should fail", res.getResult());
assertEquals("Files not found. Result is false. And... Number of errors should be the same as number of not found files", entry.getArguments().length, res.getNrErrors());
}
use of org.pentaho.di.core.Result in project pentaho-kettle by pentaho.
the class JobEntryFilesExistTest method testExecuteWithException.
@Test
public void testExecuteWithException() throws Exception {
entry.setArguments(new String[] { null });
Result res = entry.execute(new Result(), 0);
assertFalse("Entry should fail", res.getResult());
assertEquals("File with wrong name was specified. One error should be reported", 1, res.getNrErrors());
}
use of org.pentaho.di.core.Result in project pentaho-kettle by pentaho.
the class JobEntryFolderIsEmptyTest method testSetNrErrorsNewBehaviorFail.
@Test
public void testSetNrErrorsNewBehaviorFail() throws Exception {
entry.setFoldername(nonEmptyDir);
Result result = entry.execute(new Result(), 0);
assertFalse("For non-empty folder result should be false", result.getResult());
assertEquals("There should be still no errors", 0, result.getNrErrors());
}
Aggregations