public static org.apache.hadoop.mapred.JobID fromYarn(JobId id) {
    String identifier = fromClusterTimeStamp(id.getAppId().getClusterTimestamp());
    return new org.apache.hadoop.mapred.JobID(identifier, id.getId());
  }
@Test
  public void testFromYarn() throws Exception {
    int appStartTime = 612354;
    int appFinishTime = 612355;
    YarnApplicationState state = YarnApplicationState.RUNNING;
    ApplicationId applicationId = ApplicationId.newInstance(0, 0);
    ApplicationReport applicationReport = Records
        .newRecord(ApplicationReport.class);
    applicationReport.setApplicationId(applicationId);
    applicationReport.setYarnApplicationState(state);
    applicationReport.setStartTime(appStartTime);
    applicationReport.setFinishTime(appFinishTime);
    applicationReport.setUser("TestTypeConverter-user");
    applicationReport.setPriority(Priority.newInstance(3));
    ApplicationResourceUsageReport appUsageRpt = Records
        .newRecord(ApplicationResourceUsageReport.class);
    Resource r = Records.newRecord(Resource.class);
    r.setMemorySize(2048);
    appUsageRpt.setNeededResources(r);
    appUsageRpt.setNumReservedContainers(1);
    appUsageRpt.setNumUsedContainers(3);
    appUsageRpt.setReservedResources(r);
    appUsageRpt.setUsedResources(r);
    applicationReport.setApplicationResourceUsageReport(appUsageRpt);
    JobStatus jobStatus = TypeConverter.fromYarn(applicationReport, "dummy-jobfile");
    assertEquals(appStartTime, jobStatus.getStartTime());
    assertEquals(appFinishTime, jobStatus.getFinishTime());
    assertEquals(state.toString(), jobStatus.getState().toString());
    assertEquals(JobPriority.NORMAL, jobStatus.getPriority());
  }