Repository: qpid-jms
Updated Branches:
  refs/heads/master 07ccbfebf -> 148e1b9e9


Additional tests for helper methods.

Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/5bf646cf
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/5bf646cf
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/5bf646cf

Branch: refs/heads/master
Commit: 5bf646cf8b8c9998202e106d816881e3557640e8
Parents: 07ccbfe
Author: Timothy Bish <[email protected]>
Authored: Thu Sep 25 09:59:03 2014 -0400
Committer: Timothy Bish <[email protected]>
Committed: Thu Sep 25 09:59:03 2014 -0400

----------------------------------------------------------------------
 .../amqp/message/AmqpDestinationHelperTest.java | 160 +++++++++++++++++++
 1 file changed, 160 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/5bf646cf/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelperTest.java
----------------------------------------------------------------------
diff --git 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelperTest.java
 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelperTest.java
index 373298c..8fff0d8 100644
--- 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelperTest.java
+++ 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelperTest.java
@@ -18,6 +18,9 @@ package org.apache.qpid.jms.provider.amqp.message;
 
 import static 
org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.QUEUE_ATTRIBUTES_STRING;
 import static 
org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
+import static 
org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.TEMP_QUEUE_ATTRIBUTES_STRING;
+import static 
org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.TEMP_TOPIC_ATTRIBUTES_STRING;
+import static 
org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.TOPIC_ATTRIBUTES_STRING;
 import static 
org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -79,6 +82,107 @@ public class AmqpDestinationHelperTest {
         assertEquals(testAddress, destination.getName());
     }
 
+    @Test
+    public void 
testGetJmsDestinationWithoutTypeAnnotationWithTopicConsumerDest() throws 
Exception {
+        String testAddress = "testAddress";
+        AmqpJmsMessageFacade message = 
Mockito.mock(AmqpJmsMessageFacade.class);
+        Mockito.when(message.getToAddress()).thenReturn(testAddress);
+        
Mockito.when(message.getAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
+        JmsDestination consumerDestination = new 
JmsTopic("ConsumerDestination");
+
+        JmsDestination destination = helper.getJmsDestination(message, 
consumerDestination);
+        assertNotNull(destination);
+        assertTrue(destination.isTopic());
+        assertFalse(destination.isTemporary());
+        assertEquals(testAddress, destination.getName());
+    }
+
+    @Test
+    public void 
testGetJmsDestinationWithoutTypeAnnotationWithTempQueueConsumerDest() throws 
Exception {
+        String testAddress = "testAddress";
+        AmqpJmsMessageFacade message = 
Mockito.mock(AmqpJmsMessageFacade.class);
+        Mockito.when(message.getToAddress()).thenReturn(testAddress);
+        
Mockito.when(message.getAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
+        JmsDestination consumerDestination = new 
JmsTemporaryQueue("ConsumerDestination");
+
+        JmsDestination destination = helper.getJmsDestination(message, 
consumerDestination);
+        assertNotNull(destination);
+        assertTrue(destination.isQueue());
+        assertTrue(destination.isTemporary());
+        assertEquals(testAddress, destination.getName());
+    }
+
+    @Test
+    public void 
testGetJmsDestinationWithoutTypeAnnotationWithTempTopicConsumerDest() throws 
Exception {
+        String testAddress = "testAddress";
+        AmqpJmsMessageFacade message = 
Mockito.mock(AmqpJmsMessageFacade.class);
+        Mockito.when(message.getToAddress()).thenReturn(testAddress);
+        
Mockito.when(message.getAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
+        JmsDestination consumerDestination = new 
JmsTemporaryTopic("ConsumerDestination");
+
+        JmsDestination destination = helper.getJmsDestination(message, 
consumerDestination);
+        assertNotNull(destination);
+        assertTrue(destination.isTopic());
+        assertTrue(destination.isTemporary());
+        assertEquals(testAddress, destination.getName());
+    }
+
+    @Test
+    public void 
testGetJmsDestinationWithQueueTypeAnnotationNoConsumerDestination() throws 
Exception {
+        String testAddress = "testAddress";
+        AmqpJmsMessageFacade message = 
Mockito.mock(AmqpJmsMessageFacade.class);
+        Mockito.when(message.getToAddress()).thenReturn(testAddress);
+        
Mockito.when(message.getAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(QUEUE_ATTRIBUTES_STRING);
+
+        JmsDestination destination = helper.getJmsDestination(message, null);
+        assertNotNull(destination);
+        assertTrue(destination.isQueue());
+        assertFalse(destination.isTemporary());
+        assertEquals(testAddress, destination.getName());
+    }
+
+    @Test
+    public void 
testGetJmsDestinationWithTopicTypeAnnotationNoConsumerDestination() throws 
Exception {
+        String testAddress = "testAddress";
+        AmqpJmsMessageFacade message = 
Mockito.mock(AmqpJmsMessageFacade.class);
+        Mockito.when(message.getToAddress()).thenReturn(testAddress);
+        
Mockito.when(message.getAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TOPIC_ATTRIBUTES_STRING);
+
+        JmsDestination destination = helper.getJmsDestination(message, null);
+        assertNotNull(destination);
+        assertTrue(destination.isTopic());
+        assertFalse(destination.isTemporary());
+        assertEquals(testAddress, destination.getName());
+    }
+
+    @Test
+    public void 
testGetJmsDestinationWithTempQueueTypeAnnotationNoConsumerDestination() throws 
Exception {
+        String testAddress = "testAddress";
+        AmqpJmsMessageFacade message = 
Mockito.mock(AmqpJmsMessageFacade.class);
+        Mockito.when(message.getToAddress()).thenReturn(testAddress);
+        
Mockito.when(message.getAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_QUEUE_ATTRIBUTES_STRING);
+
+        JmsDestination destination = helper.getJmsDestination(message, null);
+        assertNotNull(destination);
+        assertTrue(destination.isQueue());
+        assertTrue(destination.isTemporary());
+        assertEquals(testAddress, destination.getName());
+    }
+
+    @Test
+    public void 
testGetJmsDestinationWithTempTopicTypeAnnotationNoConsumerDestination() throws 
Exception {
+        String testAddress = "testAddress";
+        AmqpJmsMessageFacade message = 
Mockito.mock(AmqpJmsMessageFacade.class);
+        Mockito.when(message.getToAddress()).thenReturn(testAddress);
+        
Mockito.when(message.getAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_TOPIC_ATTRIBUTES_STRING);
+
+        JmsDestination destination = helper.getJmsDestination(message, null);
+        assertNotNull(destination);
+        assertTrue(destination.isTopic());
+        assertTrue(destination.isTemporary());
+        assertEquals(testAddress, destination.getName());
+    }
+
     //--------------- Test getJmsReplyTo method 
------------------------------//
 
     @Test
@@ -162,6 +266,62 @@ public class AmqpDestinationHelperTest {
         assertEquals(testAddress, destination.getName());
     }
 
+    @Test
+    public void testGetJmsReplToWithQueueTypeAnnotationNoConsumerDestination() 
throws Exception {
+        String testAddress = "testAddress";
+        AmqpJmsMessageFacade message = 
Mockito.mock(AmqpJmsMessageFacade.class);
+        Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
+        
Mockito.when(message.getAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(QUEUE_ATTRIBUTES_STRING);
+
+        JmsDestination destination = helper.getJmsReplyTo(message, null);
+        assertNotNull(destination);
+        assertTrue(destination.isQueue());
+        assertFalse(destination.isTemporary());
+        assertEquals(testAddress, destination.getName());
+    }
+
+    @Test
+    public void testGetJmsReplToWithTopicTypeAnnotationNoConsumerDestination() 
throws Exception {
+        String testAddress = "testAddress";
+        AmqpJmsMessageFacade message = 
Mockito.mock(AmqpJmsMessageFacade.class);
+        Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
+        
Mockito.when(message.getAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TOPIC_ATTRIBUTES_STRING);
+
+        JmsDestination destination = helper.getJmsReplyTo(message, null);
+        assertNotNull(destination);
+        assertTrue(destination.isTopic());
+        assertFalse(destination.isTemporary());
+        assertEquals(testAddress, destination.getName());
+    }
+
+    @Test
+    public void 
testGetJmsReplToWithTempQueueTypeAnnotationNoConsumerDestination() throws 
Exception {
+        String testAddress = "testAddress";
+        AmqpJmsMessageFacade message = 
Mockito.mock(AmqpJmsMessageFacade.class);
+        Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
+        
Mockito.when(message.getAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_QUEUE_ATTRIBUTES_STRING);
+
+        JmsDestination destination = helper.getJmsReplyTo(message, null);
+        assertNotNull(destination);
+        assertTrue(destination.isQueue());
+        assertTrue(destination.isTemporary());
+        assertEquals(testAddress, destination.getName());
+    }
+
+    @Test
+    public void 
testGetJmsReplToWithTempTopicTypeAnnotationNoConsumerDestination() throws 
Exception {
+        String testAddress = "testAddress";
+        AmqpJmsMessageFacade message = 
Mockito.mock(AmqpJmsMessageFacade.class);
+        Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
+        
Mockito.when(message.getAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_TOPIC_ATTRIBUTES_STRING);
+
+        JmsDestination destination = helper.getJmsReplyTo(message, null);
+        assertNotNull(destination);
+        assertTrue(destination.isTopic());
+        assertTrue(destination.isTemporary());
+        assertEquals(testAddress, destination.getName());
+    }
+
     //--------------- Test setToAddress method 
-------------------------------//
 
     //--------------- Test setReplyToAddress method 
--------------------------//


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to