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 {
|
public Enumeration getPropertyNames() throws JMSException {
|
||||||
try {
|
try {
|
||||||
Vector<String> result = new Vector<String>(this.getProperties().keySet());
|
Vector<String> result = new Vector<String>(this.getProperties().keySet());
|
||||||
// omit standard jms props as per spec
|
return result.elements();
|
||||||
for (String propName : JMS_PROPERTY_SETERS.keySet()) {
|
} catch (IOException e) {
|
||||||
if (propName.startsWith("JMSX")) {
|
throw JMSExceptionSupport.create(e);
|
||||||
result.add(propName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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();
|
return result.elements();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw JMSExceptionSupport.create(e);
|
throw JMSExceptionSupport.create(e);
|
||||||
|
|
|
@ -356,15 +356,43 @@ public class ActiveMQMessageTest extends TestCase {
|
||||||
msg.setFloatProperty(name1, 1.3f);
|
msg.setFloatProperty(name1, 1.3f);
|
||||||
String name2 = "JMSXDeliveryCount";
|
String name2 = "JMSXDeliveryCount";
|
||||||
msg.setIntProperty(name2, 1);
|
msg.setIntProperty(name2, 1);
|
||||||
|
String name3 = "JMSRedelivered";
|
||||||
|
msg.setBooleanProperty(name3, false);
|
||||||
boolean found1 = false;
|
boolean found1 = false;
|
||||||
boolean found2 = false;
|
boolean found2 = false;
|
||||||
|
boolean found3 = false;
|
||||||
for (Enumeration iter = msg.getPropertyNames(); iter.hasMoreElements();) {
|
for (Enumeration iter = msg.getPropertyNames(); iter.hasMoreElements();) {
|
||||||
Object element = iter.nextElement();
|
Object element = iter.nextElement();
|
||||||
found1 |= element.equals(name1);
|
found1 |= element.equals(name1);
|
||||||
found2 |= element.equals(name2);
|
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 name1 found", found1);
|
||||||
assertTrue("prop name2 found", found2);
|
assertTrue("prop name2 found", found2);
|
||||||
|
assertTrue("prop name4 found", found3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSetObjectProperty() throws JMSException {
|
public void testSetObjectProperty() throws JMSException {
|
||||||
|
|
Loading…
Reference in New Issue