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 2014/02/20 17:59:57 UTC

svn commit: r1570274 - 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: Thu Feb 20 16:59:56 2014
New Revision: 1570274

URL: http://svn.apache.org/r1570274
Log:
QPIDJMS-9: add support for setting/getting the reply-to-group-id value using the synthetic JMS_AMQP_REPLY_TO_GROUP_ID vendor property

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/ClientProperties.java
    qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/MessageImpl.java
    qpid/jms/trunk/src/test/java/org/apache/qpid/jms/MessageIntegrationTest.java
    qpid/jms/trunk/src/test/java/org/apache/qpid/jms/engine/AmqpMessageTest.java
    qpid/jms/trunk/src/test/java/org/apache/qpid/jms/impl/MessageImplTest.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=1570274&r1=1570273&r2=1570274&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 Thu Feb 20 16:59:56 2014
@@ -317,6 +317,17 @@ public abstract class AmqpMessage
 
     //===== Properties ======
 
+
+    public void setReplyToGroupId(String replyToGroupId)
+    {
+        _message.setReplyToGroupId(replyToGroupId);
+    }
+
+    public String getReplyToGroupId()
+    {
+        return _message.getReplyToGroupId();
+    }
+
     public Long getGroupSequence()
     {
         if(_message.getProperties() == null)

Modified: qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/ClientProperties.java
URL: http://svn.apache.org/viewvc/qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/ClientProperties.java?rev=1570274&r1=1570273&r2=1570274&view=diff
==============================================================================
--- qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/ClientProperties.java (original)
+++ qpid/jms/trunk/src/main/java/org/apache/qpid/jms/impl/ClientProperties.java Thu Feb 20 16:59:56 2014
@@ -29,6 +29,7 @@ public class ClientProperties
 
     //Custom Message Property Names
     public static final String JMS_AMQP_TTL = "JMS_AMQP_TTL";
+    public static final String JMS_AMQP_REPLY_TO_GROUP_ID = "JMS_AMQP_REPLY_TO_GROUP_ID";
 
     //Message Annotation Names
     public static final String X_OPT_APP_CORRELATION_ID = "x-opt-app-correlation-id";

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=1570274&r1=1570273&r2=1570274&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 Thu Feb 20 16:59:56 2014
@@ -19,6 +19,7 @@
 package org.apache.qpid.jms.impl;
 
 import static org.apache.qpid.jms.impl.ClientProperties.JMS_AMQP_TTL;
+import static org.apache.qpid.jms.impl.ClientProperties.JMS_AMQP_REPLY_TO_GROUP_ID;
 import static org.apache.qpid.jms.impl.ClientProperties.JMSXUSERID;
 import static org.apache.qpid.jms.impl.ClientProperties.JMSXGROUPID;
 import static org.apache.qpid.jms.impl.ClientProperties.JMSXGROUPSEQ;
@@ -206,6 +207,11 @@ public abstract class MessageImpl<T exte
             setJMS_AMQP_TTL(value);
             return;
         }
+        else if(JMS_AMQP_REPLY_TO_GROUP_ID.equals(name))
+        {
+            setJMS_AMQP_REPLY_TO_GROUP_ID(value);
+            return;
+        }
         else if(JMSXUSERID.equals(name))
         {
             setJMSXUserID(value);
@@ -306,6 +312,24 @@ public abstract class MessageImpl<T exte
         }
     }
 
+    private void setJMS_AMQP_REPLY_TO_GROUP_ID(Object value) throws MessageFormatException
+    {
+        String replyToGroupId = null;
+        if(value != null)
+        {
+            if(value instanceof String)
+            {
+                replyToGroupId = (String) value;
+            }
+            else
+            {
+                throw createMessageFormatException(JMS_AMQP_REPLY_TO_GROUP_ID + " must be a String");
+            }
+        }
+
+        _amqpMessage.setReplyToGroupId(replyToGroupId);
+    }
+
     private Object getApplicationProperty(String name) throws MessageFormatException
     {
         checkPropertyNameIsValid(name);
@@ -326,6 +350,10 @@ public abstract class MessageImpl<T exte
         {
             return getJMSXGroupSeq();
         }
+        else if(JMS_AMQP_REPLY_TO_GROUP_ID.equals(name))
+        {
+            return _amqpMessage.getReplyToGroupId();
+        }
 
         //TODO: handle non-JMS types?
         return _amqpMessage.getApplicationProperty(name);
@@ -403,6 +431,11 @@ public abstract class MessageImpl<T exte
         return _propJMS_AMQP_TTL != null;
     }
 
+    private boolean propertyExistsJMS_AMQP_REPLY_TO_GROUP_ID()
+    {
+        return _amqpMessage.getReplyToGroupId() != null;
+    }
+
     //======= JMS Methods =======
 
 
@@ -735,6 +768,7 @@ public abstract class MessageImpl<T exte
 
         _amqpMessage.clearAllApplicationProperties();
         _propJMS_AMQP_TTL = null;
+        _amqpMessage.setReplyToGroupId(null);
         _amqpMessage.setUserId(null);
         _amqpMessage.setGroupId(null);
         _amqpMessage.setGroupSequence(null);
@@ -750,6 +784,11 @@ public abstract class MessageImpl<T exte
             return propertyExistsJMS_AMQP_TTL();
         }
 
+        if(JMS_AMQP_REPLY_TO_GROUP_ID.equals(name))
+        {
+            return propertyExistsJMS_AMQP_REPLY_TO_GROUP_ID();
+        }
+
         if(JMSXUSERID.equals(name))
         {
             return propertyExistsJMSXUserID();
@@ -980,6 +1019,11 @@ public abstract class MessageImpl<T exte
             propNames.add(JMS_AMQP_TTL);
         }
 
+        if(propertyExistsJMS_AMQP_REPLY_TO_GROUP_ID())
+        {
+            propNames.add(JMS_AMQP_REPLY_TO_GROUP_ID);
+        }
+
         if(propertyExistsJMSXUserID())
         {
             propNames.add(JMSXUSERID);

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=1570274&r1=1570273&r2=1570274&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 Thu Feb 20 16:59:56 2014
@@ -58,6 +58,7 @@ import org.apache.qpid.jms.test.testpeer
 import org.apache.qpid.proton.amqp.Binary;
 import org.apache.qpid.proton.amqp.DescribedType;
 import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.UnsignedInteger;
 import org.apache.qpid.proton.amqp.UnsignedLong;
 import org.junit.Test;
 
@@ -849,4 +850,49 @@ public class MessageIntegrationTest exte
 
         return underlyingAmqpMessageId;
     }
+
+    /**
+     * Tests that when receiving a message with the group-id, reply-to-group-id, and group-sequence
+     * fields of the AMQP properties section set, that the expected values are returned when getting
+     * the appropriate JMSX or JMS_AMQP properties from the JMS message.
+     */
+    @Test
+    public void testReceivedMessageWithGroupRelatedPropertiesSet() throws Exception
+    {
+        try(TestAmqpPeer testPeer = new TestAmqpPeer(IntegrationTestFixture.PORT);)
+        {
+            Connection connection = _testFixture.establishConnecton(testPeer);
+            connection.start();
+
+            testPeer.expectBegin();
+
+            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+            Queue queue = session.createQueue("myQueue");
+
+            PropertiesDescribedType props = new PropertiesDescribedType();
+            DescribedType amqpValueNullContent = new AmqpValueDescribedType(null);
+            MessageAnnotationsDescribedType ann = null;
+
+            String expectedGroupId = "myGroupId123";
+            int expectedGroupSeq = 1;
+            String expectedReplyToGroupId = "myReplyToGroupId456";
+
+            props.setGroupId(expectedGroupId);
+            props.setGroupSequence(UnsignedInteger.valueOf(expectedGroupSeq));
+            props.setReplyToGroupId(expectedReplyToGroupId);
+
+            testPeer.expectReceiverAttach();
+            testPeer.expectLinkFlowRespondWithTransfer(null, ann, props, null, amqpValueNullContent);
+            testPeer.expectDispositionThatIsAcceptedAndSettled();
+
+            MessageConsumer messageConsumer = session.createConsumer(queue);
+            Message receivedMessage = messageConsumer.receive(1000);
+            testPeer.waitForAllHandlersToComplete(3000);
+
+            assertNotNull("did not receive the message", receivedMessage);
+            assertEquals("did not get the expected JMSXGroupID", expectedGroupId, receivedMessage.getStringProperty(ClientProperties.JMSXGROUPID));
+            assertEquals("did not get the expected JMSXGroupSeq", expectedGroupSeq, receivedMessage.getIntProperty(ClientProperties.JMSXGROUPSEQ));
+            assertEquals("did not get the expected JMS_AMQP_REPLY_TO_GROUP_ID", expectedReplyToGroupId, receivedMessage.getStringProperty(ClientProperties.JMS_AMQP_REPLY_TO_GROUP_ID));
+        }
+    }
 }

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=1570274&r1=1570273&r2=1570274&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 Thu Feb 20 16:59:56 2014
@@ -448,7 +448,125 @@ public class AmqpMessageTest extends Qpi
         assertNull("expected userid to be null on new message", testAmqpMessage.getUserId());
     }
 
-    //TODO: delete this marker comment
+    /**
+     * Check that etting the ReplyToGroupId works on new messages without a properties
+     * properties section. New messages lack the properties section,
+     * as tested by {@link #testNewMessageHasNoUnderlyingPropertiesSection()}.
+     */
+    @Test
+    public void testGetReplyToGroupIdIsNullForNewMessage()
+    {
+        AmqpMessage testAmqpMessage = TestAmqpMessage.createNewMessage();
+
+        assertNull("expected ReplyToGroupId to be null on new message", testAmqpMessage.getReplyToGroupId());
+    }
+
+    /**
+     * Check that getting the ReplyToGroupId works on received messages without a properties section
+     */
+    @Test
+    public void testGetReplyToGroupIdWithReceivedMessageWithNoProperties()
+    {
+        Message message = Proton.message();
+        AmqpMessage testAmqpMessage = TestAmqpMessage.createReceivedMessage(message, _mockDelivery, _mockAmqpConnection);
+
+        String replyToGroupId = testAmqpMessage.getReplyToGroupId();
+        assertNull("expected ReplyToGroupId to be null on message without properties section", replyToGroupId);
+    }
+
+    /**
+     * Check that setting ReplyToGroupId null on a new message does not cause creation of the
+     * underlying properties section. New messages lack the properties section,
+     * as tested by {@link #testNewMessageHasNoUnderlyingPropertiesSection()}.
+     */
+    @Test
+    public void testSetReplyToGroupIdNullOnNewMessageDoesNotCreatePropertiesSection() throws Exception
+    {
+        AmqpMessage testAmqpMessage = TestAmqpMessage.createNewMessage();
+
+        testAmqpMessage.setReplyToGroupId(null);
+
+        assertNull("properties section was created", testAmqpMessage.getMessage().getProperties());
+    }
+
+    /**
+     * Check that getting the ReplyToGroupId works on received messages with a
+     * properties section, but no reply-to-group-id
+     */
+    @Test
+    public void testGetReplyToGroupIdWithReceivedMessageWithPropertiesButNoReplyToGroupId()
+    {
+        Message message = Proton.message();
+
+        Properties props = new Properties();
+        props.setContentType(Symbol.valueOf("content-type"));
+        message.setProperties(props);
+
+        AmqpMessage testAmqpMessage = TestAmqpMessage.createReceivedMessage(message, _mockDelivery, _mockAmqpConnection);
+
+        String replyToGroupId = testAmqpMessage.getReplyToGroupId();
+        assertNull("expected ReplyToGroupId to be null on message with properties section but no reply-to-group-id", replyToGroupId);
+    }
+
+    /**
+     * Check that getting the ReplyToGroupId returns the expected value from a
+     * received messages with a reply-to-group-id.
+     */
+    @Test
+    public void testGetReplyToGroupIdWithReceivedMessage()
+    {
+        String replyToGroupId = "myReplyGroup";
+
+        Message message = Proton.message();
+
+        Properties props = new Properties();
+        props.setReplyToGroupId(replyToGroupId);
+        message.setProperties(props);
+
+        AmqpMessage testAmqpMessage = TestAmqpMessage.createReceivedMessage(message, _mockDelivery, _mockAmqpConnection);
+
+        String actual = testAmqpMessage.getReplyToGroupId();
+        assertNotNull("expected ReplyToGroupId on message was not found", actual);
+        assertEquals("expected ReplyToGroupId on message was not found", replyToGroupId, actual);
+    }
+
+    /**
+     * Test that setting the ReplyToGroupId sets the expected value into the
+     * reply-to-group-id of the underlying proton message.
+     */
+    @Test
+    public void testSetReplyToGroupId()
+    {
+        String replyToGroupId = "myReplyGroup";
+
+        AmqpMessage testAmqpMessage = TestAmqpMessage.createNewMessage();
+
+        Message underlyingMessage = testAmqpMessage.getMessage();
+
+        testAmqpMessage.setReplyToGroupId(replyToGroupId);
+
+        assertNotNull("expected ReplyToGroupId on message was not found", underlyingMessage.getReplyToGroupId());
+        assertEquals("expected ReplyToGroupId on message was not found", replyToGroupId, underlyingMessage.getReplyToGroupId());
+    }
+
+    /**
+     * Test that setting and getting the ReplyToGroupId yields the expected result
+     */
+    @Test
+    public void testSetGetReplyToGroupId()
+    {
+        String replyToGroupId = "myReplyGroup";
+
+        AmqpMessage testAmqpMessage = TestAmqpMessage.createNewMessage();
+
+        assertNull(testAmqpMessage.getReplyToGroupId());
+
+        testAmqpMessage.setReplyToGroupId(replyToGroupId);
+
+        assertNotNull("expected ReplyToGroupId on message was not found", testAmqpMessage.getReplyToGroupId());
+        assertEquals("expected ReplyToGroupId on message was not found", replyToGroupId, testAmqpMessage.getReplyToGroupId());
+    }
+
     /**
      * Test that attempting to set a uint group-sequence (represented as a long) with a value
      * outwith the allowed [0 - 2^32) range results in an IAE being thrown

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=1570274&r1=1570273&r2=1570274&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 Thu Feb 20 16:59:56 2014
@@ -21,9 +21,11 @@
 package org.apache.qpid.jms.impl;
 
 import static org.apache.qpid.jms.impl.ClientProperties.JMS_AMQP_TTL;
+import static org.apache.qpid.jms.impl.ClientProperties.JMS_AMQP_REPLY_TO_GROUP_ID;
 import static org.apache.qpid.jms.impl.ClientProperties.JMSXUSERID;
 import static org.apache.qpid.jms.impl.ClientProperties.JMSXGROUPID;
 import static org.apache.qpid.jms.impl.ClientProperties.JMSXGROUPSEQ;
+
 import static org.junit.Assert.*;
 
 import java.nio.ByteBuffer;
@@ -2045,7 +2047,6 @@ public class MessageImplTest extends Qpi
         assertEquals("JMSXGroupID value was not as expected", myGroupId, _testMessage.getStringProperty(JMSXGROUPID));
     }
 
-    //TODO: delete this marker comment
     @Test
     public void testGetJMSXGroupSeqOnNewMessageThrowsNFE() throws Exception
     {
@@ -2221,7 +2222,141 @@ public class MessageImplTest extends Qpi
         assertEquals("JMSXGroupSeq value was not as expected", expected, _testMessage.getIntProperty(JMSXGROUPSEQ));
     }
 
-    //TODO: delete this marker comment
+    // ====== JMS_AMQP_REPLY_TO_GROUP_ID property =======
+
+    @Test
+    public void testSetJMS_AMQP_REPLY_TO_GROUP_ID_PropertyRejectsNonStringValues() throws Exception
+    {
+        try
+        {
+            _testMessage.setLongProperty(JMS_AMQP_REPLY_TO_GROUP_ID, -1L);
+            fail("expected exception not thrown");
+        }
+        catch(MessageFormatException mfe)
+        {
+            //expected
+        }
+    }
+
+    /**
+     * Test that setting the JMS_AMQP_REPLY_TO_GROUP_ID property, which is stored in the AMQP message
+     * reply-to-group-id field, causes the {@link Message#propertyExists(String)} to return true;
+     */
+    @Test
+    public void testJMS_AMQP_REPLY_TO_GROUP_ID_PropertyExists() throws Exception
+    {
+        assertFalse(_testMessage.propertyExists(JMS_AMQP_REPLY_TO_GROUP_ID));
+        _testMessage.setStringProperty(JMS_AMQP_REPLY_TO_GROUP_ID, "myReplyToGroupId");
+        assertTrue(_testMessage.propertyExists(JMS_AMQP_REPLY_TO_GROUP_ID));
+    }
+
+    /**
+     * Test that setting the JMS_AMQP_REPLY_TO_GROUP_ID property, which is stored in the AMQP message
+     * reply-to-group-id field, causes the {@link Message#getPropertyNames()} to return an enumeration
+     * containing JMS_AMQP_REPLY_TO_GROUP_ID;
+     */
+    @Test
+    public void testJMS_AMQP_REPLY_TO_GROUP_ID_GetPropertyNamesOnNewMessage() throws Exception
+    {
+        //verify the name doesn't exist originally
+        boolean containsJMS_AMQP_REPLY_TO_GROUP_ID = doesPropertyNameExist(_testMessage, JMS_AMQP_REPLY_TO_GROUP_ID);
+        assertFalse(containsJMS_AMQP_REPLY_TO_GROUP_ID);
+
+        //set property
+        _testMessage.setStringProperty(JMS_AMQP_REPLY_TO_GROUP_ID, "myReplyToGroupId");
+
+        //verify the name now exists
+        containsJMS_AMQP_REPLY_TO_GROUP_ID = doesPropertyNameExist(_testMessage, JMS_AMQP_REPLY_TO_GROUP_ID);
+        assertTrue(containsJMS_AMQP_REPLY_TO_GROUP_ID);
+    }
+
+    /**
+     * Test that getting the JMS_AMQP_REPLY_TO_GROUP_ID property on a new message returns null, since the property is a String
+     */
+    @Test
+    public void testGetJMS_AMQP_REPLY_TO_GROUP_ID_PropertyOnNewMessage() throws Exception
+    {
+        assertNull("expected non-existent string property to return null", _testMessage.getStringProperty(JMS_AMQP_REPLY_TO_GROUP_ID));
+    }
+
+    /**
+     * Test that receiving an AMQP message with the reply-to-group-id field set results in the
+     * JMS_AMQP_REPLY_TO_GROUP_ID property existing, being included in the property names, and returning
+     * the appropriate value when attempt is made to retrieve it.
+     */
+    @Test
+    public void testJMS_AMQP_REPLY_TO_GROUP_ID_PropertyBehaviourOnReceivedMessageWithUnderlyingReplyToGroupIdFieldSet() throws Exception
+    {
+        String expected = "myReplyToGroupId";
+        _testAmqpMessage.setReplyToGroupId(expected);
+        _testMessage = TestMessageImpl.createReceivedMessage(_testAmqpMessage, _mockSessionImpl, _mockConnectionImpl, null);
+
+        //check the propertyExists method
+        assertTrue(_testMessage.propertyExists(JMS_AMQP_REPLY_TO_GROUP_ID));
+
+        //verify the name exists
+        boolean containsJMS_AMQP_REPLY_TO_GROUP_ID = doesPropertyNameExist(_testMessage, JMS_AMQP_REPLY_TO_GROUP_ID);
+        assertTrue(containsJMS_AMQP_REPLY_TO_GROUP_ID);
+
+        //verify getting the value returns expected result
+        assertEquals("unexpected value for JMS_AMQP_REPLY_TO_GROUP_ID", expected, _testMessage.getStringProperty(JMS_AMQP_REPLY_TO_GROUP_ID));
+    }
+
+    /**
+     * Test that setting the JMS_AMQP_REPLY_TO_GROUP_ID property does not set an entry in the
+     * application-properties section of the underlying AMQP message, because we store the value
+     * in the reply-to-group-id field of the AMQP properties section.
+     */
+    @Test
+    public void testSetJMS_AMQP_REPLY_TO_GROUP_ID_PropertyDoesntSetEntryInUnderlyingApplicationProperties() throws Exception
+    {
+        assertFalse(_testAmqpMessage.applicationPropertyExists(JMS_AMQP_REPLY_TO_GROUP_ID));
+
+        _testMessage.setStringProperty(JMS_AMQP_REPLY_TO_GROUP_ID, "myReplyToGroupId");
+
+        //verify that the underlying message doesn't have a JMS_AMQP_REPLY_TO_GROUP_ID entry in its
+        //application-properties section, as we don't transmit the value that way
+        assertFalse(_testAmqpMessage.applicationPropertyExists(JMS_AMQP_REPLY_TO_GROUP_ID));
+    }
+
+    /**
+     * Test that clearing the message properties results in the synthetic JMS_AMQP_REPLY_TO_GROUP_ID
+     * property, which is actually stored in the reply-to-group-id field, ceasing to exist and returning null.
+     */
+    @Test
+    public void testJMS_AMQP_REPLY_TO_GROUP_ID_AfterClearProperties() throws Exception
+    {
+        _testMessage.setStringProperty(JMS_AMQP_REPLY_TO_GROUP_ID, "myReplyToGroupId");
+
+        assertTrue(_testMessage.propertyExists(JMS_AMQP_REPLY_TO_GROUP_ID));
+
+        _testMessage.clearProperties();
+
+        //check the prop no longer exists
+        assertFalse(_testMessage.propertyExists(JMS_AMQP_REPLY_TO_GROUP_ID));
+
+        //verify getting the value returns null
+        assertNull("expected non-existent string property to return null", _testMessage.getStringProperty(JMS_AMQP_REPLY_TO_GROUP_ID));
+
+        //check there are no properties
+        assertNoProperties(_testMessage);
+    }
+
+    /**
+     * Test that setting the JMS_AMQP_REPLY_TO_GROUP_ID property to null clears an existing
+     * value for the reply-to-group-id field on the underlying AMQP message
+     */
+    @Test
+    public void testSetJMS_AMQP_REPLY_TO_GROUP_IDNullClearsUnderlyingMessageGroupSequence() throws Exception
+    {
+        _testMessage.setStringProperty(JMS_AMQP_REPLY_TO_GROUP_ID, "myReplyToGroupId");
+
+        _testMessage.setStringProperty(JMS_AMQP_REPLY_TO_GROUP_ID, null);
+
+        assertFalse("did not expect a JMS_AMQP_REPLY_TO_GROUP_ID value to be present", _testMessage.propertyExists(JMS_AMQP_REPLY_TO_GROUP_ID));
+        assertNull("unexpected reply-to-group-id value on underlying message", _testAmqpMessage.getReplyToGroupId());
+    }
+
     // ====== JMS_AMQP_TTL property =======
 
     @Test



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