[LOGBack-dev] svn commit: r401 - in logback/classic/trunk/src/test: input/joran java/ch/qos/logback/classic/joran

noreply.ceki at qos.ch noreply.ceki at qos.ch
Mon Aug 7 19:30:35 CEST 2006


Author: ceki
Date: Mon Aug  7 19:30:33 2006
New Revision: 401

Added:
   logback/classic/trunk/src/test/input/joran/simpleLevel.xml
Modified:
   logback/classic/trunk/src/test/input/joran/simple2.xml
   logback/classic/trunk/src/test/input/joran/simpleList.xml
   logback/classic/trunk/src/test/java/ch/qos/logback/classic/joran/BasicJoranTest.java
Log:
new test case and input files associated with the confiuguration/logger element in joran config files.

Modified: logback/classic/trunk/src/test/input/joran/simple2.xml
==============================================================================
--- logback/classic/trunk/src/test/input/joran/simple2.xml	(original)
+++ logback/classic/trunk/src/test/input/joran/simple2.xml	Mon Aug  7 19:30:33 2006
@@ -10,7 +10,7 @@
   </appender>
     
   <root>
-    <level value ="DEBUG" />
+    <level value="DEBUG" />
     <appender-ref ref="CONSOLE" />
   </root>
   

Added: logback/classic/trunk/src/test/input/joran/simpleLevel.xml
==============================================================================
--- (empty file)
+++ logback/classic/trunk/src/test/input/joran/simpleLevel.xml	Mon Aug  7 19:30:33 2006
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE configuration>
+
+<configuration xmlns:log4j='http://com.logback.com/' debug="true">
+
+  <appender name="LIST" class="ch.qos.logback.core.appender.ListAppender"/>
+    
+     
+   <logger name="ch.qos.logback.classic.joran">
+    <level value="INFO" />
+  </logger>
+
+  <root>
+    <level value="DEBUG" />
+    <appender-ref ref="LIST" />
+  </root>
+  
+</configuration>
+  
\ No newline at end of file

Modified: logback/classic/trunk/src/test/input/joran/simpleList.xml
==============================================================================
--- logback/classic/trunk/src/test/input/joran/simpleList.xml	(original)
+++ logback/classic/trunk/src/test/input/joran/simpleList.xml	Mon Aug  7 19:30:33 2006
@@ -3,11 +3,7 @@
 
 <configuration xmlns:logback='http://com.logback.com/' debug="true">
 
-  <appender name="LIST" class="ch.qos.logback.core.appender.ListAppender">
-    <layout class="com.logback.classic.PatternLayout">
-      <param name="Pattern"  value="%d - %m%n"/>  
-    </layout>
-  </appender>
+  <appender name="LIST" class="ch.qos.logback.core.appender.ListAppender"/>
     
   <root>
     <level value="DEBUG" />

Modified: logback/classic/trunk/src/test/java/ch/qos/logback/classic/joran/BasicJoranTest.java
==============================================================================
--- logback/classic/trunk/src/test/java/ch/qos/logback/classic/joran/BasicJoranTest.java	(original)
+++ logback/classic/trunk/src/test/java/ch/qos/logback/classic/joran/BasicJoranTest.java	Mon Aug  7 19:30:33 2006
@@ -9,7 +9,9 @@
  */
 package ch.qos.logback.classic.joran;
 
+import junit.framework.Test;
 import junit.framework.TestCase;
+import junit.framework.TestSuite;
 import ch.qos.logback.classic.Logger;
 import ch.qos.logback.classic.LoggerContext;
 import ch.qos.logback.classic.spi.LoggingEvent;
@@ -19,7 +21,11 @@
 
 public class BasicJoranTest extends TestCase {
 
-  public void test() {
+  public BasicJoranTest(String name) {
+    super(name);
+  }
+  
+  public void testSimpleList() {
     JoranConfigurator jc = new JoranConfigurator();
     LoggerContext loggerContext = new LoggerContext();
     jc.setContext(loggerContext);
@@ -38,6 +44,24 @@
     assertEquals(msg, le.getMessage());
   }
   
+  public void testLevel() {
+    JoranConfigurator jc = new JoranConfigurator();
+    LoggerContext loggerContext = new LoggerContext();
+    jc.setContext(loggerContext);
+    jc.doConfigure(Constants.TEST_DIR_PREFIX + "input/joran/simpleLevel.xml");
+
+    StatusPrinter.print(loggerContext.getStatusManager());
+  
+    Logger logger = loggerContext.getLogger(this.getClass().getName());
+    Logger root = loggerContext.getRootLogger();
+    ListAppender listAppender = (ListAppender) root.getAppender("LIST");
+    assertEquals(0, listAppender.list.size());
+    String msg = "hello world";
+    logger.debug(msg);
+    assertEquals(0, listAppender.list.size());
+    //LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
+    //assertEquals(msg, le.getMessage());
+  }
   
   public void testEval() {
     JoranConfigurator jc = new JoranConfigurator();
@@ -52,4 +76,17 @@
     logger.debug("toto");
     logger.debug(msg);
   }
+  
+  
+  public static Test COMMENTED_OUT_suite() {
+    TestSuite suite = new TestSuite();
+    suite.addTest(new BasicJoranTest("testLevel"));
+    
+    //suite.addTest(new BasicJoranTest("testSimpleList"));
+
+    return suite;
+  }
+  
+  
+  
 }



More information about the logback-dev mailing list