@Test public void testGetVersion() { String jHist2 = "Avro-Json\n" + "{\"type\":\"record\",\"name\":\"Event\", " + "\"namespace\":\"org.apache.hadoop.mapreduce.jobhistory\",\"fields\":[]\""; HadoopVersion version2 = JobHistoryFileParserFactory.getVersion(jHist2.getBytes()); assertEquals(JobHistoryFileParserFactory.getHistoryFileVersion2(), version2); }
public static HadoopVersion getVersion(byte[] historyFileContents) { if(historyFileContents.length > HADOOP2_VERSION_LENGTH) { String version2Part = new String(historyFileContents, 0, HADOOP2_VERSION_LENGTH); if (StringUtils.equalsIgnoreCase(version2Part, HADOOP2_VERSION_STRING)) { return HadoopVersion.TWO; } } throw new IllegalArgumentException(" Unknown format of job history file: " + historyFileContents); }
JobHistoryFileParserFactory { public static HadoopVersion getVersion(byte[] historyFileContents) { if(historyFileContents.length > HADOOP2_VERSION_LENGTH) { String version2Part = new String(historyFileContents, 0, HADOOP2_VERSION_LENGTH); if (StringUtils.equalsIgnoreCase(version2Part, HADOOP2_VERSION_STRING)) { return HadoopVersion.TWO; } } throw new IllegalArgumentException(" Unknown format of job history file: " + historyFileContents); } }
JobHistoryFileParserFactory { public static HadoopVersion getVersion(byte[] historyFileContents) { if(historyFileContents.length > HADOOP2_VERSION_LENGTH) { String version2Part = new String(historyFileContents, 0, HADOOP2_VERSION_LENGTH); if (StringUtils.equalsIgnoreCase(version2Part, HADOOP2_VERSION_STRING)) { return HadoopVersion.TWO; } } throw new IllegalArgumentException(" Unknown format of job history file: " + historyFileContents); }  }
JobHistoryFileParserFactory { public static HadoopVersion getVersion(byte[] historyFileContents) { if(historyFileContents.length > HADOOP2_VERSION_LENGTH) { String version2Part = new String(historyFileContents, 0, HADOOP2_VERSION_LENGTH); if (StringUtils.equalsIgnoreCase(version2Part, HADOOP2_VERSION_STRING)) { return HadoopVersion.TWO; } } throw new IllegalArgumentException(" Unknown format of job history file: " + historyFileContents); }  static HadoopVersion getVersion(byte[] historyFileContents); static JobHistoryFileParser createJobHistoryFileParser(
      byte[] historyFileContents, Configuration jobConf); static HadoopVersion getHistoryFileVersion2(); }
JobHistoryFileParserFactory { public static HadoopVersion getVersion(byte[] historyFileContents) { if(historyFileContents.length > HADOOP2_VERSION_LENGTH) { String version2Part = new String(historyFileContents, 0, HADOOP2_VERSION_LENGTH); if (StringUtils.equalsIgnoreCase(version2Part, HADOOP2_VERSION_STRING)) { return HadoopVersion.TWO; } } throw new IllegalArgumentException(" Unknown format of job history file: " + historyFileContents); }  static HadoopVersion getVersion(byte[] historyFileContents); static JobHistoryFileParser createJobHistoryFileParser(
      byte[] historyFileContents, Configuration jobConf); static HadoopVersion getHistoryFileVersion2(); static final String HADOOP2_VERSION_STRING; }