[LOGBack-dev] svn commit: r62 - logback/core/trunk/src/test/java/ch/qos/logback/core/rolling

noreply.seb at qos.ch noreply.seb at qos.ch
Thu Jul 13 16:34:33 CEST 2006


Author: seb
Date: Thu Jul 13 16:34:32 2006
New Revision: 62

Modified:
   logback/core/trunk/src/test/java/ch/qos/logback/core/rolling/RenamingTest.java
Log:
using new paths to access files + deleting old .log in setUp()

Modified: logback/core/trunk/src/test/java/ch/qos/logback/core/rolling/RenamingTest.java
==============================================================================
--- logback/core/trunk/src/test/java/ch/qos/logback/core/rolling/RenamingTest.java	(original)
+++ logback/core/trunk/src/test/java/ch/qos/logback/core/rolling/RenamingTest.java	Thu Jul 13 16:34:32 2006
@@ -10,17 +10,15 @@
 
 package ch.qos.logback.core.rolling;
 
+import java.io.File;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 
 import junit.framework.TestCase;
-
 import ch.qos.logback.core.Context;
 import ch.qos.logback.core.ContextBase;
 import ch.qos.logback.core.Layout;
 import ch.qos.logback.core.layout.EchoLayout;
-import ch.qos.logback.core.rolling.RollingFileAppender;
-import ch.qos.logback.core.rolling.TimeBasedRollingPolicy;
 import ch.qos.logback.core.util.Compare;
 import ch.qos.logback.core.util.StatusPrinter;
 
@@ -45,6 +43,10 @@
   protected void setUp() throws Exception {
     super.setUp();
     layout = new EchoLayout();
+    
+	File target = new File("src/test/output/test.log");
+	target.mkdirs();
+	target.delete();
   }
 
   protected void tearDown() throws Exception {
@@ -64,8 +66,8 @@
     String[] filenames = new String[2];
 
     TimeBasedRollingPolicy tbrp = new TimeBasedRollingPolicy();
-    tbrp.setFileNamePattern("output/test-%d{" + datePattern + "}");
-    tbrp.setActiveFileName("output/test.log");
+    tbrp.setFileNamePattern("src/test/output/test-%d{" + datePattern + "}");
+    tbrp.setActiveFileName("src/test/output/test.log");
     tbrp.setContext(context);
     tbrp.start();
     
@@ -79,12 +81,12 @@
     Thread.sleep(5000);
     rfa.doAppend("Hello 1");
     
-    filenames[0] = "output/test-" + sdf.format(cal.getTime());
-    filenames[1] = "output/test.log";
+    filenames[0] = "src/test/output/test-" + sdf.format(cal.getTime());
+    filenames[1] = "src/test/output/test.log";
 
     for (int i = 0; i < filenames.length; i++) {
       System.out.println("before i="+i);
-      assertTrue(Compare.compare(filenames[i], "witness/rolling/renaming." + i));
+      assertTrue(Compare.compare(filenames[i], "src/test/witness/rolling/renaming." + i));
       System.out.println("post i="+i);
     }
   }



More information about the logback-dev mailing list