@Test
public void testMPIEOLWithSentinels()
{
ReplaySequencer dut = new ReplaySequencer();
TransactionInfoBaseMessage init1 = makeIv2InitTask(101L);
TransactionInfoBaseMessage sentinel1 = makeSentinel(1L);
TransactionInfoBaseMessage init2 = makeIv2InitTask(102L);
TransactionInfoBaseMessage init3 = makeIv2InitTask(103L);
Assert.assertFalse(dut.offer(101L, init1));
Assert.assertNull(dut.poll());
Assert.assertTrue(dut.offer(1L, sentinel1));
Assert.assertNull(dut.poll());
// SPs blocked by the sentinel
Assert.assertTrue(dut.offer(102L, init2));
Assert.assertTrue(dut.offer(103L, init3));
Assert.assertNull(dut.poll());
Assert.assertNull(dut.drain());
// The outstanding sentinel and the MP EOL should
// move us to the draining state
Assert.assertTrue(dut.offer(0L, makeMPIEOL()));
// poll() should shut up and drain should start just
// giving us everything
Assert.assertNull(dut.poll());
Assert.assertEquals(init2, dut.drain());
Assert.assertEquals(init3, dut.drain());
TransactionInfoBaseMessage init4 = makeIv2InitTask(104L);
TransactionInfoBaseMessage sentinel2 = makeSentinel(2L);
TransactionInfoBaseMessage init5 = makeIv2InitTask(105L);
// These SPIs should be offered after sentinel1
Assert.assertTrue(dut.offer(104L, init4));
Assert.assertTrue(dut.offer(2L, sentinel2));
Assert.assertTrue(dut.offer(105L, init5));