You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2011/04/08 18:16:27 UTC

svn commit: r1090318 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2902Test.java

Author: gtully
Date: Fri Apr  8 16:16:27 2011
New Revision: 1090318

URL: http://svn.apache.org/viewvc?rev=1090318&view=rev
Log:
add quick test variant to validate presence of mdc between threads

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2902Test.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2902Test.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2902Test.java?rev=1090318&r1=1090317&r2=1090318&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2902Test.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2902Test.java Fri Apr  8 16:16:27 2011
@@ -34,6 +34,7 @@ import org.apache.log4j.spi.LoggingEvent
 
 public class AMQ2902Test extends TestCase {
     final AtomicBoolean gotExceptionInLog = new AtomicBoolean(Boolean.FALSE);
+    final AtomicBoolean failedToFindMDC = new AtomicBoolean(Boolean.FALSE);
 
     Appender appender = new Appender() {
         public void addFilter(Filter newFilter) {
@@ -54,6 +55,9 @@ public class AMQ2902Test extends TestCas
                     && event.getThrowableInformation().getThrowable() instanceof TransportDisposedIOException) {
                 gotExceptionInLog.set(Boolean.TRUE);
             }
+            if (event.getMDC("activemq.broker") == null) {
+                failedToFindMDC.set(Boolean.TRUE);
+            }
             return;
         }
 
@@ -101,12 +105,15 @@ public class AMQ2902Test extends TestCas
 
     public void setUp() throws Exception {
         gotExceptionInLog.set(Boolean.FALSE);
+        failedToFindMDC.set(Boolean.FALSE);
         Logger.getRootLogger().addAppender(appender);
         Logger.getLogger(TransportConnection.class.getName() + ".Transport").setLevel(Level.DEBUG);
+        Logger.getLogger(TransportConnection.class.getName()).setLevel(Level.DEBUG);
     }
 
     public void tearDown() throws Exception {
         Logger.getRootLogger().removeAppender(appender);
         assertFalse("got unexpected ex in log on graceful close", gotExceptionInLog.get());
+        assertFalse("MDC is there", failedToFindMDC.get());
     }
 }