[logback-dev] svn commit: r1722 - logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/joran

noreply.ceki at qos.ch noreply.ceki at qos.ch
Fri Jul 18 22:40:38 CEST 2008


Author: ceki
Date: Fri Jul 18 22:40:38 2008
New Revision: 1722

Removed:
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/joran/XConfiguratorTestX.java
Modified:
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java

Log:
make turboDymanicFilter test part of the regular build

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java	Fri Jul 18 22:40:38 2008
@@ -9,6 +9,8 @@
  */
 package ch.qos.logback.classic.joran;
 
+import org.slf4j.MDC;
+
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
@@ -170,6 +172,30 @@
     assertEquals("hello", back.getMessage());
   }
   
+  public void testTurboDynamicThreshold() throws JoranException { 
+    JoranConfigurator jc = new JoranConfigurator();
+    LoggerContext loggerContext = new LoggerContext(); 
+    jc.setContext(loggerContext);
+    jc.doConfigure(TeztConstants.TEST_DIR_PREFIX + "input/joran/turboDynamicThreshold.xml");
+
+    StatusPrinter.print(loggerContext.getStatusManager());
+  
+    Logger logger = loggerContext.getLogger(this.getClass().getName());
+    Logger root = loggerContext.getLogger(LoggerContext.ROOT_NAME);
+    ListAppender listAppender = (ListAppender) root.getAppender("LIST");
+    assertEquals(0, listAppender.list.size());
+   
+    // this one should be denied
+    MDC.put("userId", "user1");
+    logger.debug("hello user1");
+    // this one should log
+    MDC.put("userId", "user2");
+    logger.debug("hello user2"); 
+    
+    assertEquals(1, listAppender.list.size());
+    LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
+    assertEquals("hello user2", le.getMessage());
+  }
   
   public static Test suite() {
     TestSuite suite = new TestSuite();


More information about the logback-dev mailing list