コード例 #1
0
  @Test
  public void execute_blocking_FAIL() throws KettleException {
    final long waitTime = 0;

    OozieJobExecutorConfig config = new OozieJobExecutorConfig();
    config.setOozieUrl(
        "http://localhost:11000/oozie"); // don't worry if it isn't running, we fake out our test
                                         // connection to it anyway
    config.setOozieWorkflowConfig("test-src/job.properties");
    config.setJobEntryName("name");
    config.setBlockingPollingInterval("1000");

    TestOozieJobExecutorJobEntry je = new TestOozieJobExecutorJobEntry(getFailingTest());

    je.setParentJob(new Job("test", null, null));
    je.setJobConfig(config);

    Result result = new Result();
    long start = System.currentTimeMillis();
    je.execute(result, 0);
    long end = System.currentTimeMillis();
    assertTrue(
        "Total runtime should be >= the wait time if we are blocking", (end - start) >= waitTime);

    Assert.assertEquals(1, result.getNrErrors());
    assertFalse(result.getResult());
  }
コード例 #2
0
  @Test
  public void testGetValidationWarnings_everythingIsGood() throws Exception {
    OozieJobExecutorJobEntry je = new TestOozieJobExecutorJobEntry(getSucceedingTest());

    OozieJobExecutorConfig config = new OozieJobExecutorConfig();
    config.setOozieUrl(
        "http://localhost:11000/oozie"); // don't worry if it isn't running, we fake out our test
                                         // connection to it anyway
    config.setOozieWorkflowConfig("file:///test/job.properties");
    config.setJobEntryName("name");

    List<String> warnings = je.getValidationWarnings(config);

    assertEquals(0, warnings.size());
  }
コード例 #3
0
  @Test
  public void testGetValidationWarnings_invalidOozieUrl() throws Exception {
    OozieJobExecutorConfig config = new OozieJobExecutorConfig();

    OozieJobExecutorJobEntry je = new OozieJobExecutorJobEntry();

    config.setOozieUrl("bad url");
    config.setOozieWorkflowConfig("file:///test/job.properties");
    config.setJobEntryName("name");

    List<String> warnings = je.getValidationWarnings(config);

    assertEquals(1, warnings.size());
    assertEquals(
        BaseMessages.getString(
            OozieJobExecutorJobEntry.class, "ValidationMessages.Invalid.Oozie.URL"),
        warnings.get(0));
  }
コード例 #4
0
  @Test
  public void testGetValidationWarnings_incompatibleVersions() throws Exception {
    OozieJobExecutorConfig config = new OozieJobExecutorConfig();

    OozieClient client = getBadConfigTest();
    OozieJobExecutorJobEntry je =
        new TestOozieJobExecutorJobEntry(client); // just use this to force an error condition

    config.setOozieUrl("http://localhost/oozie");
    config.setOozieWorkflowConfig("file:///test/job.properties");
    config.setJobEntryName("name");

    List<String> warnings = je.getValidationWarnings(config);

    assertEquals(1, warnings.size());
    assertEquals(
        BaseMessages.getString(
            OozieJobExecutorJobEntry.class,
            "ValidationMessages.Incompatible.Oozie.Versions",
            client.getClientBuildVersion()),
        warnings.get(0));
  }