[logback-dev] branch, master, updated. b228e86a5cee41e0617ba04a8350754a011d491a
added by portage for gitosis-gentoo
git-noreply at pixie.qos.ch
Tue Dec 1 22:38:55 CET 2009
The branch, master has been updated
via b228e86a5cee41e0617ba04a8350754a011d491a (commit)
from 1c9f5ace78ef615c63e8070abe61a074090ad755 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=b228e86a5cee41e0617ba04a8350754a011d491a
http://github.com/ceki/logback/commit/b228e86a5cee41e0617ba04a8350754a011d491a
commit b228e86a5cee41e0617ba04a8350754a011d491a
Author: Ceki Gulcu <ceki at qos.ch>
Date: Tue Dec 1 22:32:12 2009 +0100
- fixed http://jira.qos.ch/browse/LBCORE-119
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java
index 9dec24e..4bc1f33 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java
@@ -15,6 +15,7 @@ package ch.qos.logback.classic.turbo;
import java.io.File;
import java.net.URL;
+import java.net.URLDecoder;
import org.slf4j.Marker;
@@ -69,10 +70,11 @@ public class ReconfigureOnChangeFilter extends TurboFilter {
}
}
+ @SuppressWarnings("deprecation")
File convertToFile(URL url) {
String protocol = url.getProtocol();
if ("file".equals(protocol)) {
- File file = new File(url.getFile());
+ File file = new File(URLDecoder.decode(url.getFile()));
return file;
} else {
addError("URL [" + url + "] is not of type file");
diff --git a/logback-classic/src/test/input/turbo/scan 2.xml b/logback-classic/src/test/input/turbo/scan 1.xml
similarity index 100%
rename from logback-classic/src/test/input/turbo/scan 2.xml
rename to logback-classic/src/test/input/turbo/scan 1.xml
diff --git a/logback-classic/src/test/input/turbo/scan1.xml b/logback-classic/src/test/input/turbo/scan1.xml
deleted file mode 100644
index d9df3a0..0000000
--- a/logback-classic/src/test/input/turbo/scan1.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE configuration>
-
-<configuration scan="true" scanPeriod="50 millisecond">
- <root level="ERROR"/>
-</configuration>
-
\ No newline at end of file
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java
index 2aa2078..76dcf1d 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java
@@ -13,11 +13,13 @@
*/
package ch.qos.logback.classic.turbo;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
+import java.net.URL;
import org.junit.Before;
import org.junit.Test;
@@ -36,18 +38,15 @@ import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.status.InfoStatus;
import ch.qos.logback.core.status.StatusChecker;
import ch.qos.logback.core.testUtil.Env;
-import ch.qos.logback.core.util.StatusPrinter;
public class ReconfigureOnChangeTest {
final static int THREAD_COUNT = 5;
final static int LOOP_LEN = 1000 * 1000;
+ // the space in the file name mandated by http://jira.qos.ch/browse/LBCORE-119
final static String SCAN1_FILE_AS_STR = TeztConstants.TEST_DIR_PREFIX
- + "input/turbo/scan1.xml";
-
- final static String SCAN2_FILE_AS_STR = TeztConstants.TEST_DIR_PREFIX
- + "input/turbo/scan 2.xml";
-
+ + "input/turbo/scan 1.xml";
+
// it actually takes time for Windows to propagate file modification changes
// values below 100 milliseconds can be problematic
// the same propagation latency occurs in Linux but is even larger (>600 ms)
@@ -84,24 +83,15 @@ public class ReconfigureOnChangeTest {
return rArray;
}
-
- @Test
- public void lbcore119() throws JoranException, InterruptedException {
- File file = new File(SCAN2_FILE_AS_STR);
-
- JoranConfigurator jc = new JoranConfigurator();
- jc.setContext(loggerContext);
- jc.doConfigure(file);
-
- RunnableWithCounterAndDone[] runnableArray = buildRunnableArray(file);
- harness.execute(runnableArray);
-
- loggerContext.getStatusManager().add(
- new InfoStatus("end of execution ", this));
-
- long expectedRreconfigurations = runnableArray[0].getCounter();
- verify(expectedRreconfigurations);
-
+
+
+ @Test // See http://jira.qos.ch/browse/LBCORE-119
+ public void fileToURLAndBack() throws MalformedURLException {
+ File file = new File("a b.xml");
+ URL url = file.toURI().toURL();
+ ReconfigureOnChangeFilter rocf = new ReconfigureOnChangeFilter();
+ File back = rocf.convertToFile(url);
+ assertEquals(file.getName(), back.getName());
}
// Tests whether ConfigurationAction is installing ReconfigureOnChangeFilter
@@ -119,26 +109,21 @@ public class ReconfigureOnChangeTest {
verify(expectedRreconfigurations);
}
-
void verify(long expectedRreconfigurations) {
StatusChecker checker = new StatusChecker(loggerContext);
- try {
- assertTrue(checker.isErrorFree());
- int effectiveResets = checker
- .matchCount("Resetting and reconfiguring context");
- // the number of effective resets must be equal or less than
- // expectedRreconfigurations
- assertTrue(effectiveResets <= expectedRreconfigurations);
- // however, there should be some effective resets
- String failMsg = "effective=" + effectiveResets + ", expected="
- + expectedRreconfigurations;
- assertTrue(failMsg,
- (effectiveResets * 1.3) >= (expectedRreconfigurations * 1.0));
- } catch (AssertionError ae) {
- StatusPrinter.print(loggerContext);
- }
+ assertTrue(checker.isErrorFree());
+ int effectiveResets = checker
+ .matchCount("Resetting and reconfiguring context");
+ // the number of effective resets must be equal or less than
+ // expectedRreconfigurations
+ assertTrue(effectiveResets <= expectedRreconfigurations);
+ // however, there should be some effective resets
+ String failMsg = "effective=" + effectiveResets + ", expected="
+ + expectedRreconfigurations;
+ assertTrue(failMsg,
+ (effectiveResets * 1.3) >= (expectedRreconfigurations * 1.0));
}
-
+
ReconfigureOnChangeFilter initROCF() throws MalformedURLException {
ReconfigureOnChangeFilter rocf = new ReconfigureOnChangeFilter();
rocf.setContext(loggerContext);
-----------------------------------------------------------------------
Summary of changes:
.../classic/turbo/ReconfigureOnChangeFilter.java | 4 +-
.../test/input/turbo/{scan 2.xml => scan 1.xml} | 0
logback-classic/src/test/input/turbo/scan1.xml | 7 --
.../classic/turbo/ReconfigureOnChangeTest.java | 67 ++++++++------------
4 files changed, 29 insertions(+), 49 deletions(-)
rename logback-classic/src/test/input/turbo/{scan 2.xml => scan 1.xml} (100%)
delete mode 100644 logback-classic/src/test/input/turbo/scan1.xml
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
More information about the logback-dev
mailing list