}
@Test (timeout=300)
public void reserveAndConsumeTasks() throws Exception {
SchedulerQueue queue = getQueueInstance();
TaskReservation reservation =queue.reserveTask(new ScheduledTaskImpl());
reservation.use();
reservation = queue.reserveTask(new ScheduledTaskImpl());
reservation.cancel();
reservation = queue.reserveTask(new ScheduledTaskImpl(100));
reservation.use();
reservation = queue.reserveTask(new ScheduledTaskImpl(120));
reservation.cancel();
reservation = queue.reserveTask(new ScheduledTaskImpl(140));
reservation.use();
assertNotNull(queue.getNextTask(false));
assertNull(queue.getNextTask(false));
assertNotNull(queue.getNextTask(true));
assertNotNull(queue.getNextTask(true));
assertNull(queue.getNextTask(false));