[jboss-cvs] JBossAS SVN: r62620 - in branches/Branch_4_2: testsuite/imports/sections and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Apr 27 17:50:28 EDT 2007


Author: scott.stark at jboss.org
Date: 2007-04-27 17:50:27 -0400 (Fri, 27 Apr 2007)
New Revision: 62620

Added:
   branches/Branch_4_2/testsuite/src/resources/web/class-loading-ulr/
   branches/Branch_4_2/testsuite/src/resources/web/class-loading-ulr/.jboss-web.xml.swp
   branches/Branch_4_2/testsuite/src/resources/web/class-loading-ulr/jboss-web.xml
   branches/Branch_4_2/testsuite/src/resources/web/class-loading-ulr/web.xml
Modified:
   branches/Branch_4_2/server/src/main/org/jboss/metadata/WebMetaData.java
   branches/Branch_4_2/testsuite/imports/sections/web.xml
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/web/test/WebIntegrationUnitTestCase.java
Log:
JBAS-3047, allow both java2ClassLoadingCompliance and useJBossWebLoader from the war jboss-web.xml

Modified: branches/Branch_4_2/server/src/main/org/jboss/metadata/WebMetaData.java
===================================================================
--- branches/Branch_4_2/server/src/main/org/jboss/metadata/WebMetaData.java	2007-04-27 19:46:26 UTC (rev 62619)
+++ branches/Branch_4_2/server/src/main/org/jboss/metadata/WebMetaData.java	2007-04-27 21:50:27 UTC (rev 62620)
@@ -92,6 +92,8 @@
    private boolean distributable = false;
    /** The jboss-web.xml class-loading.java2ClassLoadingCompliance flag */
    private boolean java2ClassLoadingCompliance = false;
+   /** The jboss-web.xml class-loading jboss class loader flag */
+   private boolean useJBossWebLoader = false;
    /** The jboss-web.xml class-loading/loader-repository */
    private LoaderRepositoryConfig loaderConfig;
    /** The war context root as specified at the jboss-web.xml descriptor level. */
@@ -679,6 +681,15 @@
       java2ClassLoadingCompliance = flag;
    }
 
+   public boolean isUseJBossWebLoader()
+   {
+      return useJBossWebLoader;
+   }
+   public void setUseJBossWebLoader(boolean flag)
+   {
+      useJBossWebLoader = flag;
+   }
+
    public LoaderRepositoryConfig getLoaderConfig()
    {
       return loaderConfig;
@@ -1247,6 +1258,7 @@
          Element loader = MetaData.getOptionalChild(classLoading, "loader-repository");
          if (loader != null)
          {
+            useJBossWebLoader = true;
             try
             {
                loaderConfig = LoaderRepositoryFactory.parseRepositoryConfig(loader);

Modified: branches/Branch_4_2/testsuite/imports/sections/web.xml
===================================================================
--- branches/Branch_4_2/testsuite/imports/sections/web.xml	2007-04-27 19:46:26 UTC (rev 62619)
+++ branches/Branch_4_2/testsuite/imports/sections/web.xml	2007-04-27 21:50:27 UTC (rev 62620)
@@ -565,6 +565,25 @@
             <include name="org/jboss/test/util/Debug.class"/>
          </classes>
       </war>
+      <!-- War java2ClassLoadingCompliance=true, useJBossWebLoader=true test  -->
+      <war destfile="${build.lib}/class-loading-ulr.war"
+         webxml="${build.resources}/web/class-loading-ulr/web.xml">
+         <webinf dir="${build.resources}/web/class-loading-ulr">
+            <include name="jboss-web.xml"/>
+         </webinf>
+         <lib dir="${apache.log4j.lib}">
+            <include name="log4j.jar" />
+         </lib>
+         <lib dir="${build.lib}">
+            <include name="jbosstest-web-util.jar"/>
+            <include name="resources.jar"/>
+         </lib>
+         
+         <classes dir="${build.classes}">
+            <include name="org/jboss/test/web/servlets/ClasspathServlet2.class"/>
+            <include name="org/jboss/test/util/Debug.class"/>
+         </classes>
+      </war>
 
    </target>
 </project>

Modified: branches/Branch_4_2/testsuite/src/main/org/jboss/test/web/test/WebIntegrationUnitTestCase.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/web/test/WebIntegrationUnitTestCase.java	2007-04-27 19:46:26 UTC (rev 62619)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/web/test/WebIntegrationUnitTestCase.java	2007-04-27 21:50:27 UTC (rev 62620)
@@ -436,7 +436,8 @@
 
    /**
     * Validate a war level override of the 
-    * java2ClassLoadingComplianceOverride flag to true.
+    * java2ClassLoadingComplianceOverride flag to true with a
+    * useJBossWebLoader = false
     * 
     * @throws Exception
     */
@@ -463,6 +464,36 @@
          getLog().info("+++ End testJava2ClassLoadingComplianceOverride");
       }
    }
+   /**
+    * Validate a war level override of the 
+    * java2ClassLoadingComplianceOverride flag to true with a
+    * useJBossWebLoader = true
+    * 
+    * @throws Exception
+    */
+   public void testJava2ClassLoadingComplianceOverrideULR() throws Exception
+   {
+      getLog().info("+++ Begin testJava2ClassLoadingComplianceOverrideULR");
+      deploy("class-loading-ulr.war");
+      try
+      {
+         String baseURL = "http://" + getServerHost() + ":" + Integer.getInteger("web.port", 8080) + '/';
+         // Load a log4j class
+         URL url = new URL(baseURL+"class-loading-ulr/ClasspathServlet2?class=org.apache.log4j.net.SocketAppender");
+         HttpMethodBase request = HttpUtils.accessURL(url, REALM, HttpURLConnection.HTTP_OK);
+         Header cs = request.getResponseHeader("X-CodeSource");
+         log.info(cs);
+         // Validate it has not come from the war
+         assertTrue("X-CodeSource("+cs+") does not contain war",
+               cs.getValue().indexOf(".war") < 0 );
+         getLog().debug(url+" OK");
+      }
+      finally
+      {
+         undeploy("class-loading-ulr.war");
+         getLog().info("+++ End testJava2ClassLoadingComplianceOverrideULR");
+      }
+   }
 
    /** 
     * JBAS-3279: Authenticated user can bypass declarative role checks for servlets

Added: branches/Branch_4_2/testsuite/src/resources/web/class-loading-ulr/.jboss-web.xml.swp
===================================================================
(Binary files differ)


Property changes on: branches/Branch_4_2/testsuite/src/resources/web/class-loading-ulr/.jboss-web.xml.swp
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/Branch_4_2/testsuite/src/resources/web/class-loading-ulr/jboss-web.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/web/class-loading-ulr/jboss-web.xml	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/web/class-loading-ulr/jboss-web.xml	2007-04-27 21:50:27 UTC (rev 62620)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss-web PUBLIC
+    "-//JBoss//DTD Web Application 4.2//EN"
+    "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
+
+<jboss-web>
+    <!-- Use parent first class loading model -->
+    <class-loading java2ClassLoadingCompliance="true">
+        <!-- With an unscoped ULR -->
+	<loader-repository loaderRepositoryClass="org.jboss.mx.loading.UnifiedLoaderRepository3">jboss.test:ulr=true,java2ClassLoadingCompliance=true</loader-repository>
+    </class-loading>
+</jboss-web>


Property changes on: branches/Branch_4_2/testsuite/src/resources/web/class-loading-ulr/jboss-web.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: branches/Branch_4_2/testsuite/src/resources/web/class-loading-ulr/web.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/web/class-loading-ulr/web.xml	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/web/class-loading-ulr/web.xml	2007-04-27 21:50:27 UTC (rev 62620)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4"
+   xmlns="http://java.sun.com/xml/ns/j2ee"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+   <description>Test of overriding class loading model at war level</description>
+
+   <!-- The Welcome File List -->
+   <welcome-file-list>
+      <welcome-file>index.html</welcome-file>
+   </welcome-file-list>
+
+   <servlet>
+      <servlet-name>ClasspathServlet2</servlet-name>
+      <servlet-class>org.jboss.test.web.servlets.ClasspathServlet2</servlet-class>
+   </servlet>
+
+   <servlet-mapping>
+      <servlet-name>ClasspathServlet2</servlet-name>
+      <url-pattern>/ClasspathServlet2</url-pattern>
+   </servlet-mapping>
+</web-app>


Property changes on: branches/Branch_4_2/testsuite/src/resources/web/class-loading-ulr/web.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list