Search in sources :

Example 86 with ServerMessage

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);
}
Also used : ServerMessage(org.apache.qpid.server.message.ServerMessage)

Example 87 with ServerMessage

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);
}
Also used : ServerMessage(org.apache.qpid.server.message.ServerMessage)

Example 88 with ServerMessage

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);
}
Also used : ServerMessage(org.apache.qpid.server.message.ServerMessage)

Example 89 with ServerMessage

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;
}
Also used : ServerMessage(org.apache.qpid.server.message.ServerMessage) AMQMessageHeader(org.apache.qpid.server.message.AMQMessageHeader) MessageReference(org.apache.qpid.server.message.MessageReference) TransactionLogResource(org.apache.qpid.server.store.TransactionLogResource)

Example 90 with ServerMessage

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);
}
Also used : ServerMessage(org.apache.qpid.server.message.ServerMessage)

Aggregations

ServerMessage (org.apache.qpid.server.message.ServerMessage)103 HashMap (java.util.HashMap)26 AMQMessageHeader (org.apache.qpid.server.message.AMQMessageHeader)16 TransactionLogResource (org.apache.qpid.server.store.TransactionLogResource)16 Exchange (org.apache.qpid.server.model.Exchange)14 MessageReference (org.apache.qpid.server.message.MessageReference)13 ArrayList (java.util.ArrayList)9 MessageInstance (org.apache.qpid.server.message.MessageInstance)8 InstanceProperties (org.apache.qpid.server.message.InstanceProperties)7 Queue (org.apache.qpid.server.model.Queue)7 StoredMessage (org.apache.qpid.server.store.StoredMessage)6 MessageEnqueueRecord (org.apache.qpid.server.store.MessageEnqueueRecord)4 QpidByteBuffer (org.apache.qpid.server.bytebuffer.QpidByteBuffer)3 TestConsumerTarget (org.apache.qpid.server.consumer.TestConsumerTarget)3 MessageDeletedException (org.apache.qpid.server.message.MessageDeletedException)3 PrivilegedAction (java.security.PrivilegedAction)2 UUID (java.util.UUID)2 MessageDestination (org.apache.qpid.server.message.MessageDestination)2 MessageInstanceConsumer (org.apache.qpid.server.message.MessageInstanceConsumer)2 RoutingResult (org.apache.qpid.server.message.RoutingResult)2