use of org.apache.qpid.server.message.ServerMessage in project qpid-broker-j by apache.
the class LastValueQueueListTest method testAddTwoMessagesWithDifferentConflationKeyValue.
public void testAddTwoMessagesWithDifferentConflationKeyValue() {
ServerMessage message1 = createTestServerMessage(TEST_KEY_VALUE1);
ServerMessage message2 = createTestServerMessage(TEST_KEY_VALUE2);
_list.add(message1, null);
_list.add(message2, null);
int numberOfEntries = countEntries(_list);
assertEquals(2, numberOfEntries);
}
use of org.apache.qpid.server.message.ServerMessage in project qpid-broker-j by apache.
the class LastValueQueueListTest method testConflationMapMaintainedWithDifferentConflationKeyValue.
public void testConflationMapMaintainedWithDifferentConflationKeyValue() {
assertEquals(0, _list.getLatestValuesMap().size());
ServerMessage message1 = createTestServerMessage(TEST_KEY_VALUE1);
ServerMessage message2 = createTestServerMessage(TEST_KEY_VALUE2);
QueueEntry addedEntry1 = _list.add(message1, null);
QueueEntry addedEntry2 = _list.add(message2, null);
assertEquals(2, countEntries(_list));
assertEquals(2, _list.getLatestValuesMap().size());
addedEntry1.acquire();
addedEntry1.delete();
addedEntry2.acquire();
addedEntry2.delete();
assertEquals(0, countEntries(_list));
assertEquals(0, _list.getLatestValuesMap().size());
}
use of org.apache.qpid.server.message.ServerMessage in project qpid-broker-j by apache.
the class LastValueQueueListTest method testSupersededEntryIsDiscardedOnRelease.
public void testSupersededEntryIsDiscardedOnRelease() {
ServerMessage message1 = createTestServerMessage(TEST_KEY_VALUE);
ServerMessage message2 = createTestServerMessage(TEST_KEY_VALUE);
QueueEntry entry1 = _list.add(message1, null);
// simulate an in-progress delivery to consumer
entry1.acquire();
_list.add(message2, null);
assertFalse(entry1.isDeleted());
assertEquals(2, countEntries(_list));
// simulate consumer rollback/recover
entry1.release();
assertEquals(1, countEntries(_list));
assertTrue(entry1.isDeleted());
}
use of org.apache.qpid.server.message.ServerMessage in project qpid-broker-j by apache.
the class LastValueQueueListTest method testAddTwoMessagesWithSameConflationKeyValue.
public void testAddTwoMessagesWithSameConflationKeyValue() {
ServerMessage message1 = createTestServerMessage(TEST_KEY_VALUE);
ServerMessage message2 = createTestServerMessage(TEST_KEY_VALUE);
_list.add(message1, null);
_list.add(message2, null);
int numberOfEntries = countEntries(_list);
assertEquals(1, numberOfEntries);
}
use of org.apache.qpid.server.message.ServerMessage in project qpid-broker-j by apache.
the class LastValueQueueListTest method testConflationMapMaintained.
public void testConflationMapMaintained() {
assertEquals(0, _list.getLatestValuesMap().size());
ServerMessage message = createTestServerMessage(TEST_KEY_VALUE);
QueueEntry addedEntry = _list.add(message, null);
assertEquals(1, countEntries(_list));
assertEquals(1, _list.getLatestValuesMap().size());
addedEntry.acquire();
addedEntry.delete();
assertEquals(0, countEntries(_list));
assertEquals(0, _list.getLatestValuesMap().size());
}
Aggregations