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 2013/11/27 17:59:34 UTC

svn commit: r1546110 - in /qpid/jms/trunk/src: main/java/org/apache/qpid/jms/engine/ main/java/org/apache/qpid/jms/impl/ test/java/org/apache/qpid/jms/ test/java/org/apache/qpid/jms/engine/ test/java/org/apache/qpid/jms/impl/

Author: robbie
Date: Wed Nov 27 16:59:33 2013
New Revision: 1546110

URL: http://svn.apache.org/r1546110
Log:
QPIDJMS-9: add Message support for JMSDestination operations, with associated handling for producers and consumers

Added:
    qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/DestinationHelper.java
    qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/DestinationHelperTest.java
    qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/QueueImplTest.java
Modified:
    qpid/jms/trunk/src/main/java/org/apache/qpid/jms/engine/AmqpMessage.java
    qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/GenericAmqpMessageImpl.java
    qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MapMessageImpl.java
    qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MessageImpl.java
    qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/ObjectMessageImpl.java
    qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QueueImpl.java
    qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/SenderImpl.java
    qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/SessionImpl.java
    qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/StreamMessageImpl.java
    qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/TextMessageImpl.java
    qpid/jms/trunk/src/test/java/org/apache/qpid/jms/MessageIntegrationTest.java
    qpid/jms/trunk/src/test/java/org/apache/qpid/jms/SessionIntegrationTest.java
    qpid/jms/trunk/src/test/java/org/apache/qpid/jms/engine/AmqpMessageTest.java
    qpid/jms/trunk/src/test/java/org/apache/qpid/jms/engine/TestAmqpMessage.java
    qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/MessageImplTest.java
    qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/SenderImplTest.java
    qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/TestMessageImpl.java

Modified: qpid/jms/trunk/src/main/java/org/apache/qpid/jms/engine/AmqpMessage.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/main/java/org/apache/qpid/jms/engine/AmqpMessage.java?rev=1546110&r1=1546109&r2=1546110&view=diff
==============================================================================
--- qpid/jms/trunk/src/main/java/org/apache/qpid/jms/engine/AmqpMessage.java (original)
+++ qpid/jms/trunk/src/main/java/org/apache/qpid/jms/engine/AmqpMessage.java Wed Nov 27 16:59:33 2013
@@ -119,6 +119,8 @@ public abstract class AmqpMessage
         }
     }
 
+    //===== Header ======
+
     public void setDurable(boolean durable)
     {
         _message.setDurable(durable);
@@ -129,11 +131,7 @@ public abstract class AmqpMessage
         return _message.isDurable();
     }
 
-    public void setContentType(String contentType)
-    {
-        //TODO: do we need to synchronise this?
-        _message.setContentType(contentType);
-    }
+    //===== MessageAnnotations ======
 
     public boolean messageAnnotationExists(Object key)
     {
@@ -167,14 +165,12 @@ public abstract class AmqpMessage
 
     public void clearAllMessageAnnotations()
     {
-        //TODO: this isnt thread-safe, does it need to be?
         _messageAnnotations = null;
         _message.setMessageAnnotations(null);
     }
 
     public void setMessageAnnotation(Object key, Object value)
     {
-        //TODO: this isnt thread-safe, does it need to be?
         if(_messageAnnotationsMap == null)
         {
             _messageAnnotationsMap = new HashMap<Object,Object>();
@@ -192,11 +188,28 @@ public abstract class AmqpMessage
 
     private void setMessageAnnotations()
     {
-        //TODO: this isnt thread-safe, does it need to be?
         _messageAnnotations = new MessageAnnotations(_messageAnnotationsMap);
         _message.setMessageAnnotations(_messageAnnotations);
     }
 
+
+    //===== Properties ======
+
+    public void setContentType(String contentType)
+    {
+        _message.setContentType(contentType);
+    }
+
+    public String getTo()
+    {
+        return _message.getAddress();
+    }
+
+    public void setTo(String to)
+    {
+        _message.setAddress(to);
+    }
+
     //===== Application Properties ======
 
     private void createApplicationProperties()

Added: qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/DestinationHelper.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/DestinationHelper.java?rev=1546110&view=auto
==============================================================================
--- qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/DestinationHelper.java (added)
+++ qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/DestinationHelper.java Wed Nov 27 16:59:33 2013
@@ -0,0 +1,132 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.jms.impl;
+
+import java.util.Set;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Queue;
+import javax.jms.TemporaryQueue;
+import javax.jms.TemporaryTopic;
+import javax.jms.Topic;
+
+public class DestinationHelper
+{
+    //TODO: this only deals with Queues currently as that is all that is implemented so far. This will
+    //eventually need to distinguish Queues, Topics, and possibly 'Destinations' that are neither.
+    public DestinationHelper()
+    {
+    }
+
+    public Destination decodeDestination(String address, String typeString)
+    {
+        Set<String> typeSet = null;
+
+        if(typeString != null)
+        {
+            //TODO
+            throw new IllegalArgumentException("Support for type classification not yet present");
+        }
+
+        return createDestination(address, typeSet);
+    }
+
+    private Destination createDestination(String address, Set<String> typeSet)
+    {
+        if(address == null)
+        {
+            return null;
+        }
+
+        if(typeSet != null)
+        {
+            //TODO
+            throw new IllegalArgumentException("Support for type classification not yet present");
+        }
+
+        return new QueueImpl(address);
+    }
+
+    public Destination convertToQpidDestination(Destination dest) throws JMSException
+    {
+        if(dest == null)
+        {
+            return null;
+        }
+
+        if(!(isQpidDestination(dest)))
+        {
+            if(dest instanceof TemporaryQueue)
+            {
+                //TODO
+                throw new IllegalArgumentException("Unsupported Destination type: " + dest.getClass().getName());
+            }
+            else if(dest instanceof TemporaryTopic)
+            {
+                //TODO
+                throw new IllegalArgumentException("Unsupported Destination type: " + dest.getClass().getName());
+            }
+            else if(dest instanceof Queue)
+            {
+                return createDestination(((Queue) dest).getQueueName(), null);
+            }
+            else if(dest instanceof Topic)
+            {
+                //TODO
+                throw new IllegalArgumentException("Unsupported Destination type: " + dest.getClass().getName());
+            }
+            else
+            {
+                throw new IllegalArgumentException("Unsupported Destination type: " + dest.getClass().getName());
+            }
+        }
+        else
+        {
+            return dest;
+        }
+    }
+
+    public boolean isQpidDestination(Destination dest)
+    {
+        //TODO: support other destination types when implemented
+        return dest instanceof QueueImpl;
+    }
+
+    public String decodeAddress(Destination destination) throws JMSException
+    {
+        if(destination == null)
+        {
+            return null;
+        }
+
+        if(!isQpidDestination(destination))
+        {
+            destination = convertToQpidDestination(destination);
+        }
+
+        if(destination instanceof QueueImpl)
+        {
+            return ((QueueImpl) destination).getQueueName();
+        }
+        throw new IllegalArgumentException("Support for those destinations not yet implemented");
+    }
+}

Modified: qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/GenericAmqpMessageImpl.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/GenericAmqpMessageImpl.java?rev=1546110&r1=1546109&r2=1546110&view=diff
==============================================================================
--- qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/GenericAmqpMessageImpl.java (original)
+++ qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/GenericAmqpMessageImpl.java Wed Nov 27 16:59:33 2013
@@ -25,11 +25,13 @@ import org.apache.qpid.jms.engine.AmqpGe
 
 public class GenericAmqpMessageImpl extends MessageImpl<AmqpGenericMessage> implements Message
 {
+    //message to be sent
     public GenericAmqpMessageImpl(SessionImpl sessionImpl, ConnectionImpl connectionImpl) throws JMSException
     {
         this(new AmqpGenericMessage(), sessionImpl, connectionImpl);
     }
 
+    //message just received
     public GenericAmqpMessageImpl(AmqpGenericMessage amqpMessage, SessionImpl sessionImpl, ConnectionImpl connectionImpl) throws JMSException
     {
         super(amqpMessage, sessionImpl, connectionImpl);

Modified: qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MapMessageImpl.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MapMessageImpl.java?rev=1546110&r1=1546109&r2=1546110&view=diff
==============================================================================
--- qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MapMessageImpl.java (original)
+++ qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MapMessageImpl.java Wed Nov 27 16:59:33 2013
@@ -27,11 +27,13 @@ import org.apache.qpid.jms.engine.AmqpMa
 
 public class MapMessageImpl extends MessageImpl<AmqpMapMessage> implements MapMessage
 {
+    //message to be sent
     public MapMessageImpl(SessionImpl sessionImpl, ConnectionImpl connectionImpl) throws JMSException
     {
         this(new AmqpMapMessage(), sessionImpl, connectionImpl);
     }
 
+    //message just received
     public MapMessageImpl(AmqpMapMessage amqpMessage, SessionImpl sessionImpl, ConnectionImpl connectionImpl) throws JMSException
     {
         super(amqpMessage, sessionImpl, connectionImpl);

Modified: qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MessageImpl.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MessageImpl.java?rev=1546110&r1=1546109&r2=1546110&view=diff
==============================================================================
--- qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MessageImpl.java (original)
+++ qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MessageImpl.java Wed Nov 27 16:59:33 2013
@@ -32,10 +32,25 @@ import org.apache.qpid.jms.engine.AmqpMe
 public abstract class MessageImpl<T extends AmqpMessage> implements Message
 {
     private final T _amqpMessage;
+    private Destination _destination;
 
     public MessageImpl(T amqpMessage, SessionImpl sessionImpl, ConnectionImpl connectionImpl)
     {
         _amqpMessage = amqpMessage;
+        String to = _amqpMessage.getTo();
+        if(to != null)
+        {
+            //TODO: don't create a new DestinationHelper for every call.
+            _destination = new DestinationHelper().decodeDestination(to, null);
+        }
+        else
+        {
+            //TODO:
+            //Message doesn't have a To. If this message was received via a
+            //consumer (i.e we aren't creating this message to send), as a fallback
+            //we could set the Destination used to create the consumer itself. That
+            //responsibility might fall to the consumer though.
+        }
     }
 
     T getUnderlyingAmqpMessage(boolean prepareForSending)
@@ -173,15 +188,28 @@ public abstract class MessageImpl<T exte
     @Override
     public Destination getJMSDestination() throws JMSException
     {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException("Not Implemented");
+        return _destination;
     }
 
     @Override
-    public void setJMSDestination(Destination destination) throws JMSException
+    public void setJMSDestination(final Destination destination) throws JMSException
     {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException("Not Implemented");
+        //TODO: don't create a new DestinationHelper for every call.
+        DestinationHelper destinationHelper = new DestinationHelper();
+
+        _destination = destination;
+
+        Destination dest = destination;
+        if(dest != null && !destinationHelper.isQpidDestination(dest))
+        {
+            dest = destinationHelper.convertToQpidDestination(destination);
+        }
+
+        String to = destinationHelper.decodeAddress(destination);
+
+        _amqpMessage.setTo(to);
+
+        //TODO: set the x-opt-to-type message annotation
     }
 
     @Override

Modified: qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/ObjectMessageImpl.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/ObjectMessageImpl.java?rev=1546110&r1=1546109&r2=1546110&view=diff
==============================================================================
--- qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/ObjectMessageImpl.java (original)
+++ qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/ObjectMessageImpl.java Wed Nov 27 16:59:33 2013
@@ -27,11 +27,13 @@ import org.apache.qpid.jms.engine.AmqpOb
 
 public class ObjectMessageImpl extends MessageImpl<AmqpObjectMessage> implements ObjectMessage
 {
+    //message to be sent
     public ObjectMessageImpl(SessionImpl sessionImpl, ConnectionImpl connectionImpl) throws JMSException
     {
         this(new AmqpObjectMessage(), sessionImpl, connectionImpl);
     }
 
+    //message just received
     public ObjectMessageImpl(AmqpObjectMessage amqpMessage, SessionImpl sessionImpl, ConnectionImpl connectionImpl) throws JMSException
     {
         super(amqpMessage, sessionImpl, connectionImpl);

Modified: qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QueueImpl.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QueueImpl.java?rev=1546110&r1=1546109&r2=1546110&view=diff
==============================================================================
--- qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QueueImpl.java (original)
+++ qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/QueueImpl.java Wed Nov 27 16:59:33 2013
@@ -27,10 +27,14 @@ class QueueImpl implements Queue
 
     public QueueImpl(String queueName)
     {
+        if(queueName == null)
+        {
+            throw new IllegalArgumentException("Queue name must be specified");
+        }
+
         _queueName = queueName;
     }
 
-
     @Override
     public String getQueueName() throws JMSException
     {
@@ -42,4 +46,26 @@ class QueueImpl implements Queue
     {
         return _queueName;
     }
+
+    @Override
+    public int hashCode()
+    {
+        return _queueName.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object o)
+    {
+        if (this == o)
+        {
+            return true;
+        }
+
+        if (o == null || getClass() != o.getClass())
+        {
+            return false;
+        }
+
+        return _queueName.equals(((QueueImpl)o)._queueName);
+    }
 }

Modified: qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/SenderImpl.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/SenderImpl.java?rev=1546110&r1=1546109&r2=1546110&view=diff
==============================================================================
--- qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/SenderImpl.java (original)
+++ qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/SenderImpl.java Wed Nov 27 16:59:33 2013
@@ -32,11 +32,13 @@ import org.apache.qpid.jms.engine.AmqpSe
 public class SenderImpl extends LinkImpl implements MessageProducer
 {
     private AmqpSender _amqpSender;
+    private Destination _destination;
 
-    public SenderImpl(SessionImpl sessionImpl, ConnectionImpl connectionImpl, AmqpSender amqpSender)
+    public SenderImpl(SessionImpl sessionImpl, ConnectionImpl connectionImpl, AmqpSender amqpSender, Destination destination)
     {
         super(connectionImpl, amqpSender);
         _amqpSender = amqpSender;
+        _destination = destination;
     }
 
     private void sendMessage(Message message, int deliveryMode, int priority, long timeToLive) throws JMSException
@@ -44,6 +46,9 @@ public class SenderImpl extends LinkImpl
         getConnectionImpl().lock();
         try
         {
+            //set the Destination
+            message.setJMSDestination(_destination);
+
             //set the DeliveryMode if necessary
             if(deliveryMode != message.getJMSDeliveryMode())
             {

Modified: qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/SessionImpl.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/SessionImpl.java?rev=1546110&r1=1546109&r2=1546110&view=diff
==============================================================================
--- qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/SessionImpl.java (original)
+++ qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/SessionImpl.java Wed Nov 27 16:59:33 2013
@@ -62,7 +62,7 @@ public class SessionImpl implements Sess
         _connectionImpl = connectionImpl;
     }
 
-    void establish() throws JmsTimeoutException, JmsInterruptedException
+     void establish() throws JmsTimeoutException, JmsInterruptedException
     {
         _connectionImpl.waitUntil(new SimplePredicate("Session established", _amqpSession)
         {
@@ -79,13 +79,13 @@ public class SessionImpl implements Sess
         return _connectionImpl;
     }
 
-    private SenderImpl createSender(String address) throws JMSException
+    private SenderImpl createSender(String address, Destination destination) throws JMSException
     {
         _connectionImpl.lock();
         try
         {
             AmqpSender amqpSender = _amqpSession.createAmqpSender(address);
-            SenderImpl sender = new SenderImpl(this, _connectionImpl, amqpSender);
+            SenderImpl sender = new SenderImpl(this, _connectionImpl, amqpSender, destination);
             _connectionImpl.stateChanged();
             sender.establish();
             return sender;
@@ -160,6 +160,7 @@ public class SessionImpl implements Sess
     @Override
     public MessageProducer createProducer(Destination destination) throws JMSException
     {
+        //TODO: use destination helper to perform conversion, extract address etc.
         if(destination == null)
         {
             throw new UnsupportedOperationException("Unspecified destinations are not yet supported");
@@ -167,7 +168,8 @@ public class SessionImpl implements Sess
         else if (destination instanceof Queue)
         {
             Queue queue = (Queue) destination;
-            return createSender(queue.getQueueName());
+
+            return createSender(queue.getQueueName(), destination);
         }
         else if(destination instanceof Topic)
         {
@@ -247,13 +249,19 @@ public class SessionImpl implements Sess
     @Override
     public TextMessage createTextMessage() throws JMSException
     {
-        return new TextMessageImpl(this, _connectionImpl);
+        return createTextMessage(null);
     }
 
     @Override
     public TextMessage createTextMessage(String text) throws JMSException
     {
-        return new TextMessageImpl(text, this, _connectionImpl);
+        TextMessage msg = new TextMessageImpl(this, _connectionImpl);
+        if(text != null)
+        {
+            msg.setText(text);
+        }
+
+        return msg;
     }
 
     @Override

Modified: qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/StreamMessageImpl.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/StreamMessageImpl.java?rev=1546110&r1=1546109&r2=1546110&view=diff
==============================================================================
--- qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/StreamMessageImpl.java (original)
+++ qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/StreamMessageImpl.java Wed Nov 27 16:59:33 2013
@@ -25,11 +25,13 @@ import org.apache.qpid.jms.engine.AmqpLi
 
 public class StreamMessageImpl extends MessageImpl<AmqpListMessage> implements StreamMessage
 {
+    //message to be sent
     public StreamMessageImpl(SessionImpl sessionImpl, ConnectionImpl connectionImpl) throws JMSException
     {
         this(new AmqpListMessage(), sessionImpl, connectionImpl);
     }
 
+    //message just received
     public StreamMessageImpl(AmqpListMessage amqpMessage, SessionImpl sessionImpl, ConnectionImpl connectionImpl) throws JMSException
     {
         super(amqpMessage, sessionImpl, connectionImpl);

Modified: qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/TextMessageImpl.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/TextMessageImpl.java?rev=1546110&r1=1546109&r2=1546110&view=diff
==============================================================================
--- qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/TextMessageImpl.java (original)
+++ qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/TextMessageImpl.java Wed Nov 27 16:59:33 2013
@@ -25,17 +25,13 @@ import org.apache.qpid.jms.engine.AmqpTe
 
 public class TextMessageImpl extends MessageImpl<AmqpTextMessage> implements TextMessage
 {
+    //message to be sent
     public TextMessageImpl(SessionImpl sessionImpl, ConnectionImpl connectionImpl) throws JMSException
     {
-        this((String) null, sessionImpl, connectionImpl);
-    }
-
-    public TextMessageImpl(String text, SessionImpl sessionImpl, ConnectionImpl connectionImpl) throws JMSException
-    {
         this(new AmqpTextMessage(), sessionImpl, connectionImpl);
-        setText(text);
     }
 
+    //message just received
     public TextMessageImpl(AmqpTextMessage amqpMessage, SessionImpl sessionImpl, ConnectionImpl connectionImpl) throws JMSException
     {
         super(amqpMessage, sessionImpl, connectionImpl);

Modified: qpid/jms/trunk/src/test/java/org/apache/qpid/jms/MessageIntegrationTest.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/test/java/org/apache/qpid/jms/MessageIntegrationTest.java?rev=1546110&r1=1546109&r2=1546110&view=diff
==============================================================================
--- qpid/jms/trunk/src/test/java/org/apache/qpid/jms/MessageIntegrationTest.java (original)
+++ qpid/jms/trunk/src/test/java/org/apache/qpid/jms/MessageIntegrationTest.java Wed Nov 27 16:59:33 2013
@@ -38,6 +38,7 @@ import org.apache.qpid.jms.test.testpeer
 import org.apache.qpid.jms.test.testpeer.describedtypes.sections.ApplicationPropertiesDescribedType;
 import org.apache.qpid.jms.test.testpeer.matchers.sections.ApplicationPropertiesSectionMatcher;
 import org.apache.qpid.jms.test.testpeer.matchers.sections.MessageHeaderSectionMatcher;
+import org.apache.qpid.jms.test.testpeer.matchers.sections.MessagePropertiesSectionMatcher;
 import org.apache.qpid.jms.test.testpeer.matchers.sections.TransferPayloadCompositeMatcher;
 import org.apache.qpid.jms.test.testpeer.matchers.types.EncodedAmqpValueMatcher;
 import org.apache.qpid.proton.amqp.DescribedType;
@@ -76,7 +77,8 @@ public class MessageIntegrationTest exte
             testPeer.expectSenderAttach();
 
             Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-            Queue queue = session.createQueue("myQueue");
+            String queueName = "myQueue";
+            Queue queue = session.createQueue(queueName);
             MessageProducer producer = session.createProducer(queue);
 
             ApplicationPropertiesSectionMatcher appPropsMatcher = new ApplicationPropertiesSectionMatcher(true);
@@ -92,8 +94,11 @@ public class MessageIntegrationTest exte
 
             MessageHeaderSectionMatcher headersMatcher = new MessageHeaderSectionMatcher(true).withDurable(equalTo(true));
 
+            MessagePropertiesSectionMatcher propsMatcher = new MessagePropertiesSectionMatcher(true).withTo(equalTo(queueName));
+
             TransferPayloadCompositeMatcher messageMatcher = new TransferPayloadCompositeMatcher();
             messageMatcher.setHeadersMatcher(headersMatcher);
+            messageMatcher.setPropertiesMatcher(propsMatcher);
             messageMatcher.setApplicationPropertiesMatcher(appPropsMatcher);
             messageMatcher.setMessageContentMatcher(new EncodedAmqpValueMatcher(null));
             testPeer.expectTransfer(messageMatcher);

Modified: qpid/jms/trunk/src/test/java/org/apache/qpid/jms/SessionIntegrationTest.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/test/java/org/apache/qpid/jms/SessionIntegrationTest.java?rev=1546110&r1=1546109&r2=1546110&view=diff
==============================================================================
--- qpid/jms/trunk/src/test/java/org/apache/qpid/jms/SessionIntegrationTest.java (original)
+++ qpid/jms/trunk/src/test/java/org/apache/qpid/jms/SessionIntegrationTest.java Wed Nov 27 16:59:33 2013
@@ -79,13 +79,16 @@ public class SessionIntegrationTest exte
             testPeer.expectSenderAttach();
 
             Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-            Queue queue = session.createQueue("myQueue");
+            String queueName = "myQueue";
+            Queue queue = session.createQueue(queueName);
             MessageProducer producer = session.createProducer(queue);
 
             String text = "myMessage";
             MessageHeaderSectionMatcher headersMatcher = new MessageHeaderSectionMatcher(true).withDurable(equalTo(true));
+            MessagePropertiesSectionMatcher propsMatcher = new MessagePropertiesSectionMatcher(true).withTo(equalTo(queueName));
             TransferPayloadCompositeMatcher messageMatcher = new TransferPayloadCompositeMatcher();
             messageMatcher.setHeadersMatcher(headersMatcher);
+            messageMatcher.setPropertiesMatcher(propsMatcher);
             messageMatcher.setMessageContentMatcher(new EncodedAmqpValueMatcher(text));
             testPeer.expectTransfer(messageMatcher);
 
@@ -135,12 +138,15 @@ public class SessionIntegrationTest exte
             testPeer.expectSenderAttach();
 
             Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-            Queue queue = session.createQueue("myQueue");
+            String queueName = "myQueue";
+            Queue queue = session.createQueue(queueName);
             MessageProducer producer = session.createProducer(queue);
 
             MessageHeaderSectionMatcher headersMatcher = new MessageHeaderSectionMatcher(true).withDurable(equalTo(true));
+            MessagePropertiesSectionMatcher propsMatcher = new MessagePropertiesSectionMatcher(true).withTo(equalTo(queueName));
             TransferPayloadCompositeMatcher messageMatcher = new TransferPayloadCompositeMatcher();
             messageMatcher.setHeadersMatcher(headersMatcher);
+            messageMatcher.setPropertiesMatcher(propsMatcher);
             messageMatcher.setMessageContentMatcher(new EncodedAmqpValueMatcher(null));
             testPeer.expectTransfer(messageMatcher);
 

Modified: qpid/jms/trunk/src/test/java/org/apache/qpid/jms/engine/AmqpMessageTest.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/test/java/org/apache/qpid/jms/engine/AmqpMessageTest.java?rev=1546110&r1=1546109&r2=1546110&view=diff
==============================================================================
--- qpid/jms/trunk/src/test/java/org/apache/qpid/jms/engine/AmqpMessageTest.java (original)
+++ qpid/jms/trunk/src/test/java/org/apache/qpid/jms/engine/AmqpMessageTest.java Wed Nov 27 16:59:33 2013
@@ -28,7 +28,9 @@ import java.util.Set;
 
 import org.apache.qpid.jms.QpidJmsTestCase;
 import org.apache.qpid.proton.Proton;
+import org.apache.qpid.proton.amqp.Symbol;
 import org.apache.qpid.proton.amqp.messaging.ApplicationProperties;
+import org.apache.qpid.proton.amqp.messaging.Properties;
 import org.apache.qpid.proton.engine.Delivery;
 import org.apache.qpid.proton.message.Message;
 import org.junit.Before;
@@ -160,4 +162,77 @@ public class AmqpMessageTest extends Qpi
         }
     }
 
+    @Test
+    public void testGetToWithReceivedMessageWithNoProperties()
+    {
+        Message message = Proton.message();
+        TestAmqpMessage testAmqpMessage = new TestAmqpMessage(message, _mockDelivery, _mockAmqpConnection);
+
+        String toAddress = testAmqpMessage.getTo();
+        assertNull(toAddress);
+    }
+
+    @Test
+    public void testGetToWithReceivedMessageWithPropertiesButNoTo()
+    {
+        Message message = Proton.message();
+
+        Properties props = new Properties();
+        props.setContentType(Symbol.valueOf("content-type"));
+        message.setProperties(props);
+
+        TestAmqpMessage testAmqpMessage = new TestAmqpMessage(message, _mockDelivery, _mockAmqpConnection);
+
+        String toAddress = testAmqpMessage.getTo();
+        assertNull(toAddress);
+    }
+
+    @Test
+    public void testGetToWithReceivedMessage()
+    {
+        String testToAddress = "myTestAddress";
+
+        Message message = Proton.message();
+
+        Properties props = new Properties();
+        props.setTo(testToAddress);
+        message.setProperties(props);
+
+        TestAmqpMessage testAmqpMessage = new TestAmqpMessage(message, _mockDelivery, _mockAmqpConnection);
+
+        String toAddress = testAmqpMessage.getTo();
+        assertNotNull(toAddress);
+        assertEquals(testToAddress, testAmqpMessage.getTo());
+    }
+
+    @Test
+    public void testSetTo()
+    {
+        String testToAddress = "myTestAddress";
+
+        TestAmqpMessage testAmqpMessage = new TestAmqpMessage();
+
+        Message underlyingMessage = testAmqpMessage.getMessage();
+        assertNull(underlyingMessage.getAddress());
+
+        testAmqpMessage.setTo(testToAddress);
+
+        assertNotNull(underlyingMessage.getAddress());
+        assertEquals(testToAddress, underlyingMessage.getAddress());
+    }
+
+    @Test
+    public void testSetGetTo()
+    {
+        String testToAddress = "myTestAddress";
+
+        TestAmqpMessage testAmqpMessage = new TestAmqpMessage();
+
+        assertNull(testAmqpMessage.getTo());
+
+        testAmqpMessage.setTo(testToAddress);
+
+        assertNotNull(testAmqpMessage.getTo());
+        assertEquals(testToAddress, testAmqpMessage.getTo());
+    }
 }

Modified: qpid/jms/trunk/src/test/java/org/apache/qpid/jms/engine/TestAmqpMessage.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/test/java/org/apache/qpid/jms/engine/TestAmqpMessage.java?rev=1546110&r1=1546109&r2=1546110&view=diff
==============================================================================
--- qpid/jms/trunk/src/test/java/org/apache/qpid/jms/engine/TestAmqpMessage.java (original)
+++ qpid/jms/trunk/src/test/java/org/apache/qpid/jms/engine/TestAmqpMessage.java Wed Nov 27 16:59:33 2013
@@ -1,5 +1,6 @@
 package org.apache.qpid.jms.engine;
 
+import org.apache.qpid.proton.Proton;
 import org.apache.qpid.proton.engine.Delivery;
 import org.apache.qpid.proton.message.Message;
 
@@ -7,6 +8,7 @@ public class TestAmqpMessage extends Amq
 {
     public TestAmqpMessage()
     {
+        this(Proton.message(), null, null);
     }
 
     public TestAmqpMessage(Message message, Delivery delivery, AmqpConnection amqpConnection)

Added: qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/DestinationHelperTest.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/DestinationHelperTest.java?rev=1546110&view=auto
==============================================================================
--- qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/DestinationHelperTest.java (added)
+++ qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/DestinationHelperTest.java Wed Nov 27 16:59:33 2013
@@ -0,0 +1,114 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.jms.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import javax.jms.Destination;
+import javax.jms.Queue;
+
+import org.apache.qpid.jms.QpidJmsTestCase;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+public class DestinationHelperTest extends QpidJmsTestCase
+{
+    private DestinationHelper _helper;
+
+    @Before
+    @Override
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        _helper = new DestinationHelper();
+    }
+
+    @Test
+    public void testDecodeDestinationWithoutTypeAnnotation() throws Exception
+    {
+        String testAddress = "testAddress";
+        Destination dest = _helper.decodeDestination(testAddress, null);
+        assertNotNull(dest);
+
+        //TODO: this probably wont be true in future
+        assertTrue(dest instanceof Queue);
+    }
+
+    @Test
+    public void testConvertToQpidDestinationWithNull() throws Exception
+    {
+        assertNull(_helper.convertToQpidDestination(null));
+    }
+
+    @Test
+    public void testConvertToQpidDestinationWithQpidDestination() throws Exception
+    {
+        String testAddress = "testAddress";
+        Queue queue = new QueueImpl(testAddress);
+
+        Destination dest = _helper.convertToQpidDestination(queue);
+        assertNotNull(dest);
+        assertSame(queue, dest);
+    }
+
+    @Test
+    public void testConvertToQpidDestinationWithNonQpidQueue() throws Exception
+    {
+        String testAddress = "testAddress";
+        Queue mockQueue = Mockito.mock(Queue.class);
+        Mockito.when(mockQueue.getQueueName()).thenReturn(testAddress);
+
+        Destination dest = _helper.convertToQpidDestination(mockQueue);
+        assertNotNull(dest);
+        assertTrue(dest instanceof Queue);
+        assertEquals(testAddress, ((Queue)dest).getQueueName());
+    }
+
+    @Test
+    public void testDecodeAddressWithNull() throws Exception
+    {
+        assertNull(_helper.decodeAddress(null));
+    }
+
+    @Test
+    public void testDecodeAddressWithQpidQueue() throws Exception
+    {
+        String testAddress = "testAddress";
+        Queue queue = new QueueImpl(testAddress);
+
+        assertEquals(testAddress, _helper.decodeAddress(queue));
+    }
+
+    @Test
+    public void testDecodeAddressWithNonQpidQueue() throws Exception
+    {
+        String testAddress = "testAddress";
+        Queue mockQueue = Mockito.mock(Queue.class);
+        Mockito.when(mockQueue.getQueueName()).thenReturn(testAddress);
+
+        assertEquals(testAddress, _helper.decodeAddress(mockQueue));
+    }
+}

Modified: qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/MessageImplTest.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/MessageImplTest.java?rev=1546110&r1=1546109&r2=1546110&view=diff
==============================================================================
--- qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/MessageImplTest.java (original)
+++ qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/MessageImplTest.java Wed Nov 27 16:59:33 2013
@@ -26,6 +26,7 @@ import java.util.Enumeration;
 
 import javax.jms.JMSException;
 import javax.jms.MessageFormatException;
+import javax.jms.Queue;
 
 import org.apache.qpid.jms.QpidJmsTestCase;
 import org.apache.qpid.jms.engine.TestAmqpMessage;
@@ -38,6 +39,9 @@ public class MessageImplTest extends Qpi
     private ConnectionImpl _mockConnectionImpl;
     private SessionImpl _mockSessionImpl;
     private TestMessageImpl _testMessage;
+    private TestAmqpMessage _testAmqpMessage;
+    private String _mockQueueName;
+    private Queue _mockQueue;
 
     @Before
     @Override
@@ -46,7 +50,12 @@ public class MessageImplTest extends Qpi
         super.setUp();
         _mockConnectionImpl = Mockito.mock(ConnectionImpl.class);
         _mockSessionImpl = Mockito.mock(SessionImpl.class);
-        _testMessage = new TestMessageImpl(new TestAmqpMessage(), _mockSessionImpl, _mockConnectionImpl);
+        _testAmqpMessage = new TestAmqpMessage();
+        _testMessage = new TestMessageImpl(_testAmqpMessage, _mockSessionImpl, _mockConnectionImpl);
+
+        _mockQueueName = "mockQueueName";
+        _mockQueue = Mockito.mock(Queue.class);
+        Mockito.when(_mockQueue.getQueueName()).thenReturn(_mockQueueName);
     }
 
     @Test
@@ -430,6 +439,47 @@ public class MessageImplTest extends Qpi
         assertGetPropertyThrowsMessageFormatException(_testMessage, propertyName, Float.class);
     }
 
+    // ====== JMSDestination =======
+
+    @Test
+    public void testGetJMSDestinationOnNewMessage() throws Exception
+    {
+        //Should be null as it has not been set explicitly, and
+        // the message has not been sent anywhere
+        assertNull(_testMessage.getJMSDestination());
+    }
+
+    @Test
+    public void testSetJMSDestinationOnNewMessage() throws Exception
+    {
+        assertNull(_testAmqpMessage.getTo());
+
+        _testMessage.setJMSDestination(_mockQueue);
+
+        assertNotNull(_testAmqpMessage.getTo());
+        assertEquals(_mockQueueName, _testAmqpMessage.getTo());
+    }
+
+    @Test
+    public void testSetGetJMSDestinationOnNewMessage() throws Exception
+    {
+        _testMessage.setJMSDestination(_mockQueue);
+        assertNotNull(_testMessage.getJMSDestination());
+        assertSame(_mockQueue, _testMessage.getJMSDestination());
+    }
+
+    @Test
+    public void testGetJMSDestinationOnRecievedMessageWithTo() throws Exception
+    {
+        _testAmqpMessage.setTo(_mockQueueName);
+        _testMessage = new TestMessageImpl(_testAmqpMessage, _mockSessionImpl, _mockConnectionImpl);
+
+        assertNotNull("expected JMSDestination value not present", _testMessage.getJMSDestination());
+
+        QueueImpl newQueueExpected = new QueueImpl(_mockQueueName);
+        assertEquals(newQueueExpected, _testMessage.getJMSDestination());
+    }
+
     // ====== utility methods =======
 
     private void assertGetPropertyThrowsMessageFormatException(TestMessageImpl testMessage,

Added: qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/QueueImplTest.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/QueueImplTest.java?rev=1546110&view=auto
==============================================================================
--- qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/QueueImplTest.java (added)
+++ qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/QueueImplTest.java Wed Nov 27 16:59:33 2013
@@ -0,0 +1,70 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.jms.impl;
+
+import static org.junit.Assert.*;
+
+import javax.jms.Queue;
+
+import org.apache.qpid.jms.QpidJmsTestCase;
+import org.junit.Before;
+import org.junit.Test;
+
+public class QueueImplTest extends QpidJmsTestCase
+{
+    private String _testQueueName;
+    private QueueImpl _testQueue;
+
+    @Before
+    @Override
+    public void setUp() throws Exception
+    {
+        super.setUp();
+
+        _testQueueName = "testQueueName";
+        _testQueue = new QueueImpl(_testQueueName);
+    }
+
+    @Test
+    public void testGetQueueName() throws Exception
+    {
+        assertEquals(_testQueueName, _testQueue.getQueueName());
+    }
+
+    @Test
+    public void testToString() throws Exception
+    {
+        assertEquals(_testQueueName, _testQueue.toString());
+    }
+
+    @Test
+    public void testEqualsAndHashCode() throws Exception
+    {
+        Queue anotherEqualQueue = new QueueImpl(_testQueueName);
+        Queue unequalQueue = new QueueImpl("otherName");
+
+        assertFalse(_testQueue == anotherEqualQueue);
+        assertFalse(_testQueue.equals(unequalQueue));
+
+        assertTrue(_testQueue.equals(anotherEqualQueue));
+        assertEquals(_testQueue.hashCode(), anotherEqualQueue.hashCode());
+    }
+}

Modified: qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/SenderImplTest.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/SenderImplTest.java?rev=1546110&r1=1546109&r2=1546110&view=diff
==============================================================================
--- qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/SenderImplTest.java (original)
+++ qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/SenderImplTest.java Wed Nov 27 16:59:33 2013
@@ -21,8 +21,11 @@
 package org.apache.qpid.jms.impl;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
 
 import javax.jms.DeliveryMode;
+import javax.jms.Queue;
 
 import org.apache.qpid.jms.QpidJmsTestCase;
 import org.apache.qpid.jms.engine.AmqpMessage;
@@ -39,6 +42,8 @@ public class SenderImplTest extends Qpid
     private ConnectionImpl _mockConnection;
     private AmqpSender _mockAmqpSender;
     private SessionImpl _mockSession;
+    private Queue _mockQueue;
+    private String _mockQueueName = "mockQueueName";
 
     @Before
     @Override
@@ -48,6 +53,10 @@ public class SenderImplTest extends Qpid
         _mockConnection = Mockito.mock(ConnectionImpl.class);
         _mockAmqpSender = Mockito.mock(AmqpSender.class);
         _mockSession = Mockito.mock(SessionImpl.class);
+
+        _mockQueueName = "mockQueueName";
+        _mockQueue = Mockito.mock(Queue.class);
+        Mockito.when(_mockQueue.getQueueName()).thenReturn(_mockQueueName);
     }
 
     @Test
@@ -59,18 +68,10 @@ public class SenderImplTest extends Qpid
         Mockito.when(_mockAmqpSender.sendMessage(Mockito.any(AmqpMessage.class))).thenReturn(_mockToken);
         ImmediateWaitUntil.mockWaitUntil(_mockConnection);
 
-        SenderImpl senderImpl = new SenderImpl(_mockSession, _mockConnection, _mockAmqpSender);
+        SenderImpl senderImpl = new SenderImpl(_mockSession, _mockConnection, _mockAmqpSender, _mockQueue);
 
         TestAmqpMessage testAmqpMessage = new TestAmqpMessage();
-        TestMessageImpl testMessage = new TestMessageImpl(testAmqpMessage, null, null)
-        {
-            @Override
-            protected TestAmqpMessage prepareUnderlyingAmqpMessageForSending(TestAmqpMessage amqpMessage)
-            {
-                //NO-OP
-                return amqpMessage;
-            }
-        };
+        TestMessageImpl testMessage = new TestMessageImpl(testAmqpMessage, null, null);
 
         testMessage.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
         assertEquals(DeliveryMode.NON_PERSISTENT, testMessage.getJMSDeliveryMode());
@@ -79,4 +80,25 @@ public class SenderImplTest extends Qpid
 
         assertEquals(DeliveryMode.PERSISTENT, testMessage.getJMSDeliveryMode());
     }
+
+    @Test
+    public void testSenderSetsJMSDestinationOnMessage() throws Exception
+    {
+        //Create mock sent message token, ensure that it is immediately marked as Accepted
+        AmqpSentMessageToken _mockToken = Mockito.mock(AmqpSentMessageToken.class);
+        Mockito.when(_mockToken.getRemoteDeliveryState()).thenReturn(Accepted.getInstance());
+        Mockito.when(_mockAmqpSender.sendMessage(Mockito.any(AmqpMessage.class))).thenReturn(_mockToken);
+        ImmediateWaitUntil.mockWaitUntil(_mockConnection);
+
+        SenderImpl senderImpl = new SenderImpl(_mockSession, _mockConnection, _mockAmqpSender, _mockQueue);
+
+        TestAmqpMessage testAmqpMessage = new TestAmqpMessage();
+        TestMessageImpl testMessage = new TestMessageImpl(testAmqpMessage, null, null);
+
+        assertNull(testMessage.getJMSDestination());
+
+        senderImpl.send(testMessage);
+
+        assertSame(_mockQueue, testMessage.getJMSDestination());
+    }
 }

Modified: qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/TestMessageImpl.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/TestMessageImpl.java?rev=1546110&r1=1546109&r2=1546110&view=diff
==============================================================================
--- qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/TestMessageImpl.java (original)
+++ qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/TestMessageImpl.java Wed Nov 27 16:59:33 2013
@@ -10,10 +10,9 @@ public class TestMessageImpl extends Mes
     }
 
     @Override
-    protected TestAmqpMessage prepareUnderlyingAmqpMessageForSending(
-            TestAmqpMessage amqpMessage)
+    protected TestAmqpMessage prepareUnderlyingAmqpMessageForSending(TestAmqpMessage amqpMessage)
     {
-        //TODO
-        throw new UnsupportedOperationException("Not Implemented");
+        //NO-OP
+        return amqpMessage;
     }
 }
\ No newline at end of file



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