Fix most of the test cases, reduce the runtime of the test

using LogManager.flush()
This commit is contained in:
zab
2013-01-03 22:55:40 +00:00
parent 2c8f2ae404
commit 8e57a2e386

View File

@ -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();