mirror of https://github.com/apache/activemq.git
resolve: https://issues.apache.org/activemq/browse/AMQ-2840 - add test and apply patch with thanks
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@983564 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
24b42fcd82
commit
7f7a95b457
|
@ -273,7 +273,7 @@ public class ActiveMQMessage extends Message implements org.apache.activemq.Mess
|
|||
|
||||
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 Message implements org.apache.activemq.Mess
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -281,6 +281,9 @@ public class ActiveMQMessageTest extends TestCase {
|
|||
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 TestCase {
|
|||
|
||||
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 {
|
||||
|
|
Loading…
Reference in New Issue