@Test public void testScheduleSameTimeHeadAndTail() throws Exception { ScheduledDeliveryHandlerImpl handler = new ScheduledDeliveryHandlerImpl(null, new FakeQueueForScheduleUnitTest(0)); long time = System.currentTimeMillis() + 10000; for (int i = 10001; i < 20000; i++) { addMessage(handler, i, time, true); } addMessage(handler, 10000, time, false); time = System.currentTimeMillis() + 5000; for (int i = 1; i < 10000; i++) { addMessage(handler, i, time, true); } addMessage(handler, 0, time, false); debugList(true, handler, 20000); validateSequence(handler); }
@Test public void testScheduleWithAddHeads() throws Exception { ScheduledDeliveryHandlerImpl handler = new ScheduledDeliveryHandlerImpl(null, new FakeQueueForScheduleUnitTest(0)); addMessage(handler, 0, 1, true); addMessage(handler, 1, 2, true); addMessage(handler, 2, 3, true); addMessage(handler, 3, 3, true); addMessage(handler, 4, 4, true); addMessage(handler, 10, 5, false); addMessage(handler, 9, 5, false); addMessage(handler, 8, 5, false); addMessage(handler, 7, 5, false); addMessage(handler, 6, 5, false); addMessage(handler, 5, 5, false); validateSequence(handler); }
@Test public void testScheduleFixedSampleTailAndHead() throws Exception { ScheduledDeliveryHandlerImpl handler = new ScheduledDeliveryHandlerImpl(null, new FakeQueueForScheduleUnitTest(0)); // mix a sequence of tails / heads, but at the end this was supposed to be all sequential addMessage(handler, 1, 48L, true); addMessage(handler, 2, 48L, true); addMessage(handler, 3, 48L, true); addMessage(handler, 4, 48L, true); addMessage(handler, 5, 48L, true); addMessage(handler, 0, 48L, false); addMessage(handler, 13, 59L, true); addMessage(handler, 14, 59L, true); addMessage(handler, 15, 59L, true); addMessage(handler, 16, 59L, true); addMessage(handler, 17, 59L, true); addMessage(handler, 12, 59L, false); addMessage(handler, 7, 49L, true); addMessage(handler, 8, 49L, true); addMessage(handler, 9, 49L, true); addMessage(handler, 10, 49L, true); addMessage(handler, 11, 49L, true); addMessage(handler, 6, 49L, false); validateSequence(handler); }