use of org.apache.qpid.server.message.ServerMessage in project qpid-broker-j by apache.
the class LastValueQueueListTest method testAddMessageWithoutConflationKeyValue.
public void testAddMessageWithoutConflationKeyValue() {
ServerMessage message = createTestServerMessage(null);
_list.add(message, 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 testAddAndRemoveMessageWithConflationKeyValue.
public void testAddAndRemoveMessageWithConflationKeyValue() {
ServerMessage message = createTestServerMessage(TEST_KEY_VALUE);
QueueEntry addedEntry = _list.add(message, null);
addedEntry.acquire();
addedEntry.delete();
int numberOfEntries = countEntries(_list);
assertEquals(0, numberOfEntries);
}
use of org.apache.qpid.server.message.ServerMessage in project qpid-broker-j by apache.
the class LastValueQueueListTest method testAddAndDiscardMessageWithoutConflationKeyValue.
public void testAddAndDiscardMessageWithoutConflationKeyValue() {
ServerMessage message = createTestServerMessage(null);
QueueEntry addedEntry = _list.add(message, null);
addedEntry.acquire();
addedEntry.delete();
int numberOfEntries = countEntries(_list);
assertEquals(0, numberOfEntries);
}
use of org.apache.qpid.server.message.ServerMessage in project qpid-broker-j by apache.
the class LastValueQueueListTest method createTestServerMessage.
private ServerMessage createTestServerMessage(String conflationKeyValue) {
ServerMessage mockMessage = mock(ServerMessage.class);
AMQMessageHeader messageHeader = mock(AMQMessageHeader.class);
when(messageHeader.getHeader(CONFLATION_KEY)).thenReturn(conflationKeyValue);
when(mockMessage.getMessageHeader()).thenReturn(messageHeader);
MessageReference messageReference = mock(MessageReference.class);
when(mockMessage.newReference()).thenReturn(messageReference);
when(mockMessage.newReference(any(TransactionLogResource.class))).thenReturn(messageReference);
when(messageReference.getMessage()).thenReturn(mockMessage);
return mockMessage;
}
use of org.apache.qpid.server.message.ServerMessage in project qpid-broker-j by apache.
the class LastValueQueueListTest method testAddMessageWithConflationKeyValue.
public void testAddMessageWithConflationKeyValue() {
ServerMessage message = createTestServerMessage(TEST_KEY_VALUE);
_list.add(message, null);
int numberOfEntries = countEntries(_list);
assertEquals(1, numberOfEntries);
}
Aggregations