logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grobme...@apache.org
Subject svn commit: r1345524 [5/17] - in /logging/log4j/branches/log4j12-bz53299: ./ contribs/ contribs/CekiGulcu/ contribs/EirikLygre/ contribs/JamesHouse/ contribs/Jamie Tsao/ contribs/JimMoore/ contribs/KevinSteppe/ contribs/KitchingSimon/ contribs/LeosLite...
Date Sat, 02 Jun 2012 15:36:26 GMT
Added: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LevelTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LevelTest.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LevelTest.java (added)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LevelTest.java Sat Jun  2 15:35:46 2012
@@ -0,0 +1,267 @@
+/*
+ * 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.SerializationTestHelper;
+import java.util.Locale;
+
+
+/**
+ * Tests of Level.
+ *
+ * @author Curt Arnold
+ * @since 1.2.12
+ */
+public class LevelTest extends TestCase {
+  /**
+   * Constructs new instance of test.
+   * @param name test name.
+   */
+  public LevelTest(final String name) {
+    super(name);
+  }
+
+  /**
+   * Serialize Level.INFO and check against witness.
+   * @throws Exception if exception during test.
+   *
+   */
+  public void testSerializeINFO() throws Exception {
+    int[] skip = new int[] {  };
+    SerializationTestHelper.assertSerializationEquals(
+      "target/test-classes/witness/serialization/info.bin", Level.INFO, skip, Integer.MAX_VALUE);
+  }
+
+  /**
+   * Deserialize witness and see if resolved to Level.INFO.
+   * @throws Exception if exception during test.
+   */
+  public void testDeserializeINFO() throws Exception {
+    Object obj =
+      SerializationTestHelper.deserializeStream(
+        "target/test-classes/witness/serialization/info.bin");
+    assertTrue(obj instanceof Level);
+    Level info = (Level) obj;
+    assertEquals("INFO", info.toString());
+    //
+    //  JDK 1.1 doesn't support readResolve necessary for the assertion
+    if (!System.getProperty("java.version").startsWith("1.1.")) {
+       assertTrue(obj == Level.INFO);
+    }
+  }
+
+  /**
+   * Tests that a custom level can be serialized and deserialized
+   * and is not resolved to a stock level.
+   *
+   * @throws Exception if exception during test.
+   */
+  public void testCustomLevelSerialization() throws Exception {
+    CustomLevel custom = new CustomLevel();
+    Object obj = SerializationTestHelper.serializeClone(custom);
+    assertTrue(obj instanceof CustomLevel);
+
+    CustomLevel clone = (CustomLevel) obj;
+    assertEquals(Level.INFO.level, clone.level);
+    assertEquals(Level.INFO.levelStr, clone.levelStr);
+    assertEquals(Level.INFO.syslogEquivalent, clone.syslogEquivalent);
+  }
+
+  /**
+   * Custom level to check that custom levels are
+   * serializable, but not resolved to a plain Level.
+   */
+  private static class CustomLevel extends Level {
+    private static final long serialVersionUID = 1L;
+      /**
+       * Create an instance of CustomLevel.
+       */
+    public CustomLevel() {
+      super(
+        Level.INFO.level, Level.INFO.levelStr, Level.INFO.syslogEquivalent);
+    }
+  }
+
+    /**
+     * Tests Level.TRACE_INT.
+     */
+  public void testTraceInt() {
+      assertEquals(5000, Level.TRACE_INT);
+  }
+
+    /**
+     * Tests Level.TRACE.
+     */
+  public void testTrace() {
+      assertEquals("TRACE", Level.TRACE.toString());
+      assertEquals(5000, Level.TRACE.toInt());
+      assertEquals(7, Level.TRACE.getSyslogEquivalent());
+  }
+
+    /**
+     * Tests Level.toLevel(Level.TRACE_INT).
+     */
+  public void testIntToTrace() {
+      Level trace = Level.toLevel(5000);
+      assertEquals("TRACE", trace.toString());
+  }
+
+    /**
+     * Tests Level.toLevel("TRACE");
+     */
+  public void testStringToTrace() {
+        Level trace = Level.toLevel("TRACE");
+        assertEquals("TRACE", trace.toString());
+  }
+
+    /**
+     * Tests that Level extends Priority.
+     */
+  public void testLevelExtendsPriority() {
+      assertTrue(Priority.class.isAssignableFrom(Level.class));
+  }
+
+    /**
+     * Tests Level.OFF.
+     */
+  public void testOFF() {
+    assertTrue(Level.OFF instanceof Level);
+  }
+
+    /**
+     * Tests Level.FATAL.
+     */
+    public void testFATAL() {
+      assertTrue(Level.FATAL instanceof Level);
+    }
+
+    /**
+     * Tests Level.ERROR.
+     */
+    public void testERROR() {
+      assertTrue(Level.ERROR instanceof Level);
+    }
+
+    /**
+     * Tests Level.WARN.
+     */
+    public void testWARN() {
+      assertTrue(Level.WARN instanceof Level);
+    }
+
+    /**
+     * Tests Level.INFO.
+     */
+    public void testINFO() {
+      assertTrue(Level.INFO instanceof Level);
+    }
+
+    /**
+     * Tests Level.DEBUG.
+     */
+    public void testDEBUG() {
+      assertTrue(Level.DEBUG instanceof Level);
+    }
+
+    /**
+     * Tests Level.TRACE.
+     */
+    public void testTRACE() {
+      assertTrue(Level.TRACE instanceof Level);
+    }
+
+    /**
+     * Tests Level.ALL.
+     */
+    public void testALL() {
+      assertTrue(Level.ALL instanceof Level);
+    }
+
+    /**
+     * Tests Level.serialVersionUID.
+     */
+    public void testSerialVersionUID() {
+      assertEquals(3491141966387921974L, Level.serialVersionUID);
+    }
+
+    /**
+     * Tests Level.toLevel(Level.All_INT).
+     */
+  public void testIntToAll() {
+      Level level = Level.toLevel(Level.ALL_INT);
+      assertEquals("ALL", level.toString());
+  }
+
+    /**
+     * Tests Level.toLevel(Level.FATAL_INT).
+     */
+  public void testIntToFatal() {
+      Level level = Level.toLevel(Level.FATAL_INT);
+      assertEquals("FATAL", level.toString());
+  }
+
+
+    /**
+     * Tests Level.toLevel(Level.OFF_INT).
+     */
+  public void testIntToOff() {
+      Level level = Level.toLevel(Level.OFF_INT);
+      assertEquals("OFF", level.toString());
+  }
+
+    /**
+     * Tests Level.toLevel(17, Level.FATAL).
+     */
+  public void testToLevelUnrecognizedInt() {
+      Level level = Level.toLevel(17, Level.FATAL);
+      assertEquals("FATAL", level.toString());
+  }
+
+    /**
+     * Tests Level.toLevel(null, Level.FATAL).
+     */
+  public void testToLevelNull() {
+      Level level = Level.toLevel(null, Level.FATAL);
+      assertEquals("FATAL", level.toString());
+  }
+
+    /**
+     * Test that dotless lower I + "nfo" is recognized as INFO.
+     */
+  public void testDotlessLowerI() {
+      Level level = Level.toLevel("\u0131nfo");
+      assertEquals("INFO", level.toString());
+  }
+
+    /**
+     * Test that dotted lower I + "nfo" is recognized as INFO
+     * even in Turkish locale.
+     */
+  public void testDottedLowerI() {
+      Locale defaultLocale = Locale.getDefault();
+      Locale turkey = new Locale("tr", "TR");
+      Locale.setDefault(turkey);
+      Level level = Level.toLevel("info");
+      Locale.setDefault(defaultLocale);
+      assertEquals("INFO", level.toString());
+  }
+
+
+}

Propchange: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LevelTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LogCapture.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/LogCapture.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LogCapture.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LogCapture.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/LogCapture.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LogCapture.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LogCapture.java
------------------------------------------------------------------------------
    svn:executable = 

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LogManagerTest.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/LogManagerTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LogManagerTest.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LogManagerTest.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/LogManagerTest.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LogManagerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LoggerTestCase.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/LoggerTestCase.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LoggerTestCase.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LoggerTestCase.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/LoggerTestCase.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/MDCTestCase.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/MDCTestCase.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/MDCTestCase.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/MDCTestCase.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/MDCTestCase.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/MDCTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/MinimumTestCase.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/MinimumTestCase.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/MinimumTestCase.java (added)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/MinimumTestCase.java Sat Jun  2 15:35:46 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/log4j12-bz53299/core/src/test/java/org/apache/log4j/MinimumTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/MyPatternLayout.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/MyPatternLayout.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/MyPatternLayout.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/MyPatternLayout.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/MyPatternLayout.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/MyPatternParser.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/MyPatternParser.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/MyPatternParser.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/MyPatternParser.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/MyPatternParser.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PatternLayoutTest.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/PatternLayoutTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PatternLayoutTest.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PatternLayoutTest.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/PatternLayoutTest.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

Added: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PatternLayoutTestCase.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PatternLayoutTestCase.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PatternLayoutTestCase.java (added)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PatternLayoutTestCase.java Sat Jun  2 15:35:46 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/log4j12-bz53299/core/src/test/java/org/apache/log4j/PatternLayoutTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PriorityTest.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/PriorityTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PriorityTest.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PriorityTest.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/PriorityTest.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PropertyConfiguratorTest.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/PropertyConfiguratorTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PropertyConfiguratorTest.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PropertyConfiguratorTest.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/PropertyConfiguratorTest.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

Added: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/RFATestCase.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/RFATestCase.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/RFATestCase.java (added)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/RFATestCase.java Sat Jun  2 15:35:46 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/log4j12-bz53299/core/src/test/java/org/apache/log4j/RFATestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/StressCategory.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/StressCategory.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/StressCategory.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/StressCategory.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/StressCategory.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/TTCCLayoutTest.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/TTCCLayoutTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/TTCCLayoutTest.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/TTCCLayoutTest.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/TTCCLayoutTest.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/TestLogMF.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/TestLogMF.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/TestLogMF.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/TestLogMF.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/TestLogMF.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/TestLogSF.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/TestLogSF.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/TestLogSF.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/TestLogSF.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/TestLogSF.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/TestLogXF.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/TestLogXF.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/TestLogXF.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/TestLogXF.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/TestLogXF.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/VectorAppender.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/VectorAppender.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/VectorAppender.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/VectorAppender.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/VectorAppender.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/VectorErrorHandler.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/VectorErrorHandler.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/VectorErrorHandler.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/VectorErrorHandler.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/VectorErrorHandler.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/customLogger/XLogger.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/customLogger/XLogger.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/customLogger/XLogger.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/customLogger/XLogger.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/customLogger/XLogger.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Added: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/customLogger/XLoggerTestCase.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/customLogger/XLoggerTestCase.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/customLogger/XLoggerTestCase.java (added)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/customLogger/XLoggerTestCase.java Sat Jun  2 15:35:46 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/log4j12-bz53299/core/src/test/java/org/apache/log4j/customLogger/XLoggerTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/defaultInit/TestCase1.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/defaultInit/TestCase1.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/defaultInit/TestCase1.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/defaultInit/TestCase1.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/defaultInit/TestCase1.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/defaultInit/TestCase2.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/defaultInit/TestCase2.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/defaultInit/TestCase2.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/defaultInit/TestCase2.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/defaultInit/TestCase2.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/defaultInit/TestCase3.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/defaultInit/TestCase3.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/defaultInit/TestCase3.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/defaultInit/TestCase3.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/defaultInit/TestCase3.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/defaultInit/TestCase4.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/defaultInit/TestCase4.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/defaultInit/TestCase4.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/defaultInit/TestCase4.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/defaultInit/TestCase4.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/BoundedFIFOTestCase.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/helpers/BoundedFIFOTestCase.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/BoundedFIFOTestCase.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/BoundedFIFOTestCase.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/helpers/BoundedFIFOTestCase.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/CyclicBufferTestCase.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/helpers/CyclicBufferTestCase.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/CyclicBufferTestCase.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/CyclicBufferTestCase.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/helpers/CyclicBufferTestCase.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/DateLayoutTest.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/helpers/DateLayoutTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/DateLayoutTest.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/DateLayoutTest.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/helpers/DateLayoutTest.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/LogLogTest.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/helpers/LogLogTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/LogLogTest.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/LogLogTest.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/helpers/LogLogTest.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/OptionConverterTestCase.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/helpers/OptionConverterTestCase.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/OptionConverterTestCase.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/OptionConverterTestCase.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/helpers/OptionConverterTestCase.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Added: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/PatternParserTestCase.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/PatternParserTestCase.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/PatternParserTestCase.java (added)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/PatternParserTestCase.java Sat Jun  2 15:35:46 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/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/PatternParserTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/UtilLoggingLevelTest.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/helpers/UtilLoggingLevelTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/UtilLoggingLevelTest.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/UtilLoggingLevelTest.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/helpers/UtilLoggingLevelTest.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/or/ORTestCase.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/or/ORTestCase.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/or/ORTestCase.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/or/ORTestCase.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/or/ORTestCase.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/pattern/CachedDateFormatTest.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/pattern/CachedDateFormatTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/pattern/CachedDateFormatTest.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/pattern/CachedDateFormatTest.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/pattern/CachedDateFormatTest.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/pattern/FormattingInfoTest.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/pattern/FormattingInfoTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/pattern/FormattingInfoTest.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/pattern/FormattingInfoTest.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/pattern/FormattingInfoTest.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/pattern/NameAbbreviatorTest.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/pattern/NameAbbreviatorTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/pattern/NameAbbreviatorTest.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/pattern/NameAbbreviatorTest.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/pattern/NameAbbreviatorTest.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/pattern/Num343PatternConverter.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/pattern/Num343PatternConverter.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/pattern/Num343PatternConverter.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/pattern/Num343PatternConverter.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/pattern/Num343PatternConverter.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/pattern/PatternParserTest.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/pattern/PatternParserTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/pattern/PatternParserTest.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/pattern/PatternParserTest.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/pattern/PatternParserTest.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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

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

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/rewrite/RewriteAppenderTest.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/rewrite/RewriteAppenderTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/rewrite/RewriteAppenderTest.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/rewrite/RewriteAppenderTest.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/rewrite/RewriteAppenderTest.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/rewrite/RewriteAppenderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/spi/LocationInfoTest.java (from r1345516, logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/spi/LocationInfoTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/spi/LocationInfoTest.java?p2=logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/spi/LocationInfoTest.java&p1=logging/log4j/branches/log4j12-bz53299/tests/src/java/org/apache/log4j/spi/LocationInfoTest.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

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



Mime
View raw message