[jboss-svn-commits] JBL Code SVN: r37467 - in labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta: tests/src/org/jboss/soa/esb/notification/jms and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Sep 15 15:21:58 EDT 2011


Author: tcunning
Date: 2011-09-15 15:21:58 -0400 (Thu, 15 Sep 2011)
New Revision: 37467

Modified:
   labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/notification/jms/DefaultJMSPropertiesSetter.java
   labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/tests/src/org/jboss/soa/esb/notification/jms/DefaultJMSPropertiesSetterUnitTest.java
Log:
JBESB-3622
Need to remove properties beginning with the 'JMS' prefix in addition to
JMSX and JMS_.


Modified: labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/notification/jms/DefaultJMSPropertiesSetter.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/notification/jms/DefaultJMSPropertiesSetter.java	2011-09-15 15:02:46 UTC (rev 37466)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/src/org/jboss/soa/esb/notification/jms/DefaultJMSPropertiesSetter.java	2011-09-15 19:21:58 UTC (rev 37467)
@@ -128,7 +128,7 @@
      * <p/>
      * Note that this method does not allow the setting of JMS Header properties, that is
      * properites that start with 'JMSX', nor does it allow JMS Vendor specific properties, those
-     * that start with 'JMS_' to be set.
+     * that start with 'JMS_' to be set. It also disallows properties starting with 'JMS' in a later section.
 	 * 
 	 * @param fromESBMessage	ESB Message object instance from which properties will be retrevied
 	 * @param toJMSMessage		JMS Message object instance upon which the properties will be set
@@ -143,17 +143,27 @@
 			if ( !Strings.isValidJavaIdentifier( key ))
 				continue;
 			
+			// The spec states that the prefixes JMSX and JMS_ are reserved for 
+			// the JMS spec and implementations respectively, but it also states 
+			// in a later section that any identifier name which does not begin 
+			// with 'JMS' is application specific.
+			
+			//
             if (key.startsWith("JMSX"))
             {
                 if (!JMSX_GROUP_ID.equals(key) && !JMSX_GROUP_SEQ.equals(key))
                 {
                     continue ;
                 }
-            }
+            } 
             else if (key.startsWith("JMS_"))
             {
+            	continue;
+            }
+            else if (key.startsWith("JMS"))
+            {
                 continue ;
-            }
+            } 
             
 			Object value = properties.getProperty( key );
 			log.debug( "Setting outgoing JMSProperty, key : " + key + ", value : " + value );

Modified: labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/tests/src/org/jboss/soa/esb/notification/jms/DefaultJMSPropertiesSetterUnitTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/tests/src/org/jboss/soa/esb/notification/jms/DefaultJMSPropertiesSetterUnitTest.java	2011-09-15 15:02:46 UTC (rev 37466)
+++ labs/jbossesb/branches/JBESB_4_10_CP/product/rosetta/tests/src/org/jboss/soa/esb/notification/jms/DefaultJMSPropertiesSetterUnitTest.java	2011-09-15 19:21:58 UTC (rev 37467)
@@ -212,7 +212,7 @@
 	}
 	
 	@Test
-	public void setJMSProperties_JMSVendorProperty() throws JMSException, URISyntaxException
+	public void setJMSProperties_JMS_VendorProperty() throws JMSException, URISyntaxException
     {
         final String propertyKey = "JMS_SomeVendorName";
         fromESBMessage.getProperties().setProperty( propertyKey, "bogus" );
@@ -220,6 +220,17 @@
         strategy.setJMSProperties( fromESBMessage, toJMSMessage );
         assertNull(toJMSMessage.getStringProperty(propertyKey) );
     }
+
+	@Test
+	public void setJMSProperties_JMSVendorProperty() throws JMSException, URISyntaxException
+    {
+        final String propertyKey = "JMSSomeVendorName";
+        fromESBMessage.getProperties().setProperty( propertyKey, "bogus" );
+        
+        strategy.setJMSProperties( fromESBMessage, toJMSMessage );
+        assertNull(toJMSMessage.getStringProperty(propertyKey) );
+    }
+
 	
 	@Before
 	public void before() throws JMSException, NamingException



More information about the jboss-svn-commits mailing list