[jboss-cvs] JBossAS SVN: r103023 - in projects/test/tags: 1.1.7.CR2 and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Mar 26 06:01:34 EDT 2010


Author: wolfc
Date: 2010-03-26 06:01:34 -0400 (Fri, 26 Mar 2010)
New Revision: 103023

Added:
   projects/test/tags/1.1.7.CR2/
   projects/test/tags/1.1.7.CR2/pom.xml
   projects/test/tags/1.1.7.CR2/src/main/java/org/jboss/test/jms/LegacyJMSTestAdmin.java
Removed:
   projects/test/tags/1.1.7.CR2/pom.xml
   projects/test/tags/1.1.7.CR2/src/main/java/org/jboss/test/jms/LegacyJMSTestAdmin.java
Log:
[maven-release-plugin]  copy for tag 1.1.7.CR2

Copied: projects/test/tags/1.1.7.CR2 (from rev 103016, projects/test/trunk)

Deleted: projects/test/tags/1.1.7.CR2/pom.xml
===================================================================
--- projects/test/trunk/pom.xml	2010-03-26 07:42:50 UTC (rev 103016)
+++ projects/test/tags/1.1.7.CR2/pom.xml	2010-03-26 10:01:34 UTC (rev 103023)
@@ -1,191 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <parent>
-    <groupId>org.jboss</groupId>
-    <artifactId>jboss-parent</artifactId>
-    <version>4</version>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.jboss.test</groupId>
-  <artifactId>jboss-test</artifactId>
-  <packaging>jar</packaging>
-  <name>JBoss Test</name>
-  <version>1.1.7.CR1</version>
-  <description>Common test support classes</description>
-  <url>http://www.jboss.org</url>
-  <scm>
-    <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/test/trunk</connection>
-    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/test/trunk</developerConnection>
-  </scm>
-
-  <properties>
-    <version.apache.ant>1.7.0</version.apache.ant>
-  </properties>
-
-  <build>
-    <!-- To allow to deploy releases in SVN -->
-    <extensions>
-      <extension>
-        <groupId>org.apache.maven.wagon</groupId>
-        <artifactId>wagon-scm</artifactId>
-        <version>1.0-beta-6</version>
-      </extension>
-      <extension>
-        <groupId>org.apache.maven.scm</groupId>
-        <artifactId>maven-scm-manager-plexus</artifactId>
-        <version>1.0</version>
-      </extension>
-      <extension>
-        <groupId>org.apache.maven.scm</groupId>
-        <artifactId>maven-scm-provider-svnexe</artifactId>
-        <version>1.0</version>
-      </extension>
-    </extensions>
-
-    <plugins>
-      <!-- Dependency Plugin Configuration -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-      </plugin>
-      
-      <plugin>
-        <!-- To call this plugin, use mvn assembly:assembly -->
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-assembly-plugin</artifactId>
-        <version>2.2-beta-1</version>
-        <configuration>
-          <descriptors>
-            <descriptor>src/main/assembly/dist.xml</descriptor>
-          </descriptors>
-        </configuration>
-      </plugin>
-      
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>        
-        <artifactId>maven-release-plugin</artifactId>        
-        <configuration>
-          <tagBase>https://svn.jboss.org/repos/jbossas/projects/test/tags</tagBase>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-  
-   <dependencies>
-     <dependency>
-       <groupId>org.apache.ant</groupId>
-       <artifactId>ant</artifactId>
-       <version>${version.apache.ant}</version>
-     </dependency>
-     
-     <dependency>
-       <groupId>org.apache.ant</groupId>
-       <artifactId>ant-junit</artifactId>
-       <version>${version.apache.ant}</version>
-     </dependency>
-
-     <dependency>
-       <groupId>org.jboss.logging</groupId>
-       <artifactId>jboss-logging-spi</artifactId>
-       <version>2.1.0.GA</version>
-     </dependency>
-     
-     <dependency>
-       <groupId>org.jboss.logging</groupId>
-       <artifactId>jboss-logging-log4j</artifactId>
-       <version>2.1.0.GA</version>
-     </dependency>
-     
-     <dependency>
-       <groupId>org.jboss</groupId>
-       <artifactId>jboss-common-core</artifactId>
-       <version>2.2.16.GA</version>
-     </dependency>
-
-     <dependency>
-        <groupId>jboss.profiler.jvmti</groupId>
-        <artifactId>jboss-profiler-jvmti</artifactId>
-        <version>1.0.0.CR5</version>
-     </dependency>
-
-     <dependency>
-       <groupId>junit</groupId>
-       <artifactId>junit</artifactId>
-       <version>3.8.1</version>
-     </dependency>
-     
-     <dependency>
-       <groupId>log4j</groupId>
-       <artifactId>log4j</artifactId>
-       <version>1.2.14</version>
-     </dependency>
-     
-     <dependency>
-       <groupId>org.jboss.jbossas</groupId>
-       <artifactId>jboss-server-manager</artifactId>
-       <version>1.0.3.GA</version>
-     </dependency>
-
-   </dependencies>
-  
-  <!-- Repositories -->
-  <repositories>
-    <repository>
-      <id>repository.jboss.org</id>
-      <name>JBoss Releases Repository</name>
-      <url>http://repository.jboss.org/maven2</url>
-      <releases>
-        <enabled>true</enabled>
-      </releases>
-      <snapshots>
-        <enabled>false</enabled>
-      </snapshots>
-    </repository>
-    <repository>
-      <id>snapshots.jboss.org</id>
-      <name>JBoss Snapshots Repository</name>
-      <url>http://snapshots.jboss.org/maven2</url>
-      <releases>
-        <enabled>false</enabled>
-      </releases>
-      <snapshots>
-        <enabled>true</enabled>
-      </snapshots>
-    </repository>
-  </repositories>
-
-  <!-- Plugin Repositories -->
-  <pluginRepositories>
-    <pluginRepository>
-      <id>repository.jboss.org</id>
-      <name>JBoss Plugin Releases</name>
-      <url>http://repository.jboss.org/maven2</url>
-      <releases>
-        <enabled>true</enabled>
-      </releases>
-      <snapshots>
-        <enabled>false</enabled>
-      </snapshots>
-    </pluginRepository>
-    <pluginRepository>
-      <id>snapshots.jboss.org</id>
-      <name>JBoss Plugin Snapshots</name>
-      <url>http://snapshots.jboss.org/maven2</url>
-      <releases>
-        <enabled>false</enabled>
-      </releases>
-      <snapshots>
-        <enabled>true</enabled>
-      </snapshots>
-    </pluginRepository>
-  </pluginRepositories>
-
-  <distributionManagement>
-    <repository>
-      <id>jboss-releases</id>
-      <name>JBoss Release Repository</name>
-      <url>file:///tmp/maven-repo</url>
-    </repository>
-  </distributionManagement>
-
-   
-</project>

Copied: projects/test/tags/1.1.7.CR2/pom.xml (from rev 103022, projects/test/trunk/pom.xml)
===================================================================
--- projects/test/tags/1.1.7.CR2/pom.xml	                        (rev 0)
+++ projects/test/tags/1.1.7.CR2/pom.xml	2010-03-26 10:01:34 UTC (rev 103023)
@@ -0,0 +1,111 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.jboss</groupId>
+    <artifactId>jboss-parent</artifactId>
+    <version>4</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.jboss.test</groupId>
+  <artifactId>jboss-test</artifactId>
+  <packaging>jar</packaging>
+  <name>JBoss Test</name>
+  <version>1.1.7.CR2</version>
+  <description>Common test support classes</description>
+  <url>http://www.jboss.org</url>
+  <scm>
+    <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/test/tags/1.1.7.CR2</connection>
+    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/test/tags/1.1.7.CR2</developerConnection>
+  </scm>
+
+  <properties>
+    <version.apache.ant>1.7.0</version.apache.ant>
+  </properties>
+
+  <build>
+    <plugins>
+      <!-- Dependency Plugin Configuration -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+      </plugin>
+      
+      <plugin>
+        <!-- To call this plugin, use mvn assembly:assembly -->
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>2.2-beta-1</version>
+        <configuration>
+          <descriptors>
+            <descriptor>src/main/assembly/dist.xml</descriptor>
+          </descriptors>
+        </configuration>
+      </plugin>
+      
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>        
+        <artifactId>maven-release-plugin</artifactId>        
+        <configuration>
+          <tagBase>https://svn.jboss.org/repos/jbossas/projects/test/tags</tagBase>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  
+   <dependencies>
+     <dependency>
+       <groupId>org.apache.ant</groupId>
+       <artifactId>ant</artifactId>
+       <version>${version.apache.ant}</version>
+     </dependency>
+     
+     <dependency>
+       <groupId>org.apache.ant</groupId>
+       <artifactId>ant-junit</artifactId>
+       <version>${version.apache.ant}</version>
+     </dependency>
+
+     <dependency>
+       <groupId>org.jboss.logging</groupId>
+       <artifactId>jboss-logging-spi</artifactId>
+       <version>2.1.0.GA</version>
+     </dependency>
+     
+     <dependency>
+       <groupId>org.jboss.logging</groupId>
+       <artifactId>jboss-logging-log4j</artifactId>
+       <version>2.1.0.GA</version>
+     </dependency>
+     
+     <dependency>
+       <groupId>org.jboss</groupId>
+       <artifactId>jboss-common-core</artifactId>
+       <version>2.2.16.GA</version>
+     </dependency>
+
+     <dependency>
+        <groupId>jboss.profiler.jvmti</groupId>
+        <artifactId>jboss-profiler-jvmti</artifactId>
+        <version>1.0.0.CR5</version>
+     </dependency>
+
+     <dependency>
+       <groupId>junit</groupId>
+       <artifactId>junit</artifactId>
+       <version>3.8.1</version>
+     </dependency>
+     
+     <dependency>
+       <groupId>log4j</groupId>
+       <artifactId>log4j</artifactId>
+       <version>1.2.14</version>
+     </dependency>
+     
+     <dependency>
+       <groupId>org.jboss.jbossas</groupId>
+       <artifactId>jboss-server-manager</artifactId>
+       <version>1.0.3.GA</version>
+     </dependency>
+
+   </dependencies>
+   
+</project>

Deleted: projects/test/tags/1.1.7.CR2/src/main/java/org/jboss/test/jms/LegacyJMSTestAdmin.java
===================================================================
--- projects/test/trunk/src/main/java/org/jboss/test/jms/LegacyJMSTestAdmin.java	2010-03-26 07:42:50 UTC (rev 103016)
+++ projects/test/tags/1.1.7.CR2/src/main/java/org/jboss/test/jms/LegacyJMSTestAdmin.java	2010-03-26 10:01:34 UTC (rev 103023)
@@ -1,255 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.test.jms;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.PrintStream;
-import java.util.Map;
-
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-
-import org.jboss.logging.Logger;
-
-/**
- * 
- * @author <mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- * 
- */
-public class LegacyJMSTestAdmin extends JMSTestAdmin
-{
-   private final MBeanServerConnection jmx;
-
-   protected final ObjectName mainDeployer = new ObjectName("jboss.system:service=MainDeployer");
-
-   /** The static log */
-   private static final Logger staticLog = Logger.getLogger(LegacyJMSTestAdmin.class);
-
-   public LegacyJMSTestAdmin() throws Exception
-   {
-      InitialContext ctx = new InitialContext();
-      String adaptorName = System.getProperty("jbosstest.server.name", "jmx/invoker/RMIAdaptor");
-      jmx = (MBeanServerConnection) ctx.lookup(adaptorName);
-      ctx.close();
-   }
-
-   @Override
-   public boolean isSupported()
-   {
-      try
-      {
-         createQueue("deleteMeTest");
-         destroyCreatedDestinations();
-         
-         staticLog.info("Legacy is supported!!!");
-
-         return true;
-      } catch (Throwable e)
-      {
-         staticLog.debug("LegacyJMSTestAdmin is not support because an exception happened", e);
-         return false;
-      }
-   }
-
-   public void createQueue(String name, TestRole... securityConfig) throws Exception
-   {
-
-      createQueue(name, new String[]
-      { "/queue/" + name, name }, securityConfig);
-   }
-
-   public void createQueue(String name, String[] jndiArray, TestRole... securityConfig) throws Exception
-   {
-
-      createDestination(false, name, securityConfig);
-
-      deployedQueues.put(name, securityConfig);
-   }
-
-   public void createTopic(String name, TestRole... securityConfig) throws Exception
-   {
-      createTopic(name, new String[]
-      { "/topic/" + name, name }, securityConfig);
-   }
-
-   public void createTopic(String name, String[] jndiArray, TestRole... securityConfig) throws Exception
-   {
-
-      createDestination(true, name, securityConfig);
-
-      deployedTopics.put(name, securityConfig);
-   }
-
-   public void deleteQueue(String name) throws Exception
-   {
-      try
-      {
-         deployedQueues.remove(name);
-         undeploy(false, name);
-      } catch (Exception e)
-      {
-         staticLog.warn(e.getMessage(), e);
-         throw e;
-      }
-   }
-
-   public void deleteTopic(String name) throws Exception
-   {
-      try
-      {
-         deployedTopics.remove(name);
-         undeploy(true, name);
-      } catch (Exception e)
-      {
-         staticLog.warn(e.getMessage(), e);
-         throw e;
-      }
-   }
-
-   /**
-    * This method only exists because hornetQ doesn't actually delete the
-    * destination on undeploy. On HornetQ we need to remove every destination
-    * from the storage while on Legacy versions a simple undeploy is fine
-    */
-   public void destroyEveryDestination() throws Exception
-   {
-      destroyCreatedDestinations();
-   }
-
-   @Override
-   public void destroyCreatedDestinations() throws Exception
-   {
-      for (Map.Entry<String, TestRole[]> queue : deployedQueues.entrySet())
-      {
-         undeploy(false, queue.getKey());
-      }
-
-      for (Map.Entry<String, TestRole[]> topic : deployedTopics.entrySet())
-      {
-         undeploy(true, topic.getKey());
-      }
-
-      deployedQueues.clear();
-      deployedTopics.clear();
-   }
-
-   @Override
-   public ObjectName createQueueJMXName(String queueName)
-   {
-      try
-      {
-         return new ObjectName("org.jboss.mq.server.jmx.Queue\" name=\"jboss.mq.destination:service=Queue,name=\"" + queueName + "\"");
-      } catch (Exception e)
-      {
-         staticLog.warn(e.getMessage(), e);
-         e.printStackTrace(); // >> junit reports
-         return null;
-      }
-   }
-
-   @Override
-   public ObjectName createTopicJMXName(String queueName)
-   {
-      try
-      {
-         return new ObjectName("org.jboss.mq.server.jmx.Topic\" name=\"jboss.mq.destination:service=Topic,name=\"" + queueName + "\"");
-      } catch (Exception e)
-      {
-         staticLog.warn(e.getMessage(), e);
-         e.printStackTrace(); // >> junit reports
-         return null;
-      }
-   }
-
-   private void undeploy(boolean isTopic, String destinationName) throws Exception
-   {
-      File destFile = createFile(isTopic, destinationName);
-
-      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
-   {
-      // OK, lets see if we can figure out what it might be.
-      File fileout = createFile(isTopic, name);
-
-      if (fileout.exists())
-      {
-         fileout.delete();
-      }
-
-      FileOutputStream out = new FileOutputStream(fileout);
-
-      PrintStream str = new PrintStream(out);
-      str.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
-      str.println("<server>");
-      if (isTopic)
-      {
-         str.println("  <mbean code=\"org.jboss.mq.server.jmx.Topic\" name=\"jboss.mq.destination:service=Topic,name=" + name + "\">");
-      } else
-      {
-         str.println("  <mbean code=\"org.jboss.mq.server.jmx.Queue\" name=\"jboss.mq.destination:service=Queue,name=" + name + "\">");
-      }
-      str.println("    <depends optional-attribute-name=\"DestinationManager\">jboss.mq:service=DestinationManager</depends>");
-      str.println("    <depends optional-attribute-name=\"SecurityManager\">jboss.mq:service=SecurityManager</depends>");
-
-      if (securityConfig != null && securityConfig.length > 0)
-      {
-         str.println("    <attribute name=\"SecurityConf\">");
-         str.println("       <security>");
-         for (TestRole role : securityConfig)
-         {
-            str.println("       <role name=\"" + role.getName() + "\" read=" + role.isConsume() + " write=" + role.isSend() + " create=" + (role.isCreateDurableQueue() || role.isCreateNonDurableQueue()) + "/>");
-         }
-         str.println("   </security>");
-         str.println("</attribute>");
-      }
-      
-      str.println("   </mbean>");
-
-      str.println("</server>");
-
-      jmx.invoke(mainDeployer, "deploy", new Object[]
-      { fileout.toURI().toURL() }, new String[]
-      { "java.net.URL" });
-
-   }
-
-   private File createFile(boolean isTopic, String destinationName)
-   {
-      String deployDir = System.getProperty("jbosstest.deploy.dir");
-      if (deployDir == null)
-      {
-         deployDir = "output/lib";
-      }
-      File fileout = new File(deployDir + "/" + "tmpdest_" + (isTopic ? "topic_" : "queue_") + destinationName + "-destination-service.xml");
-      return fileout;
-   }
-
-}

Copied: projects/test/tags/1.1.7.CR2/src/main/java/org/jboss/test/jms/LegacyJMSTestAdmin.java (from rev 103020, projects/test/trunk/src/main/java/org/jboss/test/jms/LegacyJMSTestAdmin.java)
===================================================================
--- projects/test/tags/1.1.7.CR2/src/main/java/org/jboss/test/jms/LegacyJMSTestAdmin.java	                        (rev 0)
+++ projects/test/tags/1.1.7.CR2/src/main/java/org/jboss/test/jms/LegacyJMSTestAdmin.java	2010-03-26 10:01:34 UTC (rev 103023)
@@ -0,0 +1,261 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.test.jms;
+
+import org.jboss.logging.Logger;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+import java.util.Map;
+
+/**
+ * 
+ * @author <mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * 
+ */
+public class LegacyJMSTestAdmin extends JMSTestAdmin
+{
+   private final MBeanServerConnection jmx;
+
+   protected final ObjectName mainDeployer = new ObjectName("jboss.system:service=MainDeployer");
+
+   /** The static log */
+   private static final Logger staticLog = Logger.getLogger(LegacyJMSTestAdmin.class);
+
+   public LegacyJMSTestAdmin() throws Exception
+   {
+      InitialContext ctx = new InitialContext();
+      String adaptorName = System.getProperty("jbosstest.server.name", "jmx/invoker/RMIAdaptor");
+      jmx = (MBeanServerConnection) ctx.lookup(adaptorName);
+      ctx.close();
+   }
+
+   @Override
+   public boolean isSupported()
+   {
+      try
+      {
+         createQueue("deleteMeTest");
+         destroyCreatedDestinations();
+         
+         staticLog.info("Legacy is supported!!!");
+
+         return true;
+      } catch (Throwable e)
+      {
+         staticLog.debug("LegacyJMSTestAdmin is not support because an exception happened", e);
+         return false;
+      }
+   }
+
+   public void createQueue(String name, TestRole... securityConfig) throws Exception
+   {
+
+      createQueue(name, new String[]
+      { "/queue/" + name, name }, securityConfig);
+   }
+
+   public void createQueue(String name, String[] jndiArray, TestRole... securityConfig) throws Exception
+   {
+
+      createDestination(false, name, securityConfig);
+
+      deployedQueues.put(name, securityConfig);
+   }
+
+   public void createTopic(String name, TestRole... securityConfig) throws Exception
+   {
+      createTopic(name, new String[]
+      { "/topic/" + name, name }, securityConfig);
+   }
+
+   public void createTopic(String name, String[] jndiArray, TestRole... securityConfig) throws Exception
+   {
+
+      createDestination(true, name, securityConfig);
+
+      deployedTopics.put(name, securityConfig);
+   }
+
+   public void deleteQueue(String name) throws Exception
+   {
+      try
+      {
+         deployedQueues.remove(name);
+         undeploy(false, name);
+      } catch (Exception e)
+      {
+         staticLog.warn(e.getMessage(), e);
+         throw e;
+      }
+   }
+
+   public void deleteTopic(String name) throws Exception
+   {
+      try
+      {
+         deployedTopics.remove(name);
+         undeploy(true, name);
+      } catch (Exception e)
+      {
+         staticLog.warn(e.getMessage(), e);
+         throw e;
+      }
+   }
+
+   /**
+    * This method only exists because hornetQ doesn't actually delete the
+    * destination on undeploy. On HornetQ we need to remove every destination
+    * from the storage while on Legacy versions a simple undeploy is fine
+    */
+   public void destroyEveryDestination() throws Exception
+   {
+      destroyCreatedDestinations();
+   }
+
+   @Override
+   public void destroyCreatedDestinations() throws Exception
+   {
+      for (Map.Entry<String, TestRole[]> queue : deployedQueues.entrySet())
+      {
+         undeploy(false, queue.getKey());
+      }
+
+      for (Map.Entry<String, TestRole[]> topic : deployedTopics.entrySet())
+      {
+         undeploy(true, topic.getKey());
+      }
+
+      deployedQueues.clear();
+      deployedTopics.clear();
+   }
+
+   @Override
+   public ObjectName createQueueJMXName(String queueName)
+   {
+      try
+      {
+         return new ObjectName("org.jboss.mq.server.jmx.Queue\" name=\"jboss.mq.destination:service=Queue,name=\"" + queueName + "\"");
+      } catch (Exception e)
+      {
+         staticLog.warn(e.getMessage(), e);
+         e.printStackTrace(); // >> junit reports
+         return null;
+      }
+   }
+
+   @Override
+   public ObjectName createTopicJMXName(String queueName)
+   {
+      try
+      {
+         return new ObjectName("org.jboss.mq.server.jmx.Topic\" name=\"jboss.mq.destination:service=Topic,name=\"" + queueName + "\"");
+      } catch (Exception e)
+      {
+         staticLog.warn(e.getMessage(), e);
+         e.printStackTrace(); // >> junit reports
+         return null;
+      }
+   }
+
+   private void undeploy(boolean isTopic, String destinationName) throws Exception
+   {
+      File destFile = createFile(isTopic, destinationName);
+
+      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
+   {
+      // OK, lets see if we can figure out what it might be.
+      File fileout = createFile(isTopic, name);
+
+      if (fileout.exists())
+      {
+         fileout.delete();
+      }
+
+      FileOutputStream out = new FileOutputStream(fileout);
+
+      PrintStream str = new PrintStream(out);
+      str.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+      str.println("<server>");
+      if (isTopic)
+      {
+         str.println("  <mbean code=\"org.jboss.mq.server.jmx.Topic\" name=\"jboss.mq.destination:service=Topic,name=" + name + "\">");
+      } else
+      {
+         str.println("  <mbean code=\"org.jboss.mq.server.jmx.Queue\" name=\"jboss.mq.destination:service=Queue,name=" + name + "\">");
+      }
+      str.println("    <depends optional-attribute-name=\"DestinationManager\">jboss.mq:service=DestinationManager</depends>");
+      str.println("    <depends optional-attribute-name=\"SecurityManager\">jboss.mq:service=SecurityManager</depends>");
+
+      if (securityConfig != null && securityConfig.length > 0)
+      {
+         str.println("    <attribute name=\"SecurityConf\">");
+         str.println("      <security>");
+         for (TestRole role : securityConfig)
+         {
+            str.println("        <role name=" + q(role.getName()) +
+               " read=" + q(role.isConsume()) +
+               " write=" + q(role.isSend()) +
+               " create=" + q(role.isCreateDurableQueue() || role.isCreateNonDurableQueue()) + "/>");
+         }
+         str.println("      </security>");
+         str.println("    </attribute>");
+      }
+      
+      str.println("  </mbean>");
+
+      str.println("</server>");
+
+      jmx.invoke(mainDeployer, "deploy", new Object[]
+      { fileout.toURI().toURL() }, new String[]
+      { "java.net.URL" });
+
+   }
+
+   private File createFile(boolean isTopic, String destinationName)
+   {
+      String deployDir = System.getProperty("jbosstest.deploy.dir");
+      if (deployDir == null)
+      {
+         deployDir = "output/lib";
+      }
+      File fileout = new File(deployDir + "/" + "tmpdest_" + (isTopic ? "topic_" : "queue_") + destinationName + "-destination-service.xml");
+      return fileout;
+   }
+
+   private static final String q(Object s)
+   {
+      return "\"" + s + "\"";
+   }
+}




More information about the jboss-cvs-commits mailing list