From 8e57a2e3861dcb8c1456f79674c2551e5146f7c0 Mon Sep 17 00:00:00 2001 From: zab Date: Thu, 3 Jan 2013 22:55:40 +0000 Subject: [PATCH] Fix most of the test cases, reduce the runtime of the test using LogManager.flush() --- .../test/junit/net/i2p/util/LogSettingsTest.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/core/java/test/junit/net/i2p/util/LogSettingsTest.java b/core/java/test/junit/net/i2p/util/LogSettingsTest.java index 529190a77..123d0863d 100644 --- a/core/java/test/junit/net/i2p/util/LogSettingsTest.java +++ b/core/java/test/junit/net/i2p/util/LogSettingsTest.java @@ -88,10 +88,11 @@ public class LogSettingsTest extends TestCase { log.warn("DEBUG" + ": warn"); log.error("DEBUG" + ": error"); log.log(Log.CRIT, "DEBUG" + ": crit"); + _context.logManager().flush(); // Wait for the LogWriter to flush, then write extra stuff so // the test doesn't hang on failure - try { Thread.sleep(12*1000); } catch (InterruptedException ie) {} + try { Thread.sleep(1000); } catch (InterruptedException ie) {} for (int i = 0; i < 5; i++) pout.println(""); pout.flush(); @@ -137,10 +138,11 @@ public class LogSettingsTest extends TestCase { log.warn("INFO" + ": warn"); log.error("INFO" + ": error"); log.log(Log.CRIT, "INFO" + ": crit"); + _context.logManager().flush(); // Wait for the LogWriter to flush, then write extra stuff so // the test doesn't hang on failure - try { Thread.sleep(12*1000); } catch (InterruptedException ie) {} + try { Thread.sleep(1000); } catch (InterruptedException ie) {} for (int i = 0; i < 4; i++) pout.println(""); pout.flush(); @@ -184,10 +186,11 @@ public class LogSettingsTest extends TestCase { log.warn("WARN" + ": warn"); log.error("WARN" + ": error"); log.log(Log.CRIT, "WARN" + ": crit"); + _context.logManager().flush(); // Wait for the LogWriter to flush, then write extra stuff so // the test doesn't hang on failure - try { Thread.sleep(12*1000); } catch (InterruptedException ie) {} + try { Thread.sleep(1000); } catch (InterruptedException ie) {} for (int i = 0; i < 3; i++) pout.println(""); pout.flush(); @@ -228,10 +231,11 @@ public class LogSettingsTest extends TestCase { log.warn("ERROR" + ": warn"); log.error("ERROR" + ": error"); log.log(Log.CRIT, "ERROR" + ": crit"); + _context.logManager().flush(); // Wait for the LogWriter to flush, then write extra stuff so // the test doesn't hang on failure - try { Thread.sleep(12*1000); } catch (InterruptedException ie) {} + try { Thread.sleep(1000); } catch (InterruptedException ie) {} for (int i = 0; i < 2; i++) pout.println(""); pout.flush(); @@ -270,10 +274,11 @@ public class LogSettingsTest extends TestCase { log.warn("CRIT" + ": warn"); log.error("CRIT" + ": error"); log.log(Log.CRIT, "CRIT" + ": crit"); + _context.logManager().flush(); // Wait for the LogWriter to flush, then write extra stuff so // the test doesn't hang on failure - try { Thread.sleep(12*1000); } catch (InterruptedException ie) {} + try { Thread.sleep(1000); } catch (InterruptedException ie) {} pout.println(""); pout.flush(); String l1 = in.readLine();