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

noreply.ceki at qos.ch noreply.ceki at qos.ch
Wed Aug 6 22:13:23 CEST 2008


Author: ceki
Date: Wed Aug  6 22:13:23 2008
New Revision: 1734

Added:
   logback/trunk/logback-classic/src/test/input/joran/statusListener.xml
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/joran/TrivialStatusListener.java
Modified:
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java

Log:
Relates to LBCLASSIC-59 LBCLASSIC-58

test case for StatusListner support 

Added: logback/trunk/logback-classic/src/test/input/joran/statusListener.xml
==============================================================================
--- (empty file)
+++ logback/trunk/logback-classic/src/test/input/joran/statusListener.xml	Wed Aug  6 22:13:23 2008
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE configuration>
+
+<configuration debug="false">
+
+
+  <statusListener class="ch.qos.logback.classic.joran.TrivialStatusListener"/>
+  
+  <appender name="LIST" class="ch.qos.logback.core.read.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/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	Wed Aug  6 22:13:23 2008
@@ -67,6 +67,15 @@
     assertEquals(0, listAppender.list.size());
   }
   
+  public void testStatusListener() throws JoranException {
+    JoranConfigurator jc = new JoranConfigurator();
+    LoggerContext loggerContext = new LoggerContext();
+    jc.setContext(loggerContext);
+    jc.doConfigure(TeztConstants.TEST_DIR_PREFIX + "input/joran/statusListener.xml");
+    
+    StatusPrinter.print(loggerContext);
+  }
+  
   public void testEval() throws JoranException {
     JoranConfigurator jc = new JoranConfigurator();
     LoggerContext loggerContext = new LoggerContext();
@@ -199,8 +208,8 @@
   
   public static Test suite() {
     TestSuite suite = new TestSuite();
-    suite.addTestSuite(JoranConfiguratorTest.class);
-    //suite.addTest(new JoranConfiguratorTest("testEvaluatorFilter"));
+    //suite.addTestSuite(JoranConfiguratorTest.class);
+    suite.addTest(new JoranConfiguratorTest("testStatusListener"));
     return suite;
   } 
 }

Added: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/joran/TrivialStatusListener.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/joran/TrivialStatusListener.java	Wed Aug  6 22:13:23 2008
@@ -0,0 +1,18 @@
+package ch.qos.logback.classic.joran;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import ch.qos.logback.core.status.Status;
+import ch.qos.logback.core.status.StatusListener;
+
+public class TrivialStatusListener implements StatusListener {
+
+  List<Status> list = new ArrayList<Status>();
+  
+  public void addStatusEvent(Status status) {
+    System.out.println("xxxxx"+status);
+    list.add(status);
+  }
+
+}


More information about the logback-dev mailing list