logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grobme...@apache.org
Subject svn commit: r1352876 [1/2] - in /logging/log4j/branches/log4j12-bz53299/core/src/test: java/org/apache/log4j/ java/org/apache/log4j/customLogger/ java/org/apache/log4j/helpers/ java/org/apache/log4j/rewrite/ java/org/apache/log4j/spi/ java/org/apache/l...
Date Fri, 22 Jun 2012 13:24:16 GMT
Author: grobmeier
Date: Fri Jun 22 13:24:11 2012
New Revision: 1352876

URL: http://svn.apache.org/viewvc?rev=1352876&view=rev
Log:
get all input and witness files via one central class, namely ResourceHelper

Added:
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/ResourceHelper.java   (with props)
    logging/log4j/branches/log4j12-bz53299/core/src/test/resources/input/rewrite/
    logging/log4j/branches/log4j12-bz53299/core/src/test/resources/input/rewrite/map.log
    logging/log4j/branches/log4j12-bz53299/core/src/test/resources/input/rewrite/map.xml   (with props)
    logging/log4j/branches/log4j12-bz53299/core/src/test/resources/input/rewrite/property.log
    logging/log4j/branches/log4j12-bz53299/core/src/test/resources/input/rewrite/property.xml   (with props)
    logging/log4j/branches/log4j12-bz53299/core/src/test/resources/input/rewrite/reflection.log
    logging/log4j/branches/log4j12-bz53299/core/src/test/resources/input/rewrite/reflection.xml   (with props)
Removed:
    logging/log4j/branches/log4j12-bz53299/core/src/test/resources/org/apache/log4j/rewrite/
Modified:
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/DRFATestCase.java
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/EnhancedPatternLayoutTestCase.java
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/HierarchyThresholdTestCase.java
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LevelTest.java
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/MinimumTestCase.java
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PatternLayoutTestCase.java
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PropertyConfiguratorTest.java
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/RFATestCase.java
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/customLogger/XLoggerTestCase.java
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/OptionConverterTestCase.java
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/PatternParserTestCase.java
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/rewrite/RewriteAppenderTest.java
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/spi/LoggingEventTest.java
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/varia/ErrorHandlerTestCase.java
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/varia/LevelMatchFilterTestCase.java
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/xml/CustomLevelTestCase.java
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/xml/DOMTestCase.java
    logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/xml/XMLLayoutTestCase.java

Modified: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/DRFATestCase.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/DRFATestCase.java?rev=1352876&r1=1352875&r2=1352876&view=diff
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/DRFATestCase.java (original)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/DRFATestCase.java Fri Jun 22 13:24:11 2012
@@ -494,7 +494,7 @@ public class DRFATestCase extends TestCa
         append(combined, new FileInputStream(filename), buf);
         combined.close();
         assertTrue(Compare.compare(combinedFilename,
-                "target/test-classes/witness/drfa_blockedRollover.log"));
+                ResourceHelper.witnessFullpath("/drfa_blockedRollover.log")));
     }
 
     /** Check that the computed rollover period for a pattern containing a week as the finest unit is set to be

Modified: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/EnhancedPatternLayoutTestCase.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/EnhancedPatternLayoutTestCase.java?rev=1352876&r1=1352875&r2=1352876&view=diff
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/EnhancedPatternLayoutTestCase.java (original)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/EnhancedPatternLayoutTestCase.java Fri Jun 22 13:24:11 2012
@@ -40,9 +40,7 @@ import java.io.*;
 
 
 public class EnhancedPatternLayoutTestCase extends TestCase {
-  static final String FILE_PREFIX = "target/test-classes/";
-  
-  static String TEMP = "output/temp";
+ static String TEMP = "output/temp";
   static String FILTERED = "output/filtered";
   static String EXCEPTION1 = "java.lang.Exception: Just testing";
   static String EXCEPTION2 = "\\s*at .*\\(.*\\)";
@@ -113,7 +111,7 @@ public class EnhancedPatternLayoutTestCa
   }
 
   public void test1() throws Exception {
-    configure(FILE_PREFIX + "input/pattern/enhancedPatternLayout1.properties");
+    configure(ResourceHelper.inputFullpath("/pattern/enhancedPatternLayout1.properties"));
     common();
     Transformer.transform(
       TEMP, FILTERED,
@@ -121,11 +119,11 @@ public class EnhancedPatternLayoutTestCa
         new EnhancedLineNumberFilter(), new SunReflectFilter(),
         new EnhancedJunitTestRunnerFilter()
       });
-    assertTrue(compare(FILTERED, FILE_PREFIX + "witness/pattern/enhancedPatternLayout.1"));
+    assertTrue(compare(FILTERED,ResourceHelper.witnessFullpath("/pattern/enhancedPatternLayout.1")));
   }
 
   public void test2() throws Exception {
-    configure(FILE_PREFIX + "input/pattern/enhancedPatternLayout2.properties");
+    configure(ResourceHelper.inputFullpath("/pattern/enhancedPatternLayout2.properties"));
     common();
 
     ControlFilter cf1 =
@@ -137,11 +135,11 @@ public class EnhancedPatternLayoutTestCa
         cf1, new EnhancedLineNumberFilter(), new ISO8601Filter(),
         new SunReflectFilter(), new EnhancedJunitTestRunnerFilter()
       });
-    assertTrue(compare(FILTERED, FILE_PREFIX + "witness/pattern/enhancedPatternLayout.2"));
+    assertTrue(compare(FILTERED, ResourceHelper.witnessFullpath("/pattern/enhancedPatternLayout.2")));
   }
 
   public void test3() throws Exception {
-    configure(FILE_PREFIX + "input/pattern/enhancedPatternLayout3.properties");
+    configure(ResourceHelper.inputFullpath("/pattern/enhancedPatternLayout3.properties"));
     common();
 
     ControlFilter cf1 =
@@ -153,13 +151,13 @@ public class EnhancedPatternLayoutTestCa
         cf1, new EnhancedLineNumberFilter(), new ISO8601Filter(),
         new SunReflectFilter(), new EnhancedJunitTestRunnerFilter()
       });
-    assertTrue(compare(FILTERED, FILE_PREFIX + "witness/pattern/enhancedPatternLayout.3"));
+    assertTrue(compare(FILTERED, ResourceHelper.witnessFullpath("/pattern/enhancedPatternLayout.3")));
   }
 
   // Output format:
   // 06 avr. 2002 18:30:58,937 [main] DEBUG atternLayoutTest - Message 0  
   public void test4() throws Exception {
-    configure(FILE_PREFIX + "input/pattern/enhancedPatternLayout4.properties");
+    configure(ResourceHelper.inputFullpath("/pattern/enhancedPatternLayout4.properties"));
     common();
 
     ControlFilter cf1 =
@@ -171,11 +169,11 @@ public class EnhancedPatternLayoutTestCa
         cf1, new EnhancedLineNumberFilter(), new AbsoluteDateAndTimeFilter(),
         new SunReflectFilter(), new EnhancedJunitTestRunnerFilter()
       });
-    assertTrue(compare(FILTERED, FILE_PREFIX + "witness/pattern/enhancedPatternLayout.4"));
+    assertTrue(compare(FILTERED, ResourceHelper.witnessFullpath("/pattern/enhancedPatternLayout.4")));
   }
 
   public void test5() throws Exception {
-    configure(FILE_PREFIX + "input/pattern/enhancedPatternLayout5.properties");
+    configure(ResourceHelper.inputFullpath("/pattern/enhancedPatternLayout5.properties"));
     common();
 
     ControlFilter cf1 =
@@ -187,12 +185,12 @@ public class EnhancedPatternLayoutTestCa
         cf1, new EnhancedLineNumberFilter(), new AbsoluteDateAndTimeFilter(),
         new SunReflectFilter(), new EnhancedJunitTestRunnerFilter()
       });
-    assertTrue(compare(FILTERED, FILE_PREFIX + "witness/pattern/enhancedPatternLayout.5"));
+    assertTrue(compare(FILTERED, ResourceHelper.witnessFullpath("/pattern/enhancedPatternLayout.5")));
   }
 
   // 18:54:19,201 [main] DEBUG atternLayoutTest - Message 0
   public void test6() throws Exception {
-    configure(FILE_PREFIX + "input/pattern/enhancedPatternLayout6.properties");
+    configure(ResourceHelper.inputFullpath("/pattern/enhancedPatternLayout6.properties"));
     common();
 
     ControlFilter cf1 =
@@ -204,11 +202,11 @@ public class EnhancedPatternLayoutTestCa
         cf1, new EnhancedLineNumberFilter(), new AbsoluteTimeFilter(),
         new SunReflectFilter(), new EnhancedJunitTestRunnerFilter()
       });
-    assertTrue(compare(FILTERED, FILE_PREFIX + "witness/pattern/enhancedPatternLayout.6"));
+    assertTrue(compare(FILTERED, ResourceHelper.witnessFullpath("/pattern/enhancedPatternLayout.6")));
   }
 
   public void test7() throws Exception {
-    configure(FILE_PREFIX + "input/pattern/enhancedPatternLayout7.properties");
+    configure(ResourceHelper.inputFullpath("/pattern/enhancedPatternLayout7.properties"));
     common();
 
     ControlFilter cf1 =
@@ -220,11 +218,11 @@ public class EnhancedPatternLayoutTestCa
         cf1, new EnhancedLineNumberFilter(), new AbsoluteTimeFilter(),
         new SunReflectFilter(), new EnhancedJunitTestRunnerFilter()
       });
-    assertTrue(compare(FILTERED, FILE_PREFIX + "witness/pattern/enhancedPatternLayout.7"));
+    assertTrue(compare(FILTERED, ResourceHelper.witnessFullpath("/pattern/enhancedPatternLayout.7")));
   }
 
   public void test8() throws Exception {
-    configure(FILE_PREFIX + "input/pattern/enhancedPatternLayout8.properties");
+    configure(ResourceHelper.inputFullpath("/pattern/enhancedPatternLayout8.properties"));
     common();
 
     ControlFilter cf1 =
@@ -236,11 +234,11 @@ public class EnhancedPatternLayoutTestCa
         cf1, new EnhancedLineNumberFilter(), new RelativeTimeFilter(),
         new SunReflectFilter(), new EnhancedJunitTestRunnerFilter()
       });
-    assertTrue(compare(FILTERED, FILE_PREFIX + "witness/pattern/enhancedPatternLayout.8"));
+    assertTrue(compare(FILTERED, ResourceHelper.witnessFullpath("/pattern/enhancedPatternLayout.8")));
   }
 
   public void test9() throws Exception {
-    configure(FILE_PREFIX + "input/pattern/enhancedPatternLayout9.properties");
+    configure(ResourceHelper.inputFullpath("/pattern/enhancedPatternLayout9.properties"));
     common();
 
     ControlFilter cf1 =
@@ -252,11 +250,11 @@ public class EnhancedPatternLayoutTestCa
         cf1, new EnhancedLineNumberFilter(), new SunReflectFilter(),
         new EnhancedJunitTestRunnerFilter()
       });
-    assertTrue(compare(FILTERED, FILE_PREFIX + "witness/pattern/enhancedPatternLayout.9"));
+    assertTrue(compare(FILTERED, ResourceHelper.witnessFullpath("/pattern/enhancedPatternLayout.9")));
   }
 
   public void test10() throws Exception {
-    configure(FILE_PREFIX + "input/pattern/enhancedPatternLayout10.properties");
+    configure(ResourceHelper.inputFullpath("/pattern/enhancedPatternLayout10.properties"));
     common();
 
     ControlFilter cf1 =
@@ -268,11 +266,11 @@ public class EnhancedPatternLayoutTestCa
         cf1, new EnhancedLineNumberFilter(), new SunReflectFilter(),
         new EnhancedJunitTestRunnerFilter()
       });
-    assertTrue(compare(FILTERED, FILE_PREFIX + "witness/pattern/enhancedPatternLayout.10"));
+    assertTrue(compare(FILTERED, ResourceHelper.witnessFullpath("/pattern/enhancedPatternLayout.10")));
   }
 
   public void test11() throws Exception {
-    configure(FILE_PREFIX + "input/pattern/enhancedPatternLayout11.properties");
+    configure(ResourceHelper.inputFullpath("/pattern/enhancedPatternLayout11.properties"));
     common();
 
     ControlFilter cf1 =
@@ -284,11 +282,11 @@ public class EnhancedPatternLayoutTestCa
         cf1, new EnhancedLineNumberFilter(), new SunReflectFilter(),
         new EnhancedJunitTestRunnerFilter()
       });
-    assertTrue(compare(FILTERED, FILE_PREFIX + "witness/pattern/enhancedPatternLayout.11"));
+    assertTrue(compare(FILTERED, ResourceHelper.witnessFullpath("/pattern/enhancedPatternLayout.11")));
   }
 
   public void test12() throws Exception {
-    configure(FILE_PREFIX + "input/pattern/enhancedPatternLayout12.properties");
+    configure(ResourceHelper.inputFullpath("/pattern/enhancedPatternLayout12.properties"));
     common();
 
     ControlFilter cf1 =
@@ -300,11 +298,11 @@ public class EnhancedPatternLayoutTestCa
         cf1, new EnhancedLineNumberFilter(), new SunReflectFilter(),
         new EnhancedJunitTestRunnerFilter()
       });
-    assertTrue(compare(FILTERED, FILE_PREFIX + "witness/pattern/enhancedPatternLayout.12"));
+    assertTrue(compare(FILTERED, ResourceHelper.witnessFullpath("/pattern/enhancedPatternLayout.12")));
   }
 
   public void test13() throws Exception {
-    configure(FILE_PREFIX + "input/pattern/enhancedPatternLayout13.properties");
+    configure(ResourceHelper.inputFullpath("/pattern/enhancedPatternLayout13.properties"));
     common();
 
     ControlFilter cf1 =
@@ -316,7 +314,7 @@ public class EnhancedPatternLayoutTestCa
         cf1, new EnhancedLineNumberFilter(), new SunReflectFilter(),
         new EnhancedJunitTestRunnerFilter()
       });
-    assertTrue(compare(FILTERED, FILE_PREFIX + "witness/pattern/enhancedPatternLayout.13"));
+    assertTrue(compare(FILTERED, ResourceHelper.witnessFullpath("/pattern/enhancedPatternLayout.13")));
   }
 
     /**
@@ -325,7 +323,7 @@ public class EnhancedPatternLayoutTestCa
      * @throws Exception
      */
     public void test14() throws Exception {
-      configure(FILE_PREFIX + "input/pattern/enhancedPatternLayout14.properties");
+      configure(ResourceHelper.inputFullpath("/pattern/enhancedPatternLayout14.properties"));
       common();
 
       Transformer.transform(
@@ -334,7 +332,7 @@ public class EnhancedPatternLayoutTestCa
           new EnhancedLineNumberFilter(), new SunReflectFilter(),
           new EnhancedJunitTestRunnerFilter()
         });
-      assertTrue(compare(FILTERED, FILE_PREFIX + "witness/pattern/enhancedPatternLayout.14"));
+      assertTrue(compare(FILTERED, ResourceHelper.witnessFullpath("/pattern/enhancedPatternLayout.14")));
     }
 
 
@@ -346,7 +344,7 @@ public class EnhancedPatternLayoutTestCa
     }
 
   public void testMDC1() throws Exception {
-    configure(FILE_PREFIX + "input/pattern/enhancedPatternLayout.mdc.1.properties");
+    configure(ResourceHelper.inputFullpath("/pattern/enhancedPatternLayout.mdc.1.properties"));
     clearMDC();
     MDC.put("key1", "va11");
     MDC.put("key2", "va12");
@@ -361,7 +359,7 @@ public class EnhancedPatternLayoutTestCa
         new EnhancedJunitTestRunnerFilter(),
         new MDCOrderFilter()
       });
-    assertTrue(compare(FILTERED, FILE_PREFIX + "witness/pattern/enhancedPatternLayout.mdc.1"));
+    assertTrue(compare(FILTERED, ResourceHelper.witnessFullpath("/pattern/enhancedPatternLayout.mdc.1")));
   }
     /**
      * Tests log4j 1.2 style extension of EnhancedPatternLayout.
@@ -369,7 +367,7 @@ public class EnhancedPatternLayoutTestCa
      * @throws Exception
      */
     public void test15() throws Exception {
-      configure(FILE_PREFIX + "input/pattern/enhancedPatternLayout15.properties");
+      configure(ResourceHelper.inputFullpath("/pattern/enhancedPatternLayout15.properties"));
       common();
       ControlFilter cf1 = new ControlFilter(new String[]{PAT14, EXCEPTION1,
                                  EXCEPTION2, EXCEPTION3, EXCEPTION4});
@@ -379,7 +377,7 @@ public class EnhancedPatternLayoutTestCa
           cf1, new EnhancedLineNumberFilter(), new SunReflectFilter(),
           new EnhancedJunitTestRunnerFilter()
         });
-      assertTrue(compare(FILTERED, FILE_PREFIX + "witness/pattern/enhancedPatternLayout.15"));
+      assertTrue(compare(FILTERED, ResourceHelper.witnessFullpath("/pattern/enhancedPatternLayout.15")));
     }
     /**
      * Tests explicit UTC time zone in pattern.
@@ -387,7 +385,7 @@ public class EnhancedPatternLayoutTestCa
      */
     public void test16() throws Exception {
       final long start = new Date().getTime();
-      configure(FILE_PREFIX + "input/pattern/enhancedPatternLayout16.properties");
+      configure(ResourceHelper.inputFullpath("/pattern/enhancedPatternLayout16.properties"));
       common();
       final long end = new Date().getTime();
       FileReader reader = new FileReader("output/patternLayout16.log");
@@ -437,7 +435,7 @@ public class EnhancedPatternLayoutTestCa
     Test case for MDC conversion pattern. */
   public void testMDC2() throws Exception {
     String OUTPUT_FILE   = "output/patternLayout.mdc.2";
-    String WITNESS_FILE  = FILE_PREFIX + "witness/pattern/enhancedPatternLayout.mdc.2";
+    String WITNESS_FILE  = ResourceHelper.witnessFullpath("/pattern/enhancedPatternLayout.mdc.2");
     
     String mdcMsgPattern1 = "%m : %X%n";
     String mdcMsgPattern2 = "%m : %X{key1}%n";
@@ -522,7 +520,7 @@ public class EnhancedPatternLayoutTestCa
     Test case for throwable conversion pattern. */
   public void testThrowable() throws Exception {
     String OUTPUT_FILE   = "output/patternLayout.throwable";
-    String WITNESS_FILE  = FILE_PREFIX + "witness/pattern/enhancedPatternLayout.throwable";
+    String WITNESS_FILE  = ResourceHelper.witnessFullpath("/pattern/enhancedPatternLayout.throwable");
     
     
     // set up appender

Modified: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/HierarchyThresholdTestCase.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/HierarchyThresholdTestCase.java?rev=1352876&r1=1352875&r2=1352876&view=diff
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/HierarchyThresholdTestCase.java (original)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/HierarchyThresholdTestCase.java Fri Jun 22 13:24:11 2012
@@ -31,10 +31,6 @@ import org.apache.log4j.xml.XLevel;
 */
 public class HierarchyThresholdTestCase 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 Logger logger = Logger.getLogger(HierarchyThresholdTestCase.class);
 
@@ -51,51 +47,51 @@ public class HierarchyThresholdTestCase 
   }
   
   public void test1() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/hierarchyThreshold1.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/hierarchyThreshold1.properties"));
     common();
-    assertTrue(Compare.compare(TEMP, WITNESS_DIR + "/hierarchyThreshold.1"));
+    assertTrue(Compare.compare(TEMP, ResourceHelper.witnessFullpath("/hierarchyThreshold.1")));
   }
 
   public void test2() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/hierarchyThreshold2.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/hierarchyThreshold2.properties"));
     common();
-    assertTrue(Compare.compare(TEMP, WITNESS_DIR + "/hierarchyThreshold.2"));
+    assertTrue(Compare.compare(TEMP, ResourceHelper.witnessFullpath("/hierarchyThreshold.2")));
   }
 
   public void test3() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/hierarchyThreshold3.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/hierarchyThreshold3.properties"));
     common();
-    assertTrue(Compare.compare(TEMP, WITNESS_DIR + "/hierarchyThreshold.3"));
+    assertTrue(Compare.compare(TEMP, ResourceHelper.witnessFullpath("/hierarchyThreshold.3")));
   }
 
   public void test4() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/hierarchyThreshold4.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/hierarchyThreshold4.properties"));
     common();
-    assertTrue(Compare.compare(TEMP, WITNESS_DIR + "/hierarchyThreshold.4"));
+    assertTrue(Compare.compare(TEMP, ResourceHelper.witnessFullpath("/hierarchyThreshold.4")));
   }
 
   public void test5() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/hierarchyThreshold5.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/hierarchyThreshold5.properties"));
     common();
-    assertTrue(Compare.compare(TEMP, WITNESS_DIR + "/hierarchyThreshold.5"));
+    assertTrue(Compare.compare(TEMP, ResourceHelper.witnessFullpath("/hierarchyThreshold.5")));
   }
 
   public void test6() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/hierarchyThreshold6.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/hierarchyThreshold6.properties"));
     common();
-    assertTrue(Compare.compare(TEMP, WITNESS_DIR + "/hierarchyThreshold.6"));
+    assertTrue(Compare.compare(TEMP, ResourceHelper.witnessFullpath("/hierarchyThreshold.6")));
   }
 
   public void test7() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/hierarchyThreshold7.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/hierarchyThreshold7.properties"));
     common();
-    assertTrue(Compare.compare(TEMP, WITNESS_DIR + "/hierarchyThreshold.7"));
+    assertTrue(Compare.compare(TEMP, ResourceHelper.witnessFullpath("/hierarchyThreshold.7")));
   }
 
   public void test8() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/hierarchyThreshold8.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/hierarchyThreshold8.properties"));
     common();
-    assertTrue(Compare.compare(TEMP, WITNESS_DIR + "/hierarchyThreshold.8"));
+    assertTrue(Compare.compare(TEMP, ResourceHelper.witnessFullpath("/hierarchyThreshold.8")));
   }
 
 

Modified: 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=1352876&r1=1352875&r2=1352876&view=diff
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LevelTest.java (original)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/LevelTest.java Fri Jun 22 13:24:11 2012
@@ -46,7 +46,7 @@ public class LevelTest extends TestCase 
   public void testSerializeINFO() throws Exception {
     int[] skip = new int[] {  };
     SerializationTestHelper.assertSerializationEquals(
-      "target/test-classes/witness/serialization/info.bin", Level.INFO, skip, Integer.MAX_VALUE);
+        ResourceHelper.witnessFullpath("/serialization/info.bin"), Level.INFO, skip, Integer.MAX_VALUE);
   }
 
   /**
@@ -56,7 +56,7 @@ public class LevelTest extends TestCase 
   public void testDeserializeINFO() throws Exception {
     Object obj =
       SerializationTestHelper.deserializeStream(
-        "target/test-classes/witness/serialization/info.bin");
+          ResourceHelper.witnessFullpath("/serialization/info.bin"));
     assertTrue(obj instanceof Level);
     Level info = (Level) obj;
     assertEquals("INFO", info.toString());

Modified: 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=1352876&r1=1352875&r2=1352876&view=diff
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/MinimumTestCase.java (original)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/MinimumTestCase.java Fri Jun 22 13:24:11 2012
@@ -29,10 +29,6 @@ import org.apache.log4j.util.*;
  */
 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";
@@ -79,7 +75,7 @@ public class MinimumTestCase extends Tes
       new Filter[] { new LineNumberFilter(), 
                      new SunReflectFilter(), 
                      new JunitTestRunnerFilter() });
-    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/simple"));
+    assertTrue(Compare.compare(FILTERED, ResourceHelper.witnessFullpath("/simple")));
   }
 
   public void ttcc() throws Exception {
@@ -105,7 +101,7 @@ public class MinimumTestCase extends Tes
         new SunReflectFilter(), new JunitTestRunnerFilter()
       });
 
-    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/ttcc"));
+    assertTrue(Compare.compare(FILTERED, ResourceHelper.witnessFullpath("/ttcc")));
   }
 
 

Modified: 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=1352876&r1=1352875&r2=1352876&view=diff
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PatternLayoutTestCase.java (original)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PatternLayoutTestCase.java Fri Jun 22 13:24:11 2012
@@ -31,11 +31,6 @@ import org.apache.log4j.util.SunReflectF
 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";
 
@@ -84,7 +79,7 @@ public class PatternLayoutTestCase exten
   }
 
   public void test1() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout1.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/patternLayout1.properties"));
     common();
     Transformer.transform(
       TEMP, FILTERED,
@@ -92,11 +87,11 @@ public class PatternLayoutTestCase exten
         new LineNumberFilter(), new SunReflectFilter(),
         new JunitTestRunnerFilter()
       });
-    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.1"));
+    assertTrue(Compare.compare(FILTERED, ResourceHelper.witnessFullpath("/patternLayout.1")));
   }
 
   public void test2() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout2.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/patternLayout2.properties"));
     common();
     ControlFilter cf1 = new ControlFilter(new String[]{PAT1, EXCEPTION1, 
 						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
@@ -106,11 +101,11 @@ public class PatternLayoutTestCase exten
         cf1, new LineNumberFilter(), new ISO8601Filter(),
         new SunReflectFilter(), new JunitTestRunnerFilter()
       });
-    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.2"));
+    assertTrue(Compare.compare(FILTERED, ResourceHelper.witnessFullpath("/patternLayout.2")));
   }
 
   public void test3() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout3.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/patternLayout3.properties"));
     common();
     ControlFilter cf1 = new ControlFilter(new String[]{PAT1, EXCEPTION1, 
 						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
@@ -120,13 +115,13 @@ public class PatternLayoutTestCase exten
         cf1, new LineNumberFilter(), new ISO8601Filter(),
         new SunReflectFilter(), new JunitTestRunnerFilter()
       });
-    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.3"));
+    assertTrue(Compare.compare(FILTERED, ResourceHelper.witnessFullpath("/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");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/patternLayout4.properties"));
     common();
     ControlFilter cf1 = new ControlFilter(new String[]{PAT2, EXCEPTION1, 
 						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
@@ -136,11 +131,11 @@ public class PatternLayoutTestCase exten
         cf1, new LineNumberFilter(), new AbsoluteDateAndTimeFilter(),
         new SunReflectFilter(), new JunitTestRunnerFilter()
       });
-    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.4"));
+    assertTrue(Compare.compare(FILTERED, ResourceHelper.witnessFullpath("/patternLayout.4")));
   }
 
   public void test5() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout5.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/patternLayout5.properties"));
     common();
     ControlFilter cf1 = new ControlFilter(new String[]{PAT2, EXCEPTION1, 
 						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
@@ -150,12 +145,12 @@ public class PatternLayoutTestCase exten
         cf1, new LineNumberFilter(), new AbsoluteDateAndTimeFilter(),
         new SunReflectFilter(), new JunitTestRunnerFilter()
       });
-    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.5"));
+    assertTrue(Compare.compare(FILTERED, ResourceHelper.witnessFullpath("/patternLayout.5")));
   }
 
   // 18:54:19,201 [main] DEBUG rnLayoutTestCase - Message 0
   public void test6() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout6.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/patternLayout6.properties"));
     common();
     ControlFilter cf1 = new ControlFilter(new String[]{PAT3, EXCEPTION1, 
 						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
@@ -165,12 +160,12 @@ public class PatternLayoutTestCase exten
         cf1, new LineNumberFilter(), new AbsoluteTimeFilter(),
         new SunReflectFilter(), new JunitTestRunnerFilter()
       });
-    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.6"));
+    assertTrue(Compare.compare(FILTERED, ResourceHelper.witnessFullpath("/patternLayout.6")));
   }
 
 
   public void test7() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout7.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/patternLayout7.properties"));
     common();
     ControlFilter cf1 = new ControlFilter(new String[]{PAT3, EXCEPTION1, 
 						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
@@ -180,11 +175,11 @@ public class PatternLayoutTestCase exten
         cf1, new LineNumberFilter(), new AbsoluteTimeFilter(),
         new SunReflectFilter(), new JunitTestRunnerFilter()
       });
-    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.7"));
+    assertTrue(Compare.compare(FILTERED, ResourceHelper.witnessFullpath("/patternLayout.7")));
   }
 
   public void test8() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout8.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/patternLayout8.properties"));
     common();
     ControlFilter cf1 = new ControlFilter(new String[]{PAT4, EXCEPTION1, 
 						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
@@ -194,11 +189,11 @@ public class PatternLayoutTestCase exten
         cf1, new LineNumberFilter(), new RelativeTimeFilter(),
         new SunReflectFilter(), new JunitTestRunnerFilter()
       });
-    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.8"));
+    assertTrue(Compare.compare(FILTERED, ResourceHelper.witnessFullpath("/patternLayout.8")));
   }
 
   public void test9() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout9.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/patternLayout9.properties"));
     common();
     ControlFilter cf1 = new ControlFilter(new String[]{PAT5, EXCEPTION1, 
 						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
@@ -208,11 +203,11 @@ public class PatternLayoutTestCase exten
         cf1, new LineNumberFilter(), new SunReflectFilter(),
         new JunitTestRunnerFilter()
       });
-    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.9"));
+    assertTrue(Compare.compare(FILTERED, ResourceHelper.witnessFullpath("/patternLayout.9")));
   }
 
   public void test10() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout10.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/patternLayout10.properties"));
     common();
     ControlFilter cf1 = new ControlFilter(new String[]{PAT6, EXCEPTION1, 
 						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
@@ -222,11 +217,11 @@ public class PatternLayoutTestCase exten
         cf1, new LineNumberFilter(), new SunReflectFilter(),
         new JunitTestRunnerFilter()
       });
-    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.10"));
+    assertTrue(Compare.compare(FILTERED, ResourceHelper.witnessFullpath("/patternLayout.10")));
   }
 
   public void test11() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout11.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/patternLayout11.properties"));
     common();
     ControlFilter cf1 = new ControlFilter(new String[]{PAT11a, PAT11b, EXCEPTION1, 
 						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
@@ -236,11 +231,11 @@ public class PatternLayoutTestCase exten
         cf1, new LineNumberFilter(), new SunReflectFilter(),
         new JunitTestRunnerFilter()
       });
-    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.11"));
+    assertTrue(Compare.compare(FILTERED, ResourceHelper.witnessFullpath("/patternLayout.11")));
   }
 
   public void test12() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout12.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/patternLayout12.properties"));
     common();
     ControlFilter cf1 = new ControlFilter(new String[]{PAT12, EXCEPTION1, 
 						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
@@ -250,11 +245,11 @@ public class PatternLayoutTestCase exten
         cf1, new LineNumberFilter(), new SunReflectFilter(),
         new JunitTestRunnerFilter()
       });
-    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.12"));
+    assertTrue(Compare.compare(FILTERED, ResourceHelper.witnessFullpath("/patternLayout.12")));
   }
 
   public void test13() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout13.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/patternLayout13.properties"));
     common();
     ControlFilter cf1 = new ControlFilter(new String[]{PAT13, EXCEPTION1, 
 						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
@@ -264,11 +259,11 @@ public class PatternLayoutTestCase exten
         cf1, new LineNumberFilter(), new SunReflectFilter(),
         new JunitTestRunnerFilter()
       });
-    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.13"));
+    assertTrue(Compare.compare(FILTERED, ResourceHelper.witnessFullpath("/patternLayout.13")));
   }
 
   public void test14() throws Exception {
-    PropertyConfigurator.configure(INPUT_DIR + "/patternLayout14.properties");
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/patternLayout14.properties"));
     common();
     ControlFilter cf1 = new ControlFilter(new String[]{PAT14, EXCEPTION1, 
 						       EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5});
@@ -278,29 +273,29 @@ public class PatternLayoutTestCase exten
         cf1, new LineNumberFilter(), new SunReflectFilter(),
         new JunitTestRunnerFilter()
       });
-    assertTrue(Compare.compare(FILTERED, WITNESS_DIR + "/patternLayout.14"));
+    assertTrue(Compare.compare(FILTERED, ResourceHelper.witnessFullpath("/patternLayout.14")));
   }
 
     public void testMDC1() throws Exception {
-      PropertyConfigurator.configure(INPUT_DIR + "/patternLayout.mdc.1.properties");
+      PropertyConfigurator.configure(ResourceHelper.inputFullpath("/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"));
+      assertTrue(Compare.compare(TEMP, ResourceHelper.witnessFullpath("/patternLayout.mdc.1")));
     }
 
     public void testMDCClear() throws Exception {
-      PropertyConfigurator.configure(INPUT_DIR + "/patternLayout.mdc.1.properties");
+      PropertyConfigurator.configure(ResourceHelper.inputFullpath("/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"));
+      assertTrue(Compare.compare(TEMP, ResourceHelper.witnessFullpath("/patternLayout.mdc.clear")));
     }
 
 

Modified: logging/log4j/branches/log4j12-bz53299/core/src/test/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?rev=1352876&r1=1352875&r2=1352876&view=diff
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PropertyConfiguratorTest.java (original)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/PropertyConfiguratorTest.java Fri Jun 22 13:24:11 2012
@@ -1,369 +1,369 @@
-/*
- * 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 {
-    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(this.getClass().getResource("/input/filter1.properties").getFile());
-        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() {
-        try {
-            PropertyConfigurator.configure(this.getClass().getResource("/input/filter1.properties").getPath());
-            this.validateNested();
-        } finally {
-            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());
-    }
-}
+/*
+ * 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 {
+    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(ResourceHelper.inputFullpath("/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() {
+        try {
+            PropertyConfigurator.configure(ResourceHelper.inputFullpath("/filter1.properties"));
+            this.validateNested();
+        } finally {
+            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());
+    }
+}

Modified: 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=1352876&r1=1352875&r2=1352876&view=diff
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/RFATestCase.java (original)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/RFATestCase.java Fri Jun 22 13:24:11 2012
@@ -30,10 +30,6 @@ import java.io.IOException;
  */
 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);
   }
@@ -47,7 +43,7 @@ public class RFATestCase extends TestCas
      */
     public void test1() throws Exception {
      Logger logger = Logger.getLogger(RFATestCase.class);
-      PropertyConfigurator.configure(INPUT_DIR + "/RFA1.properties");
+      PropertyConfigurator.configure(ResourceHelper.inputFullpath("/RFA1.properties"));
 
       // Write exactly 10 bytes with each log
       for (int i = 0; i < 25; i++) {

Added: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/ResourceHelper.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/ResourceHelper.java?rev=1352876&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/ResourceHelper.java (added)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/ResourceHelper.java Fri Jun 22 13:24:11 2012
@@ -0,0 +1,37 @@
+/*
+ * 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;
+
+/**
+ * This class helps with looking up resources for test cases.
+ *
+ */
+public class ResourceHelper {
+    private static final String FILE_PREFIX = new File(ResourceHelper.class.getResource("/").getPath()).getAbsolutePath();
+    private static final String INPUT_DIR = FILE_PREFIX + "/input";
+    private static final String WITNESS_DIR = FILE_PREFIX + "/witness";
+
+    public static String inputFullpath(String filename) {
+        return INPUT_DIR + filename;
+    }
+
+    public static String witnessFullpath(String filename) {
+        return WITNESS_DIR + filename;
+    }
+}

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

Modified: 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=1352876&r1=1352875&r2=1352876&view=diff
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/customLogger/XLoggerTestCase.java (original)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/customLogger/XLoggerTestCase.java Fri Jun 22 13:24:11 2012
@@ -17,6 +17,7 @@
 
 package org.apache.log4j.customLogger;
 
+import org.apache.log4j.ResourceHelper;
 import org.apache.log4j.xml.DOMConfigurator;
 import org.apache.log4j.util.*;
 
@@ -46,7 +47,7 @@ public class XLoggerTestCase extends Tes
   public void test2()  throws Exception  { common(2); }
 
   void common(int number) throws Exception {
-    DOMConfigurator.configure("target/test-classes/input/xml/customLogger"+number+".xml");
+    DOMConfigurator.configure(ResourceHelper.inputFullpath("/xml/customLogger"+number+".xml"));
 
     int i = -1;
 
@@ -64,7 +65,7 @@ public class XLoggerTestCase extends Tes
         new LineNumberFilter(), new SunReflectFilter(),
         new JunitTestRunnerFilter()
       });
-    assertTrue(Compare.compare(FILTERED, "target/test-classes/witness/customLogger."+number));
+    assertTrue(Compare.compare(FILTERED,  ResourceHelper.witnessFullpath("/customLogger."+number)));
 
   }
 

Modified: logging/log4j/branches/log4j12-bz53299/core/src/test/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?rev=1352876&r1=1352875&r2=1352876&view=diff
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/OptionConverterTestCase.java (original)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/OptionConverterTestCase.java Fri Jun 22 13:24:11 2012
@@ -32,6 +32,7 @@ import junit.framework.TestSuite;
 import org.apache.log4j.Level;
 import org.apache.log4j.LogManager;
 import org.apache.log4j.PropertyConfiguratorTest;
+import org.apache.log4j.ResourceHelper;
 import org.apache.log4j.xml.XLevel;
 
 /**
@@ -130,7 +131,7 @@ public class OptionConverterTestCase ext
    * @since 1.2.17
    */
     public void testInputStream() throws IOException {
-        File file = new File(this.getClass().getResource("/input/filter1.properties").getFile());
+        File file = new File( ResourceHelper.inputFullpath("/filter1.properties"));
         assertTrue(file.exists());
         FileInputStream inputStream = new FileInputStream(file);
         try {

Modified: 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=1352876&r1=1352875&r2=1352876&view=diff
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/PatternParserTestCase.java (original)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/helpers/PatternParserTestCase.java Fri Jun 22 13:24:11 2012
@@ -28,6 +28,7 @@ import org.apache.log4j.FileAppender;
 import org.apache.log4j.PatternLayout;
 import org.apache.log4j.MDC;
 
+import org.apache.log4j.ResourceHelper;
 import org.apache.log4j.util.Compare;
 
 /**
@@ -39,7 +40,6 @@ import org.apache.log4j.util.Compare;
 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";
   
@@ -119,7 +119,7 @@ public class PatternParserTestCase exten
     layout.setConversionPattern(msgPattern);
     root.debug("finished mdc pattern test");
 
-    assertTrue(Compare.compare(OUTPUT_FILE+"_mdc", WITNESS_FILE+"_mdc"));
+    assertTrue(Compare.compare(OUTPUT_FILE+"_mdc",  ResourceHelper.witnessFullpath("/PatternParser_mdc")));
   }
 
   public static Test suite() {

Modified: logging/log4j/branches/log4j12-bz53299/core/src/test/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?rev=1352876&r1=1352875&r2=1352876&view=diff
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/rewrite/RewriteAppenderTest.java (original)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/rewrite/RewriteAppenderTest.java Fri Jun 22 13:24:11 2012
@@ -21,6 +21,7 @@ import org.apache.log4j.*;
 import org.apache.log4j.util.Compare;
 import org.apache.log4j.xml.*;
 
+import java.io.FileInputStream;
 import java.io.InputStream;
 import java.util.Map;
 import java.util.TreeMap;
@@ -46,7 +47,9 @@ public class RewriteAppenderTest extends
     }
 
     public void configure(final String resourceName) throws Exception {
-        InputStream is = RewriteAppenderTest.class.getResourceAsStream(resourceName);
+
+        String rn = ResourceHelper.inputFullpath("/rewrite/" + resourceName);
+        InputStream is = new FileInputStream(rn);
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         factory.setNamespaceAware(false);
         DocumentBuilder builder = factory.newDocumentBuilder();
@@ -68,7 +71,7 @@ public class RewriteAppenderTest extends
         logger.info(msg);
         msg.put("message", "Message 1");
         logger.info(msg);
-        assertTrue(Compare.compare(RewriteAppenderTest.class, "temp", "map.log"));
+        assertTrue(Compare.compare("output/RewriteAppenderTest-map-out.log", ResourceHelper.inputFullpath("/rewrite/map.log")));
     }
 
     private static class BaseBean {
@@ -117,7 +120,7 @@ public class RewriteAppenderTest extends
         MDC.put("p1", "Hola");
         MDC.put("p2", "p2");
         logger.info(new MessageBean("Welcome to The Hub", "Hello", "World" ));
-        assertTrue(Compare.compare(RewriteAppenderTest.class, "temp", "reflection.log"));
+        assertTrue(Compare.compare("output/RewriteAppenderTest-reflection-out.log", ResourceHelper.inputFullpath("/rewrite/reflection.log")));
     }
 
     public void testPropertyPolicy() throws Exception {
@@ -126,6 +129,6 @@ public class RewriteAppenderTest extends
         logger.info("Message 0");
         MDC.put("p1", "Hola");
         logger.info("Message 1");
-        assertTrue(Compare.compare(RewriteAppenderTest.class, "temp", "property.log"));
+        assertTrue(Compare.compare("output/RewriteAppenderTest-property-out.log", ResourceHelper.inputFullpath("/rewrite/property.log")));
     }
 }

Modified: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/spi/LoggingEventTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/spi/LoggingEventTest.java?rev=1352876&r1=1352875&r2=1352876&view=diff
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/spi/LoggingEventTest.java (original)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/spi/LoggingEventTest.java Fri Jun 22 13:24:11 2012
@@ -23,6 +23,7 @@ import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 import org.apache.log4j.MDC;
 import org.apache.log4j.NDC;
+import org.apache.log4j.ResourceHelper;
 import org.apache.log4j.util.SerializationTestHelper;
 import org.apache.log4j.Priority;
 import org.apache.log4j.Category;
@@ -34,11 +35,6 @@ import org.apache.log4j.Category;
  * @author Curt Arnold
  */
 public class LoggingEventTest 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";
-  
   /**
    * Create LoggingEventTest.
    *
@@ -62,7 +58,7 @@ public class LoggingEventTest extends Te
 
     int[] skip = new int[] { 352, 353, 354, 355, 356 };
     SerializationTestHelper.assertSerializationEquals(
-      WITNESS_DIR + "/serialization/simple.bin", event, skip, 237);
+            ResourceHelper.witnessFullpath("/serialization/simple.bin"), event, skip, 237);
   }
 
   /**
@@ -81,7 +77,7 @@ public class LoggingEventTest extends Te
 
     int[] skip = new int[] { 352, 353, 354, 355, 356 };
     SerializationTestHelper.assertSerializationEquals(
-      WITNESS_DIR + "/serialization/exception.bin", event, skip, 237);
+            ResourceHelper.witnessFullpath("/serialization/exception.bin"), event, skip, 237);
   }
 
   /**
@@ -100,7 +96,8 @@ public class LoggingEventTest extends Te
 
     int[] skip = new int[] { 352, 353, 354, 355, 356 };
     SerializationTestHelper.assertSerializationEquals(
-      WITNESS_DIR + "/serialization/location.bin", event, skip, 237);
+       ResourceHelper.witnessFullpath("/serialization/location.bin"),
+       event, skip, 237);
   }
 
   /**
@@ -119,7 +116,8 @@ public class LoggingEventTest extends Te
 
     int[] skip = new int[] { 352, 353, 354, 355, 356 };
     SerializationTestHelper.assertSerializationEquals(
-      WITNESS_DIR + "/serialization/ndc.bin", event, skip, 237);
+       ResourceHelper.witnessFullpath("/serialization/ndc.bin"),
+       event, skip, 237);
     }
 
   /**
@@ -138,7 +136,8 @@ public class LoggingEventTest extends Te
 
     int[] skip = new int[] { 352, 353, 354, 355, 356 };
     SerializationTestHelper.assertSerializationEquals(
-      WITNESS_DIR + "/serialization/mdc.bin", event, skip, 237);
+      ResourceHelper.witnessFullpath("/serialization/mdc.bin"),
+      event, skip, 237);
   }
 
   /**
@@ -149,7 +148,7 @@ public class LoggingEventTest extends Te
   public void testDeserializationSimple() throws Exception {
     Object obj =
       SerializationTestHelper.deserializeStream(
-        WITNESS_DIR + "/serialization/simple.bin");
+        ResourceHelper.witnessFullpath("/serialization/simple.bin"));
     assertTrue(obj instanceof LoggingEvent);
 
     LoggingEvent event = (LoggingEvent) obj;
@@ -165,7 +164,7 @@ public class LoggingEventTest extends Te
   public void testDeserializationWithException() throws Exception {
     Object obj =
       SerializationTestHelper.deserializeStream(
-        WITNESS_DIR + "/serialization/exception.bin");
+        ResourceHelper.witnessFullpath("/serialization/exception.bin"));
     assertTrue(obj instanceof LoggingEvent);
 
     LoggingEvent event = (LoggingEvent) obj;
@@ -181,7 +180,7 @@ public class LoggingEventTest extends Te
   public void testDeserializationWithLocation() throws Exception {
     Object obj =
       SerializationTestHelper.deserializeStream(
-        WITNESS_DIR + "/serialization/location.bin");
+        ResourceHelper.witnessFullpath("/serialization/location.bin"));
     assertTrue(obj instanceof LoggingEvent);
 
     LoggingEvent event = (LoggingEvent) obj;

Modified: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/varia/ErrorHandlerTestCase.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/varia/ErrorHandlerTestCase.java?rev=1352876&r1=1352875&r2=1352876&view=diff
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/varia/ErrorHandlerTestCase.java (original)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/varia/ErrorHandlerTestCase.java Fri Jun 22 13:24:11 2012
@@ -21,6 +21,7 @@ import junit.framework.TestCase;
 import org.apache.log4j.Appender;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
+import org.apache.log4j.ResourceHelper;
 import org.apache.log4j.spi.ErrorHandler;
 import org.apache.log4j.util.Filter;
 import org.apache.log4j.util.Transformer;
@@ -63,7 +64,7 @@ public class ErrorHandlerTestCase extend
   }
 
   public void test1() throws Exception {
-    DOMConfigurator.configure(this.getClass().getResource("/input/xml/fallback1.xml").getPath());
+    DOMConfigurator.configure(ResourceHelper.inputFullpath("/xml/fallback1.xml"));
     Appender primary = root.getAppender("PRIMARY");
     ErrorHandler eh = primary.getErrorHandler();
     assertNotNull(eh);
@@ -78,11 +79,11 @@ public class ErrorHandlerTestCase extend
                             new JunitTestRunnerFilter(),
                             new SunReflectFilter()});
 
-    assertTrue(Compare.compare(FILTERED, this.getClass().getResource("/witness/fallback1").getPath()));
+    assertTrue(Compare.compare(FILTERED, ResourceHelper.witnessFullpath("/fallback1")));
   }
   
   public void test2() throws Exception {
-    PropertyConfigurator.configure(this.getClass().getResource("/input/fallback1.properties").getPath());
+    PropertyConfigurator.configure(ResourceHelper.inputFullpath("/fallback1.properties"));
     Appender primary = root.getAppender("PRIMARY");
     ErrorHandler eh = primary.getErrorHandler();
     assertNotNull(eh);
@@ -98,7 +99,7 @@ public class ErrorHandlerTestCase extend
                             new SunReflectFilter()});
 
 
-    assertTrue(Compare.compare(FILTERED, this.getClass().getResource("/witness/fallback1").getPath()));
+    assertTrue(Compare.compare(FILTERED, ResourceHelper.witnessFullpath("/fallback1")));
   }
 
   void common() {

Modified: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/varia/LevelMatchFilterTestCase.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/varia/LevelMatchFilterTestCase.java?rev=1352876&r1=1352875&r2=1352876&view=diff
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/varia/LevelMatchFilterTestCase.java (original)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/varia/LevelMatchFilterTestCase.java Fri Jun 22 13:24:11 2012
@@ -26,6 +26,7 @@ import org.apache.log4j.Level;
 import org.apache.log4j.Appender;
 import org.apache.log4j.FileAppender;
 import org.apache.log4j.Layout;
+import org.apache.log4j.ResourceHelper;
 import org.apache.log4j.SimpleLayout;
 import org.apache.log4j.varia.LevelMatchFilter;
 import org.apache.log4j.varia.DenyAllFilter;
@@ -41,11 +42,11 @@ public class LevelMatchFilterTestCase ex
   
   static String ACCEPT_FILE     = "output/LevelMatchFilter_accept";
   static String ACCEPT_FILTERED = "output/LevelMatchFilter_accept_filtered";
-  static String ACCEPT_WITNESS  = "target/test-classes/witness/LevelMatchFilter_accept";
+  static String ACCEPT_WITNESS  = ResourceHelper.witnessFullpath("/LevelMatchFilter_accept");
 
   static String DENY_FILE       = "output/LevelMatchFilter_deny";
   static String DENY_FILTERED   = "output/LevelMatchFilter_deny_filtered";
-  static String DENY_WITNESS    = "target/test-classes/witness/LevelMatchFilter_deny";
+  static String DENY_WITNESS    = ResourceHelper.witnessFullpath("/LevelMatchFilter_deny");
 
   Logger root; 
   Logger logger;

Modified: logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/xml/CustomLevelTestCase.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/xml/CustomLevelTestCase.java?rev=1352876&r1=1352875&r2=1352876&view=diff
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/xml/CustomLevelTestCase.java (original)
+++ logging/log4j/branches/log4j12-bz53299/core/src/test/java/org/apache/log4j/xml/CustomLevelTestCase.java Fri Jun 22 13:24:11 2012
@@ -21,16 +21,13 @@ import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 import org.apache.log4j.Logger;
+import org.apache.log4j.ResourceHelper;
 import org.apache.log4j.util.Compare;
 
 import java.io.File;
 
 public class CustomLevelTestCase extends TestCase {
 
-  static final String FILE_PREFIX = new File(CustomLevelTestCase.class.getResource("/").getPath()).getAbsolutePath();
-  static final String INPUT_DIR = FILE_PREFIX + "/input";
-  static final String WITNESS_DIR = FILE_PREFIX + "/witness";
-  
   static String TEMP = "output/temp";
 
   Logger root; 
@@ -50,27 +47,27 @@ public class CustomLevelTestCase extends
   }
 
   public void test1() throws Exception {
-    DOMConfigurator.configure(INPUT_DIR + "/xml/customLevel1.xml");
+    DOMConfigurator.configure(ResourceHelper.inputFullpath("/xml/customLevel1.xml"));
     common();
-    assertTrue(Compare.compare(TEMP, WITNESS_DIR + "/customLevel.1"));
+    assertTrue(Compare.compare(TEMP, ResourceHelper.witnessFullpath("/customLevel.1")));
   }
 
   public void test2() throws Exception {
-    DOMConfigurator.configure(INPUT_DIR + "/xml/customLevel2.xml");
+    DOMConfigurator.configure(ResourceHelper.inputFullpath("/xml/customLevel2.xml"));
     common();
-    assertTrue(Compare.compare(TEMP, WITNESS_DIR + "/customLevel.2"));
+    assertTrue(Compare.compare(TEMP, ResourceHelper.witnessFullpath("/customLevel.2")));
   }
 
   public void test3() throws Exception {
-    DOMConfigurator.configure(INPUT_DIR + "/xml/customLevel3.xml");
+    DOMConfigurator.configure(ResourceHelper.inputFullpath("/xml/customLevel3.xml"));
     common();
-    assertTrue(Compare.compare(TEMP, WITNESS_DIR + "/customLevel.3"));
+    assertTrue(Compare.compare(TEMP, ResourceHelper.witnessFullpath("/customLevel.3")));
   }
 
   public void test4() throws Exception {
-    DOMConfigurator.configure(INPUT_DIR + "/xml/customLevel4.xml");
+    DOMConfigurator.configure(ResourceHelper.inputFullpath("/xml/customLevel4.xml"));
     common();
-    assertTrue(Compare.compare(TEMP, WITNESS_DIR + "/customLevel.4"));
+    assertTrue(Compare.compare(TEMP, ResourceHelper.witnessFullpath("/customLevel.4")));
   }
 
 



Mime
View raw message