TaskID extends org.apache.hadoop.mapred.ID { public TaskType getTaskType() { return type; } TaskID(JobID jobId, TaskType type, int id);  TaskID(String jtIdentifier, int jobId, TaskType type, int id); @Deprecated  TaskID(JobID jobId, boolean isMap, int id); @Deprecated  TaskID(String jtIdentifier, int jobId, boolean isMap, int id);  TaskID(); JobID getJobID(); @Deprecated boolean isMap(); TaskType getTaskType(); @Override boolean equals(Object o); @Override int compareTo(ID o); @Override String toString(); @Override int hashCode(); @Override void readFields(DataInput in); @Override void write(DataOutput out); static TaskID forName(String str); static char getRepresentingCharacter(TaskType type); static TaskType getTaskType(char c); static String getAllTaskTypes(); static final String TASK_ID_REGEX; static final Pattern taskIdPattern; }
@Test public void testGetTaskType0args() { JobID jobId = new JobID("1234", 0); for (TaskType type : TaskType.values()) { TaskID taskId = new TaskID(jobId, type, 0); assertEquals("TaskID incorrectly reported its type", type, taskId.getTaskType()); } TaskID taskId = new TaskID(); assertEquals("TaskID of default type incorrectly reported its type", TaskType.REDUCE, taskId.getTaskType()); }
@Test public void testGetTaskTypeChar() { assertEquals("The getTaskType() method did not return the expected type", TaskType.MAP, TaskID.getTaskType('m')); assertEquals("The getTaskType() method did not return the expected type", TaskType.REDUCE, TaskID.getTaskType('r')); assertEquals("The getTaskType() method did not return the expected type", TaskType.JOB_SETUP, TaskID.getTaskType('s')); assertEquals("The getTaskType() method did not return the expected type", TaskType.JOB_CLEANUP, TaskID.getTaskType('c')); assertEquals("The getTaskType() method did not return the expected type", TaskType.TASK_CLEANUP, TaskID.getTaskType('t')); assertNull("The getTaskType() method did not return null for an unknown " + "type", TaskID.getTaskType('x')); }