@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());
  }
  @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());
  }
  @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));
  }
  @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));
  }
  @Test
  public void testLoadXml() throws Exception {

    OozieJobExecutorJobEntry jobEntry = new OozieJobExecutorJobEntry();
    OozieJobExecutorConfig jobConfig = new OozieJobExecutorConfig();

    jobConfig.setOozieWorkflow("hdfs://localhost:9000/user/test-user/oozie/workflow.xml");
    jobConfig.setOozieWorkflowConfig("file:///User/test-user/oozie/job.properties");
    jobConfig.setOozieUrl("http://localhost:11000/oozie");

    jobEntry.setJobConfig(jobConfig);

    JobEntryCopy jec = new JobEntryCopy(jobEntry);
    jec.setLocation(0, 0);
    String xml = jec.getXML();

    Document d = XMLHandler.loadXMLString(xml);

    OozieJobExecutorJobEntry jobEntry2 = new OozieJobExecutorJobEntry();
    jobEntry2.loadXML(d.getDocumentElement(), null, null, null);

    OozieJobExecutorConfig jobConfig2 = jobEntry2.getJobConfig();
    assertEquals(jobConfig.getOozieWorkflow(), jobConfig2.getOozieWorkflow());
    assertEquals(jobConfig.getOozieWorkflowConfig(), jobConfig2.getOozieWorkflowConfig());
    assertEquals(jobConfig.getOozieUrl(), jobConfig2.getOozieUrl());
  }