[jboss-cvs] JBossAS SVN: r61056 - in branches/JBoss_4_0_5_GA_CP/testsuite: src/main/org/jboss/test/classloader/scoping/override/web/comlog and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Mar 2 12:42:37 EST 2007
Author: galder.zamarreno at jboss.com
Date: 2007-03-02 12:42:37 -0500 (Fri, 02 Mar 2007)
New Revision: 61056
Added:
branches/JBoss_4_0_5_GA_CP/testsuite/src/resources/classloader/scoping/override/common-logging/log4j-cl11.xml
Modified:
branches/JBoss_4_0_5_GA_CP/testsuite/imports/sections/classloader.xml
branches/JBoss_4_0_5_GA_CP/testsuite/src/main/org/jboss/test/classloader/scoping/override/web/comlog/Log4jServlet.java
branches/JBoss_4_0_5_GA_CP/testsuite/src/main/org/jboss/test/classloader/test/ScopingUnitTestCase.java
Log:
[JBAS-3988] testsuite updated to pass the tests of upgrading JCL 1.1
Modified: branches/JBoss_4_0_5_GA_CP/testsuite/imports/sections/classloader.xml
===================================================================
--- branches/JBoss_4_0_5_GA_CP/testsuite/imports/sections/classloader.xml 2007-03-02 16:33:11 UTC (rev 61055)
+++ branches/JBoss_4_0_5_GA_CP/testsuite/imports/sections/classloader.xml 2007-03-02 17:42:37 UTC (rev 61056)
@@ -330,6 +330,38 @@
</classes>
</war>
+ <!-- Similar to commons-logging.war but includes the current commons-logging.jar
+ in the war WEB-INF/lib
+ -->
+ <war destfile="${build.lib}/cl11-withjar.war"
+ webxml="${build.resources}/classloader/scoping/override/common-logging/web.xml">
+ <webinf
+ dir="${build.resources}/classloader/scoping/override/common-logging">
+ <include name="jboss-web.xml"/>
+ </webinf>
+ <!-- Need to include log4j.jar to allow the singleton config to be
+ reinitialized in the context of the war to find the war log4j.xml.
+ -->
+ <lib dir="${apache.log4j.lib}">
+ <include name="log4j.jar" />
+ </lib>
+ <lib dir="${apache.logging.lib}">
+ <include name="commons-logging.jar" />
+ </lib>
+ <classes dir="${build.classes}">
+ <include
+ name="org/jboss/test/classloader/scoping/override/web/comlog/*"/>
+ </classes>
+ <classes
+ dir="${build.resources}/classloader/scoping/override/common-logging">
+ <include name="commons-logging.properties"/>
+ </classes>
+ <zipfileset dir="${build.resources}/classloader/scoping/override/common-logging"
+ fullpath="WEB-INF/classes/log4j.xml">
+ <include name="log4j-cl11.xml"/>
+ </zipfileset>
+ </war>
+
<war destfile="${build.lib}/oldxerces.war"
webxml="${build.resources}/classloader/scoping/override/xml/web.xml">
<webinf dir="${build.resources}/classloader/scoping/override/xml">
Modified: branches/JBoss_4_0_5_GA_CP/testsuite/src/main/org/jboss/test/classloader/scoping/override/web/comlog/Log4jServlet.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/testsuite/src/main/org/jboss/test/classloader/scoping/override/web/comlog/Log4jServlet.java 2007-03-02 16:33:11 UTC (rev 61055)
+++ branches/JBoss_4_0_5_GA_CP/testsuite/src/main/org/jboss/test/classloader/scoping/override/web/comlog/Log4jServlet.java 2007-03-02 17:42:37 UTC (rev 61056)
@@ -46,6 +46,7 @@
*/
public class Log4jServlet extends HttpServlet
{
+ private static final long serialVersionUID = 1;
private static Log log = LogFactory.getLog(Log4jServlet.class);
/**
@@ -87,11 +88,15 @@
throw new ServletException("Failed to lookup ENC", e);
}
- // Validate that the cl-test.log
+ // Validate that the log exists. If the log-name param is null use cl-test.log
+ String logName = request.getParameter("log-name");
+ if( logName == null )
+ logName = "cl-test.log";
String logDir = System.getProperty("jboss.server.log.dir");
- File logFile = new File(logDir, "cl-test.log");
+ File logFile = new File(logDir, logName);
+ System.err.println("Checking for logfile: "+logFile.getAbsolutePath());
if( logFile.exists() == false )
- throw new ServletException(logFile+" does not exist");
+ throw new ServletException(logFile.getAbsolutePath()+" does not exist");
long length = logFile.length();
log.info("Current length = "+length);
Modified: branches/JBoss_4_0_5_GA_CP/testsuite/src/main/org/jboss/test/classloader/test/ScopingUnitTestCase.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/testsuite/src/main/org/jboss/test/classloader/test/ScopingUnitTestCase.java 2007-03-02 16:33:11 UTC (rev 61055)
+++ branches/JBoss_4_0_5_GA_CP/testsuite/src/main/org/jboss/test/classloader/test/ScopingUnitTestCase.java 2007-03-02 17:42:37 UTC (rev 61056)
@@ -160,6 +160,32 @@
}
/** Test the ability to override the server classes with war local versions
+ * of log4j classes when using commons-logging. This version includes the
+ * current commons-logging.jar in the war WEB-INF/lib.
+ */
+ public void testWarCommonsLoggingWithCLJarLog4jOverrides() throws Exception
+ {
+ getLog().debug("+++ testWarCommonsLoggingWithCLJarLog4jOverrides");
+ try
+ {
+ deploy("cl11-withjar.war");
+ URL log4jServletURL = new URL("http://" + getServerHost() + ":8080/cl11-withjar/Log4jServlet/?log-name=cl11-withjar.log");
+ InputStream reply = (InputStream) log4jServletURL.getContent();
+ getLog().debug("Accessed http://" + getServerHost() + ":8080/cl11-withjar/Log4jServlet/");
+ logReply(reply);
+ }
+ catch(Exception e)
+ {
+ getLog().info("Failed to access Log4jServlet in cl11-withjar.war", e);
+ throw e;
+ }
+ finally
+ {
+ undeploy("cl11-withjar.war");
+ }
+ }
+
+ /** Test the ability to override the server classes with war local versions
* of xml parser classes.
* This test is invalid as of jdk1.4+ due to the bundling of the xerces
* parser with the jdk
Added: branches/JBoss_4_0_5_GA_CP/testsuite/src/resources/classloader/scoping/override/common-logging/log4j-cl11.xml
===================================================================
--- branches/JBoss_4_0_5_GA_CP/testsuite/src/resources/classloader/scoping/override/common-logging/log4j-cl11.xml (rev 0)
+++ branches/JBoss_4_0_5_GA_CP/testsuite/src/resources/classloader/scoping/override/common-logging/log4j-cl11.xml 2007-03-02 17:42:37 UTC (rev 61056)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<!-- Used by the cl11-withjar.war to create a distinct log file that
+does not conflict with the commons-logging.war test.
+-->
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="FILE" class="org.apache.log4j.FileAppender">
+ <param name="File" value="${jboss.server.log.dir}/cl11-withjar.log"/>
+ <param name="Append" value="false"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="(%d{ABSOLUTE},%-5p,[%c{1}]) %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="FILE"/>
+ </root>
+</log4j:configuration>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list