logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattsic...@apache.org
Subject svn commit: r1582168 - /logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java
Date Thu, 27 Mar 2014 03:07:21 GMT
Author: mattsicker
Date: Thu Mar 27 03:07:21 2014
New Revision: 1582168

URL: http://svn.apache.org/r1582168
Log:
Update to use CleanFiles rule.

Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java

Modified: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java?rev=1582168&r1=1582167&r2=1582168&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java
Thu Mar 27 03:07:21 2014
@@ -21,11 +21,9 @@ import org.apache.logging.log4j.core.Lay
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.impl.Log4jLogEvent;
 import org.apache.logging.log4j.core.layout.PatternLayout;
+import org.apache.logging.log4j.junit.CleanFiles;
 import org.apache.logging.log4j.message.SimpleMessage;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.*;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -49,22 +47,14 @@ public class FileAppenderTest {
     private static final String FILENAME = "target/fileAppenderTest.log";
     private static final int THREADS = 2;
 
-    @BeforeClass
-    public static void setupClass() {
-        deleteFile();
-    }
+    @Rule
+    public CleanFiles files = new CleanFiles(FILENAME);
 
     @AfterClass
     public static void cleanupClass() {
-        deleteFile();
         assertTrue("Manager for " + FILENAME + " not removed", !OutputStreamManager.hasManager(FILENAME));
     }
 
-    @After
-    public void teardown() {
-        deleteFile();
-    }
-
     @Test
     public void testAppender() throws Exception {
         writer(false, 1, "test");
@@ -135,7 +125,8 @@ public class FileAppenderTest {
         verifyFile(THREADS * count);
     }
 
-    // @Test
+    @Test
+    @Ignore
     public void testMultipleVMs() throws Exception {
 
         final String classPath = System.getProperty("java.class.path");
@@ -209,13 +200,6 @@ public class FileAppenderTest {
 
     }
 
-    private static void deleteFile() {
-        final File file = new File(FILENAME);
-        if (file.exists()) {
-            assertTrue(file.delete());
-        }
-    }
-
     public class FileWriterRunnable implements Runnable {
         private final boolean lock;
         private final int count;



Mime
View raw message