Author: ritchiem
Date: Wed Mar 12 07:44:40 2008
New Revision: 636347
URL: http://svn.apache.org/viewvc?rev=636347&view=rev
Log:
QPID-846 : Update to prevent JMSX* values being masked, updated
JMSPropertiesTest to prevent regression.
Modified:
incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java
incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java
Modified:
incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java?rev=636347&r1=636346&r2=636347&view=diff
==============================================================================
---
incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java
(original)
+++
incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java
Wed Mar 12 07:44:40 2008
@@ -394,15 +394,10 @@
public String getStringProperty(String propertyName) throws JMSException
{
- if (propertyName.startsWith("JMSX"))
+ //NOTE: if the JMSX Property is a non AMQP property then we must check
_strictAMQP and throw as below.
+ if (propertyName.equals(CustomJMSXProperty.JMSXUserID.toString()))
{
- //NOTE: if the JMSX Property is a non AMQP property then we must
check _strictAMQP and throw as below.
- if (propertyName.equals(CustomJMSXProperty.JMSXUserID.toString()))
- {
- return ((BasicContentHeaderProperties)
_contentHeaderProperties).getUserIdAsString();
- }
-
- return null;
+ return ((BasicContentHeaderProperties)
_contentHeaderProperties).getUserIdAsString();
}
else
{
Modified:
incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java?rev=636347&r1=636346&r2=636347&view=diff
==============================================================================
---
incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java
(original)
+++
incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java
Wed Mar 12 07:44:40 2008
@@ -38,6 +38,7 @@
import javax.jms.ObjectMessage;
import javax.jms.Queue;
import javax.jms.Session;
+import java.util.Enumeration;
/**
* @author Apache Software Foundation
@@ -85,6 +86,12 @@
sentMsg.setJMSType(JMS_TYPE);
sentMsg.setJMSReplyTo(JMS_REPLY_TO);
+ String JMSXGroupID_VALUE = "group";
+ sentMsg.setStringProperty("JMSXGroupID", JMSXGroupID_VALUE);
+
+ int JMSXGroupSeq_VALUE = 1;
+ sentMsg.setIntProperty("JMSXGroupSeq", JMSXGroupSeq_VALUE);
+
// send it
producer.send(sentMsg);
@@ -102,6 +109,29 @@
assertEquals("JMS Type mismatch", sentMsg.getJMSType(),
rm.getJMSType());
assertEquals("JMS Reply To mismatch", sentMsg.getJMSReplyTo(),
rm.getJMSReplyTo());
assertTrue("JMSMessageID Does not start ID:",
rm.getJMSMessageID().startsWith("ID:"));
+
+ //Validate that the JMSX values are correct
+ assertEquals("JMSXGroupID is not as expected:", JMSXGroupID_VALUE,
rm.getStringProperty("JMSXGroupID"));
+ assertEquals("JMSXGroupSeq is not as expected:", JMSXGroupSeq_VALUE,
rm.getIntProperty("JMSXGroupSeq"));
+
+ boolean JMSXGroupID_Available = false;
+ boolean JMSXGroupSeq_Available = false;
+ Enumeration props = con.getMetaData().getJMSXPropertyNames();
+ while (props.hasMoreElements())
+ {
+ String name = (String) props.nextElement();
+ if (name.equals("JMSXGroupID"))
+ {
+ JMSXGroupID_Available = true;
+ }
+ if (name.equals("JMSXGroupSeq"))
+ {
+ JMSXGroupSeq_Available = true;
+ }
+ }
+
+ assertTrue("JMSXGroupID not available.",JMSXGroupID_Available);
+ assertTrue("JMSXGroupSeq not available.",JMSXGroupSeq_Available);
con.close();
}