@Test public void testIntExpGetValuesIntBytes() { String[] keysToBeChecked = {"httpPort"}; byte[] byteValue = null; int intValue10 = 10; JobHistoryFileParserHadoop2 jh = new JobHistoryFileParserHadoop2(null); for(String key: keysToBeChecked) { byteValue = jh.getValue(JobHistoryKeys.HADOOP2_TO_HADOOP1_MAPPING.get(key), intValue10); assertEquals(Bytes.toInt(byteValue), intValue10); } }
byte[] getValue(String key, int value) { byte[] valueBytes = null; Class<?> clazz = JobHistoryKeys.KEY_TYPES.get(JobHistoryKeys.valueOf(key)); if (clazz == null) { throw new IllegalArgumentException(" unknown key " + key + " encountered while parsing " + this.jobKey); } if (Long.class.equals(clazz)) { valueBytes = (value != 0L) ? Bytes.toBytes(new Long(value)) : Constants.ZERO_LONG_BYTES; } else { valueBytes = (value != 0) ? Bytes.toBytes(value) : Constants.ZERO_INT_BYTES; } return valueBytes; }
JobHistoryFileParserHadoop2 extends JobHistoryFileParserBase { byte[] getValue(String key, int value) { byte[] valueBytes = null; Class<?> clazz = JobHistoryKeys.KEY_TYPES.get(JobHistoryKeys.valueOf(key)); if (clazz == null) { throw new IllegalArgumentException(" unknown key " + key + " encountered while parsing " + this.jobKey); } if (Long.class.equals(clazz)) { valueBytes = (value != 0L) ? Bytes.toBytes(new Long(value)) : Constants.ZERO_LONG_BYTES; } else { valueBytes = (value != 0) ? Bytes.toBytes(value) : Constants.ZERO_INT_BYTES; } return valueBytes; } }
JobHistoryFileParserHadoop2 extends JobHistoryFileParserBase { byte[] getValue(String key, int value) { byte[] valueBytes = null; Class<?> clazz = JobHistoryKeys.KEY_TYPES.get(JobHistoryKeys.valueOf(key)); if (clazz == null) { throw new IllegalArgumentException(" unknown key " + key + " encountered while parsing " + this.jobKey); } if (Long.class.equals(clazz)) { valueBytes = (value != 0L) ? Bytes.toBytes(new Long(value)) : Constants.ZERO_LONG_BYTES; } else { valueBytes = (value != 0) ? Bytes.toBytes(value) : Constants.ZERO_INT_BYTES; } return valueBytes; } JobHistoryFileParserHadoop2(Configuration conf); }
JobHistoryFileParserHadoop2 extends JobHistoryFileParserBase { byte[] getValue(String key, int value) { byte[] valueBytes = null; Class<?> clazz = JobHistoryKeys.KEY_TYPES.get(JobHistoryKeys.valueOf(key)); if (clazz == null) { throw new IllegalArgumentException(" unknown key " + key + " encountered while parsing " + this.jobKey); } if (Long.class.equals(clazz)) { valueBytes = (value != 0L) ? Bytes.toBytes(new Long(value)) : Constants.ZERO_LONG_BYTES; } else { valueBytes = (value != 0) ? Bytes.toBytes(value) : Constants.ZERO_INT_BYTES; } return valueBytes; } JobHistoryFileParserHadoop2(Configuration conf); @Override void parse(byte[] historyFileContents, JobKey jobKey); byte[] getTaskKey(String prefix, String jobNumber, String fullId); byte[] getAMKey(String prefix, String fullId); @Override List<Put> getJobPuts(); @Override List<Put> getTaskPuts(); void printAllPuts(List<Put> p); @Override Long getMegaByteMillis(); @Override JobDetails getJobDetails(); long getMapMbMillis(); void setMapMbMillis(long mapMbMillis); long getReduceMbMillis(); void setReduceMbMillis(long reduceMbMillis); }
JobHistoryFileParserHadoop2 extends JobHistoryFileParserBase { byte[] getValue(String key, int value) { byte[] valueBytes = null; Class<?> clazz = JobHistoryKeys.KEY_TYPES.get(JobHistoryKeys.valueOf(key)); if (clazz == null) { throw new IllegalArgumentException(" unknown key " + key + " encountered while parsing " + this.jobKey); } if (Long.class.equals(clazz)) { valueBytes = (value != 0L) ? Bytes.toBytes(new Long(value)) : Constants.ZERO_LONG_BYTES; } else { valueBytes = (value != 0) ? Bytes.toBytes(value) : Constants.ZERO_INT_BYTES; } return valueBytes; } JobHistoryFileParserHadoop2(Configuration conf); @Override void parse(byte[] historyFileContents, JobKey jobKey); byte[] getTaskKey(String prefix, String jobNumber, String fullId); byte[] getAMKey(String prefix, String fullId); @Override List<Put> getJobPuts(); @Override List<Put> getTaskPuts(); void printAllPuts(List<Put> p); @Override Long getMegaByteMillis(); @Override JobDetails getJobDetails(); long getMapMbMillis(); void setMapMbMillis(long mapMbMillis); long getReduceMbMillis(); void setReduceMbMillis(long reduceMbMillis); static final String JOB_STATUS_SUCCEEDED; }