You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2014/09/25 16:22:15 UTC
[1/2] git commit: Additional tests for helper methods.
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 <ta...@gmail.com>
Authored: Thu Sep 25 09:59:03 2014 -0400
Committer: Timothy Bish <ta...@gmail.com>
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: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/2] git commit: Add tests for the address set methods.
Posted by ta...@apache.org.
Add tests for the address set 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/148e1b9e
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/148e1b9e
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/148e1b9e
Branch: refs/heads/master
Commit: 148e1b9e954a28c67f92c16ff4c1d0ce15c16429
Parents: 5bf646c
Author: Timothy Bish <ta...@gmail.com>
Authored: Thu Sep 25 10:21:58 2014 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Thu Sep 25 10:21:58 2014 -0400
----------------------------------------------------------------------
.../amqp/message/AmqpDestinationHelperTest.java | 100 ++++++++++++++++++-
1 file changed, 98 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/148e1b9e/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 8fff0d8..6564583 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
@@ -322,9 +322,105 @@ public class AmqpDestinationHelperTest {
assertEquals(testAddress, destination.getName());
}
- //--------------- Test setToAddress method -------------------------------//
+ //--------------- Test setToAddressFromDestination method ----------------//
- //--------------- Test setReplyToAddress method --------------------------//
+ @Test
+ public void testSetToAddressFromDestinationWithQueue() {
+ String testAddress = "testAddress";
+ JmsDestination destination = new JmsQueue("testAddress");
+ AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
+
+ helper.setToAddressFromDestination(message, destination);
+
+ Mockito.verify(message).setToAddress(testAddress);
+ Mockito.verify(message).setAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, QUEUE_ATTRIBUTES_STRING);
+ }
+
+ @Test
+ public void testSetToAddressFromDestinationWithTopic() {
+ String testAddress = "testAddress";
+ JmsDestination destination = new JmsTopic("testAddress");
+ AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
+
+ helper.setToAddressFromDestination(message, destination);
+
+ Mockito.verify(message).setToAddress(testAddress);
+ Mockito.verify(message).setAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, TOPIC_ATTRIBUTES_STRING);
+ }
+
+ @Test
+ public void testSetToAddressFromDestinationWithTempQueue() {
+ String testAddress = "testAddress";
+ JmsDestination destination = new JmsTemporaryQueue("testAddress");
+ AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
+
+ helper.setToAddressFromDestination(message, destination);
+
+ Mockito.verify(message).setToAddress(testAddress);
+ Mockito.verify(message).setAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, TEMP_QUEUE_ATTRIBUTES_STRING);
+ }
+
+ @Test
+ public void testSetToAddressFromDestinationWithTempTopic() {
+ String testAddress = "testAddress";
+ JmsDestination destination = new JmsTemporaryTopic("testAddress");
+ AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
+
+ helper.setToAddressFromDestination(message, destination);
+
+ Mockito.verify(message).setToAddress(testAddress);
+ Mockito.verify(message).setAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, TEMP_TOPIC_ATTRIBUTES_STRING);
+ }
+
+ //--------------- Test setReplyToAddressFromDestination method -----------//
+
+ @Test
+ public void testSetReplyToAddressFromDestinationWithQueue() {
+ String testAddress = "testAddress";
+ JmsDestination destination = new JmsQueue("testAddress");
+ AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
+
+ helper.setReplyToAddressFromDestination(message, destination);
+
+ Mockito.verify(message).setReplyToAddress(testAddress);
+ Mockito.verify(message).setAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, QUEUE_ATTRIBUTES_STRING);
+ }
+
+ @Test
+ public void testSetReplyToAddressFromDestinationWithTopic() {
+ String testAddress = "testAddress";
+ JmsDestination destination = new JmsTopic("testAddress");
+ AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
+
+ helper.setReplyToAddressFromDestination(message, destination);
+
+ Mockito.verify(message).setReplyToAddress(testAddress);
+ Mockito.verify(message).setAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, TOPIC_ATTRIBUTES_STRING);
+ }
+
+ @Test
+ public void testSetReplyToAddressFromDestinationWithTempQueue() {
+ String testAddress = "testAddress";
+ JmsDestination destination = new JmsTemporaryQueue("testAddress");
+ AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
+
+ helper.setReplyToAddressFromDestination(message, destination);
+
+ Mockito.verify(message).setReplyToAddress(testAddress);
+ Mockito.verify(message).setAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, TEMP_QUEUE_ATTRIBUTES_STRING);
+ }
+
+ @Test
+ public void testSetReplyToAddressFromDestinationWithTempTopic() {
+ String testAddress = "testAddress";
+ JmsDestination destination = new JmsTemporaryTopic("testAddress");
+ AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
+
+ helper.setReplyToAddressFromDestination(message, destination);
+
+ Mockito.verify(message).setReplyToAddress(testAddress);
+ Mockito.verify(message).setAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, TEMP_TOPIC_ATTRIBUTES_STRING);
+ }
//--------------- Test Support Methods -----------------------------------//
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org