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());
}
Aggregations