コード例 #1
0
  @Test
  public void testExecuteSuccess() throws Exception {
    entry.arguments = new String[] {existingFile1, existingFile2};

    Result res = entry.execute(new Result(), 0);

    assertTrue("Entry failed", res.getResult());
  }
コード例 #2
0
  @Test
  public void testExecuteFail() throws Exception {
    entry.arguments =
        new String[] {existingFile1, existingFile2, "nonExistingFile1.ext", "nonExistingFile2.ext"};

    Result res = entry.execute(new Result(), 0);

    assertFalse("Entry should fail", res.getResult());
  }
コード例 #3
0
  @Test
  public void testExecuteWithException() throws Exception {
    entry.arguments = 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());
  }
コード例 #4
0
  @Test
  public void testSetNrErrorsNewBehaviorFalseResult() throws Exception {
    // this tests fix for PDI-10270
    entry.arguments = new String[] {"nonExistingFile.ext"};

    Result res = entry.execute(new Result(), 0);

    assertFalse("Entry should fail", res.getResult());
    assertEquals(
        "Files not found. Result is false. But... No of errors should be zero",
        0,
        res.getNrErrors());
  }
コード例 #5
0
  @Test
  public void testSetNrErrorsOldBehaviorFalseResult() throws Exception {
    // this tests backward compatibility settings for PDI-10270
    entry.arguments = 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.arguments.length,
        res.getNrErrors());
  }