[logback-dev] svn commit: r679 - logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling
noreply.ceki at qos.ch
noreply.ceki at qos.ch
Sun Oct 15 17:25:49 CEST 2006
Author: ceki
Date: Sun Oct 15 17:25:49 2006
New Revision: 679
Modified:
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/SizeBasedRollingTest.java
Log:
indentation changes only
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 Sun Oct 15 17:25:49 2006
@@ -28,7 +28,6 @@
import ch.qos.logback.core.util.Compare;
import ch.qos.logback.core.util.Constants;
-
/**
*
* Do not forget to call start() when configuring programatically.
@@ -42,18 +41,19 @@
public SizeBasedRollingTest(String name) {
super(name);
}
-
+
public void setUp() {
- {
- File target = new File(Constants.TEST_DIR_PREFIX + "output/sizeBased-test2.log");
- target.mkdirs();
- target.delete();
- }
- {
- File target = new File(Constants.TEST_DIR_PREFIX + "output/sbr-test3.log");
- target.mkdirs();
- target.delete();
- }
+ {
+ File target = new File(Constants.TEST_DIR_PREFIX
+ + "output/sizeBased-test2.log");
+ target.mkdirs();
+ target.delete();
+ }
+ {
+ File target = new File(Constants.TEST_DIR_PREFIX + "output/sbr-test3.log");
+ target.mkdirs();
+ target.delete();
+ }
}
public void tearDown() {
@@ -66,7 +66,7 @@
public void test1() throws Exception {
// We purposefully use the \n as the line separator.
// This makes the regression test system independent.
- Context context = new ContextBase();
+ Context context = new ContextBase();
Layout layout = new DummyLayout();
RollingFileAppender rfa = new RollingFileAppender();
rfa.setLayout(layout);
@@ -76,32 +76,33 @@
fwrp.setContext(context);
SizeBasedTriggeringPolicy sbtp = new SizeBasedTriggeringPolicy();
sbtp.setContext(context);
-
+
sbtp.setMaxFileSize("100");
sbtp.start();
- fwrp.setFileNamePattern(Constants.TEST_DIR_PREFIX + "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.");
} catch (IllegalStateException e) {
return;
}
-
- //StatusPrinter.print(context.getStatusManager());
+
+ // StatusPrinter.print(context.getStatusManager());
}
/**
* Test basic rolling functionality.
*/
public void test2() throws Exception {
- Context context = new ContextBase();
-
+ Context context = new ContextBase();
+
DummyLayout layout = new DummyLayout();
RollingFileAppender rfa = new RollingFileAppender();
rfa.setName("ROLLING");
rfa.setLayout(layout);
rfa.setContext(context);
-
+
FixedWindowRollingPolicy swrp = new FixedWindowRollingPolicy();
swrp.setContext(context);
SizeBasedTriggeringPolicy sbtp = new SizeBasedTriggeringPolicy();
@@ -109,107 +110,122 @@
sbtp.setMaxFileSize("100");
swrp.setMinIndex(0);
- swrp.setActiveFileName(Constants.TEST_DIR_PREFIX + "output/sizeBased-test2.log");
+ swrp.setActiveFileName(Constants.TEST_DIR_PREFIX
+ + "output/sizeBased-test2.log");
- swrp.setFileNamePattern(Constants.TEST_DIR_PREFIX + "output/sizeBased-test2.%i");
+ swrp.setFileNamePattern(Constants.TEST_DIR_PREFIX
+ + "output/sizeBased-test2.%i");
swrp.start();
rfa.setRollingPolicy(swrp);
rfa.setTriggeringPolicy(sbtp);
rfa.start();
-
+
// Write exactly 10 bytes with each log
-// for (int i = 0; i < 25; i++) {
-// Thread.sleep(100);
-// if (i < 10) {
-// rfa.doAppend("Hello---" + i);
-// //logger.debug("Hello---" + i);
-// } else if (i < 100) {
-// rfa.doAppend("Hello---" + i);
-// //logger.debug("Hello--" + i);
-// }
-// }
-
+ // for (int i = 0; i < 25; i++) {
+ // Thread.sleep(100);
+ // if (i < 10) {
+ // rfa.doAppend("Hello---" + i);
+ // //logger.debug("Hello---" + i);
+ // } else if (i < 100) {
+ // rfa.doAppend("Hello---" + i);
+ // //logger.debug("Hello--" + i);
+ // }
+ // }
+
for (int i = 0; i < 45; i++) {
- Thread.sleep(100);
- rfa.doAppend("hello");
+ Thread.sleep(100);
+ rfa.doAppend("hello");
}
- 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());
+ 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(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"));
+ 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"));
}
-
- //StatusPrinter.print(context.getStatusManager());
+
+ // StatusPrinter.print(context.getStatusManager());
}
/**
* Same as testBasic but also with GZ compression.
*/
public void test3() throws Exception {
- Context context = new ContextBase();
+ Context context = new ContextBase();
DummyLayout layout = new DummyLayout();
RollingFileAppender rfa = new RollingFileAppender();
rfa.setLayout(layout);
rfa.setContext(context);
-
+
FixedWindowRollingPolicy fwrp = new FixedWindowRollingPolicy();
fwrp.setContext(context);
SizeBasedTriggeringPolicy sbtp = new SizeBasedTriggeringPolicy();
sbtp.setContext(context);
-
+
sbtp.setMaxFileSize("100");
fwrp.setMinIndex(0);
fwrp.setActiveFileName(Constants.TEST_DIR_PREFIX + "output/sbr-test3.log");
- fwrp.setFileNamePattern(Constants.TEST_DIR_PREFIX + "output/sbr-test3.%i.gz");
+ fwrp.setFileNamePattern(Constants.TEST_DIR_PREFIX
+ + "output/sbr-test3.%i.gz");
fwrp.start();
rfa.setRollingPolicy(fwrp);
rfa.setTriggeringPolicy(sbtp);
rfa.start();
// Write exactly 10 bytes with each log
-// for (int i = 0; i < 25; i++) {
-// Thread.sleep(100);
-// if (i < 10) {
-// rfa.doAppend("Hello---" + i);
-// //logger.debug("Hello---" + i);
-// } else if (i < 100) {
-// rfa.doAppend("Hello---" + i);
-// //logger.debug("Hello--" + i);
-// }
-// }
+ // for (int i = 0; i < 25; i++) {
+ // Thread.sleep(100);
+ // if (i < 10) {
+ // rfa.doAppend("Hello---" + i);
+ // //logger.debug("Hello---" + i);
+ // } else if (i < 100) {
+ // rfa.doAppend("Hello---" + i);
+ // //logger.debug("Hello--" + i);
+ // }
+ // }
for (int i = 0; i < 45; i++) {
- Thread.sleep(100);
- rfa.doAppend("hello");
+ Thread.sleep(100);
+ rfa.doAppend("hello");
}
-
- 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());
+
+ 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("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",
+ 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"));
+ assertTrue(Compare.gzCompare(
+ "Constants.TEST_DIR_PREFIXoutput/sbr-test3.1.gz",
+ Constants.TEST_DIR_PREFIX + "witness/rolling/sbr-test3.1.gz"));
}
- //StatusPrinter.print(context.getStatusManager());
+ // StatusPrinter.print(context.getStatusManager());
}
boolean isWindows() {
More information about the logback-dev
mailing list