org.apache.qpid.jms.JmsQueue Java Examples

The following examples show how to use org.apache.qpid.jms.JmsQueue. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JmsInitialContextFactoryTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
@Test
public void testVariableExpansionQueue() throws Exception {
    String lookupName = "myQueueLookup";
    String variableName = "myQueueVariable";
    String variableValue = "myQueueName";

    Hashtable<Object, Object> env = new Hashtable<Object, Object>();
    env.put("queue." + lookupName, "${" + variableName +"}");

    setTestSystemProperty(variableName, variableValue);

    Context ctx = createInitialContext(env);

    Object o = ctx.lookup(lookupName);

    assertNotNull("No object returned", o);
    assertEquals("Unexpected class type for returned object", JmsQueue.class, o.getClass());

    assertEquals("Unexpected name for returned queue", variableValue, ((JmsQueue) o).getQueueName());
}
 
Example #2
Source File: AmqpDestinationHelperTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetJmsReplyToWithUnknownLegacyTypeAnnotationWithQueueConsumerDest() throws Exception {
    String testAddress = "testAddress";
    AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
    AmqpConnection conn = Mockito.mock(AmqpConnection.class);
    Mockito.when(message.getConnection()).thenReturn(conn);
    Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
    Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL)).thenReturn("jms.queue");
    JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");

    JmsDestination destination = AmqpDestinationHelper.getJmsReplyTo(message, consumerDestination);
    assertNotNull(destination);
    assertTrue(destination.isQueue());
    assertFalse(destination.isTemporary());
    assertEquals(testAddress, destination.getAddress());
}
 
Example #3
Source File: AmqpDestinationHelperTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetJmsReplyToWithEmptyLegacyTypeAnnotationWithQueueConsumerDest() throws Exception {
    String testAddress = "testAddress";
    AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
    AmqpConnection conn = Mockito.mock(AmqpConnection.class);
    Mockito.when(message.getConnection()).thenReturn(conn);
    Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
    Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL)).thenReturn("");
    JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");

    JmsDestination destination = AmqpDestinationHelper.getJmsReplyTo(message, consumerDestination);
    assertNotNull(destination);
    assertTrue(destination.isQueue());
    assertFalse(destination.isTemporary());
    assertEquals(testAddress, destination.getAddress());
}
 
Example #4
Source File: AmqpDestinationHelperTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetJmsReplyToWithUnknownTypeAnnotationWithQueueConsumerDest() throws Exception {
    String testAddress = "testAddress";
    AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
    AmqpConnection conn = Mockito.mock(AmqpConnection.class);
    Mockito.when(message.getConnection()).thenReturn(conn);
    Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
    Mockito.when(message.getMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL)).thenReturn((byte) 5);
    JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");

    JmsDestination destination = AmqpDestinationHelper.getJmsReplyTo(message, consumerDestination);
    assertNotNull(destination);
    assertTrue(destination.isQueue());
    assertFalse(destination.isTemporary());
    assertEquals(testAddress, destination.getAddress());
}
 
Example #5
Source File: AmqpDestinationHelperTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetJmsReplyToWithoutTypeAnnotationWithQueueConsumerDest() throws Exception {
    String testAddress = "testAddress";
    AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
    AmqpConnection conn = Mockito.mock(AmqpConnection.class);
    Mockito.when(message.getConnection()).thenReturn(conn);

    Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
    JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");

    JmsDestination destination = AmqpDestinationHelper.getJmsReplyTo(message, consumerDestination);
    assertNotNull(destination);
    assertTrue(destination.isQueue());
    assertFalse(destination.isTemporary());
    assertEquals(testAddress, destination.getAddress());
}
 
Example #6
Source File: AmqpClientActorTest.java    From ditto with Eclipse Public License 2.0 6 votes vote down vote up
private void prepareSession(final Session mockSession, final JmsMessageConsumer mockConsumer) throws JMSException {
    doReturn(mockConsumer).when(mockSession).createConsumer(any(JmsQueue.class));
    doAnswer((Answer<MessageProducer>) destinationInv -> {
        final MessageProducer messageProducer = mock(MessageProducer.class);
        doReturn(destinationInv.getArgument(0)).when(messageProducer).getDestination();
        mockProducers.add(messageProducer);
        return messageProducer;
    }).when(mockSession).createProducer(any(Destination.class));
    doAnswer((Answer<JmsMessage>) textMsgInv -> {
        final String textMsg = textMsgInv.getArgument(0);
        final AmqpJmsTextMessageFacade facade = new AmqpJmsTextMessageFacade();
        facade.initialize(Mockito.mock(AmqpConnection.class));
        final JmsTextMessage jmsTextMessage = new JmsTextMessage(facade);
        jmsTextMessage.setText(textMsg);
        return jmsTextMessage;
    }).when(mockSession).createTextMessage(anyString());
}
 
Example #7
Source File: AmqpDestinationHelperTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetJmsDestinationWithUnknownLegacyTypeAnnotationWithQueueConsumerDest() throws Exception {
    String testAddress = "testAddress";
    AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
    AmqpConnection conn = Mockito.mock(AmqpConnection.class);
    Mockito.when(message.getConnection()).thenReturn(conn);
    Mockito.when(message.getToAddress()).thenReturn(testAddress);
    Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL)).thenReturn("jms.queue");
    JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");

    JmsDestination destination = AmqpDestinationHelper.getJmsDestination(message, consumerDestination);
    assertNotNull(destination);
    assertTrue(destination.isQueue());
    assertFalse(destination.isTemporary());
    assertEquals(testAddress, destination.getAddress());
}
 
Example #8
Source File: AmqpDestinationHelperTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetJmsDestinationWithEmptyLegacyTypeAnnotationWithQueueConsumerDest() throws Exception {
    String testAddress = "testAddress";
    AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
    AmqpConnection conn = Mockito.mock(AmqpConnection.class);
    Mockito.when(message.getConnection()).thenReturn(conn);
    Mockito.when(message.getToAddress()).thenReturn(testAddress);
    Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL)).thenReturn("");
    JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");

    JmsDestination destination = AmqpDestinationHelper.getJmsDestination(message, consumerDestination);
    assertNotNull(destination);
    assertTrue(destination.isQueue());
    assertFalse(destination.isTemporary());
    assertEquals(testAddress, destination.getAddress());
}
 
Example #9
Source File: AmqpDestinationHelperTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetJmsDestinationWithUnknownTypeAnnotationWithQueueConsumerDest() throws Exception {
    String testAddress = "testAddress";
    AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
    AmqpConnection conn = Mockito.mock(AmqpConnection.class);
    Mockito.when(message.getConnection()).thenReturn(conn);
    Mockito.when(message.getToAddress()).thenReturn(testAddress);
    Mockito.when(message.getMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL)).thenReturn((byte) 5);
    JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");

    JmsDestination destination = AmqpDestinationHelper.getJmsDestination(message, consumerDestination);
    assertNotNull(destination);
    assertTrue(destination.isQueue());
    assertFalse(destination.isTemporary());
    assertEquals(testAddress, destination.getAddress());
}
 
Example #10
Source File: JmsDefaultPresettlePolicyTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
@Test
public void testIsProducerPresettledPresettleTransactedProducers() {
    JmsDestination queue = new JmsQueue("test");
    JmsDestination topic = new JmsTopic("test");

    JmsSession session = Mockito.mock(JmsSession.class);
    Mockito.when(session.isTransacted()).thenReturn(false);

    JmsDefaultPresettlePolicy policy = new JmsDefaultPresettlePolicy();
    assertFalse(policy.isProducerPresttled(session, queue));
    assertFalse(policy.isProducerPresttled(session, topic));
    assertFalse(policy.isProducerPresttled(session, null));

    Mockito.when(session.isTransacted()).thenReturn(true);

    policy.setPresettleTransactedProducers(true);
    assertTrue(policy.isProducerPresttled(session, queue));
    assertTrue(policy.isProducerPresttled(session, topic));
    assertFalse(policy.isProducerPresttled(session, null));
}
 
Example #11
Source File: ConnectionConsumerIntegrationTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
@Test(timeout = 20000)
public void testCreateConnectionConsumer() throws Exception {
    try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
        JmsServerSessionPool sessionPool = new JmsServerSessionPool();
        Connection connection = testFixture.establishConnecton(testPeer);

        // No additional Begin calls as there's no Session created for a Connection Consumer
        testPeer.expectReceiverAttach();
        testPeer.expectLinkFlow();

        Queue queue = new JmsQueue("myQueue");
        ConnectionConsumer consumer = connection.createConnectionConsumer(queue, null, sessionPool, 100);

        testPeer.expectDetach(true, true, true);
        consumer.close();

        testPeer.expectClose();
        connection.close();

        testPeer.waitForAllHandlersToComplete(1000);
    }
}
 
Example #12
Source File: JmsDefaultPresettlePolicyTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
@Test
public void testIsProducerPresettledPresettleQueueProducers() {
    JmsDestination queue = new JmsQueue("test");
    JmsDestination topic = new JmsTopic("test");

    JmsSession session = Mockito.mock(JmsSession.class);
    Mockito.when(session.isTransacted()).thenReturn(false);

    JmsDefaultPresettlePolicy policy = new JmsDefaultPresettlePolicy();
    assertFalse(policy.isProducerPresttled(session, queue));
    assertFalse(policy.isProducerPresttled(session, topic));
    assertFalse(policy.isProducerPresttled(session, null));

    policy.setPresettleQueueProducers(true);
    assertTrue(policy.isProducerPresttled(session, queue));
    assertFalse(policy.isProducerPresttled(session, topic));
    assertFalse(policy.isProducerPresttled(session, null));
}
 
Example #13
Source File: JmsDefaultPresettlePolicyTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
@Test
public void testIsProducerPresettledPresettleTopicProducers() {
    JmsDestination queue = new JmsQueue("test");
    JmsDestination topic = new JmsTopic("test");

    JmsSession session = Mockito.mock(JmsSession.class);
    Mockito.when(session.isTransacted()).thenReturn(false);

    JmsDefaultPresettlePolicy policy = new JmsDefaultPresettlePolicy();
    assertFalse(policy.isProducerPresttled(session, queue));
    assertFalse(policy.isProducerPresttled(session, topic));
    assertFalse(policy.isProducerPresttled(session, null));

    policy.setPresettleTopicProducers(true);
    assertFalse(policy.isProducerPresttled(session, queue));
    assertTrue(policy.isProducerPresttled(session, topic));
    assertFalse(policy.isProducerPresttled(session, null));
}
 
Example #14
Source File: JmsDefaultPresettlePolicyTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
@Test
public void testIsConsumerPresettledPresettleQueueConsumer() {
    JmsDestination queue = new JmsQueue("test");
    JmsDestination topic = new JmsTopic("test");

    JmsSession session = Mockito.mock(JmsSession.class);
    Mockito.when(session.isTransacted()).thenReturn(false);

    JmsDefaultPresettlePolicy policy = new JmsDefaultPresettlePolicy();
    assertFalse(policy.isConsumerPresttled(session, queue));
    assertFalse(policy.isConsumerPresttled(session, topic));
    assertFalse(policy.isConsumerPresttled(session, null));

    policy.setPresettleQueueConsumers(true);
    assertTrue(policy.isConsumerPresttled(session, queue));
    assertFalse(policy.isConsumerPresttled(session, topic));
    assertFalse(policy.isConsumerPresttled(session, null));
}
 
Example #15
Source File: JmsDefaultPresettlePolicyTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
@Test
public void testIsConsumerPresettledPresettleTopicConsumer() {
    JmsDestination queue = new JmsQueue("test");
    JmsDestination topic = new JmsTopic("test");

    JmsSession session = Mockito.mock(JmsSession.class);
    Mockito.when(session.isTransacted()).thenReturn(false);

    JmsDefaultPresettlePolicy policy = new JmsDefaultPresettlePolicy();
    assertFalse(policy.isConsumerPresttled(session, queue));
    assertFalse(policy.isConsumerPresttled(session, topic));
    assertFalse(policy.isConsumerPresttled(session, null));

    policy.setPresettleTopicConsumers(true);
    assertFalse(policy.isConsumerPresttled(session, queue));
    assertTrue(policy.isConsumerPresttled(session, topic));
    assertFalse(policy.isConsumerPresttled(session, null));
}
 
Example #16
Source File: AmqpDestinationHelperTest.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Test
public void testSetToAddressFromDestinationWithQueue() {
    String testAddress = "testAddress";
    JmsDestination destination = new JmsQueue("testAddress");
    AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
    AmqpConnection conn = Mockito.mock(AmqpConnection.class);
    Mockito.when(message.getConnection()).thenReturn(conn);

    AmqpDestinationHelper.setToAddressFromDestination(message, destination);

    Mockito.verify(message).setToAddress(testAddress);
    Mockito.verify(message).removeMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL);

    assertNull(message.getMessageAnnotations());
}
 
Example #17
Source File: AmqpDestinationHelperTest.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Test
public void testSetReplyToAddressFromDestinationWithQueueClearsLegacyAnnotation() {
    String testAddress = "testAddress";
    JmsDestination destination = new JmsQueue("testAddress");
    AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
    AmqpConnection conn = Mockito.mock(AmqpConnection.class);
    Mockito.when(message.getConnection()).thenReturn(conn);

    AmqpDestinationHelper.setReplyToAddressFromDestination(message, destination);

    Mockito.verify(message).setReplyToAddress(testAddress);
    Mockito.verify(message).removeMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL);
}
 
Example #18
Source File: AmqpDestinationHelperTest.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Test
public void testSetReplyToAddressFromDestinationWithQueue() {
    String testAddress = "testAddress";
    JmsDestination destination = new JmsQueue("testAddress");
    AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
    AmqpConnection conn = Mockito.mock(AmqpConnection.class);
    Mockito.when(message.getConnection()).thenReturn(conn);

    AmqpDestinationHelper.setReplyToAddressFromDestination(message, destination);

    Mockito.verify(message).setReplyToAddress(testAddress);
    Mockito.verify(message).removeMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL);

    assertNull(message.getMessageAnnotations());
}
 
Example #19
Source File: AmqpDestinationHelperTest.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Test
public void testSetToAddressFromDestinationWithQueueClearsLegacyAnnotation() {
    String testAddress = "testAddress";
    JmsDestination destination = new JmsQueue("testAddress");
    AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
    AmqpConnection conn = Mockito.mock(AmqpConnection.class);
    Mockito.when(message.getConnection()).thenReturn(conn);

    AmqpDestinationHelper.setToAddressFromDestination(message, destination);

    Mockito.verify(message).setToAddress(testAddress);
    Mockito.verify(message).removeMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL);
}
 
Example #20
Source File: JmsDefaultDeserializationPolicyTest.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Test
public void testDeserializeVectorUsingPolicy() throws Exception {
    Vector<Object> vector = new Vector<Object>();
    vector.add("pi");
    vector.add(Integer.valueOf(314159));
    vector.add(new Vector<String>());
    vector.add(Boolean.FALSE);

    final JmsDefaultDeserializationPolicy policy = new JmsDefaultDeserializationPolicy();
    ByteArrayInputStream input = new ByteArrayInputStream(serializeObject(vector));
    TrustedClassFilter filter = new TrustedClassFilter() {

        @Override
        public boolean isTrusted(Class<?> clazz) {
            LOG.trace("Check for trust status of class: {}", clazz.getName());
            return policy.isTrustedType(new JmsQueue(), clazz);
        }
    };

    ClassLoadingAwareObjectInputStream reader = new ClassLoadingAwareObjectInputStream(input, filter);

    Object result = null;
    try {
        result = reader.readObject();
    } catch (Exception ex) {
        fail("Should no throw any errors");
    } finally {
        reader.close();
    }

    assertNotNull(result);
    assertTrue(result instanceof Vector);
    assertEquals(4, ((Vector<?>) result).size());
}
 
Example #21
Source File: JmsDefaultRedeliveryPolicyTest.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Test
public void testSetMaxRedeliveries() {
    JmsDestination destination = new JmsQueue("test");
    JmsDefaultRedeliveryPolicy policy = new JmsDefaultRedeliveryPolicy();

    policy.setMaxRedeliveries(JmsDefaultRedeliveryPolicy.DEFAULT_MAX_REDELIVERIES + 1);

    assertFalse(JmsDefaultRedeliveryPolicy.DEFAULT_MAX_REDELIVERIES == policy.getMaxRedeliveries(destination));

    assertEquals(JmsDefaultRedeliveryPolicy.DEFAULT_MAX_REDELIVERIES + 1, policy.getMaxRedeliveries());
    assertEquals(JmsDefaultRedeliveryPolicy.DEFAULT_MAX_REDELIVERIES + 1, policy.getMaxRedeliveries(destination));
}
 
Example #22
Source File: JmsDefaultRedeliveryPolicyTest.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Test
public void testDefaults() {
    JmsDestination destination = new JmsQueue("test");
    JmsDefaultRedeliveryPolicy policy = new JmsDefaultRedeliveryPolicy();

    assertEquals(JmsDefaultRedeliveryPolicy.DEFAULT_MAX_REDELIVERIES, policy.getMaxRedeliveries(destination));
}
 
Example #23
Source File: ActiveMQAdmin.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Override
public void createQueue(String name) {
    try {
        context.bind(name, new JmsQueue(name));
    } catch (NamingException e) {
        throw new RuntimeException(e);
    }
}
 
Example #24
Source File: JmsInitialContextFactoryTest.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Test
public void testQueueBindingWithSlashInLookupName() throws Exception {
    String lookupName = "myLookup/Name";
    String actualName = "myQueueName";

    Hashtable<Object, Object> env = new Hashtable<Object, Object>();
    env.put(JmsInitialContextFactory.QUEUE_KEY_PREFIX + lookupName, actualName);

    Context ctx = createInitialContext(env);
    Object o = ctx.lookup(lookupName);

    assertNotNull("No object returned", o);
    assertEquals("Unexpected class type for returned object", JmsQueue.class, o.getClass());
    assertEquals("Unexpected name for returned object", actualName, ((JmsQueue) o).getQueueName());
}
 
Example #25
Source File: JmsInitialContextFactoryTest.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Test
public void testDynamicQueueLookup() throws Exception {
    String actualName = "myQueueName";
    String lookupName = "dynamicQueues/" + actualName;

    Context ctx = createInitialContext(new Hashtable<Object, Object>());
    Object o = ctx.lookup(lookupName);

    assertNotNull("No object returned", o);
    assertEquals("Unexpected class type for returned object", JmsQueue.class, o.getClass());
    assertEquals("Unexpected name for returned object", actualName, ((JmsQueue) o).getQueueName());
}
 
Example #26
Source File: JmsInitialContextFactoryTest.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Test
public void testQueueBinding() throws Exception {
    String lookupName = "myLookupName";
    String actualName = "myQueueName";

    Hashtable<Object, Object> env = new Hashtable<Object, Object>();
    env.put(JmsInitialContextFactory.QUEUE_KEY_PREFIX + lookupName, actualName);

    Context ctx = createInitialContext(env);
    Object o = ctx.lookup(lookupName);

    assertNotNull("No object returned", o);
    assertEquals("Unexpected class type for returned object", JmsQueue.class, o.getClass());
    assertEquals("Unexpected name for returned object", actualName, ((JmsQueue) o).getQueueName());
}
 
Example #27
Source File: JNDIReferenceFactoryTest.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
private void doGetObjectInstanceCreatesJmsQueueTestImpl(String nameAddressProp) throws Exception, JMSException {
    Reference reference = createTestReference(JmsQueue.class.getName(), nameAddressProp, TEST_QUEUE_ADDRESS);

    Object queue = referenceFactory.getObjectInstance(reference, mockName, mockContext, testEnvironment);

    assertNotNull("Expected object to be created", queue);
    assertEquals("Unexpected object type created", JmsQueue.class, queue.getClass());
    assertEquals("Unexpected address", TEST_QUEUE_ADDRESS, ((JmsQueue) queue).getAddress());
    assertEquals("Unexpected queue name", TEST_QUEUE_ADDRESS, ((Queue) queue).getQueueName());

}
 
Example #28
Source File: JmsMessagePropertyIntercepterTest.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Test
public void testJMSReplyToPropertExistsWhenSet() throws JMSException {
    JmsMessageFacade facade = Mockito.mock(JmsMessageFacade.class);
    JmsMessage message = Mockito.mock(JmsMapMessage.class);
    Mockito.when(message.getFacade()).thenReturn(facade);
    JmsDestination queue = new JmsQueue("TestDestination");
    Mockito.when(facade.getReplyTo()).thenReturn(queue);
    assertTrue(JmsMessagePropertyIntercepter.propertyExists(message, JMS_REPLYTO));
}
 
Example #29
Source File: AmqpDestinationHelperTest.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetJmsReplyToWithNullAddressWithConsumerDestReturnsNull() throws Exception {
    AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
    Mockito.when(message.getReplyToAddress()).thenReturn(null);
    JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");

    assertNull(AmqpDestinationHelper.getJmsReplyTo(message, consumerDestination));
}
 
Example #30
Source File: JmsMessagePropertyIntercepterTest.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
private void doJMSReplyToInGetPropertyNamesWhenSetTestImpl(boolean excludeStandardJmsHeaders) throws JMSException {
    JmsMessageFacade facade = Mockito.mock(JmsMessageFacade.class);
    JmsMessage message = Mockito.mock(JmsMapMessage.class);
    Mockito.when(message.getFacade()).thenReturn(facade);
    JmsDestination queue = new JmsQueue("TestDestination");
    Mockito.when(facade.getReplyTo()).thenReturn(queue);
    if (excludeStandardJmsHeaders) {
        assertFalse(JmsMessagePropertyIntercepter.getPropertyNames(message, true).contains(JMS_REPLYTO));
    } else {
        assertTrue(JmsMessagePropertyIntercepter.getPropertyNames(message, false).contains(JMS_REPLYTO));
    }
}