Search in sources :

Example 31 with ServerMessage

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

Example 32 with ServerMessage

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

Example 33 with ServerMessage

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

Example 34 with ServerMessage

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

Example 35 with ServerMessage

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());
}
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