You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2012/12/30 20:58:55 UTC

svn commit: r1426980 - /logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java

Author: rgoers
Date: Sun Dec 30 19:58:55 2012
New Revision: 1426980

URL: http://svn.apache.org/viewvc?rev=1426980&view=rev
Log:
Cause test to fail even if user has permission to write to root directory

Modified:
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java?rev=1426980&r1=1426979&r2=1426980&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java Sun Dec 30 19:58:55 2012
@@ -45,6 +45,23 @@ public class TestConfigurator {
 
     private static final String FILESEP = System.getProperty("file.separator");
 
+    private static final String[] CHARS = new String[]
+        {
+            "aaaaaaaaaa",
+            "bbbbbbbbbb",
+            "cccccccccc",
+            "dddddddddd",
+            "eeeeeeeeee",
+            "ffffffffff",
+            "gggggggggg",
+            "hhhhhhhhhh",
+            "iiiiiiiiii",
+            "jjjjjjjjjj",
+            "kkkkkkkkkk",
+            "llllllllll",
+            "mmmmmmmmmm",
+        };
+
 
     @Test
     public void testFromFile() throws Exception {
@@ -224,7 +241,13 @@ public class TestConfigurator {
 
     @Test
     public void testBadFileName() throws Exception {
-        final String value = FILESEP.equals("/") ? "/rootdir/test.log" : "1:/target/bad:file.log";
+        StringBuilder dir = new StringBuilder("/VeryLongDirectoryName");
+
+        for (int i = 0; i < CHARS.length; ++i) {
+            dir.append(CHARS[i]);
+            dir.append(CHARS[i].toUpperCase());
+        }
+        final String value = FILESEP.equals("/") ? dir.toString() + "/test.log" : "1:/target/bad:file.log";
         System.setProperty("testfile", value);
         final LoggerContext ctx = Configurator.initialize("Test1", null, "bad/log4j-badfilename.xml");
         final Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");