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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed May 12 13:23:29 EDT 2010


Author: clebert.suconic at jboss.com
Date: 2010-05-12 13:23:28 -0400 (Wed, 12 May 2010)
New Revision: 104732

Modified:
   projects/test/trunk/src/main/java/org/jboss/test/jms/LegacyJMSTestAdmin.java
Log:
making the legacy jms to deal with deletes

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 15:32:03 UTC (rev 104731)
+++ projects/test/trunk/src/main/java/org/jboss/test/jms/LegacyJMSTestAdmin.java	2010-05-12 17:23:28 UTC (rev 104732)
@@ -48,6 +48,9 @@
    
    protected static final ObjectName namingService2;
    
+   protected static final ObjectName serverPeer;
+   
+   
    static
    {
       try
@@ -68,6 +71,15 @@
          throw new NestedRuntimeException(e);
       }
 
+      try
+      {
+          serverPeer = new ObjectName("jboss.messaging:service=ServerPeer");
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException(e);
+      }
+
    }
 
 
@@ -210,16 +222,72 @@
          return null;
       }
    }
+   
+   public ObjectName createDestinationJMXName(boolean isTopic, String destName)
+   {
+	   if (isTopic)
+	   {
+		   return createTopicJMXName(destName);
+	   }
+	   else
+	   {
+		   return createQueueJMXName(destName);
+	   }
+   }
 
    private void undeploy(boolean isTopic, String destinationName) throws Exception
    {
+
+      ObjectName objname;
+      
+      
+      if (isTopic)
+      {
+    	  objname = new ObjectName("jboss.mq.destination:service=Topic,name=" + destinationName);
+      }
+      else
+      {
+    	  objname = new ObjectName("jboss.mq.destination:service=Queue,name=" + destinationName);
+      }
+
+      try
+      {
+          jmx.invoke(objname, "removeAllMessages", null, null);
+          if (isTopic)
+          {
+        	  jmx.invoke(serverPeer, "destroyTopic", new Object[] { destinationName },  new String[] { String.class.getName() } );
+          }
+          else
+          {
+        	  jmx.invoke(serverPeer, "destroyQueue", new Object[] { destinationName },  new String[] { String.class.getName() } );
+          }
+      }
+      catch (Exception e)
+      {
+    	  staticLog.warn(e.getMessage(), e);
+      }
+
       File destFile = createFile(isTopic, destinationName);
+      
+      try
+      {
+	      jmx.invoke(mainDeployer, "undeploy", new Object[]
+	      { destFile.toURI().toURL() }, new String[]
+	      { "java.net.URL" });
+      }
+      finally
+      {
+    	  try
+    	  {
+    		  destFile.delete();
+    	  }
+    	  catch (Exception ignored)
+    	  {
+    	  }
+      }
 
-      jmx.invoke(mainDeployer, "undeploy", new Object[]
-      { destFile.toURI().toURL() }, new String[]
-      { "java.net.URL" });
 
-      destFile.delete();
+
    }
 
    private void createDestination(boolean isTopic, String name, TestRole... securityConfig) throws Exception
@@ -284,22 +352,22 @@
       
       try
       {
-    	  jmx.invoke(namingService, "createAlias", new Object[] { name, newName }, new String[] { String.class.getName(), String.class.getName() });
+    	  jmx.invoke(namingService, "createAlias", new Object[] { newName, name }, new String[] { String.class.getName(), String.class.getName() });
       }
-      catch (Exception e)
+      catch (Throwable e)
       {
     	  staticLog.debug("error creating alias", e);
       }
       
       // AS5 is using a different JMX-name, so we try both
-      try
+      /*try
       {
-    	  jmx.invoke(namingService2, "createAlias", new Object[] { name, newName }, new String[] { String.class.getName(), String.class.getName() });
+    	  jmx.invoke(namingService2, "createAlias", new Object[] { newName, name }, new String[] { String.class.getName(), String.class.getName() });
       }
-      catch (Exception e)
+      catch (Throwable e)
       {
     	  staticLog.debug("error creating alias", e);
-      }
+      }*/
       
 
    }




More information about the jboss-cvs-commits mailing list