[jboss-cvs] JBoss Messaging SVN: r4673 - in branches/Branch_Stable/tests: etc and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jul 9 20:19:20 EDT 2008


Author: clebert.suconic at jboss.com
Date: 2008-07-09 20:19:19 -0400 (Wed, 09 Jul 2008)
New Revision: 4673

Removed:
   branches/Branch_Stable/tests/src/org/jboss/test/messaging/tools/ant/JUnitTestSuiteListener.java
Modified:
   branches/Branch_Stable/tests/build.xml
   branches/Branch_Stable/tests/etc/container.xml
   branches/Branch_Stable/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
Log:
JBMESSAGING-1395 - fix on windows testsuite

Modified: branches/Branch_Stable/tests/build.xml
===================================================================
--- branches/Branch_Stable/tests/build.xml	2008-07-09 23:57:10 UTC (rev 4672)
+++ branches/Branch_Stable/tests/build.xml	2008-07-10 00:19:19 UTC (rev 4673)
@@ -460,13 +460,6 @@
                     haltonfailure="${junit.batchtest.haltonfailure}"
                     haltonerror="${junit.batchtest.haltonerror}">
             <formatter type="plain" usefile="${junit.formatter.usefile}"/>
-            <!--
-                 I needed a way to intercept the end of a forked ant JUnit test run, in order to
-                 perform clean-up, and this is it: register a JUnitTestSuiteListener as a JUnit
-                 batchtest formatter, and it will get notified on a endTestSuite() event.
-            -->
-           <formatter classname="org.jboss.test.messaging.tools.ant.JUnitTestSuiteListener"/>
-
             <fileset dir="${build.tests.classes}">
 
                <include name="**/jms/*Test.class"/>
@@ -534,12 +527,6 @@
                     haltonfailure="${junit.batchtest.haltonfailure}"
                     haltonerror="${junit.batchtest.haltonerror}">
             <formatter type="plain" usefile="${junit.formatter.usefile}"/>
-            <!--
-                 I needed a way to intercept the end of a forked ant JUnit test run, in order to
-                 perform clean-up, and this is it: register a JUnitTestSuiteListener as a JUnit
-                 batchtest formatter, and it will get notified on a endTestSuite() event.
-            -->
-           <formatter classname="org.jboss.test.messaging.tools.ant.JUnitTestSuiteListener"/>
 
             <fileset dir="${build.tests.classes}">              
                <include name="**/thirdparty/**/${test-mask}.class"/>             
@@ -699,12 +686,6 @@
                     haltonfailure="${junit.batchtest.haltonfailure}"
                     haltonerror="${junit.batchtest.haltonerror}">
             <formatter type="plain" usefile="${junit.formatter.usefile}"/>
-            <!--
-                 I needed a way to intercept the end of a forked ant JUnit test run, in order to
-                 perform clean-up, and this is it: register a JUnitTestSuiteListener as a JUnit
-                 batchtest formatter, and it will get notified on a endTestSuite() event.
-            -->
-            <formatter classname="org.jboss.test.messaging.tools.ant.JUnitTestSuiteListener"/>
 
             <fileset dir="${build.tests.classes}">
                <include name="**/jms/stress/clustering/*Test.class"/>
@@ -766,12 +747,6 @@
                     haltonfailure="${junit.batchtest.haltonfailure}"
                     haltonerror="${junit.batchtest.haltonerror}">
             <formatter type="plain" usefile="${junit.formatter.usefile}"/>
-            <!--
-                 I needed a way to intercept the end of a forked ant JUnit test run, in order to
-                 perform clean-up, and this is it: register a JUnitTestSuiteListener as a JUnit
-                 batchtest formatter, and it will get notified on a endTestSuite() event.
-            -->
-            <formatter classname="org.jboss.test.messaging.tools.ant.JUnitTestSuiteListener"/>
 
             <fileset dir="${build.tests.classes}">
               <include name="**/jms/clustering/${test-mask}.class"/>	      
@@ -827,12 +802,6 @@
                     haltonfailure="${junit.batchtest.haltonfailure}"
                     haltonerror="${junit.batchtest.haltonerror}">
             <formatter type="plain" usefile="${junit.formatter.usefile}"/>
-            <!--
-                 I needed a way to intercept the end of a forked ant JUnit test run, in order to
-                 perform clean-up, and this is it: register a JUnitTestSuiteListener as a JUnit
-                 batchtest formatter, and it will get notified on a endTestSuite() event.
-            -->
-           <formatter classname="org.jboss.test.messaging.tools.ant.JUnitTestSuiteListener"/>
 
            <fileset dir="${build.tests.classes}">
 	      <include name="**/jms/bridge/**/*Test.class"/>
@@ -896,12 +865,6 @@
                     haltonfailure="${junit.batchtest.haltonfailure}"
                     haltonerror="${junit.batchtest.haltonerror}">
             <formatter type="plain" usefile="${junit.formatter.usefile}"/>
-            <!--
-                 I needed a way to intercept the end of a forked ant JUnit test run, in order to
-                 perform clean-up, and this is it: register a JUnitTestSuiteListener as a JUnit
-                 batchtest formatter, and it will get notified on a endTestSuite() event.
-            -->
-            <formatter classname="org.jboss.test.messaging.tools.ant.JUnitTestSuiteListener"/>
 
             <fileset dir="${build.tests.classes}">
                <include name="**/ClusterLeakTest.class"/>

Modified: branches/Branch_Stable/tests/etc/container.xml
===================================================================
--- branches/Branch_Stable/tests/etc/container.xml	2008-07-09 23:57:10 UTC (rev 4672)
+++ branches/Branch_Stable/tests/etc/container.xml	2008-07-10 00:19:19 UTC (rev 4673)
@@ -29,7 +29,7 @@
          <url>jdbc:mysql://localhost/messaging</url>
          <driver>com.mysql.jdbc.Driver</driver>
          <isolation>TRANSACTION_READ_COMMITTED</isolation>
-         <username>sa</username>
+         <username>root</username>
       </database-configuration>
 
 

Modified: branches/Branch_Stable/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- branches/Branch_Stable/tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2008-07-09 23:57:10 UTC (rev 4672)
+++ branches/Branch_Stable/tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2008-07-10 00:19:19 UTC (rev 4673)
@@ -82,6 +82,28 @@
 
    private static Logger log = Logger.getLogger(ServerManagement.class);
 
+   private static Thread shutdownHookOnSpawnServer = new Thread()
+   {
+      public void run()
+      {
+         try
+         {
+            ServerManagement.destroySpawnedServers();
+         }
+         catch (Exception e)
+         {
+            log.error(e.getMessage(), e);
+         }
+      }
+   };
+   
+   // A hook to shutdown any spawned server
+   // This was done because of http://jira.jboss.com/jira/browse/JBMESSAGING-1395
+   static
+   {
+      Runtime.getRuntime().addShutdownHook(shutdownHookOnSpawnServer);
+   }
+
    private static ServerHolder[] servers = new ServerHolder[MAX_SERVER_COUNT];
 
    // Map<NotificationListener - NotificationListenerPoller>

Deleted: branches/Branch_Stable/tests/src/org/jboss/test/messaging/tools/ant/JUnitTestSuiteListener.java
===================================================================
--- branches/Branch_Stable/tests/src/org/jboss/test/messaging/tools/ant/JUnitTestSuiteListener.java	2008-07-09 23:57:10 UTC (rev 4672)
+++ branches/Branch_Stable/tests/src/org/jboss/test/messaging/tools/ant/JUnitTestSuiteListener.java	2008-07-10 00:19:19 UTC (rev 4673)
@@ -1,119 +0,0 @@
-/**
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.test.messaging.tools.ant;
-
-import java.io.OutputStream;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.optional.junit.JUnitResultFormatter;
-import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest;
-
-/**
- * This class is a hack.
- *
- * I needed a way to intercept the end of a forked ant JUnit test run, in order to perform some
- * clean-up, and this is it: register this class as a JUnit batchtest formatter, and it will get
- * notified on a endTestSuite() event. Very important, it is run in the same address space as the
- * tests themselves.
- *
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- * $Id$
- */
-public class JUnitTestSuiteListener implements JUnitResultFormatter
-{
-   // Constants -----------------------------------------------------
-
-   // Static --------------------------------------------------------
-
-   // Attributes ----------------------------------------------------
-
-   // Constructors --------------------------------------------------
-
-   // JUnitResultFormatter implementation ---------------------------
-
-   public void endTestSuite(JUnitTest suite) throws BuildException
-   {
-//      try
-//      {
-//         List destroyed = ServerManagement.destroySpawnedServers();
-//         if (destroyed.size() > 0)
-//         {
-//            StringBuffer sb = new StringBuffer("Destroyed spawned test servers ");
-//            for(Iterator i = destroyed.iterator(); i.hasNext();)
-//            {
-//               sb.append(i.next());
-//               if (i.hasNext())
-//               {
-//                  sb.append(',');
-//               }
-//            }
-//            System.out.println(sb);
-//         }
-//      }
-//      catch(Throwable t)
-//      {
-//         t.printStackTrace();
-//      }
-   }
-
-   public void startTestSuite(JUnitTest suite) throws BuildException
-   {
-      // noop
-   }
-
-   public void setOutput(OutputStream out)
-   {
-      // noop
-   }
-
-   public void setSystemOutput(String out)
-   {
-      // noop
-   }
-
-   public void setSystemError(String err)
-   {
-      // noop
-   }
-
-   // TestListener implementation -----------------------------------
-
-   public void addError(Test test, Throwable t)
-   {
-      // noop
-   }
-
-   public void addFailure(Test test, AssertionFailedError t)
-   {
-      // noop
-   }
-
-   public void endTest(Test test)
-   {
-      // noop
-   }
-
-   public void startTest(Test test)
-   {
-      // noop
-   }
-
-   // Public --------------------------------------------------------
-
-   // Package protected ---------------------------------------------
-
-   // Protected -----------------------------------------------------
-
-   // Private -------------------------------------------------------
-
-   // Inner classes -------------------------------------------------
-
-}




More information about the jboss-cvs-commits mailing list