Author: gtully
Date: Fri Aug 20 09:48:45 2010
New Revision: 987443
URL: http://svn.apache.org/viewvc?rev=987443&view=rev
Log:
resolve https://issues.apache.org/activemq/browse/AMQ-2840 - revert to 5.3
behaviour for tck compliance, add new getAllPropertyNames method that returns
all props, including JMS standard props and JMSX extnsion props
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=987443&r1=987442&r2=987443&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
Fri Aug 20 09:48:45 2010
@@ -282,12 +282,21 @@ public class ActiveMQMessage extends Mes
public Enumeration getPropertyNames() throws JMSException {
try {
Vector<String> result = new
Vector<String>(this.getProperties().keySet());
- // omit standard jms props as per spec
- for (String propName : JMS_PROPERTY_SETERS.keySet()) {
- if (propName.startsWith("JMSX")) {
- result.add(propName);
- }
- }
+ return result.elements();
+ } catch (IOException e) {
+ throw JMSExceptionSupport.create(e);
+ }
+ }
+
+ /**
+ * return all property names, including standard JMS properties and JMSX
properties
+ * @return Enumeration of all property names on this message
+ * @throws JMSException
+ */
+ public Enumeration getAllPropertyNames() throws JMSException {
+ try {
+ Vector<String> result = new
Vector<String>(this.getProperties().keySet());
+ result.addAll(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=987443&r1=987442&r2=987443&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
Fri Aug 20 09:48:45 2010
@@ -356,15 +356,43 @@ public class ActiveMQMessageTest extends
msg.setFloatProperty(name1, 1.3f);
String name2 = "JMSXDeliveryCount";
msg.setIntProperty(name2, 1);
+ String name3 = "JMSRedelivered";
+ msg.setBooleanProperty(name3, false);
boolean found1 = false;
boolean found2 = false;
+ boolean found3 = false;
for (Enumeration iter = msg.getPropertyNames();
iter.hasMoreElements();) {
Object element = iter.nextElement();
found1 |= element.equals(name1);
found2 |= element.equals(name2);
+ found3 |= element.equals(name3);
+ }
+ assertTrue("prop name1 found", found1);
+ // spec compliance, only non JMS (and JMSX) props returned
+ assertFalse("prop name2 not found", found2);
+ assertFalse("prop name4 not found", found3);
+ }
+
+ public void testGetAllPropertyNames() throws JMSException {
+ ActiveMQMessage msg = new ActiveMQMessage();
+ String name1 = "floatProperty";
+ msg.setFloatProperty(name1, 1.3f);
+ String name2 = "JMSXDeliveryCount";
+ msg.setIntProperty(name2, 1);
+ String name3 = "JMSRedelivered";
+ msg.setBooleanProperty(name3, false);
+ boolean found1 = false;
+ boolean found2 = false;
+ boolean found3 = false;
+ for (Enumeration iter = msg.getAllPropertyNames();
iter.hasMoreElements();) {
+ Object element = iter.nextElement();
+ found1 |= element.equals(name1);
+ found2 |= element.equals(name2);
+ found3 |= element.equals(name3);
}
assertTrue("prop name1 found", found1);
assertTrue("prop name2 found", found2);
+ assertTrue("prop name4 found", found3);
}
public void testSetObjectProperty() throws JMSException {