qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject svn commit: r1153274 - in /qpid/trunk/qpid/java: client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java systests/src/main/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java
Date Tue, 02 Aug 2011 21:19:08 GMT
Author: rajith
Date: Tue Aug  2 21:19:07 2011
New Revision: 1153274

URL: http://svn.apache.org/viewvc?rev=1153274&view=rev
Log:
QPID-3381 Provided the ability to retrieve the routing key from a JMS message using getStringProperty().

Modified:
    qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java

Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java?rev=1153274&r1=1153273&r2=1153274&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java
(original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java
Tue Aug  2 21:19:07 2011
@@ -634,11 +634,16 @@ public class AMQMessageDelegate_0_10 ext
         {
             return new String(_messageProps.getUserId());
         }
-        else if ("x-amqp-0-10.app-id".equals(propertyName) &&
+        else if (QpidMessageProperties.AMQP_0_10_APP_ID.equals(propertyName) &&
                 _messageProps.getAppId() != null)
         {
             return new String(_messageProps.getAppId());
         }
+        else if (QpidMessageProperties.AMQP_0_10_ROUTING_KEY.equals(propertyName) &&
+                _deliveryProps.getRoutingKey() != null)
+        {
+            return _deliveryProps.getRoutingKey();
+        }
         else
         {
             checkPropertyName(propertyName);
@@ -745,7 +750,7 @@ public class AMQMessageDelegate_0_10 ext
     {
         checkPropertyName(propertyName);
         checkWritableProperties();
-        if ("x-amqp-0-10.app-id".equals(propertyName))
+        if (QpidMessageProperties.AMQP_0_10_APP_ID.equals(propertyName))
         {
             _messageProps.setAppId(value.getBytes());
         }

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java?rev=1153274&r1=1153273&r2=1153274&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java
(original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java
Tue Aug  2 21:19:07 2011
@@ -25,6 +25,7 @@ import org.apache.qpid.client.AMQConnect
 import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.client.message.NonQpidObjectMessage;
+import org.apache.qpid.client.message.QpidMessageProperties;
 import org.apache.qpid.framing.AMQShortString;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 
@@ -172,7 +173,7 @@ public class JMSPropertiesTest extends Q
      * Test Goal : Test if custom message properties can be set and retrieved properly with
out an error.
      *             Also test if unsupported properties are filtered out. See QPID-2930.
      */
-    public void testApplicationProperties() throws Exception
+    public void testQpidExtensionProperties() throws Exception
     {
         Connection con = getConnection("guest", "guest");
         Session ssn = (AMQSession) con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
@@ -182,8 +183,8 @@ public class JMSPropertiesTest extends Q
         MessageConsumer consumer = ssn.createConsumer(topic);
         MessageProducer prod = ssn.createProducer(topic);
         Message m = ssn.createMessage();
-        m.setObjectProperty("x-amqp-0-10.routing-key", "routing-key".getBytes());
-        m.setObjectProperty("x-amqp-0-10.app-id", "my-app-id");
+        m.setObjectProperty("foo-bar", "foobar".getBytes());
+        m.setObjectProperty(QpidMessageProperties.AMQP_0_10_APP_ID, "my-app-id");
         prod.send(m);
 
         Message msg = consumer.receive(1000);
@@ -198,7 +199,9 @@ public class JMSPropertiesTest extends Q
     		map.put(name, value);
        }
 
-       assertFalse("Property 'x-amqp-0-10.routing-key' should have been filtered out",map.containsKey("x-amqp-0-10.routing-key"));
-       assertEquals("Property x-amqp-0-10.app-id should be present","my-app-id",msg.getStringProperty("x-amqp-0-10.app-id"));
+       assertFalse("Property 'foo-bar' should have been filtered out",map.containsKey("foo-bar"));
+       assertEquals("Property "+ QpidMessageProperties.AMQP_0_10_APP_ID + " should be present","my-app-id",msg.getStringProperty(QpidMessageProperties.AMQP_0_10_APP_ID));
+       assertEquals("Property "+ QpidMessageProperties.AMQP_0_10_ROUTING_KEY + " should be
present","test",msg.getStringProperty(QpidMessageProperties.AMQP_0_10_ROUTING_KEY));
+       
     }
 }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message