public void testFindChunkTaskToRun() { assertFalse(tr.findTaskToRun()); StepTask t1 = task(100, 200, 100); StepTask t2 = task(100, 300, 50); Schedule s = sched(ListUtil.list(t1, t2)); fact.setResults(s, s); assertTrue(tr.addToSchedule(t1)); assertTrue(tr.addToSchedule(t2)); assertFalse(tr.findTaskToRun()); assertEquals(Deadline.at(100), tr.runningDeadline); TimeBase.setSimulated(101); assertTrue(tr.findTaskToRun()); assertEquals(t1, tr.runningTask); assertEquals(t1.getLatestFinish(), tr.runningDeadline); assertEquals(s.getEvents().get(0), tr.runningChunk); }
// make a Chunk for the task Schedule.Chunk chunk(StepTask task) { return new Schedule.Chunk(task, task.getEarliestStart(), task.getLatestFinish(), task.curEst()); }