qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@apache.org
Subject [3/7] qpid-jms git commit: set new type annotations for JMSDestination/JMSReplyTo type on sent messages
Date Mon, 22 Dec 2014 16:39:51 GMT
set new type annotations for JMSDestination/JMSReplyTo type on sent messages


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

Branch: refs/heads/master
Commit: 84383f0ff3fa48ebcf9eceb9749647396c389ada
Parents: 7756fa3
Author: Robert Gemmell <robbie@apache.org>
Authored: Mon Dec 22 10:55:52 2014 +0000
Committer: Robert Gemmell <robbie@apache.org>
Committed: Mon Dec 22 10:55:52 2014 +0000

----------------------------------------------------------------------
 .../amqp/message/AmqpDestinationHelper.java     | 14 +++--
 .../amqp/message/AmqpMessageSupport.java        | 16 ------
 .../jms/integration/MessageIntegrationTest.java | 36 ++++++------
 .../amqp/message/AmqpDestinationHelperTest.java | 59 ++++++++++++++++----
 4 files changed, 75 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/84383f0f/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelper.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelper.java
b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelper.java
index 81ac956..e3eb84a 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelper.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelper.java
@@ -160,10 +160,13 @@ public class AmqpDestinationHelper {
         message.setToAddress(address);
 
         if (address == null || typeValue == null) {
-            message.removeMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
+            message.removeMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
         } else {
-            message.setMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, typeValue);
+            message.setMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME, typeValue);
         }
+
+        // Always clear the legacy string type annotation
+        message.removeMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
     }
 
     public void setReplyToAddressFromDestination(AmqpJmsMessageFacade message, JmsDestination
destination) {
@@ -173,10 +176,13 @@ public class AmqpDestinationHelper {
         message.setReplyToAddress(replyToAddress);
 
         if (replyToAddress == null || typeValue == null) {
-            message.removeMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
+            message.removeMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
         } else {
-            message.setMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, typeValue);
+            message.setMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, typeValue);
         }
+
+        // Always clear the legacy string type annotation
+        message.removeMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
     }
 
     private String getDestinationAddress(JmsDestination destination, AmqpConnection conn)
{

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/84383f0f/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpMessageSupport.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpMessageSupport.java
b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpMessageSupport.java
index 92f4617..88b8ae1 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpMessageSupport.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpMessageSupport.java
@@ -28,22 +28,6 @@ import org.apache.qpid.proton.message.Message;
 public final class AmqpMessageSupport {
 
     /**
-     * The Annotation name to store the destination name that the Message
-     * will be sent to.  The Message should also be tagged with the appropriate
-     * destination attribute to allow the receiver to determine the correct
-     * destination type.
-     */
-    public static final String AMQP_TO_ANNOTATION = "x-opt-to-type";
-
-    /**
-     * The Annotation name to store the destination name that the sender wants
-     * to receive replies on.  The Message should also be tagged with the
-     * appropriate destination attribute to allow the receiver to determine the
-     * correct destination type.
-     */
-    public static final String AMQP_REPLY_TO_ANNOTATION = "x-opt-reply-type";
-
-    /**
      * Attribute used to mark the Application defined correlation Id that has been
      * set for the message.
      */

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/84383f0f/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/MessageIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/MessageIntegrationTest.java
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/MessageIntegrationTest.java
index 7f7a4b5..6590fc2 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/MessageIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/MessageIntegrationTest.java
@@ -287,9 +287,9 @@ public class MessageIntegrationTest extends QpidJmsTestCase
         String replyName = "myReplyTopic";
         String destAddress = destPrefix + destName;
         String replyAddress = destPrefix + replyName;
-        String annotationName = AmqpMessageSupport.AMQP_TO_ANNOTATION;
+        String annotationName = AmqpDestinationHelper.JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
         Byte annotationValue = AmqpDestinationHelper.TOPIC_TYPE;
-        String replyAnnotationName = AmqpMessageSupport.AMQP_REPLY_TO_ANNOTATION;
+        String replyAnnotationName = AmqpDestinationHelper.JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
         Byte replyAnnotationValue = AmqpDestinationHelper.TOPIC_TYPE;
 
         doReceivedMessageOnConnectionWithPrefixTestImpl(destType, destPrefix, destName, replyName,
@@ -332,9 +332,9 @@ public class MessageIntegrationTest extends QpidJmsTestCase
         String replyName = "myReplyQueue";
         String destAddress = destPrefix + destName;
         String replyAddress = destPrefix + replyName;
-        String annotationName = AmqpMessageSupport.AMQP_TO_ANNOTATION;
+        String annotationName = AmqpDestinationHelper.JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
         Byte annotationValue = AmqpDestinationHelper.QUEUE_TYPE;
-        String replyAnnotationName = AmqpMessageSupport.AMQP_REPLY_TO_ANNOTATION;
+        String replyAnnotationName = AmqpDestinationHelper.JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
         Byte replyAnnotationValue = AmqpDestinationHelper.QUEUE_TYPE;
 
         doReceivedMessageOnConnectionWithPrefixTestImpl(destType, destPrefix, destName, replyName,
@@ -377,9 +377,9 @@ public class MessageIntegrationTest extends QpidJmsTestCase
         String replyName = "temp-queue://myReplyTempQueue";
         String destAddress = destName; // We won't manipulate the temporary addresses generated
by the broker
         String replyAddress = replyName; // We won't manipulate the temporary addresses generated
by the broker
-        String annotationName = AmqpMessageSupport.AMQP_TO_ANNOTATION;
+        String annotationName = AmqpDestinationHelper.JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
         Byte annotationValue = AmqpDestinationHelper.TEMP_QUEUE_TYPE;
-        String replyAnnotationName = AmqpMessageSupport.AMQP_REPLY_TO_ANNOTATION;
+        String replyAnnotationName = AmqpDestinationHelper.JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
         Byte replyAnnotationValue = AmqpDestinationHelper.TEMP_QUEUE_TYPE;
 
         doReceivedMessageOnConnectionWithPrefixTestImpl(destType, destPrefix, destName, replyName,
@@ -399,9 +399,9 @@ public class MessageIntegrationTest extends QpidJmsTestCase
         String replyName = "temp-topic://myReplyTempTopic";
         String destAddress = destName; // We won't manipulate the temporary addresses generated
by the broker
         String replyAddress = replyName; // We won't manipulate the temporary addresses generated
by the broker
-        String annotationName = AmqpMessageSupport.AMQP_TO_ANNOTATION;
+        String annotationName = AmqpDestinationHelper.JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
         Byte annotationValue = AmqpDestinationHelper.TEMP_TOPIC_TYPE;
-        String replyAnnotationName = AmqpMessageSupport.AMQP_REPLY_TO_ANNOTATION;
+        String replyAnnotationName = AmqpDestinationHelper.JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
         Byte replyAnnotationValue = AmqpDestinationHelper.TEMP_TOPIC_TYPE;
 
         doReceivedMessageOnConnectionWithPrefixTestImpl(destType, destPrefix, destName, replyName,
@@ -628,8 +628,8 @@ public class MessageIntegrationTest extends QpidJmsTestCase
 
             MessageHeaderSectionMatcher headersMatcher = new MessageHeaderSectionMatcher(true);
             MessageAnnotationsSectionMatcher msgAnnotationsMatcher = new MessageAnnotationsSectionMatcher(true);
-            msgAnnotationsMatcher.withEntry(Symbol.valueOf(AmqpMessageSupport.AMQP_TO_ANNOTATION),
equalTo(destTypeAnnotationValue));
-            msgAnnotationsMatcher.withEntry(Symbol.valueOf(AmqpMessageSupport.AMQP_REPLY_TO_ANNOTATION),
equalTo(destTypeAnnotationValue));
+            msgAnnotationsMatcher.withEntry(Symbol.valueOf(AmqpDestinationHelper.JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME),
equalTo(destTypeAnnotationValue));
+            msgAnnotationsMatcher.withEntry(Symbol.valueOf(AmqpDestinationHelper.JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME),
equalTo(destTypeAnnotationValue));
             MessagePropertiesSectionMatcher propsMatcher = new MessagePropertiesSectionMatcher(true);
             propsMatcher.withTo(equalTo(destAddress));
             propsMatcher.withReplyTo(equalTo(destAddress));
@@ -655,7 +655,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
     // --- byte type annotation values --- //
 
     /**
-     * Tests that the {@link AmqpMessageSupport#AMQP_TO_ANNOTATION} is set as a byte on
+     * Tests that the {@link AmqpDestinationHelper#JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME}
is set as a byte on
      * a sent message to indicate its 'to' address represents a Topic JMSDestination.
      */
     @Test(timeout = 5000)
@@ -670,7 +670,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
 
             MessageHeaderSectionMatcher headersMatcher = new MessageHeaderSectionMatcher(true).withDurable(equalTo(true));
             MessageAnnotationsSectionMatcher msgAnnotationsMatcher = new MessageAnnotationsSectionMatcher(true);
-            Symbol annotationKey = AmqpMessageSupport.getSymbol(AmqpMessageSupport.AMQP_TO_ANNOTATION);
+            Symbol annotationKey = AmqpMessageSupport.getSymbol(AmqpDestinationHelper.JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
             msgAnnotationsMatcher.withEntry(annotationKey, equalTo(AmqpDestinationHelper.TOPIC_TYPE));
 
             MessagePropertiesSectionMatcher propsMatcher = new MessagePropertiesSectionMatcher(true).withTo(equalTo("topic://"
+ topicName));
@@ -692,7 +692,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
     }
 
     /**
-     * Tests that the {@link AmqpMessageSupport#AMQP_REPLY_TO_ANNOTATION} is set as a byte
on
+     * Tests that the {@link AmqpDestinationHelper#JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME}
is set as a byte on
      * a sent message to indicate its 'reply-to' address represents a Topic JMSDestination.
      */
     @Test(timeout = 5000)
@@ -709,7 +709,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
 
             MessageHeaderSectionMatcher headersMatcher = new MessageHeaderSectionMatcher(true).withDurable(equalTo(true));
             MessageAnnotationsSectionMatcher msgAnnotationsMatcher = new MessageAnnotationsSectionMatcher(true);
-            Symbol annotationKey = AmqpMessageSupport.getSymbol(AmqpMessageSupport.AMQP_REPLY_TO_ANNOTATION);
+            Symbol annotationKey = AmqpMessageSupport.getSymbol(AmqpDestinationHelper.JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
             msgAnnotationsMatcher.withEntry(annotationKey, equalTo(AmqpDestinationHelper.TOPIC_TYPE));
 
             MessagePropertiesSectionMatcher propsMatcher = new MessagePropertiesSectionMatcher(true).withReplyTo(equalTo("topic://"
+ replyTopicName));
@@ -736,7 +736,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
     // --- old string type annotation values --- //
 
     /**
-     * Tests that the {@link AmqpMessageSupport#AMQP_TO_ANNOTATION} set on a message to
+     * Tests that the {@link AmqpDestinationHelper#TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME} set
on a message to
      * indicate its 'to' address represents a Topic results in the JMSDestination object
being a
      * Topic. Ensure the consumers destination is not used by consuming from a Queue.
      */
@@ -752,7 +752,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
             Queue queue = session.createQueue("myQueue");
 
             MessageAnnotationsDescribedType msgAnnotations = new MessageAnnotationsDescribedType();
-            msgAnnotations.setSymbolKeyedAnnotation(AmqpMessageSupport.AMQP_TO_ANNOTATION,
AmqpDestinationHelper.TOPIC_ATTRIBUTE);
+            msgAnnotations.setSymbolKeyedAnnotation(AmqpDestinationHelper.TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME,
AmqpDestinationHelper.TOPIC_ATTRIBUTE);
 
             PropertiesDescribedType props = new PropertiesDescribedType();
             String myTopicAddress = "myTopicAddress";
@@ -778,7 +778,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
     }
 
     /**
-     * Tests that the {@link AmqpMessageSupport#AMQP_REPLY_TO_ANNOTATION} set on a message
to
+     * Tests that the {@link AmqpDestinationHelper#REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME}
set on a message to
      * indicate its 'reply-to' address represents a Topic results in the JMSReplyTo object
being a
      * Topic. Ensure the consumers destination is not used by consuming from a Queue.
      */
@@ -794,7 +794,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
             Queue queue = session.createQueue("myQueue");
 
             MessageAnnotationsDescribedType msgAnnotations = new MessageAnnotationsDescribedType();
-            msgAnnotations.setSymbolKeyedAnnotation(AmqpMessageSupport.AMQP_REPLY_TO_ANNOTATION,
AmqpDestinationHelper.TOPIC_ATTRIBUTE);
+            msgAnnotations.setSymbolKeyedAnnotation(AmqpDestinationHelper.REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME,
AmqpDestinationHelper.TOPIC_ATTRIBUTE);
 
             PropertiesDescribedType props = new PropertiesDescribedType();
             String myTopicAddress = "myTopicAddress";

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/84383f0f/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 54a5dcd..dea756b 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
@@ -16,6 +16,8 @@
  */
 package org.apache.qpid.jms.provider.amqp.message;
 
+import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
+import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
 import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.QUEUE_ATTRIBUTE;
 import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.QUEUE_TYPE;
 import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
@@ -51,6 +53,7 @@ public class AmqpDestinationHelperTest {
     private final AmqpDestinationHelper helper = AmqpDestinationHelper.INSTANCE;
 
     //--------------- Test getJmsDestination method --------------------------//
+    //========================================================================//
 
     @Test
     public void testGetJmsDestinationWithNullAddressAndNullConsumerDestReturnsNull() throws
Exception {
@@ -258,6 +261,7 @@ public class AmqpDestinationHelperTest {
     }
 
     //--------------- Test getJmsReplyTo method ------------------------------//
+    //========================================================================//
 
     @Test
     public void testGetJmsReplyToWithNullAddressAndNullConsumerDestReturnsNull() throws Exception
{
@@ -463,13 +467,14 @@ public class AmqpDestinationHelperTest {
     }
 
     //--------------- Test setToAddressFromDestination method ----------------//
+    //========================================================================//
 
     @Test
     public void testSetToAddressFromDestinationWithNullDestination() {
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         helper.setToAddressFromDestination(message, null);
         Mockito.verify(message).setToAddress(null);
-        Mockito.verify(message).removeMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
+        Mockito.verify(message).removeMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
     }
 
     @Test(expected=NullPointerException.class)
@@ -484,6 +489,20 @@ public class AmqpDestinationHelperTest {
     }
 
     @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);
+
+        helper.setToAddressFromDestination(message, destination);
+
+        Mockito.verify(message).setToAddress(testAddress);
+        Mockito.verify(message).removeMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
+    }
+
+    @Test
     public void testSetToAddressFromDestinationWithQueue() {
         String testAddress = "testAddress";
         JmsDestination destination = new JmsQueue("testAddress");
@@ -494,7 +513,7 @@ public class AmqpDestinationHelperTest {
         helper.setToAddressFromDestination(message, destination);
 
         Mockito.verify(message).setToAddress(testAddress);
-        Mockito.verify(message).setMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME,
QUEUE_TYPE);
+        Mockito.verify(message).setMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME,
QUEUE_TYPE);
     }
 
     @Test
@@ -508,7 +527,7 @@ public class AmqpDestinationHelperTest {
         helper.setToAddressFromDestination(message, destination);
 
         Mockito.verify(message).setToAddress(testAddress);
-        Mockito.verify(message).setMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME,
TOPIC_TYPE);
+        Mockito.verify(message).setMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME,
TOPIC_TYPE);
     }
 
     @Test
@@ -520,7 +539,7 @@ public class AmqpDestinationHelperTest {
         helper.setToAddressFromDestination(message, destination);
 
         Mockito.verify(message).setToAddress(testAddress);
-        Mockito.verify(message).setMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME,
TEMP_QUEUE_TYPE);
+        Mockito.verify(message).setMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME,
TEMP_QUEUE_TYPE);
     }
 
     @Test
@@ -532,7 +551,7 @@ public class AmqpDestinationHelperTest {
         helper.setToAddressFromDestination(message, destination);
 
         Mockito.verify(message).setToAddress(testAddress);
-        Mockito.verify(message).setMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME,
TEMP_TOPIC_TYPE);
+        Mockito.verify(message).setMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME,
TEMP_TOPIC_TYPE);
     }
 
     @Test
@@ -545,17 +564,18 @@ public class AmqpDestinationHelperTest {
         helper.setToAddressFromDestination(message, destination);
 
         Mockito.verify(message).setToAddress(testAddress);
-        Mockito.verify(message).removeMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
+        Mockito.verify(message).removeMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
     }
 
     //--------------- Test setReplyToAddressFromDestination method -----------//
+    //========================================================================//
 
     @Test
     public void testSetReplyToAddressFromDestinationWithNullDestination() {
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         helper.setReplyToAddressFromDestination(message, null);
         Mockito.verify(message).setReplyToAddress(null);
-        Mockito.verify(message).removeMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
+        Mockito.verify(message).removeMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
     }
 
     @Test(expected=NullPointerException.class)
@@ -580,7 +600,21 @@ public class AmqpDestinationHelperTest {
         helper.setReplyToAddressFromDestination(message, destination);
 
         Mockito.verify(message).setReplyToAddress(testAddress);
-        Mockito.verify(message).setMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME,
QUEUE_TYPE);
+        Mockito.verify(message).setMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME,
QUEUE_TYPE);
+    }
+
+    @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);
+
+        helper.setReplyToAddressFromDestination(message, destination);
+
+        Mockito.verify(message).setReplyToAddress(testAddress);
+        Mockito.verify(message).removeMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
     }
 
     @Test
@@ -594,7 +628,7 @@ public class AmqpDestinationHelperTest {
         helper.setReplyToAddressFromDestination(message, destination);
 
         Mockito.verify(message).setReplyToAddress(testAddress);
-        Mockito.verify(message).setMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME,
TOPIC_TYPE);
+        Mockito.verify(message).setMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME,
TOPIC_TYPE);
     }
 
     @Test
@@ -606,7 +640,7 @@ public class AmqpDestinationHelperTest {
         helper.setReplyToAddressFromDestination(message, destination);
 
         Mockito.verify(message).setReplyToAddress(testAddress);
-        Mockito.verify(message).setMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME,
TEMP_QUEUE_TYPE);
+        Mockito.verify(message).setMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME,
TEMP_QUEUE_TYPE);
     }
 
     @Test
@@ -618,7 +652,7 @@ public class AmqpDestinationHelperTest {
         helper.setReplyToAddressFromDestination(message, destination);
 
         Mockito.verify(message).setReplyToAddress(testAddress);
-        Mockito.verify(message).setMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME,
TEMP_TOPIC_TYPE);
+        Mockito.verify(message).setMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME,
TEMP_TOPIC_TYPE);
     }
 
     @Test
@@ -631,10 +665,11 @@ public class AmqpDestinationHelperTest {
         helper.setReplyToAddressFromDestination(message, destination);
 
         Mockito.verify(message).setReplyToAddress(testAddress);
-        Mockito.verify(message).removeMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
+        Mockito.verify(message).removeMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
     }
 
     //--------------- Test Support Methods -----------------------------------//
+    //========================================================================//
 
     @Test
     public void testSplitAttributeWithExtraneousCommas() throws Exception {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message