activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r812394 - in /activemq/trunk/activemq-core/src/test/java/org/apache/activemq: AutoFailTestSupport.java bugs/AMQ1936Test.java bugs/AMQ2183Test.java
Date Tue, 08 Sep 2009 08:50:26 GMT
Author: gtully
Date: Tue Sep  8 08:50:26 2009
New Revision: 812394

URL: http://svn.apache.org/viewvc?rev=812394&view=rev
Log:
make amq-2183 test auto fail as it hangs in hudson, add a thread dump to help diagnose

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/AutoFailTestSupport.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ1936Test.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2183Test.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/AutoFailTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/AutoFailTestSupport.java?rev=812394&r1=812393&r2=812394&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/AutoFailTestSupport.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/AutoFailTestSupport.java
Tue Sep  8 08:50:26 2009
@@ -16,6 +16,8 @@
  */
 package org.apache.activemq;
 
+import java.util.Map;
+import java.util.Map.Entry;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import junit.framework.TestCase;
@@ -78,6 +80,7 @@
                     if (!isTestSuccess.get()) {
                         LOG.error("Test case has exceeded the maximum allotted time to run
of: " + getMaxTestTime() + " ms.");
                         LOG.fatal("Test case has exceeded the maximum allotted time to run
of: " + getMaxTestTime() + " ms.");
+                        dumpAllThreads(getName());
                         System.exit(EXIT_ERROR);
                     }
                 }
@@ -138,4 +141,15 @@
     public long getMaxTestTime() {
         return this.maxTestTime;
     }
+    
+    
+    public static void dumpAllThreads(String prefix) {
+        Map<Thread, StackTraceElement[]> stacks = Thread.getAllStackTraces();
+        for (Entry<Thread, StackTraceElement[]> stackEntry : stacks.entrySet()) {
+            System.err.println(prefix + " " + stackEntry.getKey());
+            for(StackTraceElement element : stackEntry.getValue()) {
+                System.err.println("     " + element);
+            }
+        }
+    }
 }

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ1936Test.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ1936Test.java?rev=812394&r1=812393&r2=812394&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ1936Test.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ1936Test.java Tue
Sep  8 08:50:26 2009
@@ -17,6 +17,7 @@
 package org.apache.activemq.bugs;
 
 import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.AutoFailTestSupport;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.util.Wait;
 import org.apache.log4j.Logger;
@@ -200,23 +201,14 @@
             }
         }, 1*60*1000);
         if (!ok) {
-            dumpAllThreads("--STUCK?--");
+            AutoFailTestSupport.dumpAllThreads("--STUCK?--");
         }
         assertEquals( "Number of messages received does not match the number sent", TEST_MESSAGE_COUNT,
messages.size( ) );
         assertEquals( TEST_MESSAGE_COUNT,  messageCount.get() );
     }
     
     
-    private void dumpAllThreads(String prefix) {
-        Map<Thread, StackTraceElement[]> stacks = Thread.getAllStackTraces();
-        for (Entry<Thread, StackTraceElement[]> stackEntry : stacks.entrySet()) {
-            System.err.println(prefix + stackEntry.getKey());
-            for(StackTraceElement element : stackEntry.getValue()) {
-                System.err.println("     " + element);
-            }
-        }
-        
-    }
+    
     private final static class ThreadedMessageReceiver implements Runnable {
        
         private String queueName            = null;

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2183Test.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2183Test.java?rev=812394&r1=812393&r2=812394&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2183Test.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2183Test.java Tue
Sep  8 08:50:26 2009
@@ -32,6 +32,7 @@
 import junit.framework.TestCase;
 
 import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.AutoFailTestSupport;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.command.ActiveMQQueue;
 import org.apache.activemq.command.ActiveMQTopic;
@@ -40,7 +41,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-public class AMQ2183Test extends TestCase implements UncaughtExceptionHandler, MessageListener
{
+public class AMQ2183Test extends AutoFailTestSupport implements UncaughtExceptionHandler,
MessageListener {
        
     private static final Log LOG = LogFactory.getLog(AMQ2183Test.class);
     private static final int maxSent = 2000;    
@@ -55,7 +56,8 @@
     }
     
     public void setUp() throws Exception {
-    
+        setAutoFail(true);
+        super.setUp();
         master = new BrokerService();
         slave = new BrokerService();
         



Mime
View raw message