[jboss-cvs] JBoss Messaging SVN: r7542 - in branches/Branch_1_4: tests/src/org/jboss/test/messaging/jms/server/destination and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jul 8 06:26:58 EDT 2009


Author: gaohoward
Date: 2009-07-08 06:26:57 -0400 (Wed, 08 Jul 2009)
New Revision: 7542

Modified:
   branches/Branch_1_4/src/main/org/jboss/jms/server/destination/DestinationServiceSupport.java
   branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/server/destination/QueueManagementTest.java
   branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/server/destination/TopicManagementTest.java
Log:
JBMESSAGING-1667 


Modified: branches/Branch_1_4/src/main/org/jboss/jms/server/destination/DestinationServiceSupport.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/jms/server/destination/DestinationServiceSupport.java	2009-07-08 08:24:57 UTC (rev 7541)
+++ branches/Branch_1_4/src/main/org/jboss/jms/server/destination/DestinationServiceSupport.java	2009-07-08 10:26:57 UTC (rev 7542)
@@ -101,6 +101,14 @@
                                             "name was not properly set in the service's" +
                                             "ObjectName");
          }
+         
+         //https://jira.jboss.org/jira/browse/JBMESSAGING-1667
+         if (name.contains("/"))
+         {
+            throw new IllegalStateException("The " + (isQueue() ? "queue" : "topic") +
+                                            " " +
+                                            "name should not contain forward slash: " + name);
+         }
 
          destination.setName(name);
          // must be set after the peer is set on the destination.

Modified: branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/server/destination/QueueManagementTest.java
===================================================================
--- branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/server/destination/QueueManagementTest.java	2009-07-08 08:24:57 UTC (rev 7541)
+++ branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/server/destination/QueueManagementTest.java	2009-07-08 10:26:57 UTC (rev 7542)
@@ -890,6 +890,30 @@
       undeployDestination("rtQueue");
    }
 
+   public void testQueueDeploymentWithForwardSlashedName() throws Exception
+   {      
+      String config =
+         "<mbean code=\"org.jboss.jms.server.destination.QueueService\" " +
+         "       name=\"somedomain:service=Queue,name=root/rtQueue\"" +
+         "       xmbean-dd=\"xmdesc/Queue-xmbean.xml\">" +
+         "    <depends optional-attribute-name=\"ServerPeer\">jboss.messaging:service=ServerPeer</depends>" +
+         "    <attribute name=\"MessageCounterHistoryDayLimit\">10</attribute>" +
+         "</mbean>";
+      
+      try
+      {
+         deploy(config);
+         fail("Shouldn't allow forward slash in queue name.");
+      }
+      catch (RuntimeMBeanException e)
+      {
+         if (!(e.getCause() instanceof IllegalStateException))
+         {
+            throw e;
+         }
+      }
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------

Modified: branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/server/destination/TopicManagementTest.java
===================================================================
--- branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/server/destination/TopicManagementTest.java	2009-07-08 08:24:57 UTC (rev 7541)
+++ branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/server/destination/TopicManagementTest.java	2009-07-08 10:26:57 UTC (rev 7542)
@@ -34,6 +34,7 @@
 import javax.jms.TopicConnection;
 import javax.jms.TopicSession;
 import javax.management.ObjectName;
+import javax.management.RuntimeMBeanException;
 
 import org.jboss.jms.server.destination.SubscriptionInfo;
 import org.jboss.test.messaging.jms.server.destination.base.DestinationManagementTestBase;
@@ -908,6 +909,29 @@
       undeployDestination("rtTopic");
    }
 
+   public void testTopicDeploymentWithForwardSlashedName() throws Exception
+   {      
+      String config =
+         "<mbean code=\"org.jboss.jms.server.destination.TopicService\" " +
+         "       name=\"somedomain:service=Topic,name=root/rtTopic\"" +
+         "       xmbean-dd=\"xmdesc/Topic-xmbean.xml\">" +
+         "    <depends optional-attribute-name=\"ServerPeer\">jboss.messaging:service=ServerPeer</depends>" +
+         "    <attribute name=\"MessageCounterHistoryDayLimit\">10</attribute>" +
+         "</mbean>";
+      
+      try
+      {
+         deploy(config);
+         fail("Shouldn't allow forward slash in topic name.");
+      }
+      catch (RuntimeMBeanException e)
+      {
+         if (!(e.getCause() instanceof IllegalStateException))
+         {
+            throw e;
+         }
+      }
+   }
 
    // Package protected ---------------------------------------------
    




More information about the jboss-cvs-commits mailing list