Search in sources :

Example 1 with OozieScheduler

use of com.linkedin.drelephant.schedulers.OozieScheduler in project dr-elephant by linkedin.

the class InfoExtractorTest method testGetSchedulerInstanceOozie.

@Test
public void testGetSchedulerInstanceOozie() throws Exception {
    final String jobInfo = "0004167-160629080632562-oozie-oozi-W";
    final String jobParentInfo = "0004166-160629080632562-oozie-oozi-W";
    Properties properties = new Properties();
    properties.put("oozie.action.id", jobInfo + "@some-action");
    properties.put("oozie.job.id", jobInfo);
    new Expectations() {

        {
            workflowJob.getId();
            result = jobInfo;
            workflowJob.getParentId();
            result = jobParentInfo;
            oozieClient.getJobInfo(jobInfo);
            result = workflowJob;
            parentWorkflowJob.getId();
            result = jobParentInfo;
            parentWorkflowJob.getParentId();
            result = null;
            oozieClient.getJobInfo(jobParentInfo);
            result = parentWorkflowJob;
        }
    };
    Scheduler scheduler = InfoExtractor.getSchedulerInstance("id", properties);
    assertEquals(true, scheduler instanceof OozieScheduler);
    assertEquals("oozie", scheduler.getSchedulerName());
    assertEquals(jobParentInfo, scheduler.getFlowDefId());
    assertEquals(jobParentInfo, scheduler.getFlowExecId());
    assertEquals(jobInfo, scheduler.getJobDefId());
    assertEquals(jobInfo, scheduler.getJobExecId());
    assertEquals(jobInfo, scheduler.getJobName());
}
Also used : Expectations(mockit.Expectations) Scheduler(com.linkedin.drelephant.schedulers.Scheduler) AzkabanScheduler(com.linkedin.drelephant.schedulers.AzkabanScheduler) AirflowScheduler(com.linkedin.drelephant.schedulers.AirflowScheduler) OozieScheduler(com.linkedin.drelephant.schedulers.OozieScheduler) OozieScheduler(com.linkedin.drelephant.schedulers.OozieScheduler) Properties(java.util.Properties) Test(org.junit.Test)

Aggregations

AirflowScheduler (com.linkedin.drelephant.schedulers.AirflowScheduler)1 AzkabanScheduler (com.linkedin.drelephant.schedulers.AzkabanScheduler)1 OozieScheduler (com.linkedin.drelephant.schedulers.OozieScheduler)1 Scheduler (com.linkedin.drelephant.schedulers.Scheduler)1 Properties (java.util.Properties)1 Expectations (mockit.Expectations)1 Test (org.junit.Test)1