public virtual void TestTaskStartTimes() { TaskId taskId = Org.Mockito.Mockito.Mock <TaskId>(); JobHistoryParser.TaskInfo taskInfo = Org.Mockito.Mockito.Mock <JobHistoryParser.TaskInfo >(); IDictionary <TaskAttemptID, JobHistoryParser.TaskAttemptInfo> taskAttempts = new SortedDictionary <TaskAttemptID, JobHistoryParser.TaskAttemptInfo>(); TaskAttemptID id = new TaskAttemptID("0", 0, TaskType.Map, 0, 0); JobHistoryParser.TaskAttemptInfo info = Org.Mockito.Mockito.Mock <JobHistoryParser.TaskAttemptInfo >(); Org.Mockito.Mockito.When(info.GetAttemptId()).ThenReturn(id); Org.Mockito.Mockito.When(info.GetStartTime()).ThenReturn(10l); taskAttempts[id] = info; id = new TaskAttemptID("1", 0, TaskType.Map, 1, 1); info = Org.Mockito.Mockito.Mock <JobHistoryParser.TaskAttemptInfo>(); Org.Mockito.Mockito.When(info.GetAttemptId()).ThenReturn(id); Org.Mockito.Mockito.When(info.GetStartTime()).ThenReturn(20l); taskAttempts[id] = info; Org.Mockito.Mockito.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 NUnit.Framework.Assert.IsTrue(report.GetStartTime() == 10); }
public virtual long GetLaunchTime() { return(attemptInfo.GetStartTime()); }