You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gr...@apache.org on 2012/06/02 13:41:11 UTC

svn commit: r1345492 [5/18] - in /logging/log4j/branches/log4j12modules: ./ contribs/ contribs/CekiGulcu/ contribs/EirikLygre/ contribs/JamesHouse/ contribs/Jamie Tsao/ contribs/JimMoore/ contribs/KevinSteppe/ contribs/KitchingSimon/ contribs/LeosLiter...

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/LoggerTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/LoggerTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/MinimumTestCase.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/MinimumTestCase.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/MinimumTestCase.java (added)
+++ logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/MinimumTestCase.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,209 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.log4j;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.framework.Test;
+
+import org.apache.log4j.helpers.AbsoluteTimeDateFormat;
+import org.apache.log4j.util.*;
+
+/**
+   A superficial but general test of log4j.
+ */
+public class MinimumTestCase extends TestCase {
+
+  static final String FILE_PREFIX = "target/test-classes";
+  static final String INPUT_DIR = FILE_PREFIX + "/input";
+  static final String WITNESS_DIR = FILE_PREFIX + "/witness";
+  
+  static String FILTERED = "output/filtered";
+
+  static String EXCEPTION1 = "java.lang.Exception: Just testing";
+  static String EXCEPTION2 = "\\s*at .*\\(.*\\)";
+  static String EXCEPTION3 = "\\s*at .*\\(Native Method\\)";
+  static String EXCEPTION4 = "\\s*at .*\\(.*Compiled Code\\)";
+  static String EXCEPTION5 = "\\s*at .*\\(.*libgcj.*\\)";
+
+  //18 fevr. 2002 20:02:41,551 [main] FATAL ERR - Message 0
+
+  static String TTCC_PAT = Filter.ABSOLUTE_DATE_AND_TIME_PAT+ 
+              " \\[main]\\ (TRACE|DEBUG|INFO|WARN|ERROR|FATAL) .* - Message \\d{1,2}";
+
+  static String TTCC2_PAT = Filter.ABSOLUTE_DATE_AND_TIME_PAT+ 
+              " \\[main]\\ (TRACE|DEBUG|INFO|WARN|ERROR|FATAL) .* - Messages should bear numbers 0 through 29\\.";
+
+  //18 fvr. 2002 19:49:53,456
+
+  Logger root; 
+  Logger logger;
+
+  public MinimumTestCase(String name) {
+    super(name);
+  }
+
+  public void setUp() {
+    root = Logger.getRootLogger();
+    root.removeAllAppenders();
+  }
+
+  public void tearDown() {  
+    root.getLoggerRepository().resetConfiguration();
+  }
+
+  public void simple() throws Exception {
+    
+    Layout layout = new SimpleLayout();
+    Appender appender = new FileAppender(layout, "output/simple", false);
+    root.addAppender(appender);    
+    common();
+
+    Transformer.transform(
+      "output/simple", FILTERED,
+      new Filter[] { new LineNumberFilter(), 
+                     new SunReflectFilter(), 
+                     new JunitTestRunnerFilter() });
+    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/simple"));
+  }
+
+  public void ttcc() throws Exception {
+    
+    Layout layout = new TTCCLayout(AbsoluteTimeDateFormat.DATE_AND_TIME_DATE_FORMAT);
+    Appender appender = new FileAppender(layout, "output/ttcc", false);
+    root.addAppender(appender);    
+
+    String oldName = Thread.currentThread().getName();
+    Thread.currentThread().setName("main");
+    common();
+    Thread.currentThread().setName(oldName);
+
+    ControlFilter cf1 = new ControlFilter(new String[]{TTCC_PAT, 
+       TTCC2_PAT, EXCEPTION1, EXCEPTION2, 
+       EXCEPTION3, EXCEPTION4, EXCEPTION5 });
+
+    Transformer.transform(
+      "output/ttcc", FILTERED,
+      new Filter[] {
+        cf1, new LineNumberFilter(), 
+        new AbsoluteDateAndTimeFilter(),
+        new SunReflectFilter(), new JunitTestRunnerFilter()
+      });
+
+    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/ttcc"));
+  }
+
+
+  void common() {
+    
+    int i = 0;
+
+    // In the lines below, the category names are chosen as an aid in
+    // remembering their level values. In general, the category names
+    // have no bearing to level values.
+    
+    Logger ERR = Logger.getLogger("ERR");
+    ERR.setLevel(Level.ERROR);
+    Logger INF = Logger.getLogger("INF");
+    INF.setLevel(Level.INFO);
+    Logger INF_ERR = Logger.getLogger("INF.ERR");
+    INF_ERR.setLevel(Level.ERROR);
+    Logger DEB = Logger.getLogger("DEB");
+    DEB.setLevel(Level.DEBUG);
+    Logger TRC = Logger.getLogger("TRC");
+    TRC.setLevel(Level.TRACE);
+    
+    // Note: categories with undefined level 
+    Logger INF_UNDEF = Logger.getLogger("INF.UNDEF");
+    Logger INF_ERR_UNDEF = Logger.getLogger("INF.ERR.UNDEF");    
+    Logger UNDEF = Logger.getLogger("UNDEF");   
+
+
+    // These should all log.----------------------------
+    ERR.log(Level.FATAL, "Message " + i); i++;  //0
+    ERR.error( "Message " + i); i++;          
+
+    INF.log(Level.FATAL, "Message " + i); i++; // 2
+    INF.error( "Message " + i); i++;         
+    INF.warn ( "Message " + i); i++; 
+    INF.info ( "Message " + i); i++;
+
+    INF_UNDEF.log(Level.FATAL, "Message " + i); i++;  //6
+    INF_UNDEF.error( "Message " + i); i++;         
+    INF_UNDEF.warn ( "Message " + i); i++; 
+    INF_UNDEF.info ( "Message " + i); i++; 
+    
+    INF_ERR.log(Level.FATAL, "Message " + i); i++;  // 10
+    INF_ERR.error( "Message " + i); i++;  
+
+    INF_ERR_UNDEF.log(Level.FATAL, "Message " + i); i++; 
+    INF_ERR_UNDEF.error( "Message " + i); i++;             
+
+    DEB.log(Level.FATAL, "Message " + i); i++;  //14
+    DEB.error( "Message " + i); i++;         
+    DEB.warn ( "Message " + i); i++; 
+    DEB.info ( "Message " + i); i++; 
+    DEB.debug( "Message " + i); i++;             
+
+    TRC.log(Level.FATAL, "Message " + i); i++;  //19
+    TRC.error( "Message " + i); i++;         
+    TRC.warn ( "Message " + i); i++; 
+    TRC.info ( "Message " + i); i++; 
+    TRC.debug( "Message " + i); i++; 
+    TRC.trace( "Message " + i); i++; 
+    
+    // defaultLevel=DEBUG
+    UNDEF.log(Level.FATAL, "Message " + i); i++;  // 25
+    UNDEF.error("Message " + i); i++;         
+    UNDEF.warn ("Message " + i); i++; 
+    UNDEF.info ("Message " + i); i++; 
+    UNDEF.debug("Message " + i, new Exception("Just testing."));
+    int printCount = i;
+    i++;
+
+    // -------------------------------------------------
+    // The following should not log
+    ERR.warn("Message " + i);  i++; 
+    ERR.info("Message " + i);  i++; 
+    ERR.debug("Message " + i);  i++; 
+      
+    INF.debug("Message " + i);  i++; 
+    INF_UNDEF.debug("Message " + i); i++; 
+
+
+    INF_ERR.warn("Message " + i);  i++; 
+    INF_ERR.info("Message " + i);  i++; 
+    INF_ERR.debug("Message " + i); i++; 
+    INF_ERR_UNDEF.warn("Message " + i);  i++; 
+    INF_ERR_UNDEF.info("Message " + i);  i++; 
+    INF_ERR_UNDEF.debug("Message " + i); i++; 
+    
+    UNDEF.trace("Message " + i, new Exception("Just testing.")); i++;
+    // -------------------------------------------------
+      
+    INF.info("Messages should bear numbers 0 through "+printCount+".");
+  }
+
+  public static Test suite() {
+    TestSuite suite = new TestSuite();
+    suite.addTest(new MinimumTestCase("simple"));
+    suite.addTest(new MinimumTestCase("ttcc"));
+    return suite;
+  }
+
+}

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/MinimumTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/MyPatternLayout.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/MyPatternLayout.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/MyPatternLayout.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/MyPatternLayout.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/MyPatternLayout.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/MyPatternLayout.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/MyPatternLayout.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/MyPatternParser.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/MyPatternParser.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/MyPatternParser.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/MyPatternParser.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/MyPatternParser.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/MyPatternParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/MyPatternParser.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/PatternLayoutTest.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/PatternLayoutTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/PatternLayoutTest.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/PatternLayoutTest.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/PatternLayoutTest.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/PatternLayoutTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/PatternLayoutTestCase.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/PatternLayoutTestCase.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/PatternLayoutTestCase.java (added)
+++ logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/PatternLayoutTestCase.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,344 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.log4j;
+
+import junit.framework.TestCase;
+import org.apache.log4j.util.AbsoluteDateAndTimeFilter;
+import org.apache.log4j.util.AbsoluteTimeFilter;
+import org.apache.log4j.util.Compare;
+import org.apache.log4j.util.ControlFilter;
+import org.apache.log4j.util.Filter;
+import org.apache.log4j.util.ISO8601Filter;
+import org.apache.log4j.util.JunitTestRunnerFilter;
+import org.apache.log4j.util.LineNumberFilter;
+import org.apache.log4j.util.RelativeTimeFilter;
+import org.apache.log4j.util.SunReflectFilter;
+import org.apache.log4j.util.Transformer;
+
+public class PatternLayoutTestCase extends TestCase {
+
+  static final String FILE_PREFIX = "target/test-classes";
+  static final String INPUT_DIR = FILE_PREFIX + "/input";
+  static final String WITNESS_DIR = FILE_PREFIX + "/witness";
+  
+  static String TEMP = "output/temp";
+  static String FILTERED = "output/filtered";
+
+  Logger root; 
+  Logger logger;
+
+  static String EXCEPTION1 = "java.lang.Exception: Just testing";
+  static String EXCEPTION2 = "\\s*at .*\\(.*\\)";
+  static String EXCEPTION3 = "\\s*at .*\\(Native Method\\)";
+  static String EXCEPTION4 = "\\s*at .*\\(.*Compiled Code\\)";
+  static String EXCEPTION5 = "\\s*at .*\\(.*libgcj.*\\)";
+
+  static String PAT0 = "\\[main]\\ (TRACE|DEBUG|INFO |WARN |ERROR|FATAL) .* - Message \\d{1,2}";
+  static String PAT1 = Filter.ISO8601_PAT + " " + PAT0;
+  static String PAT2 = Filter.ABSOLUTE_DATE_AND_TIME_PAT+ " " + PAT0;
+  static String PAT3 = Filter.ABSOLUTE_TIME_PAT+ " " + PAT0;
+  static String PAT4 = Filter.RELATIVE_TIME_PAT+ " " + PAT0;
+
+  static String PAT5 = "\\[main]\\ (TRACE|DEBUG|INFO |WARN |ERROR|FATAL) .* : Message \\d{1,2}";
+  static String PAT6 = "\\[main]\\ (TRACE|DEBUG|INFO |WARN |ERROR|FATAL) org.apache.log4j.PatternLayoutTestCase.common\\(PatternLayoutTestCase.java(:\\d{1,4})?\\): Message \\d{1,2}";
+
+  static String PAT11a = "^(TRACE|DEBUG|INFO |WARN |ERROR|FATAL) \\[main]\\ log4j.PatternLayoutTestCase: Message \\d{1,2}";
+  static String PAT11b = "^(TRACE|DEBUG|INFO |WARN |ERROR|FATAL) \\[main]\\ root: Message \\d{1,2}";
+
+  static String PAT12 = "^\\[main]\\ (TRACE|DEBUG|INFO |WARN |ERROR|FATAL) "+
+    "org.apache.log4j.PatternLayoutTestCase.common\\(PatternLayoutTestCase.java:\\d{3}\\): "+
+    "Message \\d{1,2}";
+
+  static String PAT13 = "^\\[main]\\ (TRACE|DEBUG|INFO |WARN |ERROR|FATAL) "+
+    "apache.log4j.PatternLayoutTestCase.common\\(PatternLayoutTestCase.java:\\d{3}\\): "+
+    "Message \\d{1,2}";
+
+  static String PAT14 = "^(TRACE|DEBUG| INFO| WARN|ERROR|FATAL)\\ \\d{1,2}\\ *- Message \\d{1,2}";
+
+  public PatternLayoutTestCase(String name) {
+    super(name);
+  }
+
+  public void setUp() {
+    root = Logger.getRootLogger();
+    logger = Logger.getLogger(PatternLayoutTestCase.class);
+  }
+
+  public void tearDown() {  
+    root.getLoggerRepository().resetConfiguration();
+  }
+
+  public void test1() throws Exception {
+    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout1.properties");
+    common();
+    Transformer.transform(
+      TEMP, FILTERED,
+      new Filter[] {
+        new LineNumberFilter(), new SunReflectFilter(),
+        new JunitTestRunnerFilter()
+      });
+    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.1"));
+  }
+
+  public void test2() throws Exception {
+    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout2.properties");
+    common();
+    ControlFilter cf1 = new ControlFilter(new String[]{PAT1, EXCEPTION1, 
+						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
+    Transformer.transform(
+      TEMP, FILTERED,
+      new Filter[] {
+        cf1, new LineNumberFilter(), new ISO8601Filter(),
+        new SunReflectFilter(), new JunitTestRunnerFilter()
+      });
+    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.2"));
+  }
+
+  public void test3() throws Exception {
+    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout3.properties");
+    common();
+    ControlFilter cf1 = new ControlFilter(new String[]{PAT1, EXCEPTION1, 
+						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
+    Transformer.transform(
+      TEMP, FILTERED,
+      new Filter[] {
+        cf1, new LineNumberFilter(), new ISO8601Filter(),
+        new SunReflectFilter(), new JunitTestRunnerFilter()
+      });
+    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.3"));
+  }
+
+  // Output format:
+  // 06 avr. 2002 18:30:58,937 [main] DEBUG rnLayoutTestCase - Message 0  
+  public void test4() throws Exception {
+    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout4.properties");
+    common();
+    ControlFilter cf1 = new ControlFilter(new String[]{PAT2, EXCEPTION1, 
+						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
+    Transformer.transform(
+      TEMP, FILTERED,
+      new Filter[] {
+        cf1, new LineNumberFilter(), new AbsoluteDateAndTimeFilter(),
+        new SunReflectFilter(), new JunitTestRunnerFilter()
+      });
+    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.4"));
+  }
+
+  public void test5() throws Exception {
+    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout5.properties");
+    common();
+    ControlFilter cf1 = new ControlFilter(new String[]{PAT2, EXCEPTION1, 
+						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
+    Transformer.transform(
+      TEMP, FILTERED,
+      new Filter[] {
+        cf1, new LineNumberFilter(), new AbsoluteDateAndTimeFilter(),
+        new SunReflectFilter(), new JunitTestRunnerFilter()
+      });
+    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.5"));
+  }
+
+  // 18:54:19,201 [main] DEBUG rnLayoutTestCase - Message 0
+  public void test6() throws Exception {
+    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout6.properties");
+    common();
+    ControlFilter cf1 = new ControlFilter(new String[]{PAT3, EXCEPTION1, 
+						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
+    Transformer.transform(
+      TEMP, FILTERED,
+      new Filter[] {
+        cf1, new LineNumberFilter(), new AbsoluteTimeFilter(),
+        new SunReflectFilter(), new JunitTestRunnerFilter()
+      });
+    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.6"));
+  }
+
+
+  public void test7() throws Exception {
+    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout7.properties");
+    common();
+    ControlFilter cf1 = new ControlFilter(new String[]{PAT3, EXCEPTION1, 
+						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
+    Transformer.transform(
+      TEMP, FILTERED,
+      new Filter[] {
+        cf1, new LineNumberFilter(), new AbsoluteTimeFilter(),
+        new SunReflectFilter(), new JunitTestRunnerFilter()
+      });
+    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.7"));
+  }
+
+  public void test8() throws Exception {
+    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout8.properties");
+    common();
+    ControlFilter cf1 = new ControlFilter(new String[]{PAT4, EXCEPTION1, 
+						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
+    Transformer.transform(
+      TEMP, FILTERED,
+      new Filter[] {
+        cf1, new LineNumberFilter(), new RelativeTimeFilter(),
+        new SunReflectFilter(), new JunitTestRunnerFilter()
+      });
+    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.8"));
+  }
+
+  public void test9() throws Exception {
+    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout9.properties");
+    common();
+    ControlFilter cf1 = new ControlFilter(new String[]{PAT5, EXCEPTION1, 
+						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
+    Transformer.transform(
+      TEMP, FILTERED,
+      new Filter[] {
+        cf1, new LineNumberFilter(), new SunReflectFilter(),
+        new JunitTestRunnerFilter()
+      });
+    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.9"));
+  }
+
+  public void test10() throws Exception {
+    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout10.properties");
+    common();
+    ControlFilter cf1 = new ControlFilter(new String[]{PAT6, EXCEPTION1, 
+						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
+    Transformer.transform(
+      TEMP, FILTERED,
+      new Filter[] {
+        cf1, new LineNumberFilter(), new SunReflectFilter(),
+        new JunitTestRunnerFilter()
+      });
+    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.10"));
+  }
+
+  public void test11() throws Exception {
+    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout11.properties");
+    common();
+    ControlFilter cf1 = new ControlFilter(new String[]{PAT11a, PAT11b, EXCEPTION1, 
+						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
+    Transformer.transform(
+      TEMP, FILTERED,
+      new Filter[] {
+        cf1, new LineNumberFilter(), new SunReflectFilter(),
+        new JunitTestRunnerFilter()
+      });
+    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.11"));
+  }
+
+  public void test12() throws Exception {
+    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout12.properties");
+    common();
+    ControlFilter cf1 = new ControlFilter(new String[]{PAT12, EXCEPTION1, 
+						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
+    Transformer.transform(
+      TEMP, FILTERED,
+      new Filter[] {
+        cf1, new LineNumberFilter(), new SunReflectFilter(),
+        new JunitTestRunnerFilter()
+      });
+    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.12"));
+  }
+
+  public void test13() throws Exception {
+    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout13.properties");
+    common();
+    ControlFilter cf1 = new ControlFilter(new String[]{PAT13, EXCEPTION1, 
+						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
+    Transformer.transform(
+      TEMP, FILTERED,
+      new Filter[] {
+        cf1, new LineNumberFilter(), new SunReflectFilter(),
+        new JunitTestRunnerFilter()
+      });
+    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.13"));
+  }
+
+  public void test14() throws Exception {
+    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout14.properties");
+    common();
+    ControlFilter cf1 = new ControlFilter(new String[]{PAT14, EXCEPTION1, 
+						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
+    Transformer.transform(
+      TEMP, FILTERED,
+      new Filter[] {
+        cf1, new LineNumberFilter(), new SunReflectFilter(),
+        new JunitTestRunnerFilter()
+      });
+    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.14"));
+  }
+
+    public void testMDC1() throws Exception {
+      PropertyConfigurator.configure(INPUT_DIR + "/patternLayout.mdc.1.properties");
+      MDC.put("key1", "va11");
+      MDC.put("key2", "va12");
+      logger.debug("Hello World");
+      MDC.remove("key1");
+      MDC.remove("key2");
+
+      assertTrue(Compare.compare(TEMP, WITNESS_DIR + "/patternLayout.mdc.1"));
+    }
+
+    public void testMDCClear() throws Exception {
+      PropertyConfigurator.configure(INPUT_DIR + "/patternLayout.mdc.1.properties");
+      MDC.put("key1", "va11");
+      MDC.put("key2", "va12");
+      logger.debug("Hello World");
+      MDC.clear();
+      logger.debug("Hello World");
+
+      assertTrue(Compare.compare(TEMP, WITNESS_DIR + "/patternLayout.mdc.clear"));
+    }
+
+
+
+  void common() {
+    String oldThreadName = Thread.currentThread().getName();
+    Thread.currentThread().setName("main");
+
+    int i = -1;
+
+    logger.trace("Message " + ++i);
+    root.trace("Message " + i);
+
+    logger.debug("Message " + ++i);
+    root.debug("Message " + i);
+
+    logger.info ("Message " + ++i);
+    root.info("Message " + i);
+
+    logger.warn ("Message " + ++i);
+    root.warn("Message " + i);
+
+    logger.error("Message " + ++i);
+    root.error("Message " + i);
+
+    logger.log(Level.FATAL, "Message " + ++i);
+    root.log(Level.FATAL, "Message " + i);
+
+    Exception e = new Exception("Just testing");
+    logger.trace("Message " + ++i, e);
+    logger.debug("Message " + ++i, e);
+    logger.info("Message " + ++i, e);
+    logger.warn("Message " + ++i , e);
+    logger.error("Message " + ++i, e);
+    logger.log(Level.FATAL, "Message " + ++i, e);
+
+    Thread.currentThread().setName(oldThreadName);
+  }
+
+
+}

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/PatternLayoutTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/PriorityTest.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/PriorityTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/PriorityTest.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/PriorityTest.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/PriorityTest.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/PriorityTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/PropertyConfiguratorTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/PropertyConfiguratorTest.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/PropertyConfiguratorTest.java (added)
+++ logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/PropertyConfiguratorTest.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,382 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Properties;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.spi.Filter;
+import org.apache.log4j.spi.LoggingEvent;
+import org.apache.log4j.spi.OptionHandler;
+import org.apache.log4j.spi.ThrowableRenderer;
+import org.apache.log4j.spi.ThrowableRendererSupport;
+import org.apache.log4j.varia.LevelRangeFilter;
+
+/**
+ * Test property configurator.
+ *
+ */
+public class PropertyConfiguratorTest extends TestCase {
+
+    static final String FILE_PREFIX = "target/test-classes";
+    static final String INPUT_DIR = FILE_PREFIX + "/input";
+    static final String WITNESS_DIR = FILE_PREFIX + "/witness";
+
+    public PropertyConfiguratorTest(final String testName) {
+        super(testName);
+    }
+
+    /**
+     * Test for bug 40944.
+     * Did not catch IllegalArgumentException on Properties.load
+     * and close input stream.
+     * @throws IOException if IOException creating properties file.
+     */
+    public void testBadUnicodeEscape() throws IOException {
+        String fileName = "output/badescape.properties";
+        FileWriter writer = new FileWriter(fileName);
+        writer.write("log4j.rootLogger=\\uXX41");
+        writer.close();
+        PropertyConfigurator.configure(fileName);
+        File file = new File(fileName);
+        assertTrue(file.delete()) ;
+        assertFalse(file.exists());
+    }
+
+    /**
+     * Test for bug 40944.
+     * configure(URL) never closed opened stream.
+     * @throws IOException if IOException creating properties file.
+     */
+        public void testURL() throws IOException {
+        File file = new File("output/unclosed.properties");
+        FileWriter writer = new FileWriter(file);
+        writer.write("log4j.rootLogger=debug");
+        writer.close();
+        URL url = file.toURL();
+        PropertyConfigurator.configure(url);
+        assertTrue(file.delete());
+        assertFalse(file.exists());
+    }
+
+    /**
+     * Test for bug 40944.
+     * configure(URL) did not catch IllegalArgumentException and
+     * did not close stream.
+     * @throws IOException if IOException creating properties file.
+     */
+        public void testURLBadEscape() throws IOException {
+        File file = new File("output/urlbadescape.properties");
+        FileWriter writer = new FileWriter(file);
+        writer.write("log4j.rootLogger=\\uXX41");
+        writer.close();
+        URL url = file.toURL();
+        PropertyConfigurator.configure(url);
+        assertTrue(file.delete());
+        assertFalse(file.exists());
+    }
+
+    /**
+     * Tests configuring Log4J from an InputStream.
+     * 
+     * @since 1.2.17
+     */
+    public void testInputStream() throws IOException {
+        File file = new File("input/filter1.properties");
+        assertTrue(file.exists());
+        FileInputStream inputStream = new FileInputStream(file);
+        try {
+            PropertyConfigurator.configure(inputStream);
+        } finally {
+            inputStream.close();
+        }
+        this.validateNested();
+        LogManager.resetConfiguration();
+    }
+
+    public void validateNested() {
+        RollingFileAppender rfa = (RollingFileAppender)
+                Logger.getLogger("org.apache.log4j.PropertyConfiguratorTest")
+                   .getAppender("ROLLING");
+        FixedWindowRollingPolicy rollingPolicy = (FixedWindowRollingPolicy) rfa.getRollingPolicy();
+        assertEquals("filterBase-test1.log", rollingPolicy.getActiveFileName());
+        assertEquals("filterBased-test1.%i", rollingPolicy.getFileNamePattern());
+        assertEquals(0, rollingPolicy.getMinIndex());
+        assertTrue(rollingPolicy.isActivated());
+        FilterBasedTriggeringPolicy triggeringPolicy =
+                (FilterBasedTriggeringPolicy) rfa.getTriggeringPolicy();
+        LevelRangeFilter filter = (LevelRangeFilter) triggeringPolicy.getFilter();
+        assertTrue(Level.INFO.equals(filter.getLevelMin()));        
+    }
+    
+    /**
+     * Test for bug 47465.
+     * configure(URL) did not close opened JarURLConnection.
+     * @throws IOException if IOException creating properties jar.
+     */
+    public void testJarURL() throws IOException {
+        File dir = new File("output");
+        dir.mkdirs();
+        File file = new File("output/properties.jar");
+        ZipOutputStream zos =
+            new ZipOutputStream(new FileOutputStream(file));
+        zos.putNextEntry(new ZipEntry(LogManager.DEFAULT_CONFIGURATION_FILE));
+        zos.write("log4j.rootLogger=debug".getBytes());
+        zos.closeEntry();
+        zos.close();
+        URL url = new URL("jar:" + file.toURL() + "!/" +
+                LogManager.DEFAULT_CONFIGURATION_FILE);
+        PropertyConfigurator.configure(url);
+        assertTrue(file.delete());
+        assertFalse(file.exists());
+    }
+
+    /**
+     * Test processing of log4j.reset property, see bug 17531.
+     *
+     */
+    public void testReset() {
+        VectorAppender appender = new VectorAppender();
+        appender.setName("A1");
+        Logger.getRootLogger().addAppender(appender);
+        Properties props = new Properties();
+        props.put("log4j.reset", "true");
+        PropertyConfigurator.configure(props);
+        assertNull(Logger.getRootLogger().getAppender("A1"));
+        LogManager.resetConfiguration();
+    }
+
+
+    /**
+     * Mock definition of org.apache.log4j.rolling.RollingPolicy
+     * from extras companion.
+     */
+    public static class RollingPolicy implements OptionHandler {
+        private boolean activated = false;
+
+        public RollingPolicy() {
+
+        }
+        public void activateOptions() {
+            activated = true;
+        }
+
+        public final boolean isActivated() {
+            return activated;
+        }
+
+    }
+
+    /**
+     * Mock definition of FixedWindowRollingPolicy from extras companion.
+     */
+    public static final class FixedWindowRollingPolicy extends RollingPolicy {
+        private String activeFileName;
+        private String fileNamePattern;
+        private int minIndex;
+
+        public FixedWindowRollingPolicy() {
+            minIndex = -1;
+        }
+
+        public String getActiveFileName() {
+            return activeFileName;
+        }
+        public void setActiveFileName(final String val) {
+            activeFileName = val;
+        }
+
+        public String getFileNamePattern() {
+            return fileNamePattern;
+        }
+        public void setFileNamePattern(final String val) {
+            fileNamePattern = val;
+        }
+
+        public int getMinIndex() {
+            return minIndex;
+        }
+
+        public void setMinIndex(final int val) {
+            minIndex = val;
+        }
+    }
+
+    /**
+     * Mock definition of TriggeringPolicy from extras companion.
+     */
+    public static class TriggeringPolicy implements OptionHandler {
+        private boolean activated = false;
+
+        public TriggeringPolicy() {
+
+        }
+        public void activateOptions() {
+            activated = true;
+        }
+
+        public final boolean isActivated() {
+            return activated;
+        }
+
+    }
+
+    /**
+     * Mock definition of FilterBasedTriggeringPolicy from extras companion.
+     */
+    public static final class FilterBasedTriggeringPolicy extends TriggeringPolicy {
+        private Filter filter;
+        public FilterBasedTriggeringPolicy() {
+        }
+
+        public void setFilter(final Filter val) {
+             filter = val;
+        }
+
+        public Filter getFilter() {
+            return filter;
+
+        }
+    }
+
+    /**
+     * Mock definition of org.apache.log4j.rolling.RollingFileAppender
+     * from extras companion.
+     */
+    public static final class RollingFileAppender extends AppenderSkeleton {
+        private RollingPolicy rollingPolicy;
+        private TriggeringPolicy triggeringPolicy;
+        private boolean append;
+
+        public RollingFileAppender() {
+
+        }
+
+        public RollingPolicy getRollingPolicy() {
+            return rollingPolicy;
+        }
+
+        public void setRollingPolicy(final RollingPolicy policy) {
+            rollingPolicy = policy;
+        }
+
+        public TriggeringPolicy getTriggeringPolicy() {
+            return triggeringPolicy;
+        }
+
+        public void setTriggeringPolicy(final TriggeringPolicy policy) {
+            triggeringPolicy = policy;
+        }
+
+        public boolean getAppend() {
+            return append;
+        }
+
+        public void setAppend(boolean val) {
+            append = val;
+        }
+
+        public void close() {
+
+        }
+
+        public boolean requiresLayout() {
+            return true;
+        }
+
+        public void append(final LoggingEvent event) {
+
+        }
+    }
+
+    /**
+     * Tests processing of nested objects, see bug 36384.
+     */
+    public void testNested() {
+        PropertyConfigurator.configure(INPUT_DIR + "/filter1.properties");
+        RollingFileAppender rfa = (RollingFileAppender)
+                Logger.getLogger("org.apache.log4j.PropertyConfiguratorTest")
+                   .getAppender("ROLLING");
+        FixedWindowRollingPolicy rollingPolicy = (FixedWindowRollingPolicy) rfa.getRollingPolicy();
+        assertEquals("filterBase-test1.log", rollingPolicy.getActiveFileName());
+        assertEquals("filterBased-test1.%i", rollingPolicy.getFileNamePattern());
+        assertEquals(0, rollingPolicy.getMinIndex());
+        assertTrue(rollingPolicy.isActivated());
+        FilterBasedTriggeringPolicy triggeringPolicy =
+                (FilterBasedTriggeringPolicy) rfa.getTriggeringPolicy();
+        LevelRangeFilter filter = (LevelRangeFilter) triggeringPolicy.getFilter();
+        assertTrue(Level.INFO.equals(filter.getLevelMin()));
+        LogManager.resetConfiguration();
+    }
+
+
+    /**
+     * Mock ThrowableRenderer for testThrowableRenderer.  See bug 45721.
+     */
+    public static class MockThrowableRenderer implements ThrowableRenderer, OptionHandler {
+        private boolean activated = false;
+        private boolean showVersion = true;
+
+        public MockThrowableRenderer() {
+        }
+
+        public void activateOptions() {
+            activated = true;
+        }
+
+        public boolean isActivated() {
+            return activated;
+        }
+
+        public String[] doRender(final Throwable t) {
+            return new String[0];
+        }
+
+        public void setShowVersion(boolean v) {
+            showVersion = v;
+        }
+
+        public boolean getShowVersion() {
+            return showVersion;
+        }
+    }
+
+    /**
+     * Test of log4j.throwableRenderer support.  See bug 45721.
+     */
+    public void testThrowableRenderer() {
+        Properties props = new Properties();
+        props.put("log4j.throwableRenderer", "org.apache.log4j.PropertyConfiguratorTest$MockThrowableRenderer");
+        props.put("log4j.throwableRenderer.showVersion", "false");
+        PropertyConfigurator.configure(props);
+        ThrowableRendererSupport repo = (ThrowableRendererSupport) LogManager.getLoggerRepository();
+        MockThrowableRenderer renderer = (MockThrowableRenderer) repo.getThrowableRenderer();
+        LogManager.resetConfiguration();
+        assertNotNull(renderer);
+        assertEquals(true, renderer.isActivated());
+        assertEquals(false, renderer.getShowVersion());
+    }
+}

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/PropertyConfiguratorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/RFATestCase.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/RFATestCase.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/RFATestCase.java (added)
+++ logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/RFATestCase.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,241 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.log4j;
+
+import junit.framework.TestCase;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+/**
+ *  Test of RollingFileAppender.
+ *
+ * @author Curt Arnold
+ */
+public class RFATestCase extends TestCase {
+
+  static final String FILE_PREFIX = "target/test-classes";
+  static final String INPUT_DIR = FILE_PREFIX + "/input";
+  static final String WITNESS_DIR = FILE_PREFIX + "/witness";
+  
+  public RFATestCase(String name) {
+    super(name);
+  }
+
+  public void tearDown() {
+      LogManager.resetConfiguration();
+  }
+
+    /**
+     * Test basic rolling functionality using property file configuration.
+     */
+    public void test1() throws Exception {
+     Logger logger = Logger.getLogger(RFATestCase.class);
+      PropertyConfigurator.configure(INPUT_DIR + "/RFA1.properties");
+
+      // Write exactly 10 bytes with each log
+      for (int i = 0; i < 25; i++) {
+        if (i < 10) {
+          logger.debug("Hello---" + i);
+        } else if (i < 100) {
+          logger.debug("Hello--" + i);
+        }
+      }
+
+      assertTrue(new File("output/RFA-test1.log").exists());
+      assertTrue(new File("output/RFA-test1.log.1").exists());
+    }
+
+    /**
+     * Test basic rolling functionality using API configuration.
+     */
+    public void test2() throws Exception {
+      Logger logger = Logger.getLogger(RFATestCase.class);
+      Logger root = Logger.getRootLogger();
+      PatternLayout layout = new PatternLayout("%m\n");
+      org.apache.log4j.RollingFileAppender rfa =
+        new org.apache.log4j.RollingFileAppender();
+      rfa.setName("ROLLING");
+      rfa.setLayout(layout);
+      rfa.setAppend(false);
+      rfa.setMaxBackupIndex(3);
+      rfa.setMaximumFileSize(100);
+      rfa.setFile("output/RFA-test2.log");
+      rfa.activateOptions();
+      root.addAppender(rfa);
+
+      // Write exactly 10 bytes with each log
+      for (int i = 0; i < 55; i++) {
+        if (i < 10) {
+          logger.debug("Hello---" + i);
+        } else if (i < 100) {
+          logger.debug("Hello--" + i);
+        }
+      }
+
+      assertTrue(new File("output/RFA-test2.log").exists());
+      assertTrue(new File("output/RFA-test2.log.1").exists());
+      assertTrue(new File("output/RFA-test2.log.2").exists());
+      assertTrue(new File("output/RFA-test2.log.3").exists());
+      assertFalse(new File("output/RFA-test2.log.4").exists());
+    }
+
+    /**
+     * Tests 2 parameter constructor.
+     * @throws IOException if IOException during test.
+     */
+    public void test2ParamConstructor() throws IOException {
+        SimpleLayout layout = new SimpleLayout();
+        RollingFileAppender appender =
+                new RollingFileAppender(layout,"output/rfa_2param.log");
+        assertEquals(1, appender.getMaxBackupIndex());
+        assertEquals(10*1024*1024, appender.getMaximumFileSize());
+    }
+    /**
+     * Tests 3 parameter constructor.
+     * @throws IOException if IOException during test.
+     */
+    public void test3ParamConstructor() throws IOException {
+        SimpleLayout layout = new SimpleLayout();
+        RollingFileAppender appender =
+                new RollingFileAppender(layout,"output/rfa_3param.log", false);
+        assertEquals(1, appender.getMaxBackupIndex());
+    }
+
+    /**
+     * Test locking of .1 file.
+     */
+    public void testLockDotOne() throws Exception {
+      Logger logger = Logger.getLogger(RFATestCase.class);
+      Logger root = Logger.getRootLogger();
+      PatternLayout layout = new PatternLayout("%m\n");
+      org.apache.log4j.RollingFileAppender rfa =
+        new org.apache.log4j.RollingFileAppender();
+      rfa.setName("ROLLING");
+      rfa.setLayout(layout);
+      rfa.setAppend(false);
+      rfa.setMaxBackupIndex(10);
+      rfa.setMaximumFileSize(100);
+      rfa.setFile("output/RFA-dot1.log");
+      rfa.activateOptions();
+      root.addAppender(rfa);
+
+      new File("output/RFA-dot1.log.2").delete();
+
+      FileWriter dot1 = new FileWriter("output/RFA-dot1.log.1");
+      dot1.write("Locked file");
+      FileWriter dot5 = new FileWriter("output/RFA-dot1.log.5");
+      dot5.write("Unlocked file");
+      dot5.close();
+
+      // Write exactly 10 bytes with each log
+      for (int i = 0; i < 15; i++) {
+        if (i < 10) {
+          logger.debug("Hello---" + i);
+        } else if (i < 100) {
+          logger.debug("Hello--" + i);
+        }
+      }
+      dot1.close();
+
+      for (int i = 15; i < 25; i++) {
+            logger.debug("Hello--" + i);
+      }
+      rfa.close();
+
+
+      assertTrue(new File("output/RFA-dot1.log.7").exists());
+      //
+      //     if .2 is the locked file then
+      //       renaming wasn't successful until the file was closed
+      if (new File("output/RFA-dot1.log.2").length() < 15) {
+          assertEquals(50, new File("output/RFA-dot1.log").length());
+          assertEquals(200, new File("output/RFA-dot1.log.1").length());
+      } else {
+          assertTrue(new File("output/RFA-dot1.log").exists());
+          assertTrue(new File("output/RFA-dot1.log.1").exists());
+          assertTrue(new File("output/RFA-dot1.log.2").exists());
+          assertTrue(new File("output/RFA-dot1.log.3").exists());
+          assertFalse(new File("output/RFA-dot1.log.4").exists());
+      }
+    }
+
+
+    /**
+     * Test locking of .3 file.
+     */
+    public void testLockDotThree() throws Exception {
+      Logger logger = Logger.getLogger(RFATestCase.class);
+      Logger root = Logger.getRootLogger();
+      PatternLayout layout = new PatternLayout("%m\n");
+      org.apache.log4j.RollingFileAppender rfa =
+        new org.apache.log4j.RollingFileAppender();
+      rfa.setName("ROLLING");
+      rfa.setLayout(layout);
+      rfa.setAppend(false);
+      rfa.setMaxBackupIndex(10);
+      rfa.setMaximumFileSize(100);
+      rfa.setFile("output/RFA-dot3.log");
+      rfa.activateOptions();
+      root.addAppender(rfa);
+
+      new File("output/RFA-dot3.log.1").delete();
+      new File("output/RFA-dot3.log.2").delete();
+      new File("output/RFA-dot3.log.4").delete();
+
+      FileWriter dot3 = new FileWriter("output/RFA-dot3.log.3");
+      dot3.write("Locked file");
+      FileWriter dot5 = new FileWriter("output/RFA-dot3.log.5");
+      dot5.write("Unlocked file");
+      dot5.close();
+
+      // Write exactly 10 bytes with each log
+      for (int i = 0; i < 15; i++) {
+        if (i < 10) {
+          logger.debug("Hello---" + i);
+        } else if (i < 100) {
+          logger.debug("Hello--" + i);
+        }
+      }
+      dot3.close();
+
+      for (int i = 15; i < 35; i++) {
+          logger.debug("Hello--" + i);
+      }
+      rfa.close();
+
+      assertTrue(new File("output/RFA-dot3.log.8").exists());
+      //
+      //     if .3 is the locked file then
+      //       renaming wasn't successful until file was closed
+      if (new File("output/RFA-dot3.log.5").exists()) {
+          assertEquals(50, new File("output/RFA-dot3.log").length());
+          assertEquals(100, new File("output/RFA-dot3.log.1").length());
+          assertEquals(200, new File("output/RFA-dot3.log.2").length());
+      } else {
+          assertTrue(new File("output/RFA-dot3.log").exists());
+          assertTrue(new File("output/RFA-dot3.log.1").exists());
+          assertTrue(new File("output/RFA-dot3.log.2").exists());
+          assertTrue(new File("output/RFA-dot3.log.3").exists());
+          assertFalse(new File("output/RFA-dot3.log.4").exists());
+      }
+    }
+
+
+}

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/RFATestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/StressCategory.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/StressCategory.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/StressCategory.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/StressCategory.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/StressCategory.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/StressCategory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/StressCategory.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/TTCCLayoutTest.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/TTCCLayoutTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/TTCCLayoutTest.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/TTCCLayoutTest.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/TTCCLayoutTest.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/TTCCLayoutTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/TestLogMF.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/TestLogMF.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/TestLogMF.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/TestLogMF.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/TestLogMF.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/TestLogMF.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/TestLogMF.java
------------------------------------------------------------------------------
    svn:executable = 

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/TestLogSF.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/TestLogSF.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/TestLogSF.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/TestLogSF.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/TestLogSF.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/TestLogSF.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/TestLogSF.java
------------------------------------------------------------------------------
    svn:executable = 

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/TestLogXF.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/TestLogXF.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/TestLogXF.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/TestLogXF.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/TestLogXF.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/TestLogXF.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/VectorAppender.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/VectorAppender.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/VectorAppender.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/VectorAppender.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/VectorAppender.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/VectorAppender.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/VectorAppender.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/VectorErrorHandler.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/VectorErrorHandler.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/VectorErrorHandler.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/VectorErrorHandler.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/VectorErrorHandler.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/VectorErrorHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/customLogger/XLogger.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/customLogger/XLogger.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/customLogger/XLogger.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/customLogger/XLogger.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/customLogger/XLogger.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/customLogger/XLogger.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/customLogger/XLogger.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/customLogger/XLoggerTestCase.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/customLogger/XLoggerTestCase.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/customLogger/XLoggerTestCase.java (added)
+++ logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/customLogger/XLoggerTestCase.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.log4j.customLogger;
+
+import org.apache.log4j.xml.DOMConfigurator;
+import org.apache.log4j.util.*;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.framework.Test;
+
+/**
+   Tests handling of custom loggers.
+   
+   @author Ceki G&uuml;lc&uuml;
+*/
+public class XLoggerTestCase extends TestCase {
+
+  static String FILTERED = "output/filtered";
+  static XLogger logger = (XLogger) XLogger.getLogger(XLoggerTestCase.class);
+
+  public XLoggerTestCase(String name){
+    super(name);
+  }
+
+  public void tearDown() {
+    logger.getLoggerRepository().resetConfiguration();
+  }
+
+  public void test1()  throws Exception  { common(1); }
+  public void test2()  throws Exception  { common(2); }
+
+  void common(int number) throws Exception {
+    DOMConfigurator.configure("target/test-classes/input/xml/customLogger"+number+".xml");
+
+    int i = -1;
+
+    logger.trace("Message " + ++i);
+    logger.debug("Message " + ++i);
+    logger.warn ("Message " + ++i);
+    logger.error("Message " + ++i);
+    logger.fatal("Message " + ++i);
+    Exception e = new Exception("Just testing");
+    logger.debug("Message " + ++i, e);
+
+    Transformer.transform(
+      "output/temp", FILTERED,
+      new Filter[] {
+        new LineNumberFilter(), new SunReflectFilter(),
+        new JunitTestRunnerFilter()
+      });
+    assertTrue(Compare.compare(FILTERED, "target/test-classes/witness/customLogger."+number));
+
+  }
+
+  public static Test suite() {
+    TestSuite suite = new TestSuite();
+    suite.addTest(new XLoggerTestCase("test1"));
+    suite.addTest(new XLoggerTestCase("test2"));
+    return suite;
+  }
+}

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/customLogger/XLoggerTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase1.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/defaultInit/TestCase1.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase1.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase1.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/defaultInit/TestCase1.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase1.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase1.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase2.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/defaultInit/TestCase2.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase2.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase2.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/defaultInit/TestCase2.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase2.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase3.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/defaultInit/TestCase3.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase3.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase3.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/defaultInit/TestCase3.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase3.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase3.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase4.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/defaultInit/TestCase4.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase4.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase4.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/defaultInit/TestCase4.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase4.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/defaultInit/TestCase4.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/BoundedFIFOTestCase.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/helpers/BoundedFIFOTestCase.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/BoundedFIFOTestCase.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/BoundedFIFOTestCase.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/helpers/BoundedFIFOTestCase.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/BoundedFIFOTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/BoundedFIFOTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/CyclicBufferTestCase.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/helpers/CyclicBufferTestCase.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/CyclicBufferTestCase.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/CyclicBufferTestCase.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/helpers/CyclicBufferTestCase.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/CyclicBufferTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/CyclicBufferTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/DateLayoutTest.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/helpers/DateLayoutTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/DateLayoutTest.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/DateLayoutTest.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/helpers/DateLayoutTest.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/DateLayoutTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/LogLogTest.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/helpers/LogLogTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/LogLogTest.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/LogLogTest.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/helpers/LogLogTest.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/LogLogTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/OptionConverterTestCase.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/helpers/OptionConverterTestCase.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/OptionConverterTestCase.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/OptionConverterTestCase.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/helpers/OptionConverterTestCase.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/OptionConverterTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/OptionConverterTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/PatternParserTestCase.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/PatternParserTestCase.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/PatternParserTestCase.java (added)
+++ logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/PatternParserTestCase.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.log4j.helpers;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.framework.Test;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+import org.apache.log4j.Appender;
+import org.apache.log4j.FileAppender;
+import org.apache.log4j.PatternLayout;
+import org.apache.log4j.MDC;
+
+import org.apache.log4j.util.Compare;
+
+/**
+   Test case for helpers/PatternParser.java. Tests the various 
+   conversion patterns supported by PatternParser. This test
+   class tests PatternParser via the PatternLayout class which
+   uses it.
+ */
+public class PatternParserTestCase extends TestCase {
+  
+  static String OUTPUT_FILE   = "output/PatternParser";
+  static String WITNESS_FILE  = "target/test-classes/witness/PatternParser";
+
+  static String msgPattern = "%m%n";
+  
+  Logger root; 
+  Logger logger;
+
+  public PatternParserTestCase(String name) {
+    super(name);
+  }
+
+  public void setUp() {
+    root = Logger.getRootLogger();
+    root.removeAllAppenders();
+  }
+
+  public void tearDown() {  
+    root.getLoggerRepository().resetConfiguration();
+  }
+
+  /**
+    Test case for MDC conversion pattern. */
+  public void mdcPattern() throws Exception {
+    
+    String mdcMsgPattern1 = "%m : %X%n";
+    String mdcMsgPattern2 = "%m : %X{key1}%n";
+    String mdcMsgPattern3 = "%m : %X{key2}%n";
+    String mdcMsgPattern4 = "%m : %X{key3}%n";
+    String mdcMsgPattern5 = "%m : %X{key1},%X{key2},%X{key3}%n";
+    
+    // set up appender
+    PatternLayout layout = new PatternLayout(msgPattern);
+    Appender appender = new FileAppender(layout, OUTPUT_FILE+"_mdc", false);
+            
+    // set appender on root and set level to debug
+    root.addAppender(appender);
+    root.setLevel(Level.DEBUG);
+    
+    // output starting message
+    root.debug("starting mdc pattern test");
+ 
+    layout.setConversionPattern(mdcMsgPattern1);
+    root.debug("empty mdc, no key specified in pattern");
+    
+    layout.setConversionPattern(mdcMsgPattern2);
+    root.debug("empty mdc, key1 in pattern");
+    
+    layout.setConversionPattern(mdcMsgPattern3);
+    root.debug("empty mdc, key2 in pattern");
+    
+    layout.setConversionPattern(mdcMsgPattern4);
+    root.debug("empty mdc, key3 in pattern");
+    
+    layout.setConversionPattern(mdcMsgPattern5);
+    root.debug("empty mdc, key1, key2, and key3 in pattern");
+
+    MDC.put("key1", "value1");
+    MDC.put("key2", "value2");
+
+    layout.setConversionPattern(mdcMsgPattern1);
+    root.debug("filled mdc, no key specified in pattern");
+    
+    layout.setConversionPattern(mdcMsgPattern2);
+    root.debug("filled mdc, key1 in pattern");
+    
+    layout.setConversionPattern(mdcMsgPattern3);
+    root.debug("filled mdc, key2 in pattern");
+    
+    layout.setConversionPattern(mdcMsgPattern4);
+    root.debug("filled mdc, key3 in pattern");
+    
+    layout.setConversionPattern(mdcMsgPattern5);
+    root.debug("filled mdc, key1, key2, and key3 in pattern");
+
+    MDC.remove("key1");
+    MDC.remove("key2");
+
+    layout.setConversionPattern(msgPattern);
+    root.debug("finished mdc pattern test");
+
+    assertTrue(Compare.compare(OUTPUT_FILE+"_mdc", WITNESS_FILE+"_mdc"));
+  }
+
+  public static Test suite() {
+    TestSuite suite = new TestSuite();
+    //
+    //   MDC requires JDK 1.2+
+    //
+    if (!System.getProperty("java.version").startsWith("1.1.")) {
+       suite.addTest(new PatternParserTestCase("mdcPattern"));
+    }
+    return suite;
+  }
+
+}

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/helpers/PatternParserTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/or/ORTestCase.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/or/ORTestCase.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/or/ORTestCase.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/or/ORTestCase.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/or/ORTestCase.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/or/ORTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/or/ORTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/CachedDateFormatTest.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/pattern/CachedDateFormatTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/CachedDateFormatTest.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/CachedDateFormatTest.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/pattern/CachedDateFormatTest.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/CachedDateFormatTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/CachedDateFormatTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/FormattingInfoTest.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/pattern/FormattingInfoTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/FormattingInfoTest.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/FormattingInfoTest.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/pattern/FormattingInfoTest.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/FormattingInfoTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/FormattingInfoTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/NameAbbreviatorTest.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/pattern/NameAbbreviatorTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/NameAbbreviatorTest.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/NameAbbreviatorTest.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/pattern/NameAbbreviatorTest.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/NameAbbreviatorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/NameAbbreviatorTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/Num343PatternConverter.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/pattern/Num343PatternConverter.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/Num343PatternConverter.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/Num343PatternConverter.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/pattern/Num343PatternConverter.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/Num343PatternConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/Num343PatternConverter.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/PatternParserTest.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/pattern/PatternParserTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/PatternParserTest.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/PatternParserTest.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/pattern/PatternParserTest.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/PatternParserTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/pattern/PatternParserTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/spi/LocationInfoTest.java (from r1345481, logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/spi/LocationInfoTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/spi/LocationInfoTest.java?p2=logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/spi/LocationInfoTest.java&p1=logging/log4j/branches/log4j12modules/tests/src/java/org/apache/log4j/spi/LocationInfoTest.java&r1=1345481&r2=1345492&rev=1345492&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12modules/core/src/test/java/org/apache/log4j/spi/LocationInfoTest.java
------------------------------------------------------------------------------
    svn:eol-style = native