コード例 #1
0
  @Test
  public void testNrErrorsFailureNewBehavior() throws Exception {
    entry.limit = "1";
    entry.successCondition = JobEntryEvalTableContent.SUCCESS_CONDITION_ROWS_COUNT_EQUAL;
    entry.tablename = "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);
  }
コード例 #2
0
  @Test
  public void testNrErrorsFailureOldBehavior() throws Exception {
    entry.limit = "1";
    entry.successCondition = JobEntryEvalTableContent.SUCCESS_CONDITION_ROWS_COUNT_EQUAL;
    entry.tablename = "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);
  }
コード例 #3
0
  @Before
  public void setUp() throws Exception {
    MockDriver.registerInstance();
    Job job = new Job(null, new JobMeta());
    entry = new JobEntryEvalTableContent();

    job.getJobMeta().addJobEntry(new JobEntryCopy(entry));
    entry.setParentJob(job);

    job.setStopped(false);

    DatabaseMeta dbMeta = new DatabaseMeta();
    dbMeta.setDatabaseType("mock-db");

    entry.setDatabase(dbMeta);
  }
コード例 #4
0
  @Test
  public void testNrErrorsNoCustomSql() throws Exception {
    entry.limit = "5";
    entry.successCondition = JobEntryEvalTableContent.SUCCESS_CONDITION_ROWS_COUNT_EQUAL;
    entry.iscustomSQL = true;
    entry.customSQL = 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);
  }
コード例 #5
0
  @Test
  public void testNrErrorsSuccess() throws Exception {
    entry.limit = "5";
    entry.successCondition = JobEntryEvalTableContent.SUCCESS_CONDITION_ROWS_COUNT_EQUAL;
    entry.tablename = "table";

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

    assertTrue("Eval number of rows should be suceeded", res.getResult());
    assertEquals("Apparently there should no error", res.getNrErrors(), 0);

    // 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);

    assertTrue("Eval number of rows should be suceeded", res.getResult());
    assertEquals("Apparently there should no error", res.getNrErrors(), 0);
  }