[jboss-cvs] JBossAS SVN: r60485 - in branches/Branch_4_2/testsuite/src: main/org/jboss/test/classloader/test and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 12 02:51:35 EST 2007


Author: scott.stark at jboss.org
Date: 2007-02-12 02:51:34 -0500 (Mon, 12 Feb 2007)
New Revision: 60485

Added:
   branches/Branch_4_2/testsuite/src/resources/classloader/scoping/override/common-logging/log4j-cl11.xml
Modified:
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/classloader/scoping/override/web/comlog/Log4jServlet.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/classloader/test/ScopingUnitTestCase.java
Log:
JBAS-2823, update the commons logging override test to include a version that bundles the commons-logging.jar

Modified: branches/Branch_4_2/testsuite/src/main/org/jboss/test/classloader/scoping/override/web/comlog/Log4jServlet.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/classloader/scoping/override/web/comlog/Log4jServlet.java	2007-02-12 07:50:56 UTC (rev 60484)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/classloader/scoping/override/web/comlog/Log4jServlet.java	2007-02-12 07:51:34 UTC (rev 60485)
@@ -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/Branch_4_2/testsuite/src/main/org/jboss/test/classloader/test/ScopingUnitTestCase.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/classloader/test/ScopingUnitTestCase.java	2007-02-12 07:50:56 UTC (rev 60484)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/classloader/test/ScopingUnitTestCase.java	2007-02-12 07:51:34 UTC (rev 60485)
@@ -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/Branch_4_2/testsuite/src/resources/classloader/scoping/override/common-logging/log4j-cl11.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/classloader/scoping/override/common-logging/log4j-cl11.xml	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/classloader/scoping/override/common-logging/log4j-cl11.xml	2007-02-12 07:51:34 UTC (rev 60485)
@@ -0,0 +1,22 @@
+<?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>




More information about the jboss-cvs-commits mailing list