[logback-dev] svn commit: r2390 - logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling
noreply.ceki at qos.ch
noreply.ceki at qos.ch
Fri Jul 31 16:00:22 CEST 2009
Author: ceki
Date: Fri Jul 31 16:00:21 2009
New Revision: 2390
Modified:
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/ScaffoldingForRollingTests.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/SizeBasedRollingTest.java
Log:
- tests were not passing on Windows
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/ScaffoldingForRollingTests.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/ScaffoldingForRollingTests.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/ScaffoldingForRollingTests.java Fri Jul 31 16:00:21 2009
@@ -10,6 +10,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
+import java.util.Comparator;
import java.util.List;
import ch.qos.logback.core.Context;
@@ -80,15 +81,20 @@
fileContentCheck(fileArray, runLength, prefix);
}
- public static void reverseOrderedContentCheck(String outputDirStr,
+ public static void reverseSortedContentCheck(String outputDirStr,
int runLength, String prefix) throws IOException {
File[] fileArray = getFilesInDirectory(outputDirStr);
- File[] reversedArray = new File[fileArray.length];
- for (int i = 0; i < fileArray.length; i++) {
- reversedArray[fileArray.length - 1 - i] = fileArray[i];
+
+ Arrays.sort(fileArray, new Comparator<File>() {
+ public int compare(File o1, File o2) {
+ String o1Name = o1.getName();
+ String o2Name = o2.getName();
+ return (o2Name.compareTo(o1Name));
+ }
}
- System.out.println(Arrays.toString(reversedArray));
- fileContentCheck(reversedArray, runLength, prefix);
+ );
+ System.out.println(Arrays.toString(fileArray));
+ fileContentCheck(fileArray, runLength, prefix);
}
public static void existenceCheck(List<String> filenameList) {
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/SizeBasedRollingTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/SizeBasedRollingTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/SizeBasedRollingTest.java Fri Jul 31 16:00:21 2009
@@ -130,7 +130,7 @@
expectedFilenameList.add(randomOutputDir + "sizeBased-smoke.1");
existenceCheck(expectedFilenameList);
- reverseOrderedContentCheck(randomOutputDir, runLength, prefix);
+ reverseSortedContentCheck(randomOutputDir, runLength, prefix);
}
/**
@@ -143,7 +143,7 @@
RollingFileAppender<Object> rfa = new RollingFileAppender<Object>();
rfa.setLayout(layout);
rfa.setContext(context);
- rfa.setFile(randomOutputDir + "sbr-test3.log");
+ rfa.setFile(randomOutputDir + "a-sbr-test3.log");
FixedWindowRollingPolicy fwrp = new FixedWindowRollingPolicy();
fwrp.setContext(context);
@@ -168,12 +168,12 @@
rfa.doAppend("hello"+i);
}
- expectedFilenameList.add(randomOutputDir + "sbr-test3.log");
+ expectedFilenameList.add(randomOutputDir + "a-sbr-test3.log");
expectedFilenameList.add(randomOutputDir + "sbr-test3.0.gz");
expectedFilenameList.add(randomOutputDir + "sbr-test3.1.gz");
existenceCheck(expectedFilenameList);
- reverseOrderedContentCheck(randomOutputDir, runLength, prefix);
+ reverseSortedContentCheck(randomOutputDir, runLength, prefix);
}
More information about the logback-dev
mailing list