Java 类org.apache.hadoop.mapreduce.v2.hs.CompletedTask 实例源码

项目:aliyun-oss-hadoop-fs    文件:TestCompletedTask.java   
@Test (timeout=5000)
public void testTaskStartTimes() {

  TaskId taskId = mock(TaskId.class); 
  TaskInfo taskInfo = mock(TaskInfo.class);
  Map<TaskAttemptID, TaskAttemptInfo> taskAttempts
    = new TreeMap<TaskAttemptID, TaskAttemptInfo>();

  TaskAttemptID id = new TaskAttemptID("0", 0, TaskType.MAP, 0, 0);
  TaskAttemptInfo info = mock(TaskAttemptInfo.class);
  when(info.getAttemptId()).thenReturn(id);
  when(info.getStartTime()).thenReturn(10l);
  taskAttempts.put(id, info);

  id = new TaskAttemptID("1", 0, TaskType.MAP, 1, 1);
  info = mock(TaskAttemptInfo.class);
  when(info.getAttemptId()).thenReturn(id);
  when(info.getStartTime()).thenReturn(20l);
  taskAttempts.put(id, info);


  when(taskInfo.getAllTaskAttempts()).thenReturn(taskAttempts);
  CompletedTask task = new CompletedTask(taskId, taskInfo);
  TaskReport report = task.getReport();

  // Make sure the startTime returned by report is the lesser of the 
  // attempy launch times
  assertTrue(report.getStartTime() == 10);
}
项目:big-c    文件:TestCompletedTask.java   
@Test (timeout=5000)
public void testTaskStartTimes() {

  TaskId taskId = mock(TaskId.class); 
  TaskInfo taskInfo = mock(TaskInfo.class);
  Map<TaskAttemptID, TaskAttemptInfo> taskAttempts
    = new TreeMap<TaskAttemptID, TaskAttemptInfo>();

  TaskAttemptID id = new TaskAttemptID("0", 0, TaskType.MAP, 0, 0);
  TaskAttemptInfo info = mock(TaskAttemptInfo.class);
  when(info.getAttemptId()).thenReturn(id);
  when(info.getStartTime()).thenReturn(10l);
  taskAttempts.put(id, info);

  id = new TaskAttemptID("1", 0, TaskType.MAP, 1, 1);
  info = mock(TaskAttemptInfo.class);
  when(info.getAttemptId()).thenReturn(id);
  when(info.getStartTime()).thenReturn(20l);
  taskAttempts.put(id, info);


  when(taskInfo.getAllTaskAttempts()).thenReturn(taskAttempts);
  CompletedTask task = new CompletedTask(taskId, taskInfo);
  TaskReport report = task.getReport();

  // Make sure the startTime returned by report is the lesser of the 
  // attempy launch times
  assertTrue(report.getStartTime() == 10);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestCompletedTask.java   
@Test (timeout=5000)
public void testTaskStartTimes() {

  TaskId taskId = mock(TaskId.class); 
  TaskInfo taskInfo = mock(TaskInfo.class);
  Map<TaskAttemptID, TaskAttemptInfo> taskAttempts
    = new TreeMap<TaskAttemptID, TaskAttemptInfo>();

  TaskAttemptID id = new TaskAttemptID("0", 0, TaskType.MAP, 0, 0);
  TaskAttemptInfo info = mock(TaskAttemptInfo.class);
  when(info.getAttemptId()).thenReturn(id);
  when(info.getStartTime()).thenReturn(10l);
  taskAttempts.put(id, info);

  id = new TaskAttemptID("1", 0, TaskType.MAP, 1, 1);
  info = mock(TaskAttemptInfo.class);
  when(info.getAttemptId()).thenReturn(id);
  when(info.getStartTime()).thenReturn(20l);
  taskAttempts.put(id, info);


  when(taskInfo.getAllTaskAttempts()).thenReturn(taskAttempts);
  CompletedTask task = new CompletedTask(taskId, taskInfo);
  TaskReport report = task.getReport();

  // Make sure the startTime returned by report is the lesser of the 
  // attempy launch times
  assertTrue(report.getStartTime() == 10);
}
项目:hadoop-plus    文件:TestCompletedTask.java   
@Test (timeout=5000)
public void testTaskStartTimes() {

  TaskId taskId = mock(TaskId.class); 
  TaskInfo taskInfo = mock(TaskInfo.class);
  Map<TaskAttemptID, TaskAttemptInfo> taskAttempts
    = new TreeMap<TaskAttemptID, TaskAttemptInfo>();

  TaskAttemptID id = new TaskAttemptID("0", 0, TaskType.MAP, 0, 0);
  TaskAttemptInfo info = mock(TaskAttemptInfo.class);
  when(info.getAttemptId()).thenReturn(id);
  when(info.getStartTime()).thenReturn(10l);
  taskAttempts.put(id, info);

  id = new TaskAttemptID("1", 0, TaskType.MAP, 1, 1);
  info = mock(TaskAttemptInfo.class);
  when(info.getAttemptId()).thenReturn(id);
  when(info.getStartTime()).thenReturn(20l);
  taskAttempts.put(id, info);


  when(taskInfo.getAllTaskAttempts()).thenReturn(taskAttempts);
  CompletedTask task = new CompletedTask(taskId, taskInfo);
  TaskReport report = task.getReport();

  // Make sure the startTime returned by report is the lesser of the 
  // attempy launch times
  assertTrue(report.getStartTime() == 10);
}
项目:FlexMap    文件:TestCompletedTask.java   
@Test (timeout=5000)
public void testTaskStartTimes() {

  TaskId taskId = mock(TaskId.class); 
  TaskInfo taskInfo = mock(TaskInfo.class);
  Map<TaskAttemptID, TaskAttemptInfo> taskAttempts
    = new TreeMap<TaskAttemptID, TaskAttemptInfo>();

  TaskAttemptID id = new TaskAttemptID("0", 0, TaskType.MAP, 0, 0);
  TaskAttemptInfo info = mock(TaskAttemptInfo.class);
  when(info.getAttemptId()).thenReturn(id);
  when(info.getStartTime()).thenReturn(10l);
  taskAttempts.put(id, info);

  id = new TaskAttemptID("1", 0, TaskType.MAP, 1, 1);
  info = mock(TaskAttemptInfo.class);
  when(info.getAttemptId()).thenReturn(id);
  when(info.getStartTime()).thenReturn(20l);
  taskAttempts.put(id, info);


  when(taskInfo.getAllTaskAttempts()).thenReturn(taskAttempts);
  CompletedTask task = new CompletedTask(taskId, taskInfo);
  TaskReport report = task.getReport();

  // Make sure the startTime returned by report is the lesser of the 
  // attempy launch times
  assertTrue(report.getStartTime() == 10);
}
项目:hops    文件:TestCompletedTask.java   
@Test (timeout=5000)
public void testTaskStartTimes() {

  TaskId taskId = mock(TaskId.class); 
  TaskInfo taskInfo = mock(TaskInfo.class);
  Map<TaskAttemptID, TaskAttemptInfo> taskAttempts
    = new TreeMap<TaskAttemptID, TaskAttemptInfo>();

  TaskAttemptID id = new TaskAttemptID("0", 0, TaskType.MAP, 0, 0);
  TaskAttemptInfo info = mock(TaskAttemptInfo.class);
  when(info.getAttemptId()).thenReturn(id);
  when(info.getStartTime()).thenReturn(10l);
  taskAttempts.put(id, info);

  id = new TaskAttemptID("1", 0, TaskType.MAP, 1, 1);
  info = mock(TaskAttemptInfo.class);
  when(info.getAttemptId()).thenReturn(id);
  when(info.getStartTime()).thenReturn(20l);
  taskAttempts.put(id, info);


  when(taskInfo.getAllTaskAttempts()).thenReturn(taskAttempts);
  CompletedTask task = new CompletedTask(taskId, taskInfo);
  TaskReport report = task.getReport();

  // Make sure the startTime returned by report is the lesser of the 
  // attempy launch times
  assertTrue(report.getStartTime() == 10);
}
项目:hadoop-TCP    文件:TestCompletedTask.java   
@Test (timeout=5000)
public void testTaskStartTimes() {

  TaskId taskId = mock(TaskId.class); 
  TaskInfo taskInfo = mock(TaskInfo.class);
  Map<TaskAttemptID, TaskAttemptInfo> taskAttempts
    = new TreeMap<TaskAttemptID, TaskAttemptInfo>();

  TaskAttemptID id = new TaskAttemptID("0", 0, TaskType.MAP, 0, 0);
  TaskAttemptInfo info = mock(TaskAttemptInfo.class);
  when(info.getAttemptId()).thenReturn(id);
  when(info.getStartTime()).thenReturn(10l);
  taskAttempts.put(id, info);

  id = new TaskAttemptID("1", 0, TaskType.MAP, 1, 1);
  info = mock(TaskAttemptInfo.class);
  when(info.getAttemptId()).thenReturn(id);
  when(info.getStartTime()).thenReturn(20l);
  taskAttempts.put(id, info);


  when(taskInfo.getAllTaskAttempts()).thenReturn(taskAttempts);
  CompletedTask task = new CompletedTask(taskId, taskInfo);
  TaskReport report = task.getReport();

  // Make sure the startTime returned by report is the lesser of the 
  // attempy launch times
  assertTrue(report.getStartTime() == 10);
}
项目:hardfs    文件:TestCompletedTask.java   
@Test (timeout=5000)
public void testTaskStartTimes() {

  TaskId taskId = mock(TaskId.class); 
  TaskInfo taskInfo = mock(TaskInfo.class);
  Map<TaskAttemptID, TaskAttemptInfo> taskAttempts
    = new TreeMap<TaskAttemptID, TaskAttemptInfo>();

  TaskAttemptID id = new TaskAttemptID("0", 0, TaskType.MAP, 0, 0);
  TaskAttemptInfo info = mock(TaskAttemptInfo.class);
  when(info.getAttemptId()).thenReturn(id);
  when(info.getStartTime()).thenReturn(10l);
  taskAttempts.put(id, info);

  id = new TaskAttemptID("1", 0, TaskType.MAP, 1, 1);
  info = mock(TaskAttemptInfo.class);
  when(info.getAttemptId()).thenReturn(id);
  when(info.getStartTime()).thenReturn(20l);
  taskAttempts.put(id, info);


  when(taskInfo.getAllTaskAttempts()).thenReturn(taskAttempts);
  CompletedTask task = new CompletedTask(taskId, taskInfo);
  TaskReport report = task.getReport();

  // Make sure the startTime returned by report is the lesser of the 
  // attempy launch times
  assertTrue(report.getStartTime() == 10);
}
项目:hadoop-on-lustre2    文件:TestCompletedTask.java   
@Test (timeout=5000)
public void testTaskStartTimes() {

  TaskId taskId = mock(TaskId.class); 
  TaskInfo taskInfo = mock(TaskInfo.class);
  Map<TaskAttemptID, TaskAttemptInfo> taskAttempts
    = new TreeMap<TaskAttemptID, TaskAttemptInfo>();

  TaskAttemptID id = new TaskAttemptID("0", 0, TaskType.MAP, 0, 0);
  TaskAttemptInfo info = mock(TaskAttemptInfo.class);
  when(info.getAttemptId()).thenReturn(id);
  when(info.getStartTime()).thenReturn(10l);
  taskAttempts.put(id, info);

  id = new TaskAttemptID("1", 0, TaskType.MAP, 1, 1);
  info = mock(TaskAttemptInfo.class);
  when(info.getAttemptId()).thenReturn(id);
  when(info.getStartTime()).thenReturn(20l);
  taskAttempts.put(id, info);


  when(taskInfo.getAllTaskAttempts()).thenReturn(taskAttempts);
  CompletedTask task = new CompletedTask(taskId, taskInfo);
  TaskReport report = task.getReport();

  // Make sure the startTime returned by report is the lesser of the 
  // attempy launch times
  assertTrue(report.getStartTime() == 10);
}