Search in sources :

Example 1 with ConsumerTarget

use of org.apache.qpid.server.consumer.ConsumerTarget in project qpid-broker-j by apache.

the class TrustStoreMessageSourceTest method testAddConsumer.

public void testAddConsumer() throws Exception {
    final EnumSet<ConsumerOption> options = EnumSet.noneOf(ConsumerOption.class);
    final ConsumerTarget target = mock(ConsumerTarget.class);
    when(target.allocateCredit(any(ServerMessage.class))).thenReturn(true);
    MessageInstanceConsumer consumer = _trustStoreMessageSource.addConsumer(target, null, ServerMessage.class, getTestName(), options, 0);
    final MessageContainer messageContainer = consumer.pullMessage();
    assertNotNull("Could not pull message of TrustStore", messageContainer);
    final ServerMessage message = messageContainer.getMessageInstance().getMessage();
    assertCertificates(getCertificatesFromMessage(message));
}
Also used : MessageContainer(org.apache.qpid.server.message.MessageContainer) ConsumerOption(org.apache.qpid.server.consumer.ConsumerOption) ConsumerTarget(org.apache.qpid.server.consumer.ConsumerTarget) ServerMessage(org.apache.qpid.server.message.ServerMessage) MessageInstanceConsumer(org.apache.qpid.server.message.MessageInstanceConsumer)

Example 2 with ConsumerTarget

use of org.apache.qpid.server.consumer.ConsumerTarget in project qpid-broker-j by apache.

the class VirtualHostPropertiesNodeTest method testAddConsumer.

public void testAddConsumer() throws Exception {
    final EnumSet<ConsumerOption> options = EnumSet.noneOf(ConsumerOption.class);
    final ConsumerTarget target = mock(ConsumerTarget.class);
    when(target.allocateCredit(any(ServerMessage.class))).thenReturn(true);
    MessageInstanceConsumer consumer = _virtualHostPropertiesNode.addConsumer(target, null, ServerMessage.class, getTestName(), options, 0);
    final MessageContainer messageContainer = consumer.pullMessage();
    assertNotNull("Could not pull message from VirtualHostPropertyNode", messageContainer);
    if (messageContainer.getMessageReference() != null) {
        messageContainer.getMessageReference().release();
    }
}
Also used : MessageContainer(org.apache.qpid.server.message.MessageContainer) ConsumerOption(org.apache.qpid.server.consumer.ConsumerOption) ConsumerTarget(org.apache.qpid.server.consumer.ConsumerTarget) ServerMessage(org.apache.qpid.server.message.ServerMessage) MessageInstanceConsumer(org.apache.qpid.server.message.MessageInstanceConsumer)

Aggregations

ConsumerOption (org.apache.qpid.server.consumer.ConsumerOption)2 ConsumerTarget (org.apache.qpid.server.consumer.ConsumerTarget)2 MessageContainer (org.apache.qpid.server.message.MessageContainer)2 MessageInstanceConsumer (org.apache.qpid.server.message.MessageInstanceConsumer)2 ServerMessage (org.apache.qpid.server.message.ServerMessage)2