You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2015/01/02 17:21:14 UTC

[1/9] qpid-jms git commit: tidy up a bit now that we only support sending the byte type annotation, reduce boxing where possible

Repository: qpid-jms
Updated Branches:
  refs/heads/master 2f78161bd -> 54f93bc6e


tidy up a bit now that we only support sending the byte type annotation, reduce boxing where possible


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

Branch: refs/heads/master
Commit: 4e3595c610bfa38158166f44cd07fc74e52abee7
Parents: 2f78161
Author: Robert Gemmell <ro...@apache.org>
Authored: Fri Jan 2 12:24:37 2015 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Fri Jan 2 12:24:37 2015 +0000

----------------------------------------------------------------------
 .../amqp/message/AmqpDestinationHelper.java     | 43 +++++++++++---------
 1 file changed, 23 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/4e3595c6/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 d04e403..fb6f9b4 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
@@ -40,6 +40,7 @@ public class AmqpDestinationHelper {
     public static final byte TOPIC_TYPE = 0x01;
     public static final byte TEMP_QUEUE_TYPE = 0x02;
     public static final byte TEMP_TOPIC_TYPE = 0x03;
+    private static final byte UNKNOWN_TYPE = -1;
 
     // For support of old string type values
     public static final String TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME = "x-opt-to-type";
@@ -63,8 +64,8 @@ public class AmqpDestinationHelper {
      */
     public JmsDestination getJmsDestination(AmqpJmsMessageFacade message, JmsDestination consumerDestination) {
         String to = message.getToAddress();
-        Byte typeByte = getTypeByte(message, JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
-        if (typeByte == null) {
+        byte typeByte = getTypeByte(message, JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
+        if (typeByte == UNKNOWN_TYPE) {
             // Try the legacy string type annotation
             typeByte = getTypeByte(message, TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
         }
@@ -76,8 +77,8 @@ public class AmqpDestinationHelper {
 
     public JmsDestination getJmsReplyTo(AmqpJmsMessageFacade message, JmsDestination consumerDestination) {
         String replyTo = message.getReplyToAddress();
-        Byte typeByte = getTypeByte(message, JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
-        if (typeByte == null) {
+        byte typeByte = getTypeByte(message, JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
+        if (typeByte == UNKNOWN_TYPE) {
             // Try the legacy string type annotation
             typeByte = getTypeByte(message, REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
         }
@@ -87,12 +88,12 @@ public class AmqpDestinationHelper {
         return createDestination(name, typeByte, consumerDestination, true);
     }
 
-    private String stripPrefixIfNecessary(String address, AmqpConnection conn, Byte typeByte, JmsDestination consumerDestination) {
+    private String stripPrefixIfNecessary(String address, AmqpConnection conn, byte typeByte, JmsDestination consumerDestination) {
         if (address == null) {
             return null;
         }
 
-        if (typeByte == null) {
+        if (typeByte == UNKNOWN_TYPE) {
             String queuePrefix = conn.getQueuePrefix();
             if (queuePrefix != null && address.startsWith(queuePrefix)) {
                 return address.substring(queuePrefix.length());
@@ -117,12 +118,12 @@ public class AmqpDestinationHelper {
         return address;
     }
 
-    private JmsDestination createDestination(String address, Byte typeByte, JmsDestination consumerDestination, boolean useConsumerDestForTypeOnly) {
+    private JmsDestination createDestination(String address, byte typeByte, JmsDestination consumerDestination, boolean useConsumerDestForTypeOnly) {
         if (address == null) {
             return useConsumerDestForTypeOnly ? null : consumerDestination;
         }
 
-        if (typeByte != null) {
+        if (typeByte != UNKNOWN_TYPE) {
             switch (typeByte) {
             case QUEUE_TYPE:
                 return new JmsQueue(address);
@@ -155,11 +156,12 @@ public class AmqpDestinationHelper {
 
     public void setToAddressFromDestination(AmqpJmsMessageFacade message, JmsDestination destination) {
         String address = getDestinationAddress(destination, message.getConnection());
-        Object typeValue = toTypeAnnotation(destination);
+        byte typeValue = toTypeAnnotation(destination);
 
         message.setToAddress(address);
 
-        if (address == null || typeValue == null) {
+        // Set or clear the new byte type annotation as appropriate
+        if (address == null || typeValue == UNKNOWN_TYPE) {
             message.removeMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
         } else {
             message.setMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME, typeValue);
@@ -171,11 +173,12 @@ public class AmqpDestinationHelper {
 
     public void setReplyToAddressFromDestination(AmqpJmsMessageFacade message, JmsDestination destination) {
         String replyToAddress = getDestinationAddress(destination, message.getConnection());
-        Object typeValue = toTypeAnnotation(destination);
+        byte typeValue = toTypeAnnotation(destination);
 
         message.setReplyToAddress(replyToAddress);
 
-        if (replyToAddress == null || typeValue == null) {
+        // Set or clear the new byte type annotation as appropriate
+        if (replyToAddress == null || typeValue == UNKNOWN_TYPE) {
             message.removeMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
         } else {
             message.setMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, typeValue);
@@ -213,12 +216,12 @@ public class AmqpDestinationHelper {
     }
 
     /**
-     * @return the annotation type value, or null if the supplied destination
-     *         is null or can't be classified
+     * @return the annotation type value, or {@value AmqpDestinationHelper#UNKNOWN_TYPE} if the
+     *         supplied destination null or can't be classified
      */
-    private Object toTypeAnnotation(JmsDestination destination) {
+    private byte toTypeAnnotation(JmsDestination destination) {
         if (destination == null) {
-            return null;
+            return UNKNOWN_TYPE;
         }
 
         if (destination.isQueue()) {
@@ -235,7 +238,7 @@ public class AmqpDestinationHelper {
             }
         }
 
-        return null;
+        return UNKNOWN_TYPE;
     }
 
     Set<String> splitAttributesString(String typeString) {
@@ -256,12 +259,12 @@ public class AmqpDestinationHelper {
         return typeSet;
     }
 
-    private Byte getTypeByte(AmqpJmsMessageFacade message, String annotationName) {
+    private byte getTypeByte(AmqpJmsMessageFacade message, String annotationName) {
         Object typeAnnotation = message.getMessageAnnotation(annotationName);
 
         if (typeAnnotation == null) {
             // Doesn't exist, or null.
-            return null;
+            return UNKNOWN_TYPE;
         } else if (typeAnnotation instanceof Byte) {
             // Return the value found.
             return (Byte) typeAnnotation;
@@ -290,7 +293,7 @@ public class AmqpDestinationHelper {
                 }
             }
 
-            return null;
+            return UNKNOWN_TYPE;
         }
     }
 


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


[3/9] qpid-jms git commit: fix up some of the javadoc issues

Posted by ro...@apache.org.
fix up some of the javadoc issues


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

Branch: refs/heads/master
Commit: f797c60521fc297531bb81215394a2b74d2d04f5
Parents: 4acb2a6
Author: Robert Gemmell <ro...@apache.org>
Authored: Fri Jan 2 14:42:04 2015 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Fri Jan 2 14:42:04 2015 +0000

----------------------------------------------------------------------
 .../apache/qpid/jms/JmsConnectionFactory.java   |  6 +++---
 .../qpid/jms/JmsLocalTransactionContext.java    |  2 +-
 .../org/apache/qpid/jms/JmsMessageConsumer.java |  2 +-
 .../qpid/jms/provider/ProviderFuture.java       |  4 ----
 .../provider/amqp/AmqpTransactionContext.java   |  2 --
 .../provider/amqp/AmqpTransferTagGenerator.java |  2 +-
 .../amqp/message/AmqpJmsMessageFacade.java      |  2 +-
 .../amqp/message/AmqpMessageIdHelper.java       |  2 +-
 .../qpid/jms/transports/SslTransport.java       |  2 +-
 .../org/apache/qpid/jms/util/PropertyUtil.java  |  4 +---
 .../BytesMessageIntegrationTest.java            |  2 +-
 .../qpid/jms/message/JmsBytesMessageTest.java   |  4 ++--
 .../qpid/jms/message/JmsObjectMessageTest.java  |  2 +-
 .../amqp/message/AmqpJmsMessageBuilderTest.java |  2 +-
 .../amqp/message/AmqpJmsMessageFacadeTest.java  |  4 ++--
 .../amqp/message/AmqpMessageIdHelperTest.java   | 20 ++++++++++----------
 .../qpid/jms/test/testpeer/FrameSender.java     |  2 +-
 .../matchers/types/EncodedDataMatcher.java      |  1 +
 18 files changed, 29 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f797c605/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java
index 5e02cd8..6a7dcf8 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnectionFactory.java
@@ -152,7 +152,7 @@ public class JmsConnectionFactory extends JNDIStorable implements ConnectionFact
     }
 
     /**
-     * @param userName
+     * @param username
      * @param password
      * @return a TopicConnection
      * @throws JMSException
@@ -182,7 +182,7 @@ public class JmsConnectionFactory extends JNDIStorable implements ConnectionFact
     }
 
     /**
-     * @param userName
+     * @param username
      * @param password
      * @return Connection
      * @throws JMSException
@@ -211,7 +211,7 @@ public class JmsConnectionFactory extends JNDIStorable implements ConnectionFact
     }
 
     /**
-     * @param userName
+     * @param username
      * @param password
      * @return a QueueConnection
      * @throws JMSException

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f797c605/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java
index c9395ba..f0473d3 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsLocalTransactionContext.java
@@ -48,7 +48,7 @@ public class JmsLocalTransactionContext {
     /**
      * Adds the given Transaction synchronization to the current list.
      *
-     * @param synchronization
+     * @param s
      *        the transaction synchronization to add.
      */
     public void addSynchronization(JmsTxSynchronization s) {

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f797c605/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java
index c8a9703..9afe13a 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsMessageConsumer.java
@@ -295,7 +295,7 @@ public class JmsMessageConsumer implements MessageConsumer, JmsMessageAvailableC
      * Called from the session when a new Message has been dispatched to this Consumer
      * from the connection.
      *
-     * @param facade
+     * @param envelope
      *        the newly arrived message.
      */
     @Override

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f797c605/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java
index 417d185..e1fc3fc 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProviderFuture.java
@@ -64,8 +64,6 @@ public class ProviderFuture extends WrappedAsyncResult {
      * @param unit
      *        The unit to use for this wait period.
      *
-     * @return the result of this operation or null if the wait timed out.
-     *
      * @throws IOException if an error occurs while waiting for the response.
      */
     public void sync(long amount, TimeUnit unit) throws IOException {
@@ -81,8 +79,6 @@ public class ProviderFuture extends WrappedAsyncResult {
     /**
      * Waits for a response to some Provider requested operation.
      *
-     * @return the response from the Provider for this operation.
-     *
      * @throws IOException if an error occurs while waiting for the response.
      */
     public void sync() throws IOException {

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f797c605/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTransactionContext.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTransactionContext.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTransactionContext.java
index 13b181e..8a9d0da 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTransactionContext.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTransactionContext.java
@@ -72,8 +72,6 @@ public class AmqpTransactionContext extends AmqpAbstractResource<JmsSessionInfo,
      *
      * @param session
      *        The session that owns this transaction
-     * @param resource
-     *        The JmsTransactionInfo that defines this Transaction.
      */
     public AmqpTransactionContext(AmqpSession session) {
         super(session.getJmsResource());

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f797c605/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTransferTagGenerator.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTransferTagGenerator.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTransferTagGenerator.java
index 309561c..9981b5c 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTransferTagGenerator.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTransferTagGenerator.java
@@ -72,7 +72,7 @@ public final class AmqpTransferTagGenerator {
      * When used as a pooled cache of tags the unused tags should always be returned once
      * the transfer has been settled.
      *
-     * @param tag
+     * @param data
      *        a previously borrowed tag that is no longer in use.
      */
     public void returnTag(byte[] data) {

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f797c605/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageFacade.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageFacade.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageFacade.java
index 5465ccb..1c06093 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageFacade.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageFacade.java
@@ -748,7 +748,7 @@ public class AmqpJmsMessageFacade implements JmsMessageFacade {
 
     /**
      * The AmqpConnection instance that is associated with this Message.
-     * @return
+     * @return the connection
      */
     public AmqpConnection getConnection() {
         return connection;

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f797c605/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpMessageIdHelper.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpMessageIdHelper.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpMessageIdHelper.java
index 18c0b91..9801661 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpMessageIdHelper.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpMessageIdHelper.java
@@ -81,7 +81,7 @@ public class AmqpMessageIdHelper {
     /**
      * Returns the suffix of the given string after removing the first "ID:" prefix (if present).
      *
-     * @param string the string to process
+     * @param id the string to process
      * @return the suffix, or the original String if the "ID:" prefix is not present
      */
     public String stripMessageIdPrefix(String id) {

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f797c605/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/SslTransport.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/SslTransport.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/SslTransport.java
index 49d250c..0860aae 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/SslTransport.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/SslTransport.java
@@ -37,7 +37,7 @@ public class SslTransport extends TcpTransport {
      *        The TransportListener that will handle events from this Transport instance.
      * @param remoteLocation
      *        The location that is being connected to.
-     * @param JmsSslContext
+     * @param context
      *        The JMS Framework SslContext to use for this SSL connection.
      */
     public SslTransport(TransportListener listener, URI remoteLocation, JmsSslContext context) {

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f797c605/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/PropertyUtil.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/PropertyUtil.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/PropertyUtil.java
index aebb845..6184487 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/PropertyUtil.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/util/PropertyUtil.java
@@ -97,8 +97,6 @@ public class PropertyUtil {
      *
      * @param uri
      *        The source URI whose existing query is replaced with the newly supplied one.
-     * @param query
-     *        The new URI query string that should be appended to the given URI.
      *
      * @return a new URI that is a combination of the original URI and the given query string.
      * @throws URISyntaxException
@@ -215,7 +213,7 @@ public class PropertyUtil {
      * Given a map of properties, filter out only those prefixed with the given value, the
      * values filtered are returned in a new Map instance.
      *
-     * @param properties
+     * @param props
      *        The map of properties to filter.
      * @param optionPrefix
      *        The prefix value to use when filtering.

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f797c605/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/BytesMessageIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/BytesMessageIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/BytesMessageIntegrationTest.java
index 6f2726c..06264d5 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/BytesMessageIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/BytesMessageIntegrationTest.java
@@ -240,7 +240,7 @@ public class BytesMessageIntegrationTest extends QpidJmsTestCase {
      * Binary and no content type is returned as a BytesMessage, verify it gives the
      * expected data values when read, and when sent to the test peer it results in an
      * AMQP message containing a data body section and content type of
-     * {@link AmqpMessageSupport.OCTET_STREAM_CONTENT_TYPE}
+     * {@link AmqpMessageSupport#OCTET_STREAM_CONTENT_TYPE}
      */
     @Test(timeout = 5000)
     public void testReceiveBytesMessageWithAmqpValueAndResendResultsInData() throws Exception {

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f797c605/qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsBytesMessageTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsBytesMessageTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsBytesMessageTest.java
index d1923d6..0206a68 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsBytesMessageTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsBytesMessageTest.java
@@ -248,7 +248,7 @@ public class JmsBytesMessageTest {
     }
 
     /**
-     * Verify that when {@link BytesMessage#readBytes(byte[], int))} is called
+     * Verify that when {@link BytesMessage#readBytes(byte[], int)} is called
      * with a negative length that an {@link IndexOutOfBoundsException} is thrown.
      */
     @Test(expected=IndexOutOfBoundsException.class)
@@ -260,7 +260,7 @@ public class JmsBytesMessageTest {
     }
 
     /**
-     * Verify that when {@link BytesMessage#readBytes(byte[], int))} is called
+     * Verify that when {@link BytesMessage#readBytes(byte[], int)} is called
      * with a length that is greater than the size of the provided array,
      * an {@link IndexOutOfBoundsException} is thrown.
      */

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f797c605/qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsObjectMessageTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsObjectMessageTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsObjectMessageTest.java
index 5ba2bf2..305aa5b 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsObjectMessageTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsObjectMessageTest.java
@@ -102,7 +102,7 @@ public class JmsObjectMessageTest {
 
     /**
      * Test that calling {@link ObjectMessage#clearBody()} of a received message
-     * causes the body of the underlying {@link AmqpObjectMessage} to be emptied.
+     * causes the body of the underlying message facade to be emptied.
      */
     @Test
     public void testClearBodyOnReceivedObjectMessageClearsUnderlyingMessageBody() throws Exception {

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f797c605/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageBuilderTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageBuilderTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageBuilderTest.java
index 36e467f..71d35b9 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageBuilderTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageBuilderTest.java
@@ -162,7 +162,7 @@ public class AmqpJmsMessageBuilderTest extends QpidJmsTestCase {
     /**
      * Test that a message with the {@value AmqpMessageSupport#JMS_MSG_TYPE}
      * annotation set to  {@value AmqpMessageSupport#JMS_OBJECT_MESSAGE} and
-     * content-type set to {@value AmqpMessageSupport.OCTET_STREAM_CONTENT_TYPE} is
+     * content-type set to {@value AmqpMessageSupport#OCTET_STREAM_CONTENT_TYPE} is
      * treated as a {@link JmsObjectMessage} with {@link AmqpJmsObjectMessageFacade}
      * containing a {@link AmqpSerializedObjectDelegate}.
      */

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f797c605/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageFacadeTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageFacadeTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageFacadeTest.java
index 1966ced..f3cfe9a 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageFacadeTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageFacadeTest.java
@@ -1606,8 +1606,8 @@ public class AmqpJmsMessageFacadeTest extends AmqpJmsMessageTypesTestCase  {
     }
 
     /**
-     * Test that {@link MessageImpl#getJMSType()} returns the expected value for a message
-     * received with the {@link ClientProperties#X_OPT_JMS_TYPE} message annotation set.
+     * Test that {@link AmqpJmsMessageFacade#getType()} returns the expected value for a message
+     * received with the {@link AmqpMessageSupport#JMS_TYPE} message annotation set.
      */
     @Test
     public void testGetJMSTypeWithReceivedMessage() throws Exception {

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f797c605/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpMessageIdHelperTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpMessageIdHelperTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpMessageIdHelperTest.java
index 40b711e..1c4efc5 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpMessageIdHelperTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpMessageIdHelperTest.java
@@ -145,7 +145,7 @@ public class AmqpMessageIdHelperTest extends QpidJmsTestCase {
     }
 
     /**
-     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} returns null if given null
+     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} returns null if given null
      */
     @Test
     public void testToBaseMessageIdStringWithNull() {
@@ -154,7 +154,7 @@ public class AmqpMessageIdHelperTest extends QpidJmsTestCase {
     }
 
     /**
-     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} throws an IAE if given an unexpected object type.
+     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} throws an IAE if given an unexpected object type.
      */
     @Test
     public void testToBaseMessageIdStringThrowsIAEWithUnexpectedType() {
@@ -167,7 +167,7 @@ public class AmqpMessageIdHelperTest extends QpidJmsTestCase {
     }
 
     /**
-     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} returns the given
+     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} returns the given
      * basic string unchanged
      */
     @Test
@@ -180,7 +180,7 @@ public class AmqpMessageIdHelperTest extends QpidJmsTestCase {
     }
 
     /**
-     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} returns a string
+     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} returns a string
      * indicating an AMQP encoded string, when the given string happens to already begin with
      * the {@link AmqpMessageIdHelper#AMQP_UUID_PREFIX}.
      */
@@ -195,7 +195,7 @@ public class AmqpMessageIdHelperTest extends QpidJmsTestCase {
     }
 
     /**
-     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} returns a string
+     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} returns a string
      * indicating an AMQP encoded string, when the given string happens to already begin with
      * the {@link AmqpMessageIdHelper#AMQP_ULONG_PREFIX}.
      */
@@ -210,7 +210,7 @@ public class AmqpMessageIdHelperTest extends QpidJmsTestCase {
     }
 
     /**
-     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} returns a string
+     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} returns a string
      * indicating an AMQP encoded string, when the given string happens to already begin with
      * the {@link AmqpMessageIdHelper#AMQP_BINARY_PREFIX}.
      */
@@ -225,7 +225,7 @@ public class AmqpMessageIdHelperTest extends QpidJmsTestCase {
     }
 
     /**
-     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} returns a string
+     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} returns a string
      * indicating an AMQP encoded string (effectively twice), when the given string happens to already begin with
      * the {@link AmqpMessageIdHelper#AMQP_STRING_PREFIX}.
      */
@@ -240,7 +240,7 @@ public class AmqpMessageIdHelperTest extends QpidJmsTestCase {
     }
 
     /**
-     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} returns a string
+     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} returns a string
      * indicating an AMQP encoded UUID when given a UUID object.
      */
     @Test
@@ -254,7 +254,7 @@ public class AmqpMessageIdHelperTest extends QpidJmsTestCase {
     }
 
     /**
-     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} returns a string
+     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} returns a string
      * indicating an AMQP encoded ulong when given a UnsignedLong object.
      */
     @Test
@@ -268,7 +268,7 @@ public class AmqpMessageIdHelperTest extends QpidJmsTestCase {
     }
 
     /**
-     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(String)} returns a string
+     * Test that {@link AmqpMessageIdHelper#toBaseMessageIdString(Object)} returns a string
      * indicating an AMQP encoded binary when given a Binary object.
      */
     @Test

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f797c605/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/FrameSender.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/FrameSender.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/FrameSender.java
index 4dbdef7..ed34384 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/FrameSender.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/FrameSender.java
@@ -20,7 +20,7 @@ package org.apache.qpid.jms.test.testpeer;
 
 import org.apache.qpid.proton.amqp.Binary;
 
-class FrameSender implements AmqpPeerRunnable
+public class FrameSender implements AmqpPeerRunnable
 {
     private final TestAmqpPeer _testAmqpPeer;
     private final FrameType _type;

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f797c605/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/types/EncodedDataMatcher.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/types/EncodedDataMatcher.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/types/EncodedDataMatcher.java
index 94cea5e..4930930 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/types/EncodedDataMatcher.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/matchers/types/EncodedDataMatcher.java
@@ -21,6 +21,7 @@ package org.apache.qpid.jms.test.testpeer.matchers.types;
 import org.apache.qpid.proton.amqp.Binary;
 import org.apache.qpid.proton.amqp.Symbol;
 import org.apache.qpid.proton.amqp.UnsignedLong;
+import org.apache.qpid.proton.amqp.messaging.AmqpValue;
 import org.hamcrest.Description;
 
 public class EncodedDataMatcher extends EncodedAmqpTypeMatcher


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


[9/9] qpid-jms git commit: remove unused imports

Posted by ro...@apache.org.
remove unused imports


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

Branch: refs/heads/master
Commit: 54f93bc6e346772c982bd1a710893eafab99d709
Parents: 265878a
Author: Robert Gemmell <ro...@apache.org>
Authored: Fri Jan 2 16:20:32 2015 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Fri Jan 2 16:20:32 2015 +0000

----------------------------------------------------------------------
 .../main/java/org/apache/qpid/jms/provider/amqp/AmqpSession.java    | 1 -
 .../qpid/jms/provider/amqp/message/AmqpJmsMessageFacadeTest.java    | 1 -
 2 files changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/54f93bc6/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpSession.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpSession.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpSession.java
index 08c974b..27d018e 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpSession.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpSession.java
@@ -21,7 +21,6 @@ import java.util.Map;
 
 import javax.jms.IllegalStateException;
 
-import org.apache.qpid.jms.JmsDestination;
 import org.apache.qpid.jms.meta.JmsConsumerId;
 import org.apache.qpid.jms.meta.JmsConsumerInfo;
 import org.apache.qpid.jms.meta.JmsProducerId;

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/54f93bc6/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageFacadeTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageFacadeTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageFacadeTest.java
index f3cfe9a..81fb84b 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageFacadeTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageFacadeTest.java
@@ -58,7 +58,6 @@ import org.apache.qpid.proton.amqp.messaging.MessageAnnotations;
 import org.apache.qpid.proton.amqp.messaging.Properties;
 import org.apache.qpid.proton.codec.impl.DataImpl;
 import org.apache.qpid.proton.message.Message;
-import org.apache.qpid.proton.message.impl.MessageImpl;
 import org.junit.Test;
 import org.mockito.Mockito;
 


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


[5/9] qpid-jms git commit: move constants for the old destination annotations

Posted by ro...@apache.org.
move constants for the old destination annotations


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

Branch: refs/heads/master
Commit: 5c5b302ad4df9c9d82d82caf40d1006f48f0e070
Parents: 03463f8
Author: Robert Gemmell <ro...@apache.org>
Authored: Fri Jan 2 15:01:51 2015 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Fri Jan 2 15:01:51 2015 +0000

----------------------------------------------------------------------
 .../amqp/message/AmqpDestinationHelper.java     | 24 ++++++----------
 .../amqp/message/AmqpMessageSupport.java        |  7 +++++
 .../jms/integration/MessageIntegrationTest.java | 10 +++----
 .../amqp/message/AmqpDestinationHelperTest.java | 30 ++++++++++----------
 4 files changed, 35 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/5c5b302a/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 16c9a0a..47a7bb1 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
@@ -33,7 +33,6 @@ import org.apache.qpid.jms.provider.amqp.AmqpConnection;
 public class AmqpDestinationHelper {
     public static final AmqpDestinationHelper INSTANCE = new AmqpDestinationHelper();
 
-    // For support of current byte type values
     public static final String JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME = "x-opt-jms-dest";
     public static final String JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME = "x-opt-jms-reply-to";
     public static final byte QUEUE_TYPE = 0x00;
@@ -42,13 +41,6 @@ public class AmqpDestinationHelper {
     public static final byte TEMP_TOPIC_TYPE = 0x03;
     private static final byte UNKNOWN_TYPE = -1;
 
-    // For support of old string type values
-    public static final String LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME = "x-opt-to-type";
-    public static final String LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME = "x-opt-reply-type";
-    public static final String LEGACY_QUEUE_ATTRIBUTE = "queue";
-    public static final String LEGACY_TOPIC_ATTRIBUTE = "topic";
-    public static final String LEGACY_TEMPORARY_ATTRIBUTE = "temporary";
-
     /**
      * Decode the provided To address, type description, and consumer destination
      * information such that an appropriate Destination object can be returned.
@@ -67,7 +59,7 @@ public class AmqpDestinationHelper {
         byte typeByte = getTypeByte(message, JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
         if (typeByte == UNKNOWN_TYPE) {
             // Try the legacy string type annotation
-            typeByte = getTypeByte(message, LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
+            typeByte = getTypeByte(message, AmqpMessageSupport.LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
         }
 
         String name = stripPrefixIfNecessary(to, message.getConnection(), typeByte, consumerDestination);
@@ -80,7 +72,7 @@ public class AmqpDestinationHelper {
         byte typeByte = getTypeByte(message, JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
         if (typeByte == UNKNOWN_TYPE) {
             // Try the legacy string type annotation
-            typeByte = getTypeByte(message, LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
+            typeByte = getTypeByte(message, AmqpMessageSupport.LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
         }
 
         String name = stripPrefixIfNecessary(replyTo, message.getConnection(), typeByte, consumerDestination);
@@ -168,7 +160,7 @@ public class AmqpDestinationHelper {
         }
 
         // Always clear the legacy string type annotation
-        message.removeMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
+        message.removeMessageAnnotation(AmqpMessageSupport.LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
     }
 
     public void setReplyToAddressFromDestination(AmqpJmsMessageFacade message, JmsDestination destination) {
@@ -185,7 +177,7 @@ public class AmqpDestinationHelper {
         }
 
         // Always clear the legacy string type annotation
-        message.removeMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
+        message.removeMessageAnnotation(AmqpMessageSupport.LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
     }
 
     public String getDestinationAddress(JmsDestination destination, AmqpConnection conn) {
@@ -278,14 +270,14 @@ public class AmqpDestinationHelper {
             }
 
             if (typeSet != null && !typeSet.isEmpty()) {
-                if (typeSet.contains(LEGACY_QUEUE_ATTRIBUTE)) {
-                    if (typeSet.contains(LEGACY_TEMPORARY_ATTRIBUTE)) {
+                if (typeSet.contains(AmqpMessageSupport.LEGACY_QUEUE_ATTRIBUTE)) {
+                    if (typeSet.contains(AmqpMessageSupport.LEGACY_TEMPORARY_ATTRIBUTE)) {
                         return TEMP_QUEUE_TYPE;
                     } else {
                         return QUEUE_TYPE;
                     }
-                } else if (typeSet.contains(LEGACY_TOPIC_ATTRIBUTE)) {
-                    if (typeSet.contains(LEGACY_TEMPORARY_ATTRIBUTE)) {
+                } else if (typeSet.contains(AmqpMessageSupport.LEGACY_TOPIC_ATTRIBUTE)) {
+                    if (typeSet.contains(AmqpMessageSupport.LEGACY_TEMPORARY_ATTRIBUTE)) {
                         return TEMP_TOPIC_TYPE;
                     } else {
                         return TOPIC_TYPE;

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/5c5b302a/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 88b8ae1..842cda9 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
@@ -100,6 +100,13 @@ public final class AmqpMessageSupport {
      */
     public static final String OCTET_STREAM_CONTENT_TYPE = "application/octet-stream";
 
+    // For support of old string destination type annotations
+    public static final String LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME = "x-opt-to-type";
+    public static final String LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME = "x-opt-reply-type";
+    public static final String LEGACY_QUEUE_ATTRIBUTE = "queue";
+    public static final String LEGACY_TOPIC_ATTRIBUTE = "topic";
+    public static final String LEGACY_TEMPORARY_ATTRIBUTE = "temporary";
+
     /**
      * Lookup and return the correct Proton Symbol instance based on the given key.
      *

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/5c5b302a/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 49bab7d..c527577 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
@@ -919,7 +919,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
     /**
      * Tests that lack of any destination type annotation value (via either
      * {@link AmqpDestinationHelper#JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME}
-     * or {@link AmqpDestinationHelper#LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME}) set
+     * or {@link AmqpMessageSupport#LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME}) set
      * on a message to indicate type of its 'reply-to' address results in it
      * being classed as the same type as the consumer destination.
      */
@@ -1042,7 +1042,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
     // --- old string destination type annotation values --- //
 
     /**
-     * Tests that the {@link AmqpDestinationHelper#LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME} set on a message to
+     * Tests that the {@link AmqpMessageSupport#LEGACY_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.
      */
@@ -1058,7 +1058,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
             Queue queue = session.createQueue("myQueue");
 
             MessageAnnotationsDescribedType msgAnnotations = new MessageAnnotationsDescribedType();
-            msgAnnotations.setSymbolKeyedAnnotation(AmqpDestinationHelper.LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, AmqpDestinationHelper.LEGACY_TOPIC_ATTRIBUTE);
+            msgAnnotations.setSymbolKeyedAnnotation(AmqpMessageSupport.LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, AmqpMessageSupport.LEGACY_TOPIC_ATTRIBUTE);
 
             PropertiesDescribedType props = new PropertiesDescribedType();
             String myTopicAddress = "myTopicAddress";
@@ -1084,7 +1084,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
     }
 
     /**
-     * Tests that the {@link AmqpDestinationHelper#LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME} set on a message to
+     * Tests that the {@link AmqpMessageSupport#LEGACY_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.
      */
@@ -1100,7 +1100,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
             Queue queue = session.createQueue("myQueue");
 
             MessageAnnotationsDescribedType msgAnnotations = new MessageAnnotationsDescribedType();
-            msgAnnotations.setSymbolKeyedAnnotation(AmqpDestinationHelper.LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, AmqpDestinationHelper.LEGACY_TOPIC_ATTRIBUTE);
+            msgAnnotations.setSymbolKeyedAnnotation(AmqpMessageSupport.LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, AmqpMessageSupport.LEGACY_TOPIC_ATTRIBUTE);
 
             PropertiesDescribedType props = new PropertiesDescribedType();
             String myTopicAddress = "myTopicAddress";

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/5c5b302a/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 d47aa24..405714c 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,15 +18,15 @@ 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.LEGACY_QUEUE_ATTRIBUTE;
 import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.QUEUE_TYPE;
-import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
-import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.LEGACY_TEMPORARY_ATTRIBUTE;
 import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.TEMP_QUEUE_TYPE;
 import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.TEMP_TOPIC_TYPE;
-import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.LEGACY_TOPIC_ATTRIBUTE;
 import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.TOPIC_TYPE;
-import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
+import static org.apache.qpid.jms.provider.amqp.message.AmqpMessageSupport.LEGACY_QUEUE_ATTRIBUTE;
+import static org.apache.qpid.jms.provider.amqp.message.AmqpMessageSupport.LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
+import static org.apache.qpid.jms.provider.amqp.message.AmqpMessageSupport.LEGACY_TEMPORARY_ATTRIBUTE;
+import static org.apache.qpid.jms.provider.amqp.message.AmqpMessageSupport.LEGACY_TOPIC_ATTRIBUTE;
+import static org.apache.qpid.jms.provider.amqp.message.AmqpMessageSupport.LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -47,8 +47,8 @@ import org.junit.Test;
 import org.mockito.Mockito;
 
 public class AmqpDestinationHelperTest {
-    public static final String TEMP_QUEUE_ATTRIBUTES_STRING = LEGACY_QUEUE_ATTRIBUTE + "," + LEGACY_TEMPORARY_ATTRIBUTE;
-    public static final String TEMP_TOPIC_ATTRIBUTES_STRING = LEGACY_TOPIC_ATTRIBUTE + "," + LEGACY_TEMPORARY_ATTRIBUTE;
+    private static final String TEMP_QUEUE_ATTRIBUTES_STRING = LEGACY_QUEUE_ATTRIBUTE + "," + LEGACY_TEMPORARY_ATTRIBUTE;
+    private static final String TEMP_TOPIC_ATTRIBUTES_STRING = LEGACY_TOPIC_ATTRIBUTE + "," + LEGACY_TEMPORARY_ATTRIBUTE;
 
     private final AmqpDestinationHelper helper = AmqpDestinationHelper.INSTANCE;
 
@@ -675,34 +675,34 @@ public class AmqpDestinationHelperTest {
     public void testSplitAttributeWithExtraneousCommas() throws Exception {
 
         Set<String> set = new HashSet<String>();
-        set.add(AmqpDestinationHelper.LEGACY_QUEUE_ATTRIBUTE);
-        set.add(AmqpDestinationHelper.LEGACY_TEMPORARY_ATTRIBUTE);
+        set.add(LEGACY_QUEUE_ATTRIBUTE);
+        set.add(LEGACY_TEMPORARY_ATTRIBUTE);
 
         // test for no NPE errors.
         assertNull(helper.splitAttributesString(null));
 
         // test a single comma separator produces expected set
         assertEquals(set, helper.splitAttributesString(LEGACY_QUEUE_ATTRIBUTE + "," +
-                                                 AmqpDestinationHelper.LEGACY_TEMPORARY_ATTRIBUTE));
+                                                 LEGACY_TEMPORARY_ATTRIBUTE));
 
         // test trailing comma doesn't alter produced set
         assertEquals(set, helper.splitAttributesString(LEGACY_QUEUE_ATTRIBUTE + "," +
-                                                 AmqpDestinationHelper.LEGACY_TEMPORARY_ATTRIBUTE + ","));
+                                                 LEGACY_TEMPORARY_ATTRIBUTE + ","));
 
         // test leading comma doesn't alter produced set
         assertEquals(set, helper.splitAttributesString("," + LEGACY_QUEUE_ATTRIBUTE + ","
-                                                     + AmqpDestinationHelper.LEGACY_TEMPORARY_ATTRIBUTE));
+                                                     + LEGACY_TEMPORARY_ATTRIBUTE));
 
         // test consecutive central commas don't alter produced set
         assertEquals(set, helper.splitAttributesString(LEGACY_QUEUE_ATTRIBUTE + ",," +
-                                                 AmqpDestinationHelper.LEGACY_TEMPORARY_ATTRIBUTE));
+                                                 LEGACY_TEMPORARY_ATTRIBUTE));
 
         // test consecutive trailing commas don't alter produced set
         assertEquals(set, helper.splitAttributesString(LEGACY_QUEUE_ATTRIBUTE + "," +
-                                                 AmqpDestinationHelper.LEGACY_TEMPORARY_ATTRIBUTE + ",,"));
+                                                 LEGACY_TEMPORARY_ATTRIBUTE + ",,"));
 
         // test consecutive leading commas don't alter produced set
         assertEquals(set, helper.splitAttributesString("," + LEGACY_QUEUE_ATTRIBUTE + ","
-                                                     + AmqpDestinationHelper.LEGACY_TEMPORARY_ATTRIBUTE));
+                                                     + LEGACY_TEMPORARY_ATTRIBUTE));
     }
 }


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


[7/9] qpid-jms git commit: add tests for AmqpDestinationHelper#getJmsReplyTo using new byte destination type anntotation, rearrange/group tests for clarity

Posted by ro...@apache.org.
add tests for AmqpDestinationHelper#getJmsReplyTo using new byte destination type anntotation, rearrange/group tests for clarity


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

Branch: refs/heads/master
Commit: 4302c28f6684e0af2edc99924139f530566a2a36
Parents: b957ce7
Author: Robert Gemmell <ro...@apache.org>
Authored: Fri Jan 2 15:42:22 2015 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Fri Jan 2 15:42:22 2015 +0000

----------------------------------------------------------------------
 .../amqp/message/AmqpDestinationHelperTest.java | 145 ++++++++++++++-----
 1 file changed, 110 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/4302c28f/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 5b468b7..603c8fe 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
@@ -47,8 +47,8 @@ import org.junit.Test;
 import org.mockito.Mockito;
 
 public class AmqpDestinationHelperTest {
-    private static final String TEMP_QUEUE_ATTRIBUTES_STRING = LEGACY_QUEUE_ATTRIBUTE + "," + LEGACY_TEMPORARY_ATTRIBUTE;
-    private static final String TEMP_TOPIC_ATTRIBUTES_STRING = LEGACY_TOPIC_ATTRIBUTE + "," + LEGACY_TEMPORARY_ATTRIBUTE;
+    private static final String LEGACY_TEMP_QUEUE_ATTRIBUTES = LEGACY_QUEUE_ATTRIBUTE + "," + LEGACY_TEMPORARY_ATTRIBUTE;
+    private static final String LEGACY_TEMP_TOPIC_ATTRIBUTES = LEGACY_TOPIC_ATTRIBUTE + "," + LEGACY_TEMPORARY_ATTRIBUTE;
 
     private final AmqpDestinationHelper helper = AmqpDestinationHelper.INSTANCE;
 
@@ -314,7 +314,7 @@ public class AmqpDestinationHelperTest {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_QUEUE_ATTRIBUTES_STRING);
+        Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(LEGACY_TEMP_QUEUE_ATTRIBUTES);
 
         JmsDestination destination = helper.getJmsDestination(message, null);
         assertNotNull(destination);
@@ -328,7 +328,7 @@ public class AmqpDestinationHelperTest {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_TOPIC_ATTRIBUTES_STRING);
+        Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(LEGACY_TEMP_TOPIC_ATTRIBUTES);
 
         JmsDestination destination = helper.getJmsDestination(message, null);
         assertNotNull(destination);
@@ -341,12 +341,12 @@ public class AmqpDestinationHelperTest {
     //--------------- Test getJmsReplyTo method ------------------------------//
     //========================================================================//
 
+    // --- general / no type annotations  --- //
+
     @Test
     public void testGetJmsReplyToWithNullAddressAndNullConsumerDestReturnsNull() throws Exception {
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getReplyToAddress()).thenReturn(null);
-        Mockito.when(message.getMessageAnnotation(
-            LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(LEGACY_QUEUE_ATTRIBUTE);
 
         assertNull(helper.getJmsDestination(message, null));
     }
@@ -355,8 +355,6 @@ public class AmqpDestinationHelperTest {
     public void testGetJmsReplyToWithNullAddressWithConsumerDestReturnsNull() throws Exception {
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getReplyToAddress()).thenReturn(null);
-        Mockito.when(message.getMessageAnnotation(
-            LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(LEGACY_QUEUE_ATTRIBUTE);
         JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");
 
         assertNull(helper.getJmsReplyTo(message, consumerDestination));
@@ -370,7 +368,6 @@ public class AmqpDestinationHelperTest {
         Mockito.when(message.getConnection()).thenReturn(conn);
 
         Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
         JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
@@ -381,13 +378,60 @@ public class AmqpDestinationHelperTest {
     }
 
     @Test
+    public void testGetJmsReplyToWithoutTypeAnnotationWithTopicConsumerDest() 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);
+        JmsTopic consumerDestination = new JmsTopic("ConsumerDestination");
+
+        JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
+        assertNotNull(destination);
+        assertTrue(destination.isTopic());
+        assertFalse(destination.isTemporary());
+        assertEquals(testAddress, destination.getName());
+    }
+
+    @Test
+    public void testGetJmsReplyToWithoutTypeAnnotationWithTempTopicConsumerDest() 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);
+        JmsTemporaryTopic consumerDestination = new JmsTemporaryTopic("ConsumerDestination");
+
+        JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
+        assertNotNull(destination);
+        assertTrue(destination.isTopic());
+        assertTrue(destination.isTemporary());
+        assertEquals(testAddress, destination.getName());
+    }
+
+    @Test
+    public void testGetJmsReplyToWithoutTypeAnnotationWithTempQueueConsumerDest() 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);
+        JmsTemporaryQueue consumerDestination = new JmsTemporaryQueue("ConsumerDestination");
+
+        JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
+        assertNotNull(destination);
+        assertTrue(destination.isQueue());
+        assertTrue(destination.isTemporary());
+        assertEquals(testAddress, destination.getName());
+    }
+
+    @Test
     public void testGetJmsReplyToWithoutTypeAnnotationWithAnonymousConsumerDest() {
         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_NAME)).thenReturn(null);
 
         JmsDestination consumerDestination = Mockito.mock(JmsDestination.class);
         Mockito.when(consumerDestination.getName()).thenReturn("ConsumerDestination");
@@ -399,14 +443,16 @@ public class AmqpDestinationHelperTest {
         assertEquals(testAddress, destination.getName());
     }
 
+    // --- new byte destination type annotations --- //
+
     @Test
-    public void testGetJmsReplyToWithEmptyTypeAnnotationWithQueueConsumerDest() throws Exception {
+    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(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn("");
+        Mockito.when(message.getMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn((byte) 5);
         JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
@@ -416,17 +462,17 @@ public class AmqpDestinationHelperTest {
         assertEquals(testAddress, destination.getName());
     }
 
+
     @Test
-    public void testGetJmsReplyToWithUnknownTypeAnnotationWithQueueConsumerDest() throws Exception {
+    public void testGetJmsReplToWithQueueTypeAnnotationNoConsumerDestination() 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_NAME)).thenReturn("jms.queue");
-        JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");
+        Mockito.when(message.getMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(QUEUE_TYPE);
 
-        JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
+        JmsDestination destination = helper.getJmsReplyTo(message, null);
         assertNotNull(destination);
         assertTrue(destination.isQueue());
         assertFalse(destination.isTemporary());
@@ -434,16 +480,15 @@ public class AmqpDestinationHelperTest {
     }
 
     @Test
-    public void testGetJmsReplyToWithoutTypeAnnotationWithTopicConsumerDest() throws Exception {
+    public void testGetJmsReplToWithTopicTypeAnnotationNoConsumerDestination() 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_NAME)).thenReturn(null);
-        JmsTopic consumerDestination = new JmsTopic("ConsumerDestination");
+        Mockito.when(message.getMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TOPIC_TYPE);
 
-        JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
+        JmsDestination destination = helper.getJmsReplyTo(message, null);
         assertNotNull(destination);
         assertTrue(destination.isTopic());
         assertFalse(destination.isTemporary());
@@ -451,41 +496,71 @@ public class AmqpDestinationHelperTest {
     }
 
     @Test
-    public void testGetJmsReplyToWithoutTypeAnnotationWithTempQueueConsumerDest() throws Exception {
+    public void testGetJmsReplToWithTempQueueTypeAnnotationNoConsumerDestination() throws Exception {
+        String testAddress = "testAddress";
+        AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
+        Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
+        Mockito.when(message.getMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_QUEUE_TYPE);
+
+        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.getMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_TOPIC_TYPE);
+
+        JmsDestination destination = helper.getJmsReplyTo(message, null);
+        assertNotNull(destination);
+        assertTrue(destination.isTopic());
+        assertTrue(destination.isTemporary());
+        assertEquals(testAddress, destination.getName());
+    }
+
+    // --- legacy string destination type annotations --- //
+
+    @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_NAME)).thenReturn(null);
-        JmsTemporaryQueue consumerDestination = new JmsTemporaryQueue("ConsumerDestination");
+        Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn("");
+        JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
         assertNotNull(destination);
         assertTrue(destination.isQueue());
-        assertTrue(destination.isTemporary());
+        assertFalse(destination.isTemporary());
         assertEquals(testAddress, destination.getName());
     }
 
     @Test
-    public void testGetJmsReplyToWithoutTypeAnnotationWithTempTopicConsumerDest() throws Exception {
+    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_NAME)).thenReturn(null);
-        JmsTemporaryTopic consumerDestination = new JmsTemporaryTopic("ConsumerDestination");
+        Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn("jms.queue");
+        JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
         assertNotNull(destination);
-        assertTrue(destination.isTopic());
-        assertTrue(destination.isTemporary());
+        assertTrue(destination.isQueue());
+        assertFalse(destination.isTemporary());
         assertEquals(testAddress, destination.getName());
     }
 
     @Test
-    public void testGetJmsReplToWithQueueTypeAnnotationNoConsumerDestination() throws Exception {
+    public void testGetJmsReplToWithLegacyQueueTypeAnnotationNoConsumerDestination() throws Exception {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
@@ -501,7 +576,7 @@ public class AmqpDestinationHelperTest {
     }
 
     @Test
-    public void testGetJmsReplToWithTopicTypeAnnotationNoConsumerDestination() throws Exception {
+    public void testGetJmsReplToWithLegacyTopicTypeAnnotationNoConsumerDestination() throws Exception {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
@@ -517,11 +592,11 @@ public class AmqpDestinationHelperTest {
     }
 
     @Test
-    public void testGetJmsReplToWithTempQueueTypeAnnotationNoConsumerDestination() throws Exception {
+    public void testGetJmsReplToWithLegacyTempQueueTypeAnnotationNoConsumerDestination() throws Exception {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_QUEUE_ATTRIBUTES_STRING);
+        Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(LEGACY_TEMP_QUEUE_ATTRIBUTES);
 
         JmsDestination destination = helper.getJmsReplyTo(message, null);
         assertNotNull(destination);
@@ -531,11 +606,11 @@ public class AmqpDestinationHelperTest {
     }
 
     @Test
-    public void testGetJmsReplToWithTempTopicTypeAnnotationNoConsumerDestination() throws Exception {
+    public void testGetJmsReplToWithLegacyTempTopicTypeAnnotationNoConsumerDestination() throws Exception {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_TOPIC_ATTRIBUTES_STRING);
+        Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(LEGACY_TEMP_TOPIC_ATTRIBUTES);
 
         JmsDestination destination = helper.getJmsReplyTo(message, null);
         assertNotNull(destination);


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


[6/9] qpid-jms git commit: add tests for AmqpDestinationHelper#getJmsDestination using new byte destination type anntotation, rearrange/group tests for clarity

Posted by ro...@apache.org.
add tests for AmqpDestinationHelper#getJmsDestination using new byte destination type anntotation, rearrange/group tests for clarity


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

Branch: refs/heads/master
Commit: b957ce7abfe9088c87542683154452bcd2eb7e46
Parents: 5c5b302
Author: Robert Gemmell <ro...@apache.org>
Authored: Fri Jan 2 15:19:03 2015 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Fri Jan 2 15:21:08 2015 +0000

----------------------------------------------------------------------
 .../jms/integration/MessageIntegrationTest.java |   4 +-
 .../amqp/message/AmqpDestinationHelperTest.java | 147 ++++++++++++++-----
 2 files changed, 116 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/b957ce7a/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 c527577..f9e0fed 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
@@ -1047,7 +1047,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
      * Topic. Ensure the consumers destination is not used by consuming from a Queue.
      */
     @Test(timeout = 2000)
-    public void testReceivedMessageFromQueueWithToTypeAnnotationForTopic() throws Exception {
+    public void testReceivedMessageFromQueueWithToLegacyTypeAnnotationForTopic() throws Exception {
         try (TestAmqpPeer testPeer = new TestAmqpPeer(IntegrationTestFixture.PORT);) {
             Connection connection = testFixture.establishConnecton(testPeer);
             connection.start();
@@ -1089,7 +1089,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
      * Topic. Ensure the consumers destination is not used by consuming from a Queue.
      */
     @Test(timeout = 2000)
-    public void testReceivedMessageFromQueueWithReplyToTypeAnnotationForTopic() throws Exception {
+    public void testReceivedMessageFromQueueWithLegacyReplyToTypeAnnotationForTopic() throws Exception {
         try (TestAmqpPeer testPeer = new TestAmqpPeer(IntegrationTestFixture.PORT);) {
             Connection connection = testFixture.establishConnecton(testPeer);
             connection.start();

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/b957ce7a/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 405714c..5b468b7 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
@@ -52,15 +52,16 @@ public class AmqpDestinationHelperTest {
 
     private final AmqpDestinationHelper helper = AmqpDestinationHelper.INSTANCE;
 
+    //========================================================================//
     //--------------- Test getJmsDestination method --------------------------//
     //========================================================================//
 
+    // --- general / no type annotations  --- //
+
     @Test
     public void testGetJmsDestinationWithNullAddressAndNullConsumerDestReturnsNull() throws Exception {
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getToAddress()).thenReturn(null);
-        Mockito.when(message.getMessageAnnotation(
-            LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(LEGACY_QUEUE_ATTRIBUTE);
 
         assertNull(helper.getJmsDestination(message, null));
     }
@@ -69,8 +70,6 @@ public class AmqpDestinationHelperTest {
     public void testGetJmsDestinationWithNullAddressWithConsumerDestReturnsSameConsumerDestObject() throws Exception {
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getToAddress()).thenReturn(null);
-        Mockito.when(message.getMessageAnnotation(
-            LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(LEGACY_QUEUE_ATTRIBUTE);
 
         JmsDestination consumerDestination = new JmsQueue("ConsumerDestination");
         assertSame(consumerDestination, helper.getJmsDestination(message, consumerDestination));
@@ -80,14 +79,15 @@ public class AmqpDestinationHelperTest {
     }
 
     @Test
-    public void testGetJmsDestinationWithEmptyTypeAnnotationWithQueueConsumerDest() throws Exception {
+    public void testGetJmsDestinationWithoutTypeAnnotationWithAnonymousConsumerDest() {
         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_NAME)).thenReturn("");
-        JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");
+
+        JmsDestination consumerDestination = Mockito.mock(JmsDestination.class);
+        Mockito.when(consumerDestination.getName()).thenReturn("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsDestination(message, consumerDestination);
         assertNotNull(destination);
@@ -97,13 +97,12 @@ public class AmqpDestinationHelperTest {
     }
 
     @Test
-    public void testGetJmsDestinationWithUnknownTypeAnnotationWithQueueConsumerDest() throws Exception {
+    public void testGetJmsDestinationWithoutTypeAnnotationWithQueueConsumerDest() 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_NAME)).thenReturn("jms.queue");
         JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsDestination(message, consumerDestination);
@@ -113,33 +112,65 @@ public class AmqpDestinationHelperTest {
         assertEquals(testAddress, destination.getName());
     }
 
+
     @Test
-    public void testGetJmsDestinationWithoutTypeAnnotationWithAnonymousConsumerDest() {
+    public void testGetJmsDestinationWithoutTypeAnnotationWithTopicConsumerDest() 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_NAME)).thenReturn(null);
+        JmsDestination consumerDestination = new JmsTopic("ConsumerDestination");
 
-        JmsDestination consumerDestination = Mockito.mock(JmsDestination.class);
-        Mockito.when(consumerDestination.getName()).thenReturn("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);
+        AmqpConnection conn = Mockito.mock(AmqpConnection.class);
+        Mockito.when(message.getConnection()).thenReturn(conn);
+        JmsDestination consumerDestination = new JmsTemporaryQueue("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsDestination(message, consumerDestination);
         assertNotNull(destination);
         assertTrue(destination.isQueue());
-        assertFalse(destination.isTemporary());
+        assertTrue(destination.isTemporary());
         assertEquals(testAddress, destination.getName());
     }
 
     @Test
-    public void testGetJmsDestinationWithoutTypeAnnotationWithQueueConsumerDest() throws Exception {
+    public void testGetJmsDestinationWithoutTypeAnnotationWithTempTopicConsumerDest() 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_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());
+    }
+
+    // --- new byte destination type annotations --- //
+
+    @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_NAME)).thenReturn((byte) 5);
         JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsDestination(message, consumerDestination);
@@ -149,17 +180,33 @@ public class AmqpDestinationHelperTest {
         assertEquals(testAddress, destination.getName());
     }
 
+
     @Test
-    public void testGetJmsDestinationWithoutTypeAnnotationWithTopicConsumerDest() throws Exception {
+    public void testGetJmsDestinationWithQueueTypeAnnotationNoConsumerDestination() 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_NAME)).thenReturn(null);
-        JmsDestination consumerDestination = new JmsTopic("ConsumerDestination");
+        Mockito.when(message.getMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(QUEUE_TYPE);
 
-        JmsDestination destination = helper.getJmsDestination(message, consumerDestination);
+        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);
+        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_NAME)).thenReturn(TOPIC_TYPE);
+
+        JmsDestination destination = helper.getJmsDestination(message, null);
         assertNotNull(destination);
         assertTrue(destination.isTopic());
         assertFalse(destination.isTemporary());
@@ -167,41 +214,71 @@ public class AmqpDestinationHelperTest {
     }
 
     @Test
-    public void testGetJmsDestinationWithoutTypeAnnotationWithTempQueueConsumerDest() throws Exception {
+    public void testGetJmsDestinationWithTempQueueTypeAnnotationNoConsumerDestination() throws Exception {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
+        Mockito.when(message.getMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_QUEUE_TYPE);
+
+        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.getMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_TOPIC_TYPE);
+
+        JmsDestination destination = helper.getJmsDestination(message, null);
+        assertNotNull(destination);
+        assertTrue(destination.isTopic());
+        assertTrue(destination.isTemporary());
+        assertEquals(testAddress, destination.getName());
+    }
+
+    // --- legacy string destination type annotations --- //
+
+    @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.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
-        JmsDestination consumerDestination = new JmsTemporaryQueue("ConsumerDestination");
+        Mockito.when(message.getToAddress()).thenReturn(testAddress);
+        Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn("");
+        JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsDestination(message, consumerDestination);
         assertNotNull(destination);
         assertTrue(destination.isQueue());
-        assertTrue(destination.isTemporary());
+        assertFalse(destination.isTemporary());
         assertEquals(testAddress, destination.getName());
     }
 
     @Test
-    public void testGetJmsDestinationWithoutTypeAnnotationWithTempTopicConsumerDest() throws Exception {
+    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_NAME)).thenReturn(null);
-        JmsDestination consumerDestination = new JmsTemporaryTopic("ConsumerDestination");
+        Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn("jms.queue");
+        JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsDestination(message, consumerDestination);
         assertNotNull(destination);
-        assertTrue(destination.isTopic());
-        assertTrue(destination.isTemporary());
+        assertTrue(destination.isQueue());
+        assertFalse(destination.isTemporary());
         assertEquals(testAddress, destination.getName());
     }
 
     @Test
-    public void testGetJmsDestinationWithQueueTypeAnnotationNoConsumerDestination() throws Exception {
+    public void testGetJmsDestinationWithLegacyQueueTypeAnnotationNoConsumerDestination() throws Exception {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
@@ -217,7 +294,7 @@ public class AmqpDestinationHelperTest {
     }
 
     @Test
-    public void testGetJmsDestinationWithTopicTypeAnnotationNoConsumerDestination() throws Exception {
+    public void testGetJmsDestinationWithLegacyTopicTypeAnnotationNoConsumerDestination() throws Exception {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
@@ -233,7 +310,7 @@ public class AmqpDestinationHelperTest {
     }
 
     @Test
-    public void testGetJmsDestinationWithTempQueueTypeAnnotationNoConsumerDestination() throws Exception {
+    public void testGetJmsDestinationWithLegacyTempQueueTypeAnnotationNoConsumerDestination() throws Exception {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
@@ -247,7 +324,7 @@ public class AmqpDestinationHelperTest {
     }
 
     @Test
-    public void testGetJmsDestinationWithTempTopicTypeAnnotationNoConsumerDestination() throws Exception {
+    public void testGetJmsDestinationWithLegacyTempTopicTypeAnnotationNoConsumerDestination() throws Exception {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
@@ -260,6 +337,7 @@ public class AmqpDestinationHelperTest {
         assertEquals(testAddress, destination.getName());
     }
 
+    //========================================================================//
     //--------------- Test getJmsReplyTo method ------------------------------//
     //========================================================================//
 
@@ -466,6 +544,7 @@ public class AmqpDestinationHelperTest {
         assertEquals(testAddress, destination.getName());
     }
 
+    //========================================================================//
     //--------------- Test setToAddressFromDestination method ----------------//
     //========================================================================//
 
@@ -567,6 +646,7 @@ public class AmqpDestinationHelperTest {
         Mockito.verify(message).removeMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
     }
 
+    //========================================================================//
     //--------------- Test setReplyToAddressFromDestination method -----------//
     //========================================================================//
 
@@ -668,6 +748,7 @@ public class AmqpDestinationHelperTest {
         Mockito.verify(message).removeMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
     }
 
+    //========================================================================//
     //--------------- Test Support Methods -----------------------------------//
     //========================================================================//
 


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


[2/9] qpid-jms git commit: some test fixups and a little reordering to group for clarity

Posted by ro...@apache.org.
some test fixups and a little reordering to group for clarity


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

Branch: refs/heads/master
Commit: 4acb2a6cf226f21bc1d8c6f46de83588ad48ac87
Parents: 4e3595c
Author: Robert Gemmell <ro...@apache.org>
Authored: Fri Jan 2 13:06:11 2015 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Fri Jan 2 13:06:11 2015 +0000

----------------------------------------------------------------------
 .../jms/integration/MessageIntegrationTest.java | 157 ++++++++++---------
 1 file changed, 83 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/4acb2a6c/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 f6cb671..78aecf9 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
@@ -213,6 +213,8 @@ public class MessageIntegrationTest extends QpidJmsTestCase
     //==== Destination Handling ====
     //==============================
 
+    // --- missing to/reply-to field values --- //
+
     /**
      * Tests that the lack of a 'to' in the Properties section of the incoming message (e.g
      * one sent by a non-JMS client) is handled by making the JMSDestination method simply
@@ -280,6 +282,41 @@ public class MessageIntegrationTest extends QpidJmsTestCase
     }
 
     /**
+     * Tests that lack of the reply-to set on a message results in it returning null for JMSReplyTo
+     * and not the consumer destination as happens for JMSDestination.
+     */
+    @Test(timeout = 2000)
+    public void testReceivedMessageFromQueueWithNoReplyToReturnsNull() throws Exception {
+        try (TestAmqpPeer testPeer = new TestAmqpPeer(IntegrationTestFixture.PORT);) {
+            Connection connection = testFixture.establishConnecton(testPeer);
+            connection.start();
+
+            testPeer.expectBegin(true);
+
+            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+            Queue queue = session.createQueue("myQueue");
+
+            PropertiesDescribedType props = new PropertiesDescribedType();
+            props.setMessageId("myMessageIDString");
+
+            DescribedType amqpValueNullContent = new AmqpValueDescribedType(null);
+
+            testPeer.expectReceiverAttach();
+            testPeer.expectLinkFlowRespondWithTransfer(null, null, props, null, amqpValueNullContent);
+            testPeer.expectDispositionThatIsAcceptedAndSettled();
+
+            MessageConsumer messageConsumer = session.createConsumer(queue);
+            Message receivedMessage = messageConsumer.receive(1000);
+            testPeer.waitForAllHandlersToComplete(3000);
+
+            assertNotNull(receivedMessage);
+            assertNull(receivedMessage.getJMSReplyTo());
+        }
+    }
+
+    // --- destination prefix handling --- //
+
+    /**
      * Tests that the a connection with a 'topic prefix' set on it strips the
      * prefix from the content of the to/reply-to fields for incoming messages.
      */
@@ -877,7 +914,51 @@ public class MessageIntegrationTest extends QpidJmsTestCase
         }
     }
 
-    // --- byte type annotation values --- //
+    // --- missing destination type annotation values --- //
+
+    /**
+     * Tests that lack of any destination type annotation value (via either
+     * {@link AmqpDestinationHelper#JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME}
+     * or {@link AmqpDestinationHelper#REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME}) set
+     * on a message to indicate type of its 'reply-to' address results in it
+     * being classed as the same type as the consumer destination.
+     */
+    @Test(timeout = 2000)
+    public void testReceivedMessageFromTopicWithReplyToWithoutTypeAnnotationResultsInUseOfConsumerDestinationType() throws Exception {
+        try (TestAmqpPeer testPeer = new TestAmqpPeer(IntegrationTestFixture.PORT);) {
+            Connection connection = testFixture.establishConnecton(testPeer);
+            connection.start();
+
+            testPeer.expectBegin(true);
+
+            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+            Topic topic = session.createTopic("myTopic");
+
+            String myReplyTopicAddress = "myReplyTopicAddress";
+            PropertiesDescribedType props = new PropertiesDescribedType();
+            props.setReplyTo(myReplyTopicAddress);
+            props.setMessageId("myMessageIDString");
+
+            DescribedType amqpValueNullContent = new AmqpValueDescribedType(null);
+
+            testPeer.expectReceiverAttach();
+            testPeer.expectLinkFlowRespondWithTransfer(null, null, props, null, amqpValueNullContent);
+            testPeer.expectDispositionThatIsAcceptedAndSettled();
+
+            MessageConsumer messageConsumer = session.createConsumer(topic);
+            Message receivedMessage = messageConsumer.receive(1000);
+            testPeer.waitForAllHandlersToComplete(3000);
+
+            assertNotNull(receivedMessage);
+
+            Destination dest = receivedMessage.getJMSReplyTo();
+            assertNotNull("JMSReplyTo should not be null", dest);
+            assertTrue("Destination not of expected type: " + dest.getClass(), dest instanceof Topic);
+            assertEquals(myReplyTopicAddress, ((Topic)dest).getTopicName());
+        }
+    }
+
+    // --- byte destination type annotation values --- //
 
     /**
      * Tests that the {@link AmqpDestinationHelper#JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME} is set as a byte on
@@ -958,7 +1039,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
         }
     }
 
-    // --- old string type annotation values --- //
+    // --- old string destination type annotation values --- //
 
     /**
      * Tests that the {@link AmqpDestinationHelper#TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME} set on a message to
@@ -1043,78 +1124,6 @@ public class MessageIntegrationTest extends QpidJmsTestCase
         }
     }
 
-    /**
-     * Tests that lack of the {@link AmqpMessageSupport#AMQP_REPLY_TO_ANNOTATION} set on a
-     * message to indicate type of its 'reply-to' address results in it being classed as the same
-     * type as the destination used to create the consumer.
-     */
-    @Test(timeout = 2000)
-    public void testReceivedMessageFromQueueWithReplyToWithoutTypeAnnotationResultsInUseOfConsumerDestinationType() throws Exception {
-        try (TestAmqpPeer testPeer = new TestAmqpPeer(IntegrationTestFixture.PORT);) {
-            Connection connection = testFixture.establishConnecton(testPeer);
-            connection.start();
-
-            testPeer.expectBegin(true);
-
-            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-            Queue queue = session.createQueue("myQueue");
-
-            String myOtherQueueAddress = "myOtherQueueAddress";
-            PropertiesDescribedType props = new PropertiesDescribedType();
-            props.setReplyTo(myOtherQueueAddress);
-            props.setMessageId("myMessageIDString");
-
-            DescribedType amqpValueNullContent = new AmqpValueDescribedType(null);
-
-            testPeer.expectReceiverAttach();
-            testPeer.expectLinkFlowRespondWithTransfer(null, null, props, null, amqpValueNullContent);
-            testPeer.expectDispositionThatIsAcceptedAndSettled();
-
-            MessageConsumer messageConsumer = session.createConsumer(queue);
-            Message receivedMessage = messageConsumer.receive(1000);
-            testPeer.waitForAllHandlersToComplete(3000);
-
-            assertNotNull(receivedMessage);
-
-            Destination dest = receivedMessage.getJMSReplyTo();
-            assertTrue(dest instanceof Queue);
-            assertEquals(myOtherQueueAddress, ((Queue)dest).getQueueName());
-        }
-    }
-
-    /**
-     * Tests that lack of the reply-to set on a message results in it returning null for JMSReplyTo
-     * and not the consumer destination as happens for JMSDestination.
-     */
-    @Test(timeout = 2000)
-    public void testReceivedMessageFromQueueWithNoReplyToReturnsNull() throws Exception {
-        try (TestAmqpPeer testPeer = new TestAmqpPeer(IntegrationTestFixture.PORT);) {
-            Connection connection = testFixture.establishConnecton(testPeer);
-            connection.start();
-
-            testPeer.expectBegin(true);
-
-            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-            Queue queue = session.createQueue("myQueue");
-
-            PropertiesDescribedType props = new PropertiesDescribedType();
-            props.setMessageId("myMessageIDString");
-
-            DescribedType amqpValueNullContent = new AmqpValueDescribedType(null);
-
-            testPeer.expectReceiverAttach();
-            testPeer.expectLinkFlowRespondWithTransfer(null, null, props, null, amqpValueNullContent);
-            testPeer.expectDispositionThatIsAcceptedAndSettled();
-
-            MessageConsumer messageConsumer = session.createConsumer(queue);
-            Message receivedMessage = messageConsumer.receive(1000);
-            testPeer.waitForAllHandlersToComplete(3000);
-
-            assertNotNull(receivedMessage);
-            assertNull(receivedMessage.getJMSReplyTo());
-        }
-    }
-
     //==== TTL / Expiration Handling ====
     //===================================
 


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


[4/9] qpid-jms git commit: rename constants to make their usage clearer

Posted by ro...@apache.org.
rename constants to make their usage clearer


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

Branch: refs/heads/master
Commit: 03463f8fdf3e26157886400cb7223246ec81a4c9
Parents: f797c60
Author: Robert Gemmell <ro...@apache.org>
Authored: Fri Jan 2 14:50:28 2015 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Fri Jan 2 14:50:28 2015 +0000

----------------------------------------------------------------------
 .../amqp/message/AmqpDestinationHelper.java     | 26 +++---
 .../jms/integration/MessageIntegrationTest.java | 10 +-
 .../amqp/message/AmqpDestinationHelperTest.java | 98 ++++++++++----------
 3 files changed, 67 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/03463f8f/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 fb6f9b4..16c9a0a 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
@@ -43,11 +43,11 @@ public class AmqpDestinationHelper {
     private static final byte UNKNOWN_TYPE = -1;
 
     // For support of old string type values
-    public static final String TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME = "x-opt-to-type";
-    public static final String REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME = "x-opt-reply-type";
-    public static final String QUEUE_ATTRIBUTE = "queue";
-    public static final String TOPIC_ATTRIBUTE = "topic";
-    public static final String TEMPORARY_ATTRIBUTE = "temporary";
+    public static final String LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME = "x-opt-to-type";
+    public static final String LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME = "x-opt-reply-type";
+    public static final String LEGACY_QUEUE_ATTRIBUTE = "queue";
+    public static final String LEGACY_TOPIC_ATTRIBUTE = "topic";
+    public static final String LEGACY_TEMPORARY_ATTRIBUTE = "temporary";
 
     /**
      * Decode the provided To address, type description, and consumer destination
@@ -67,7 +67,7 @@ public class AmqpDestinationHelper {
         byte typeByte = getTypeByte(message, JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
         if (typeByte == UNKNOWN_TYPE) {
             // Try the legacy string type annotation
-            typeByte = getTypeByte(message, TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
+            typeByte = getTypeByte(message, LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
         }
 
         String name = stripPrefixIfNecessary(to, message.getConnection(), typeByte, consumerDestination);
@@ -80,7 +80,7 @@ public class AmqpDestinationHelper {
         byte typeByte = getTypeByte(message, JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
         if (typeByte == UNKNOWN_TYPE) {
             // Try the legacy string type annotation
-            typeByte = getTypeByte(message, REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
+            typeByte = getTypeByte(message, LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
         }
 
         String name = stripPrefixIfNecessary(replyTo, message.getConnection(), typeByte, consumerDestination);
@@ -168,7 +168,7 @@ public class AmqpDestinationHelper {
         }
 
         // Always clear the legacy string type annotation
-        message.removeMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
+        message.removeMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
     }
 
     public void setReplyToAddressFromDestination(AmqpJmsMessageFacade message, JmsDestination destination) {
@@ -185,7 +185,7 @@ public class AmqpDestinationHelper {
         }
 
         // Always clear the legacy string type annotation
-        message.removeMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
+        message.removeMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
     }
 
     public String getDestinationAddress(JmsDestination destination, AmqpConnection conn) {
@@ -278,14 +278,14 @@ public class AmqpDestinationHelper {
             }
 
             if (typeSet != null && !typeSet.isEmpty()) {
-                if (typeSet.contains(QUEUE_ATTRIBUTE)) {
-                    if (typeSet.contains(TEMPORARY_ATTRIBUTE)) {
+                if (typeSet.contains(LEGACY_QUEUE_ATTRIBUTE)) {
+                    if (typeSet.contains(LEGACY_TEMPORARY_ATTRIBUTE)) {
                         return TEMP_QUEUE_TYPE;
                     } else {
                         return QUEUE_TYPE;
                     }
-                } else if (typeSet.contains(TOPIC_ATTRIBUTE)) {
-                    if (typeSet.contains(TEMPORARY_ATTRIBUTE)) {
+                } else if (typeSet.contains(LEGACY_TOPIC_ATTRIBUTE)) {
+                    if (typeSet.contains(LEGACY_TEMPORARY_ATTRIBUTE)) {
                         return TEMP_TOPIC_TYPE;
                     } else {
                         return TOPIC_TYPE;

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/03463f8f/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 78aecf9..49bab7d 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
@@ -919,7 +919,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
     /**
      * Tests that lack of any destination type annotation value (via either
      * {@link AmqpDestinationHelper#JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME}
-     * or {@link AmqpDestinationHelper#REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME}) set
+     * or {@link AmqpDestinationHelper#LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME}) set
      * on a message to indicate type of its 'reply-to' address results in it
      * being classed as the same type as the consumer destination.
      */
@@ -1042,7 +1042,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
     // --- old string destination type annotation values --- //
 
     /**
-     * Tests that the {@link AmqpDestinationHelper#TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME} set on a message to
+     * Tests that the {@link AmqpDestinationHelper#LEGACY_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.
      */
@@ -1058,7 +1058,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
             Queue queue = session.createQueue("myQueue");
 
             MessageAnnotationsDescribedType msgAnnotations = new MessageAnnotationsDescribedType();
-            msgAnnotations.setSymbolKeyedAnnotation(AmqpDestinationHelper.TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, AmqpDestinationHelper.TOPIC_ATTRIBUTE);
+            msgAnnotations.setSymbolKeyedAnnotation(AmqpDestinationHelper.LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, AmqpDestinationHelper.LEGACY_TOPIC_ATTRIBUTE);
 
             PropertiesDescribedType props = new PropertiesDescribedType();
             String myTopicAddress = "myTopicAddress";
@@ -1084,7 +1084,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
     }
 
     /**
-     * Tests that the {@link AmqpDestinationHelper#REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME} set on a message to
+     * Tests that the {@link AmqpDestinationHelper#LEGACY_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.
      */
@@ -1100,7 +1100,7 @@ public class MessageIntegrationTest extends QpidJmsTestCase
             Queue queue = session.createQueue("myQueue");
 
             MessageAnnotationsDescribedType msgAnnotations = new MessageAnnotationsDescribedType();
-            msgAnnotations.setSymbolKeyedAnnotation(AmqpDestinationHelper.REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, AmqpDestinationHelper.TOPIC_ATTRIBUTE);
+            msgAnnotations.setSymbolKeyedAnnotation(AmqpDestinationHelper.LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME, AmqpDestinationHelper.LEGACY_TOPIC_ATTRIBUTE);
 
             PropertiesDescribedType props = new PropertiesDescribedType();
             String myTopicAddress = "myTopicAddress";

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/03463f8f/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 dea756b..d47aa24 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,15 +18,15 @@ 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.LEGACY_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;
-import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.TEMPORARY_ATTRIBUTE;
+import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
+import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.LEGACY_TEMPORARY_ATTRIBUTE;
 import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.TEMP_QUEUE_TYPE;
 import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.TEMP_TOPIC_TYPE;
-import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.TOPIC_ATTRIBUTE;
+import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.LEGACY_TOPIC_ATTRIBUTE;
 import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.TOPIC_TYPE;
-import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
+import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -47,8 +47,8 @@ import org.junit.Test;
 import org.mockito.Mockito;
 
 public class AmqpDestinationHelperTest {
-    public static final String TEMP_QUEUE_ATTRIBUTES_STRING = QUEUE_ATTRIBUTE + "," + TEMPORARY_ATTRIBUTE;
-    public static final String TEMP_TOPIC_ATTRIBUTES_STRING = TOPIC_ATTRIBUTE + "," + TEMPORARY_ATTRIBUTE;
+    public static final String TEMP_QUEUE_ATTRIBUTES_STRING = LEGACY_QUEUE_ATTRIBUTE + "," + LEGACY_TEMPORARY_ATTRIBUTE;
+    public static final String TEMP_TOPIC_ATTRIBUTES_STRING = LEGACY_TOPIC_ATTRIBUTE + "," + LEGACY_TEMPORARY_ATTRIBUTE;
 
     private final AmqpDestinationHelper helper = AmqpDestinationHelper.INSTANCE;
 
@@ -60,7 +60,7 @@ public class AmqpDestinationHelperTest {
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getToAddress()).thenReturn(null);
         Mockito.when(message.getMessageAnnotation(
-            TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(QUEUE_ATTRIBUTE);
+            LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(LEGACY_QUEUE_ATTRIBUTE);
 
         assertNull(helper.getJmsDestination(message, null));
     }
@@ -70,7 +70,7 @@ public class AmqpDestinationHelperTest {
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getToAddress()).thenReturn(null);
         Mockito.when(message.getMessageAnnotation(
-            TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(QUEUE_ATTRIBUTE);
+            LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(LEGACY_QUEUE_ATTRIBUTE);
 
         JmsDestination consumerDestination = new JmsQueue("ConsumerDestination");
         assertSame(consumerDestination, helper.getJmsDestination(message, consumerDestination));
@@ -86,7 +86,7 @@ public class AmqpDestinationHelperTest {
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
         Mockito.when(message.getConnection()).thenReturn(conn);
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn("");
+        Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn("");
         JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsDestination(message, consumerDestination);
@@ -103,7 +103,7 @@ public class AmqpDestinationHelperTest {
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
         Mockito.when(message.getConnection()).thenReturn(conn);
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn("jms.queue");
+        Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn("jms.queue");
         JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsDestination(message, consumerDestination);
@@ -120,7 +120,7 @@ public class AmqpDestinationHelperTest {
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
         Mockito.when(message.getConnection()).thenReturn(conn);
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
+        Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
 
         JmsDestination consumerDestination = Mockito.mock(JmsDestination.class);
         Mockito.when(consumerDestination.getName()).thenReturn("ConsumerDestination");
@@ -139,7 +139,7 @@ public class AmqpDestinationHelperTest {
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
         Mockito.when(message.getConnection()).thenReturn(conn);
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
+        Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
         JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsDestination(message, consumerDestination);
@@ -156,7 +156,7 @@ public class AmqpDestinationHelperTest {
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
         Mockito.when(message.getConnection()).thenReturn(conn);
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
+        Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
         JmsDestination consumerDestination = new JmsTopic("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsDestination(message, consumerDestination);
@@ -173,7 +173,7 @@ public class AmqpDestinationHelperTest {
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
         Mockito.when(message.getConnection()).thenReturn(conn);
-        Mockito.when(message.getMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
+        Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
         JmsDestination consumerDestination = new JmsTemporaryQueue("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsDestination(message, consumerDestination);
@@ -190,7 +190,7 @@ public class AmqpDestinationHelperTest {
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
         Mockito.when(message.getConnection()).thenReturn(conn);
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
+        Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
         JmsDestination consumerDestination = new JmsTemporaryTopic("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsDestination(message, consumerDestination);
@@ -207,7 +207,7 @@ public class AmqpDestinationHelperTest {
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
         Mockito.when(message.getConnection()).thenReturn(conn);
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(QUEUE_ATTRIBUTE);
+        Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(LEGACY_QUEUE_ATTRIBUTE);
 
         JmsDestination destination = helper.getJmsDestination(message, null);
         assertNotNull(destination);
@@ -223,7 +223,7 @@ public class AmqpDestinationHelperTest {
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
         Mockito.when(message.getConnection()).thenReturn(conn);
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TOPIC_ATTRIBUTE);
+        Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(LEGACY_TOPIC_ATTRIBUTE);
 
         JmsDestination destination = helper.getJmsDestination(message, null);
         assertNotNull(destination);
@@ -237,7 +237,7 @@ public class AmqpDestinationHelperTest {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_QUEUE_ATTRIBUTES_STRING);
+        Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_QUEUE_ATTRIBUTES_STRING);
 
         JmsDestination destination = helper.getJmsDestination(message, null);
         assertNotNull(destination);
@@ -251,7 +251,7 @@ public class AmqpDestinationHelperTest {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_TOPIC_ATTRIBUTES_STRING);
+        Mockito.when(message.getMessageAnnotation(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_TOPIC_ATTRIBUTES_STRING);
 
         JmsDestination destination = helper.getJmsDestination(message, null);
         assertNotNull(destination);
@@ -268,7 +268,7 @@ public class AmqpDestinationHelperTest {
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getReplyToAddress()).thenReturn(null);
         Mockito.when(message.getMessageAnnotation(
-            REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(QUEUE_ATTRIBUTE);
+            LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(LEGACY_QUEUE_ATTRIBUTE);
 
         assertNull(helper.getJmsDestination(message, null));
     }
@@ -278,7 +278,7 @@ public class AmqpDestinationHelperTest {
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getReplyToAddress()).thenReturn(null);
         Mockito.when(message.getMessageAnnotation(
-            REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(QUEUE_ATTRIBUTE);
+            LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(LEGACY_QUEUE_ATTRIBUTE);
         JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");
 
         assertNull(helper.getJmsReplyTo(message, consumerDestination));
@@ -292,7 +292,7 @@ public class AmqpDestinationHelperTest {
         Mockito.when(message.getConnection()).thenReturn(conn);
 
         Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
+        Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
         JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
@@ -309,7 +309,7 @@ public class AmqpDestinationHelperTest {
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
         Mockito.when(message.getConnection()).thenReturn(conn);
         Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
+        Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
 
         JmsDestination consumerDestination = Mockito.mock(JmsDestination.class);
         Mockito.when(consumerDestination.getName()).thenReturn("ConsumerDestination");
@@ -328,7 +328,7 @@ public class AmqpDestinationHelperTest {
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
         Mockito.when(message.getConnection()).thenReturn(conn);
         Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn("");
+        Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn("");
         JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
@@ -345,7 +345,7 @@ public class AmqpDestinationHelperTest {
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
         Mockito.when(message.getConnection()).thenReturn(conn);
         Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn("jms.queue");
+        Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn("jms.queue");
         JmsQueue consumerDestination = new JmsQueue("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
@@ -362,7 +362,7 @@ public class AmqpDestinationHelperTest {
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
         Mockito.when(message.getConnection()).thenReturn(conn);
         Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
+        Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
         JmsTopic consumerDestination = new JmsTopic("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
@@ -379,7 +379,7 @@ public class AmqpDestinationHelperTest {
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
         Mockito.when(message.getConnection()).thenReturn(conn);
         Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
+        Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
         JmsTemporaryQueue consumerDestination = new JmsTemporaryQueue("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
@@ -396,7 +396,7 @@ public class AmqpDestinationHelperTest {
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
         Mockito.when(message.getConnection()).thenReturn(conn);
         Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
+        Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(null);
         JmsTemporaryTopic consumerDestination = new JmsTemporaryTopic("ConsumerDestination");
 
         JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
@@ -413,7 +413,7 @@ public class AmqpDestinationHelperTest {
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
         Mockito.when(message.getConnection()).thenReturn(conn);
         Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(QUEUE_ATTRIBUTE);
+        Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(LEGACY_QUEUE_ATTRIBUTE);
 
         JmsDestination destination = helper.getJmsReplyTo(message, null);
         assertNotNull(destination);
@@ -429,7 +429,7 @@ public class AmqpDestinationHelperTest {
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
         Mockito.when(message.getConnection()).thenReturn(conn);
         Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TOPIC_ATTRIBUTE);
+        Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(LEGACY_TOPIC_ATTRIBUTE);
 
         JmsDestination destination = helper.getJmsReplyTo(message, null);
         assertNotNull(destination);
@@ -443,7 +443,7 @@ public class AmqpDestinationHelperTest {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_QUEUE_ATTRIBUTES_STRING);
+        Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_QUEUE_ATTRIBUTES_STRING);
 
         JmsDestination destination = helper.getJmsReplyTo(message, null);
         assertNotNull(destination);
@@ -457,7 +457,7 @@ public class AmqpDestinationHelperTest {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
-        Mockito.when(message.getMessageAnnotation(REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_TOPIC_ATTRIBUTES_STRING);
+        Mockito.when(message.getMessageAnnotation(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_TOPIC_ATTRIBUTES_STRING);
 
         JmsDestination destination = helper.getJmsReplyTo(message, null);
         assertNotNull(destination);
@@ -499,7 +499,7 @@ 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(LEGACY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
     }
 
     @Test
@@ -614,7 +614,7 @@ 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(LEGACY_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME);
     }
 
     @Test
@@ -675,34 +675,34 @@ public class AmqpDestinationHelperTest {
     public void testSplitAttributeWithExtraneousCommas() throws Exception {
 
         Set<String> set = new HashSet<String>();
-        set.add(AmqpDestinationHelper.QUEUE_ATTRIBUTE);
-        set.add(AmqpDestinationHelper.TEMPORARY_ATTRIBUTE);
+        set.add(AmqpDestinationHelper.LEGACY_QUEUE_ATTRIBUTE);
+        set.add(AmqpDestinationHelper.LEGACY_TEMPORARY_ATTRIBUTE);
 
         // test for no NPE errors.
         assertNull(helper.splitAttributesString(null));
 
         // test a single comma separator produces expected set
-        assertEquals(set, helper.splitAttributesString(QUEUE_ATTRIBUTE + "," +
-                                                 AmqpDestinationHelper.TEMPORARY_ATTRIBUTE));
+        assertEquals(set, helper.splitAttributesString(LEGACY_QUEUE_ATTRIBUTE + "," +
+                                                 AmqpDestinationHelper.LEGACY_TEMPORARY_ATTRIBUTE));
 
         // test trailing comma doesn't alter produced set
-        assertEquals(set, helper.splitAttributesString(QUEUE_ATTRIBUTE + "," +
-                                                 AmqpDestinationHelper.TEMPORARY_ATTRIBUTE + ","));
+        assertEquals(set, helper.splitAttributesString(LEGACY_QUEUE_ATTRIBUTE + "," +
+                                                 AmqpDestinationHelper.LEGACY_TEMPORARY_ATTRIBUTE + ","));
 
         // test leading comma doesn't alter produced set
-        assertEquals(set, helper.splitAttributesString("," + QUEUE_ATTRIBUTE + ","
-                                                     + AmqpDestinationHelper.TEMPORARY_ATTRIBUTE));
+        assertEquals(set, helper.splitAttributesString("," + LEGACY_QUEUE_ATTRIBUTE + ","
+                                                     + AmqpDestinationHelper.LEGACY_TEMPORARY_ATTRIBUTE));
 
         // test consecutive central commas don't alter produced set
-        assertEquals(set, helper.splitAttributesString(QUEUE_ATTRIBUTE + ",," +
-                                                 AmqpDestinationHelper.TEMPORARY_ATTRIBUTE));
+        assertEquals(set, helper.splitAttributesString(LEGACY_QUEUE_ATTRIBUTE + ",," +
+                                                 AmqpDestinationHelper.LEGACY_TEMPORARY_ATTRIBUTE));
 
         // test consecutive trailing commas don't alter produced set
-        assertEquals(set, helper.splitAttributesString(QUEUE_ATTRIBUTE + "," +
-                                                 AmqpDestinationHelper.TEMPORARY_ATTRIBUTE + ",,"));
+        assertEquals(set, helper.splitAttributesString(LEGACY_QUEUE_ATTRIBUTE + "," +
+                                                 AmqpDestinationHelper.LEGACY_TEMPORARY_ATTRIBUTE + ",,"));
 
         // test consecutive leading commas don't alter produced set
-        assertEquals(set, helper.splitAttributesString("," + QUEUE_ATTRIBUTE + ","
-                                                     + AmqpDestinationHelper.TEMPORARY_ATTRIBUTE));
+        assertEquals(set, helper.splitAttributesString("," + LEGACY_QUEUE_ATTRIBUTE + ","
+                                                     + AmqpDestinationHelper.LEGACY_TEMPORARY_ATTRIBUTE));
     }
 }


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


[8/9] qpid-jms git commit: expand tests for AmqpDestinationHelper#getJmsDestination and AmqpDestinationHelper#getJmsReplyTo to cover handling where a consumer destination is also given

Posted by ro...@apache.org.
expand tests for AmqpDestinationHelper#getJmsDestination and AmqpDestinationHelper#getJmsReplyTo to cover handling where a consumer destination is also given


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

Branch: refs/heads/master
Commit: 265878ad6440b71146dcb7143447b1a011c6c0f0
Parents: 4302c28
Author: Robert Gemmell <ro...@apache.org>
Authored: Fri Jan 2 16:18:07 2015 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Fri Jan 2 16:18:40 2015 +0000

----------------------------------------------------------------------
 .../amqp/message/AmqpDestinationHelperTest.java | 91 +++++++++++++++++---
 1 file changed, 80 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/265878ad/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 603c8fe..f22bf12 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
@@ -180,9 +180,17 @@ public class AmqpDestinationHelperTest {
         assertEquals(testAddress, destination.getName());
     }
 
-
     @Test
     public void testGetJmsDestinationWithQueueTypeAnnotationNoConsumerDestination() throws Exception {
+        doGetJmsDestinationWithQueueTypeAnnotationTestImpl(null);
+    }
+
+    @Test
+    public void testGetJmsDestinationWithQueueTypeAnnotationWithConsumerDestination() throws Exception {
+        doGetJmsDestinationWithQueueTypeAnnotationTestImpl(new JmsTopic("ConsumerDestination"));
+    }
+
+    private void doGetJmsDestinationWithQueueTypeAnnotationTestImpl(JmsDestination consumerDestination) {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
@@ -190,7 +198,7 @@ public class AmqpDestinationHelperTest {
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
         Mockito.when(message.getMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(QUEUE_TYPE);
 
-        JmsDestination destination = helper.getJmsDestination(message, null);
+        JmsDestination destination = helper.getJmsDestination(message, consumerDestination);
         assertNotNull(destination);
         assertTrue(destination.isQueue());
         assertFalse(destination.isTemporary());
@@ -199,6 +207,15 @@ public class AmqpDestinationHelperTest {
 
     @Test
     public void testGetJmsDestinationWithTopicTypeAnnotationNoConsumerDestination() throws Exception {
+        doGetJmsDestinationWithTopicTypeAnnotationTestImpl(null);
+    }
+
+    @Test
+    public void testGetJmsDestinationWithTopicTypeAnnotationWithConsumerDestination() throws Exception {
+        doGetJmsDestinationWithTopicTypeAnnotationTestImpl(new JmsQueue("ConsumerDestination"));
+    }
+
+    private void doGetJmsDestinationWithTopicTypeAnnotationTestImpl(JmsDestination consumerDestination) {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
@@ -206,7 +223,7 @@ public class AmqpDestinationHelperTest {
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
         Mockito.when(message.getMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TOPIC_TYPE);
 
-        JmsDestination destination = helper.getJmsDestination(message, null);
+        JmsDestination destination = helper.getJmsDestination(message, consumerDestination);
         assertNotNull(destination);
         assertTrue(destination.isTopic());
         assertFalse(destination.isTemporary());
@@ -215,12 +232,21 @@ public class AmqpDestinationHelperTest {
 
     @Test
     public void testGetJmsDestinationWithTempQueueTypeAnnotationNoConsumerDestination() throws Exception {
+        doGetJmsDestinationWithTempQueueTypeAnnotationTestImpl(null);
+    }
+
+    @Test
+    public void testGetJmsDestinationWithTempQueueTypeAnnotationWithConsumerDestination() throws Exception {
+        doGetJmsDestinationWithTempQueueTypeAnnotationTestImpl(new JmsQueue("ConsumerDestination"));
+    }
+
+    private void doGetJmsDestinationWithTempQueueTypeAnnotationTestImpl(JmsDestination consumerDestination) {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
         Mockito.when(message.getMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_QUEUE_TYPE);
 
-        JmsDestination destination = helper.getJmsDestination(message, null);
+        JmsDestination destination = helper.getJmsDestination(message, consumerDestination);
         assertNotNull(destination);
         assertTrue(destination.isQueue());
         assertTrue(destination.isTemporary());
@@ -229,12 +255,21 @@ public class AmqpDestinationHelperTest {
 
     @Test
     public void testGetJmsDestinationWithTempTopicTypeAnnotationNoConsumerDestination() throws Exception {
+        doGetJmsDestinationWithTempTopicTypeAnnotationTestImpl(null);
+    }
+
+    @Test
+    public void testGetJmsDestinationWithTempTopicTypeAnnotationWithConsumerDestination() throws Exception {
+        doGetJmsDestinationWithTempTopicTypeAnnotationTestImpl(new JmsQueue("ConsumerDestination"));
+    }
+
+    private void doGetJmsDestinationWithTempTopicTypeAnnotationTestImpl(JmsDestination consumerDestination) {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getToAddress()).thenReturn(testAddress);
         Mockito.when(message.getMessageAnnotation(JMS_DEST_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_TOPIC_TYPE);
 
-        JmsDestination destination = helper.getJmsDestination(message, null);
+        JmsDestination destination = helper.getJmsDestination(message, consumerDestination);
         assertNotNull(destination);
         assertTrue(destination.isTopic());
         assertTrue(destination.isTemporary());
@@ -462,9 +497,17 @@ public class AmqpDestinationHelperTest {
         assertEquals(testAddress, destination.getName());
     }
 
-
     @Test
     public void testGetJmsReplToWithQueueTypeAnnotationNoConsumerDestination() throws Exception {
+        doGetJmsReplToWithQueueTypeAnnotationTestImpl(null);
+    }
+
+    @Test
+    public void testGetJmsReplToWithQueueTypeAnnotationWithConsumerDestination() throws Exception {
+        doGetJmsReplToWithQueueTypeAnnotationTestImpl(new JmsTopic("ConsumerDestination"));
+    }
+
+    private void doGetJmsReplToWithQueueTypeAnnotationTestImpl(JmsDestination consumerDestination) {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
@@ -472,7 +515,7 @@ public class AmqpDestinationHelperTest {
         Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
         Mockito.when(message.getMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(QUEUE_TYPE);
 
-        JmsDestination destination = helper.getJmsReplyTo(message, null);
+        JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
         assertNotNull(destination);
         assertTrue(destination.isQueue());
         assertFalse(destination.isTemporary());
@@ -481,6 +524,15 @@ public class AmqpDestinationHelperTest {
 
     @Test
     public void testGetJmsReplToWithTopicTypeAnnotationNoConsumerDestination() throws Exception {
+        doGetJmsReplToWithTopicTypeAnnotationTestImpl(null);
+    }
+
+    @Test
+    public void testGetJmsReplToWithTopicTypeAnnotationWithConsumerDestination() throws Exception {
+        doGetJmsReplToWithTopicTypeAnnotationTestImpl(new JmsQueue("ConsumerDestination"));
+    }
+
+    private void doGetJmsReplToWithTopicTypeAnnotationTestImpl(JmsDestination consumerDestination) {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         AmqpConnection conn = Mockito.mock(AmqpConnection.class);
@@ -488,7 +540,7 @@ public class AmqpDestinationHelperTest {
         Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
         Mockito.when(message.getMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TOPIC_TYPE);
 
-        JmsDestination destination = helper.getJmsReplyTo(message, null);
+        JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
         assertNotNull(destination);
         assertTrue(destination.isTopic());
         assertFalse(destination.isTemporary());
@@ -497,12 +549,21 @@ public class AmqpDestinationHelperTest {
 
     @Test
     public void testGetJmsReplToWithTempQueueTypeAnnotationNoConsumerDestination() throws Exception {
+        doGetJmsReplToWithTempQueueTypeAnnotationTestImpl(null);
+    }
+
+    @Test
+    public void testGetJmsReplToWithTempQueueTypeAnnotationWithConsumerDestination() throws Exception {
+        doGetJmsReplToWithTempQueueTypeAnnotationTestImpl(new JmsTopic("ConsumerDestination"));
+    }
+
+    private void doGetJmsReplToWithTempQueueTypeAnnotationTestImpl(JmsDestination consumerDestination) {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
         Mockito.when(message.getMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_QUEUE_TYPE);
 
-        JmsDestination destination = helper.getJmsReplyTo(message, null);
+        JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
         assertNotNull(destination);
         assertTrue(destination.isQueue());
         assertTrue(destination.isTemporary());
@@ -511,12 +572,21 @@ public class AmqpDestinationHelperTest {
 
     @Test
     public void testGetJmsReplToWithTempTopicTypeAnnotationNoConsumerDestination() throws Exception {
+        doGetJmsReplToWithTempTopicTypeAnnotationTestImpl(null);
+    }
+
+    @Test
+    public void testGetJmsReplToWithTempTopicTypeAnnotationWithConsumerDestination() throws Exception {
+        doGetJmsReplToWithTempTopicTypeAnnotationTestImpl(new JmsTopic("ConsumerDestination"));
+    }
+
+    private void doGetJmsReplToWithTempTopicTypeAnnotationTestImpl(JmsDestination consumerDestination) {
         String testAddress = "testAddress";
         AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
         Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
         Mockito.when(message.getMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME)).thenReturn(TEMP_TOPIC_TYPE);
 
-        JmsDestination destination = helper.getJmsReplyTo(message, null);
+        JmsDestination destination = helper.getJmsReplyTo(message, consumerDestination);
         assertNotNull(destination);
         assertTrue(destination.isTopic());
         assertTrue(destination.isTemporary());
@@ -829,7 +899,6 @@ public class AmqpDestinationHelperTest {
 
     @Test
     public void testSplitAttributeWithExtraneousCommas() throws Exception {
-
         Set<String> set = new HashSet<String>();
         set.add(LEGACY_QUEUE_ATTRIBUTE);
         set.add(LEGACY_TEMPORARY_ATTRIBUTE);


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