mirror of https://github.com/apache/activemq.git
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
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@987443 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cf3db575a5
commit
e121ccc990
|
@ -282,12 +282,21 @@ public class ActiveMQMessage extends Message implements org.apache.activemq.Mess
|
|||
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);
|
||||
|
|
|
@ -356,15 +356,43 @@ public class ActiveMQMessageTest extends TestCase {
|
|||
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 {
|
||||
|
|
Loading…
Reference in New Issue