[LOGBack-dev] svn commit: r69 - in logback/core/trunk/src/test/java/ch/qos/logback/core: joran rolling rolling/helper
noreply.seb at qos.ch
noreply.seb at qos.ch
Fri Jul 14 10:29:46 CEST 2006
Author: seb
Date: Fri Jul 14 10:29:45 2006
New Revision: 69
Modified:
logback/core/trunk/src/test/java/ch/qos/logback/core/joran/SkippingInInterpreterTest.java
logback/core/trunk/src/test/java/ch/qos/logback/core/rolling/SizeBasedRollingTest.java
logback/core/trunk/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingTest.java
logback/core/trunk/src/test/java/ch/qos/logback/core/rolling/helper/CompressTest.java
Log:
using TEST_DIR_PREFIX instead of specifying the prefix path
Modified: logback/core/trunk/src/test/java/ch/qos/logback/core/joran/SkippingInInterpreterTest.java
==============================================================================
--- logback/core/trunk/src/test/java/ch/qos/logback/core/joran/SkippingInInterpreterTest.java (original)
+++ logback/core/trunk/src/test/java/ch/qos/logback/core/joran/SkippingInInterpreterTest.java Fri Jul 14 10:29:45 2006
@@ -25,6 +25,7 @@
import ch.qos.logback.core.joran.spi.Pattern;
import ch.qos.logback.core.joran.spi.RuleStore;
import ch.qos.logback.core.joran.spi.SimpleRuleStore;
+import ch.qos.logback.core.util.Constants;
/**
@@ -73,7 +74,7 @@
ec.setContext(new ContextBase());
SAXParser saxParser = createParser();
- saxParser.parse("file:src/test/input/joran/exception1.xml", jp);
+ saxParser.parse("file:" + Constants.TEST_DIR_PREFIX + "input/joran/exception1.xml", jp);
String str = (String) ec.getObjectMap().get("hello");
assertEquals("Hello John Doe.", str);
@@ -99,7 +100,7 @@
ExecutionContext ec = jp.getExecutionContext();
SAXParser saxParser = createParser();
- saxParser.parse("file:src/test/input/joran/badEnd1.xml", jp);
+ saxParser.parse("file:" + Constants.TEST_DIR_PREFIX + "input/joran/badEnd1.xml", jp);
String str = (String) ec.getObjectMap().get("hello");
assertNull(str);
@@ -119,7 +120,7 @@
ExecutionContext ec = jp.getExecutionContext();
SAXParser saxParser = createParser();
- saxParser.parse("file:src/test/input/joran/badEnd2.xml", jp);
+ saxParser.parse("file:" + Constants.TEST_DIR_PREFIX + "input/joran/badEnd2.xml", jp);
String str = (String) ec.getObjectMap().get("hello");
assertEquals("Hello John Doe.", str);
Modified: logback/core/trunk/src/test/java/ch/qos/logback/core/rolling/SizeBasedRollingTest.java
==============================================================================
--- logback/core/trunk/src/test/java/ch/qos/logback/core/rolling/SizeBasedRollingTest.java (original)
+++ logback/core/trunk/src/test/java/ch/qos/logback/core/rolling/SizeBasedRollingTest.java Fri Jul 14 10:29:45 2006
@@ -24,6 +24,7 @@
import ch.qos.logback.core.Layout;
import ch.qos.logback.core.layout.DummyLayout;
import ch.qos.logback.core.util.Compare;
+import ch.qos.logback.core.util.Constants;
/**
@@ -41,12 +42,12 @@
public void setUp() {
{
- File target = new File("src/test/output/sizeBased-test2.log");
+ File target = new File(Constants.TEST_DIR_PREFIX + "output/sizeBased-test2.log");
target.mkdirs();
target.delete();
}
{
- File target = new File("src/test/output/sbr-test3.log");
+ File target = new File(Constants.TEST_DIR_PREFIX + "output/sbr-test3.log");
target.mkdirs();
target.delete();
}
@@ -70,7 +71,7 @@
SizeBasedTriggeringPolicy sbtp = new SizeBasedTriggeringPolicy();
sbtp.setMaxFileSize(100);
sbtp.start();
- fwrp.setFileNamePattern("src/test/output/sizeBased-test1.%i");
+ fwrp.setFileNamePattern(Constants.TEST_DIR_PREFIX + "output/sizeBased-test1.%i");
try {
fwrp.start();
fail("The absence of activeFileName option should have caused an exception.");
@@ -94,9 +95,9 @@
sbtp.setMaxFileSize(100);
swrp.setMinIndex(0);
- swrp.setActiveFileName("src/test/output/sizeBased-test2.log");
+ swrp.setActiveFileName(Constants.TEST_DIR_PREFIX + "output/sizeBased-test2.log");
- swrp.setFileNamePattern("src/test/output/sizeBased-test2.%i");
+ swrp.setFileNamePattern(Constants.TEST_DIR_PREFIX + "output/sizeBased-test2.%i");
swrp.start();
rfa.setRollingPolicy(swrp);
@@ -115,20 +116,20 @@
}
}
- assertTrue(new File("src/test/output/sizeBased-test2.log").exists());
- assertTrue(new File("src/test/output/sizeBased-test2.0").exists());
- assertTrue(new File("src/test/output/sizeBased-test2.1").exists());
+ assertTrue(new File(Constants.TEST_DIR_PREFIX + "output/sizeBased-test2.log").exists());
+ assertTrue(new File(Constants.TEST_DIR_PREFIX + "output/sizeBased-test2.0").exists());
+ assertTrue(new File(Constants.TEST_DIR_PREFIX + "output/sizeBased-test2.1").exists());
// The File.length() method is not accurate under Windows
if (!isWindows()) {
- assertTrue(Compare.compare("src/test/output/sizeBased-test2.log",
- "src/test/witness/rolling/sbr-test2.l"));
- assertTrue(Compare.compare("src/test/output/sizeBased-test2.0",
- "src/test/witness/rolling/sbr-test2.0"));
- assertTrue(Compare.compare("src/test/output/sizeBased-test2.1",
- "src/test/witness/rolling/sbr-test2.1"));
+ assertTrue(Compare.compare(Constants.TEST_DIR_PREFIX + "output/sizeBased-test2.log",
+ Constants.TEST_DIR_PREFIX + "witness/rolling/sbr-test2.l"));
+ assertTrue(Compare.compare(Constants.TEST_DIR_PREFIX + "output/sizeBased-test2.0",
+ Constants.TEST_DIR_PREFIX + "witness/rolling/sbr-test2.0"));
+ assertTrue(Compare.compare(Constants.TEST_DIR_PREFIX + "output/sizeBased-test2.1",
+ Constants.TEST_DIR_PREFIX + "witness/rolling/sbr-test2.1"));
}
}
@@ -145,8 +146,8 @@
sbtp.setMaxFileSize(100);
fwrp.setMinIndex(0);
- fwrp.setActiveFileName("src/test/output/sbr-test3.log");
- fwrp.setFileNamePattern("src/test/output/sbr-test3.%i.gz");
+ fwrp.setActiveFileName(Constants.TEST_DIR_PREFIX + "output/sbr-test3.log");
+ fwrp.setFileNamePattern(Constants.TEST_DIR_PREFIX + "output/sbr-test3.%i.gz");
fwrp.start();
rfa.setRollingPolicy(fwrp);
rfa.setTriggeringPolicy(sbtp);
@@ -164,18 +165,18 @@
}
}
- assertTrue(new File("src/test/output/sbr-test3.log").exists());
- assertTrue(new File("src/test/output/sbr-test3.0.gz").exists());
- assertTrue(new File("src/test/output/sbr-test3.1.gz").exists());
+ assertTrue(new File(Constants.TEST_DIR_PREFIX + "output/sbr-test3.log").exists());
+ assertTrue(new File(Constants.TEST_DIR_PREFIX + "output/sbr-test3.0.gz").exists());
+ assertTrue(new File(Constants.TEST_DIR_PREFIX + "output/sbr-test3.1.gz").exists());
if (!isWindows()) {
- assertTrue(Compare.compare("src/test/output/sbr-test3.log",
- "src/test/witness/rolling/sbr-test3.l"));
- assertTrue(Compare.gzCompare("src/test/output/sbr-test3.0.gz",
- "src/test/witness/rolling/sbr-test3.0.gz"));
- assertTrue(Compare.gzCompare("src/test/output/sbr-test3.1.gz",
- "src/test/witness/rolling/sbr-test3.1.gz"));
+ assertTrue(Compare.compare("Constants.TEST_DIR_PREFIXoutput/sbr-test3.log",
+ Constants.TEST_DIR_PREFIX + "witness/rolling/sbr-test3.l"));
+ assertTrue(Compare.gzCompare("Constants.TEST_DIR_PREFIXoutput/sbr-test3.0.gz",
+ Constants.TEST_DIR_PREFIX + "witness/rolling/sbr-test3.0.gz"));
+ assertTrue(Compare.gzCompare("Constants.TEST_DIR_PREFIXoutput/sbr-test3.1.gz",
+ Constants.TEST_DIR_PREFIX + "witness/rolling/sbr-test3.1.gz"));
}
}
Modified: logback/core/trunk/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingTest.java
==============================================================================
--- logback/core/trunk/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingTest.java (original)
+++ logback/core/trunk/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingTest.java Fri Jul 14 10:29:45 2006
@@ -20,6 +20,7 @@
import junit.framework.TestSuite;
import ch.qos.logback.core.layout.EchoLayout;
import ch.qos.logback.core.util.Compare;
+import ch.qos.logback.core.util.Constants;
@@ -56,17 +57,17 @@
public void setUp() {
//Delete .log files
{
- File target = new File("src/test/output/test4.log");
+ File target = new File(Constants.TEST_DIR_PREFIX + "output/test4.log");
target.mkdirs();
target.delete();
}
{
- File target = new File("src/test/output/test5.log");
+ File target = new File(Constants.TEST_DIR_PREFIX + "output/test5.log");
target.mkdirs();
target.delete();
}
{
- File target = new File("src/test/output/test6.log");
+ File target = new File(Constants.TEST_DIR_PREFIX + "output/test6.log");
target.mkdirs();
target.delete();
}
@@ -84,7 +85,7 @@
rfa.setLayout(layout);
TimeBasedRollingPolicy tbrp = new TimeBasedRollingPolicy();
- tbrp.setFileNamePattern("src/test/output/test1-%d{" + DATE_PATTERN + "}");
+ tbrp.setFileNamePattern(Constants.TEST_DIR_PREFIX + "output/test1-%d{" + DATE_PATTERN + "}");
tbrp.start();
rfa.setRollingPolicy(tbrp);
rfa.start();
@@ -96,7 +97,7 @@
Calendar cal = Calendar.getInstance();
for (int i = 0; i < 4; i++) {
- filenames[i] = "src/test/output/test1-" + sdf.format(cal.getTime());
+ filenames[i] = Constants.TEST_DIR_PREFIX + "output/test1-" + sdf.format(cal.getTime());
cal.add(Calendar.SECOND, 1);
}
@@ -114,7 +115,7 @@
}
for (int i = 0; i < 4; i++) {
- assertTrue(Compare.compare(filenames[i], "src/test/witness/rolling/tbr-test1." + i));
+ assertTrue(Compare.compare(filenames[i], Constants.TEST_DIR_PREFIX + "witness/rolling/tbr-test1." + i));
}
}
@@ -126,7 +127,7 @@
rfa1.setLayout(layout);
TimeBasedRollingPolicy tbrp1 = new TimeBasedRollingPolicy();
- tbrp1.setFileNamePattern("src/test/output/test2-%d{" + DATE_PATTERN + "}");
+ tbrp1.setFileNamePattern(Constants.TEST_DIR_PREFIX + "output/test2-%d{" + DATE_PATTERN + "}");
tbrp1.start();
rfa1.setRollingPolicy(tbrp1);
rfa1.start();
@@ -138,7 +139,7 @@
Calendar cal = Calendar.getInstance();
for (int i = 0; i < 4; i++) {
- filenames[i] = "src/test/output/test2-" + sdf.format(cal.getTime());
+ filenames[i] = Constants.TEST_DIR_PREFIX + "output/test2-" + sdf.format(cal.getTime());
cal.add(Calendar.SECOND, 1);
}
@@ -158,7 +159,7 @@
rfa2.setLayout(layout);
TimeBasedRollingPolicy tbrp2 = new TimeBasedRollingPolicy();
- tbrp2.setFileNamePattern("src/test/output/test2-%d{" + DATE_PATTERN + "}");
+ tbrp2.setFileNamePattern(Constants.TEST_DIR_PREFIX + "output/test2-%d{" + DATE_PATTERN + "}");
tbrp2.start();
rfa2.setRollingPolicy(tbrp2);
rfa2.start();
@@ -170,7 +171,7 @@
}
for (int i = 0; i < 4; i++) {
- assertTrue(Compare.compare(filenames[i], "src/test/witness/rolling/tbr-test2." + i));
+ assertTrue(Compare.compare(filenames[i], Constants.TEST_DIR_PREFIX + "witness/rolling/tbr-test2." + i));
}
}
@@ -183,7 +184,7 @@
TimeBasedRollingPolicy tbrp = new TimeBasedRollingPolicy();
- tbrp.setFileNamePattern("src/test/output/test3-%d{" + DATE_PATTERN + "}.gz");
+ tbrp.setFileNamePattern(Constants.TEST_DIR_PREFIX + "output/test3-%d{" + DATE_PATTERN + "}.gz");
tbrp.start();
rfa.setRollingPolicy(tbrp);
rfa.start();
@@ -195,7 +196,7 @@
Calendar cal = Calendar.getInstance();
for (int i = 0; i < 3; i++) {
- filenames[i] = "src/test/output/test3-" + sdf.format(cal.getTime()) + ".gz";
+ filenames[i] = Constants.TEST_DIR_PREFIX + "output/test3-" + sdf.format(cal.getTime()) + ".gz";
cal.add(Calendar.SECOND, 1);
}
Modified: logback/core/trunk/src/test/java/ch/qos/logback/core/rolling/helper/CompressTest.java
==============================================================================
--- logback/core/trunk/src/test/java/ch/qos/logback/core/rolling/helper/CompressTest.java (original)
+++ logback/core/trunk/src/test/java/ch/qos/logback/core/rolling/helper/CompressTest.java Fri Jul 14 10:29:45 2006
@@ -22,6 +22,7 @@
import ch.qos.logback.core.Context;
import ch.qos.logback.core.ContextBase;
import ch.qos.logback.core.util.Compare;
+import ch.qos.logback.core.util.Constants;
import ch.qos.logback.core.util.StatusPrinter;
@@ -43,26 +44,26 @@
//Copy source files
//Delete output files
{
- File source = new File("src/test/input/compress1.copy");
- File dest = new File("src/test/input/compress1.txt");
+ File source = new File(Constants.TEST_DIR_PREFIX + "input/compress1.copy");
+ File dest = new File(Constants.TEST_DIR_PREFIX + "input/compress1.txt");
copy(source, dest);
- File target = new File("src/test/output/compress1.txt.gz");
+ File target = new File(Constants.TEST_DIR_PREFIX + "output/compress1.txt.gz");
target.mkdirs();
target.delete();
}
{
- File source = new File("src/test/input/compress2.copy");
- File dest = new File("src/test/input/compress2.txt");
+ File source = new File(Constants.TEST_DIR_PREFIX + "input/compress2.copy");
+ File dest = new File(Constants.TEST_DIR_PREFIX + "input/compress2.txt");
copy(source, dest);
- File target = new File("src/test/output/compress2.txt.gz");
+ File target = new File(Constants.TEST_DIR_PREFIX + "output/compress2.txt.gz");
target.mkdirs();
target.delete();
}
{
- File source = new File("src/test/input/compress3.copy");
- File dest = new File("src/test/input/compress3.txt");
+ File source = new File(Constants.TEST_DIR_PREFIX + "input/compress3.copy");
+ File dest = new File(Constants.TEST_DIR_PREFIX + "input/compress3.txt");
copy(source, dest);
- File target = new File("src/test/output/compress3.txt.zip");
+ File target = new File(Constants.TEST_DIR_PREFIX + "output/compress3.txt.zip");
target.mkdirs();
target.delete();
}
@@ -72,25 +73,25 @@
}
public void test1() throws Exception {
- compress.GZCompress("src/test/input/compress1.txt", "src/test/output/compress1.txt.gz");
+ compress.GZCompress(Constants.TEST_DIR_PREFIX + "input/compress1.txt", Constants.TEST_DIR_PREFIX + "output/compress1.txt.gz");
StatusPrinter.print(context.getStatusManager());
assertEquals(0, context.getStatusManager().getCount());
- assertTrue(Compare.gzCompare("src/test/output/compress1.txt.gz",
- "src/test/witness/compress1.txt.gz"));
+ assertTrue(Compare.gzCompare(Constants.TEST_DIR_PREFIX + "output/compress1.txt.gz",
+ Constants.TEST_DIR_PREFIX + "witness/compress1.txt.gz"));
}
public void test2() throws Exception {
- compress.GZCompress("src/test/input/compress2.txt", "src/test/output/compress2.txt");
+ compress.GZCompress(Constants.TEST_DIR_PREFIX + "input/compress2.txt", Constants.TEST_DIR_PREFIX + "output/compress2.txt");
StatusPrinter.print(context.getStatusManager());
assertEquals(0, context.getStatusManager().getCount());
- assertTrue(Compare.gzCompare("src/test/output/compress2.txt.gz",
- "src/test/witness/compress2.txt.gz"));
+ assertTrue(Compare.gzCompare(Constants.TEST_DIR_PREFIX + "output/compress2.txt.gz",
+ Constants.TEST_DIR_PREFIX + "witness/compress2.txt.gz"));
}
public void test3() throws Exception {
- compress.ZIPCompress("src/test/input/compress3.txt", "src/test/output/compress3.txt");
+ compress.ZIPCompress(Constants.TEST_DIR_PREFIX + "input/compress3.txt", Constants.TEST_DIR_PREFIX + "output/compress3.txt");
StatusPrinter.print(context.getStatusManager());
assertEquals(0, context.getStatusManager().getCount());
More information about the logback-dev
mailing list