activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r983564 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/command/ActiveMQMessage.java test/java/org/apache/activemq/command/ActiveMQMessageTest.java
Date Mon, 09 Aug 2010 09:12:46 GMT
Author: gtully
Date: Mon Aug  9 09:12:45 2010
New Revision: 983564

URL: http://svn.apache.org/viewvc?rev=983564&view=rev
Log:
resolve: https://issues.apache.org/activemq/browse/AMQ-2840 - add test and apply patch with
thanks

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java?rev=983564&r1=983563&r2=983564&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java
Mon Aug  9 09:12:45 2010
@@ -273,7 +273,7 @@ public class ActiveMQMessage extends Mes
 
     public boolean propertyExists(String name) throws JMSException {
         try {
-            return this.getProperties().containsKey(name);
+            return (this.getProperties().containsKey(name) || getObjectProperty(name)!= null);
         } catch (IOException e) {
             throw JMSExceptionSupport.create(e);
         }
@@ -281,7 +281,9 @@ public class ActiveMQMessage extends Mes
 
     public Enumeration getPropertyNames() throws JMSException {
         try {
-            return new Vector<String>(this.getProperties().keySet()).elements();
+            Vector<String> result = new Vector<String>(this.getProperties().keySet());
+            result.addAll(new Vector<String>(JMS_PROPERTY_SETERS.keySet()));
+            return result.elements();
         } catch (IOException e) {
             throw JMSExceptionSupport.create(e);
         }

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java?rev=983564&r1=983563&r2=983564&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java
Mon Aug  9 09:12:45 2010
@@ -281,6 +281,9 @@ public class ActiveMQMessageTest extends
         ActiveMQMessage msg = new ActiveMQMessage();
         msg.setStringProperty("test", "test");
         assertTrue(msg.propertyExists("test"));
+
+        msg.setIntProperty("JMSXDeliveryCount", 1);
+        assertTrue(msg.propertyExists("JMSXDeliveryCount"));
     }
 
     public void testGetBooleanProperty() throws JMSException {
@@ -349,11 +352,19 @@ public class ActiveMQMessageTest extends
 
     public void testGetPropertyNames() throws JMSException {
         ActiveMQMessage msg = new ActiveMQMessage();
-        String name = "floatProperty";
-        msg.setFloatProperty(name, 1.3f);
+        String name1 = "floatProperty";
+        msg.setFloatProperty(name1, 1.3f);
+        String name2 = "JMSXDeliveryCount";
+        msg.setIntProperty("name2", 1);
+        boolean found1 = false;
+        boolean found2 = false;
         for (Enumeration iter = msg.getPropertyNames(); iter.hasMoreElements();) {
-            assertTrue(iter.nextElement().equals(name));
+            Object element = iter.nextElement();
+            found1 |= element.equals(name1);
+            found2 |= element.equals(name2);
         }
+        assertTrue("prop name1 found", found1);
+        assertTrue("prop name2 found", found2);
     }
 
     public void testSetObjectProperty() throws JMSException {



Mime
View raw message