[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-19-gdefa388

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Thu Feb 11 14:44:10 CET 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".

The branch, master has been updated
       via  defa388aea50810872efdfe85baad9d4ff67c49f (commit)
      from  4e5aba2f2489bd7d2a1f8284202a8cf7d3373a22 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=defa388aea50810872efdfe85baad9d4ff67c49f
http://github.com/ceki/logback/commit/defa388aea50810872efdfe85baad9d4ff67c49f

commit defa388aea50810872efdfe85baad9d4ff67c49f
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Thu Feb 11 14:41:58 2010 +0100

    - renaming test file

diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/event/SaxEventRecorderTest.java b/logback-core/src/test/java/ch/qos/logback/core/joran/event/SaxEventRecorderTest.java
new file mode 100644
index 0000000..a820f19
--- /dev/null
+++ b/logback-core/src/test/java/ch/qos/logback/core/joran/event/SaxEventRecorderTest.java
@@ -0,0 +1,110 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ *   or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.core.joran.event;
+
+import static org.junit.Assert.*;
+
+import java.io.FileInputStream;
+import java.util.List;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.junit.Test;
+import org.xml.sax.Attributes;
+
+import ch.qos.logback.core.Context;
+import ch.qos.logback.core.ContextBase;
+import ch.qos.logback.core.status.Status;
+import ch.qos.logback.core.status.StatusManager;
+import ch.qos.logback.core.util.CoreTestConstants;
+
+/**
+ * Test whether SaxEventRecorder does a good job.
+ * 
+ * @author Ceki Gulcu
+ */
+public class SaxEventRecorderTest {
+
+  Context context =  new ContextBase();
+
+
+  SAXParser createParser() throws Exception {
+    SAXParserFactory spf = SAXParserFactory.newInstance();
+    return spf.newSAXParser();
+  }
+
+  public List<SaxEvent> doTest(String filename) throws Exception {
+    SaxEventRecorder recorder = new SaxEventRecorder();
+    recorder.setContext(context);
+    FileInputStream fis = new FileInputStream(CoreTestConstants.TEST_DIR_PREFIX
+        + "input/joran/"+ filename);
+    recorder.recordEvents(fis);
+    return  recorder.getSaxEventList();
+    
+ 
+  }
+ 
+  public void dump(List<SaxEvent> seList) {
+    for (SaxEvent se : seList) {
+      System.out.println(se);
+    }
+  }
+
+  @Test
+  public void test1() throws Exception {
+    List<SaxEvent> seList = doTest("event1.xml");
+    StatusManager sm = context.getStatusManager();
+    assertTrue(sm.getLevel() == Status.INFO);
+    //dump(seList);  
+    assertEquals(11, seList.size());
+  }
+
+  @Test
+  public void test2() throws Exception {
+    List<SaxEvent> seList = doTest("ampEvent.xml");
+    StatusManager sm = context.getStatusManager();
+    assertTrue(sm.getLevel() == Status.INFO);
+    //dump(seList);  
+    assertEquals(3, seList.size());
+    
+    BodyEvent be = (BodyEvent) seList.get(1);
+    assertEquals("xxx & yyy", be.getText());
+  }
+
+  @Test
+  public void test3() throws Exception {
+    List<SaxEvent> seList = doTest("inc.xml");
+    StatusManager sm = context.getStatusManager();
+    assertTrue(sm.getLevel() == Status.INFO);
+    //dump(seList);  
+    assertEquals(4, seList.size());
+    
+    StartEvent se = (StartEvent) seList.get(1);
+    Attributes attr = se.getAttributes();
+    assertNotNull(attr);
+    assertEquals("1", attr.getValue("increment"));
+  }
+  
+  @Test
+  public void bodyWithSpacesAndQuotes() throws Exception {
+    List<SaxEvent> seList = doTest("spacesAndQuotes.xml");
+    assertEquals(3, seList.size());
+    BodyEvent be = (BodyEvent) seList.get(1);
+    assertEquals("[x][x] \"xyz\"%n", be.getText());
+  }
+  
+  
+
+}

-----------------------------------------------------------------------

Summary of changes:
 .../core/joran/event/SaxEventRecorderTest.java     |  110 ++++++++++++++++++++
 1 files changed, 110 insertions(+), 0 deletions(-)
 create mode 100644 logback-core/src/test/java/ch/qos/logback/core/joran/event/SaxEventRecorderTest.java


hooks/post-receive
-- 
Logback: the generic, reliable, fast and flexible logging framework.


More information about the logback-dev mailing list