@Test public void testGenerateFileNameFinishedJob() { String appId = "app123"; long started = 1L; long completed = 2L; String user = "user"; JobMetadata metadata = new JobMetadata.Builder() .setId(appId) .setStarted(started) .setCompleted(completed) .setUser(user) .setStatus(Constants.SUCCEEDED) .setConf(new YarnConfiguration()) .build(); String expectedName = "app123-1-2-user-SUCCEEDED." + Constants.HISTFILE_SUFFIX; assertEquals(HistoryFileUtils.generateFileName(metadata), expectedName); }
public static String generateFileName(JobMetadata metadata) { StringBuilder sb = new StringBuilder(); sb.append(metadata.getId()); sb.append("-"); sb.append(metadata.getStarted()); sb.append("-"); if (metadata.getCompleted() != -1L) { sb.append(metadata.getCompleted()); sb.append("-"); } sb.append(metadata.getUser()); if (!metadata.getStatus().isEmpty()) { sb.append("-"); sb.append(metadata.getStatus()); sb.append("." + Constants.HISTFILE_SUFFIX); return sb.toString(); } sb.append("." + Constants.HISTFILE_SUFFIX); sb.append("." + Constants.INPROGRESS); return sb.toString(); }
HistoryFileUtils { public static String generateFileName(JobMetadata metadata) { StringBuilder sb = new StringBuilder(); sb.append(metadata.getId()); sb.append("-"); sb.append(metadata.getStarted()); sb.append("-"); if (metadata.getCompleted() != -1L) { sb.append(metadata.getCompleted()); sb.append("-"); } sb.append(metadata.getUser()); if (!metadata.getStatus().isEmpty()) { sb.append("-"); sb.append(metadata.getStatus()); sb.append("." + Constants.HISTFILE_SUFFIX); return sb.toString(); } sb.append("." + Constants.HISTFILE_SUFFIX); sb.append("." + Constants.INPROGRESS); return sb.toString(); } }
HistoryFileUtils { public static String generateFileName(JobMetadata metadata) { StringBuilder sb = new StringBuilder(); sb.append(metadata.getId()); sb.append("-"); sb.append(metadata.getStarted()); sb.append("-"); if (metadata.getCompleted() != -1L) { sb.append(metadata.getCompleted()); sb.append("-"); } sb.append(metadata.getUser()); if (!metadata.getStatus().isEmpty()) { sb.append("-"); sb.append(metadata.getStatus()); sb.append("." + Constants.HISTFILE_SUFFIX); return sb.toString(); } sb.append("." + Constants.HISTFILE_SUFFIX); sb.append("." + Constants.INPROGRESS); return sb.toString(); } private  HistoryFileUtils(); }
HistoryFileUtils { public static String generateFileName(JobMetadata metadata) { StringBuilder sb = new StringBuilder(); sb.append(metadata.getId()); sb.append("-"); sb.append(metadata.getStarted()); sb.append("-"); if (metadata.getCompleted() != -1L) { sb.append(metadata.getCompleted()); sb.append("-"); } sb.append(metadata.getUser()); if (!metadata.getStatus().isEmpty()) { sb.append("-"); sb.append(metadata.getStatus()); sb.append("." + Constants.HISTFILE_SUFFIX); return sb.toString(); } sb.append("." + Constants.HISTFILE_SUFFIX); sb.append("." + Constants.INPROGRESS); return sb.toString(); } private  HistoryFileUtils(); static String generateFileName(JobMetadata metadata); }
HistoryFileUtils { public static String generateFileName(JobMetadata metadata) { StringBuilder sb = new StringBuilder(); sb.append(metadata.getId()); sb.append("-"); sb.append(metadata.getStarted()); sb.append("-"); if (metadata.getCompleted() != -1L) { sb.append(metadata.getCompleted()); sb.append("-"); } sb.append(metadata.getUser()); if (!metadata.getStatus().isEmpty()) { sb.append("-"); sb.append(metadata.getStatus()); sb.append("." + Constants.HISTFILE_SUFFIX); return sb.toString(); } sb.append("." + Constants.HISTFILE_SUFFIX); sb.append("." + Constants.INPROGRESS); return sb.toString(); } private  HistoryFileUtils(); static String generateFileName(JobMetadata metadata);  }