}
@SuppressWarnings("unchecked")
public void testParseCoordinatorJob() {
JSONObject json = createJsonCoordinatorJob();
CoordinatorJob job = JsonToBean.createCoordinatorJob(json);
assertEquals("a", job.getAppPath());
assertEquals("b", job.getAppName());
assertEquals("c", job.getId());
assertEquals("d", job.getConf());
assertEquals(CoordinatorJob.Status.RUNNING, job.getStatus());
assertEquals(CoordinatorJob.Execution.FIFO, job.getExecutionOrder());
assertEquals("1", job.getFrequency());
assertEquals(CoordinatorJob.Timeunit.DAY, job.getTimeUnit());
assertEquals("e", job.getTimeZone());
assertEquals(2, job.getConcurrency());
assertEquals(3, job.getTimeout());
assertEquals(JsonUtils.parseDateRfc822(LAST_ACTION), job.getLastActionTime());
assertEquals(JsonUtils.parseDateRfc822(NEXT_MATERIALIZED), job.getNextMaterializedTime());
assertEquals(JsonUtils.parseDateRfc822(START_TIME), job.getStartTime());
assertEquals(JsonUtils.parseDateRfc822(END_TIME), job.getEndTime());
assertEquals(JsonUtils.parseDateRfc822(PAUSE_TIME), job.getPauseTime());
assertEquals("f", job.getUser());
assertEquals("g", job.getGroup());
assertEquals("h", job.getConsoleUrl());
assertEquals(2, job.getActions().size());
assertEquals("ca1", job.getActions().get(0).getId());
assertEquals("ca2", job.getActions().get(1).getId());
// Test backward compatibility with 3.x. 3.x will not be forward compatible with 4.x though.
// i.e 4.1 client can be used with 3.x server. But 3.x client cannot be used with 4.x server.
// Frequency was a int in 3.x but was changed to String in 4.x for cron support
json.put(JsonTags.COORDINATOR_JOB_FREQUENCY, 1L);
CoordinatorJob oozie3xjob = JsonToBean.createCoordinatorJob(json);
assertEquals("1", oozie3xjob.getFrequency());
}