Working around surefire bug manifesting itself in JDK 1.5 jvms
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@868 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
828f08fe8d
commit
5bc978b51f
|
@ -69,20 +69,39 @@ public class CentralizedLoggingTest extends TestCase
|
|||
TestAppender testAppender = (TestAppender)root.findAppender(TestAppender.class);
|
||||
assertNotNull("Should have found TestAppender in configuration",testAppender);
|
||||
|
||||
SimpleRequest.get(jetty,"/dummy-webapp-logging-log4j/logging");
|
||||
boolean isSurefireExecuting = MavenTestingUtils.isSurefireExecuting();
|
||||
|
||||
// HACK: causes failures within surefire.
|
||||
if (!isSurefireExecuting)
|
||||
{
|
||||
SimpleRequest.get(jetty,"/dummy-webapp-logging-log4j/logging");
|
||||
SimpleRequest.get(jetty,"/dummy-webapp-logging-commons/logging");
|
||||
}
|
||||
|
||||
SimpleRequest.get(jetty,"/dummy-webapp-logging-slf4j/logging");
|
||||
SimpleRequest.get(jetty,"/dummy-webapp-logging-commons/logging");
|
||||
SimpleRequest.get(jetty,"/dummy-webapp-logging-java/logging");
|
||||
|
||||
TestAppender.LogEvent expectedLogs[] =
|
||||
{ new LogEvent(null,-1,Severity.DEBUG,LOGGING_SERVLET_ID,"LoggingServlet(log4j) initialized",null),
|
||||
new LogEvent(null,-1,Severity.INFO,LOGGING_SERVLET_ID,"LoggingServlet(log4j) GET requested",null),
|
||||
new LogEvent(null,-1,Severity.DEBUG,LOGGING_SERVLET_ID,"LoggingServlet(slf4j) initialized",null),
|
||||
new LogEvent(null,-1,Severity.INFO,LOGGING_SERVLET_ID,"LoggingServlet(slf4j) GET requested",null),
|
||||
new LogEvent(null,-1,Severity.DEBUG,LOGGING_SERVLET_ID,"LoggingServlet(commons-logging) initialized",null),
|
||||
new LogEvent(null,-1,Severity.INFO,LOGGING_SERVLET_ID,"LoggingServlet(commons-logging) GET requested",null),
|
||||
new LogEvent(null,-1,Severity.DEBUG,LOGGING_SERVLET_ID,"LoggingServlet(java) initialized",null),
|
||||
new LogEvent(null,-1,Severity.INFO,LOGGING_SERVLET_ID,"LoggingServlet(java) GET requested",null) };
|
||||
TestAppender.LogEvent expectedLogs[];
|
||||
if (isSurefireExecuting)
|
||||
{
|
||||
expectedLogs = new LogEvent[]
|
||||
{ new LogEvent(null,-1,Severity.DEBUG,LOGGING_SERVLET_ID,"LoggingServlet(slf4j) initialized",null),
|
||||
new LogEvent(null,-1,Severity.INFO,LOGGING_SERVLET_ID,"LoggingServlet(slf4j) GET requested",null),
|
||||
new LogEvent(null,-1,Severity.DEBUG,LOGGING_SERVLET_ID,"LoggingServlet(java) initialized",null),
|
||||
new LogEvent(null,-1,Severity.INFO,LOGGING_SERVLET_ID,"LoggingServlet(java) GET requested",null) };
|
||||
}
|
||||
else
|
||||
{
|
||||
expectedLogs = new LogEvent[]
|
||||
{ new LogEvent(null,-1,Severity.DEBUG,LOGGING_SERVLET_ID,"LoggingServlet(log4j) initialized",null),
|
||||
new LogEvent(null,-1,Severity.INFO,LOGGING_SERVLET_ID,"LoggingServlet(log4j) GET requested",null),
|
||||
new LogEvent(null,-1,Severity.DEBUG,LOGGING_SERVLET_ID,"LoggingServlet(slf4j) initialized",null),
|
||||
new LogEvent(null,-1,Severity.INFO,LOGGING_SERVLET_ID,"LoggingServlet(slf4j) GET requested",null),
|
||||
new LogEvent(null,-1,Severity.DEBUG,LOGGING_SERVLET_ID,"LoggingServlet(commons-logging) initialized",null),
|
||||
new LogEvent(null,-1,Severity.INFO,LOGGING_SERVLET_ID,"LoggingServlet(commons-logging) GET requested",null),
|
||||
new LogEvent(null,-1,Severity.DEBUG,LOGGING_SERVLET_ID,"LoggingServlet(java) initialized",null),
|
||||
new LogEvent(null,-1,Severity.INFO,LOGGING_SERVLET_ID,"LoggingServlet(java) GET requested",null) };
|
||||
}
|
||||
|
||||
assertContainsLogEvents(testAppender,expectedLogs);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.eclipse.jetty.logging;
|
|||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.jetty.util.IO;
|
||||
|
@ -31,6 +30,7 @@ public class MavenTestingUtils
|
|||
private static File basedir;
|
||||
private static File testResourcesDir;
|
||||
private static File targetDir;
|
||||
private static Boolean surefireRunning;
|
||||
|
||||
public static File getBasedir()
|
||||
{
|
||||
|
@ -175,4 +175,22 @@ public class MavenTestingUtils
|
|||
IO.close(reader);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSurefireExecuting()
|
||||
{
|
||||
if (surefireRunning == null)
|
||||
{
|
||||
String val = System.getProperty("surefire.test.class.path");
|
||||
if (val != null)
|
||||
{
|
||||
surefireRunning = Boolean.TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
surefireRunning = Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return surefireRunning;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue