[jboss-cvs] JBossAS SVN: r104706 - projects/test/trunk/src/main/java/org/jboss/test/jms.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 11 23:59:19 EDT 2010


Author: clebert.suconic at jboss.com
Date: 2010-05-11 23:59:19 -0400 (Tue, 11 May 2010)
New Revision: 104706

Modified:
   projects/test/trunk/src/main/java/org/jboss/test/jms/LegacyJMSTestAdmin.java
Log:
tweaks

Modified: projects/test/trunk/src/main/java/org/jboss/test/jms/LegacyJMSTestAdmin.java
===================================================================
--- projects/test/trunk/src/main/java/org/jboss/test/jms/LegacyJMSTestAdmin.java	2010-05-12 03:58:24 UTC (rev 104705)
+++ projects/test/trunk/src/main/java/org/jboss/test/jms/LegacyJMSTestAdmin.java	2010-05-12 03:59:19 UTC (rev 104706)
@@ -23,6 +23,7 @@
 package org.jboss.test.jms;
 
 import org.jboss.logging.Logger;
+import org.jboss.util.NestedRuntimeException;
 
 import javax.management.MBeanServerConnection;
 import javax.management.ObjectName;
@@ -43,6 +44,34 @@
 
    protected final ObjectName mainDeployer = new ObjectName("jboss.system:service=MainDeployer");
 
+   protected static final ObjectName namingService;
+   
+   protected static final ObjectName namingService2;
+   
+   static
+   {
+      try
+      {
+         namingService = new ObjectName("jboss:service=Naming");
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException(e);
+      }
+
+      try
+      {
+         namingService2 = new ObjectName("jboss:service=NamingBeanImpl");
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException(e);
+      }
+
+   }
+
+
+   
    /** The static log */
    private static final Logger staticLog = Logger.getLogger(LegacyJMSTestAdmin.class);
 
@@ -215,6 +244,7 @@
       {
          str.println("  <mbean code=\"org.jboss.mq.server.jmx.Queue\" name=\"jboss.mq.destination:service=Queue,name=" + name + "\">");
       }
+      str.println("    <attribute name=\"JNDIName\">" + name + "</attribute>");
       str.println("    <depends optional-attribute-name=\"DestinationManager\">jboss.mq:service=DestinationManager</depends>");
       str.println("    <depends optional-attribute-name=\"SecurityManager\">jboss.mq:service=SecurityManager</depends>");
 
@@ -240,6 +270,37 @@
       jmx.invoke(mainDeployer, "deploy", new Object[]
       { fileout.toURI().toURL() }, new String[]
       { "java.net.URL" });
+      
+      String newName;
+      
+      if (isTopic)
+      {
+    	  newName = "/topic/" + name;
+      }
+      else
+      {
+    	  newName = "/queue/" + name;
+      }
+      
+      try
+      {
+    	  jmx.invoke(namingService, "createAlias", new Object[] { name, newName }, new String[] { String.class.getName(), String.class.getName() });
+      }
+      catch (Exception e)
+      {
+    	  staticLog.debug("error creating alias", e);
+      }
+      
+      // AS5 is using a different JMX-name, so we try both
+      try
+      {
+    	  jmx.invoke(namingService2, "createAlias", new Object[] { name, newName }, new String[] { String.class.getName(), String.class.getName() });
+      }
+      catch (Exception e)
+      {
+    	  staticLog.debug("error creating alias", e);
+      }
+      
 
    }
 




More information about the jboss-cvs-commits mailing list