Author: julien(a)jboss.com
Date: 2007-11-19 18:03:47 -0500 (Mon, 19 Nov 2007)
New Revision: 9026
Added:
modules/web/trunk/web/src/main/org/jboss/portal/test/web/ServletTestCase.java
modules/web/trunk/web/src/main/org/jboss/portal/test/web/TestServlet.java
modules/web/trunk/web/src/main/org/jboss/portal/test/web/request/
modules/web/trunk/web/src/main/org/jboss/portal/test/web/request/GetTestCase.java
modules/web/trunk/web/src/main/org/jboss/portal/test/web/request/PostApplicationXWWWFormURLEncodedTestCase.java
modules/web/trunk/web/src/main/org/jboss/portal/test/web/request/PostMultipartFormDataTestCase.java
modules/web/trunk/web/src/main/org/jboss/portal/test/web/spi/SPITestCase.java
modules/web/trunk/web/src/main/org/jboss/portal/web/Body.java
modules/web/trunk/web/src/main/org/jboss/portal/web/WebRequest.java
modules/web/trunk/web/src/main/org/jboss/portal/web/WebResponse.java
modules/web/trunk/web/src/resources/portal-test-request-jar/
modules/web/trunk/web/src/resources/portal-test-request-jar/org/
modules/web/trunk/web/src/resources/portal-test-request-jar/org/jboss/
modules/web/trunk/web/src/resources/portal-test-request-jar/org/jboss/portal/
modules/web/trunk/web/src/resources/portal-test-request-jar/org/jboss/portal/test/
modules/web/trunk/web/src/resources/portal-test-request-jar/org/jboss/portal/test/web/
modules/web/trunk/web/src/resources/portal-test-request-jar/org/jboss/portal/test/web/server-beans.xml
modules/web/trunk/web/src/resources/portal-test-spi-jar/
modules/web/trunk/web/src/resources/portal-test-spi-jar/org/
modules/web/trunk/web/src/resources/portal-test-spi-jar/org/jboss/
modules/web/trunk/web/src/resources/portal-test-spi-jar/org/jboss/portal/
modules/web/trunk/web/src/resources/portal-test-spi-jar/org/jboss/portal/test/
modules/web/trunk/web/src/resources/portal-test-spi-jar/org/jboss/portal/test/web/
modules/web/trunk/web/src/resources/portal-test-spi-jar/org/jboss/portal/test/web/server-beans.xml
modules/web/trunk/web/src/resources/test/support/
modules/web/trunk/web/src/resources/test/support/jboss-4.2-container-servlet/
modules/web/trunk/web/src/resources/test/support/jboss-4.2-container-servlet/server-war/
modules/web/trunk/web/src/resources/test/support/jboss-4.2-container-servlet/server-war/WEB-INF/
modules/web/trunk/web/src/resources/test/support/jboss-4.2-container-servlet/server-war/WEB-INF/context.xml
modules/web/trunk/web/src/resources/test/support/jboss-4.2-container-servlet/server-war/WEB-INF/jboss-web.xml
modules/web/trunk/web/src/resources/test/support/jboss-4.2-container-servlet/server-war/WEB-INF/web.xml
modules/web/trunk/web/src/resources/test/support/jboss-4.2-generic/
modules/web/trunk/web/src/resources/test/support/jboss-4.2-generic/server-war/
modules/web/trunk/web/src/resources/test/support/jboss-4.2-generic/server-war/WEB-INF/
modules/web/trunk/web/src/resources/test/support/jboss-4.2-generic/server-war/WEB-INF/jboss-web.xml
modules/web/trunk/web/src/resources/test/support/jboss-4.2-generic/server-war/WEB-INF/web.xml
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/META-INF/
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/META-INF/context.xml
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/WEB-INF/
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/WEB-INF/classes/
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/WEB-INF/classes/log4j.properties
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/WEB-INF/classes/logging.properties
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/WEB-INF/web.xml
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/META-INF/
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/META-INF/context.xml
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/WEB-INF/
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/WEB-INF/classes/
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/WEB-INF/classes/log4j.properties
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/WEB-INF/classes/logging.properties
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/WEB-INF/web.xml
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-lifecycle-listener/
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-lifecycle-listener/server-war/
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-lifecycle-listener/server-war/WEB-INF/
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-lifecycle-listener/server-war/WEB-INF/classes/
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-lifecycle-listener/server-war/WEB-INF/classes/log4j.properties
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-lifecycle-listener/server-war/WEB-INF/classes/logging.properties
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-lifecycle-listener/server-war/WEB-INF/web.xml
Removed:
modules/web/trunk/web/src/main/org/jboss/portal/test/web/spi/SPITestServlet.java
modules/web/trunk/web/src/main/org/jboss/portal/web/RequestInfo.java
modules/web/trunk/web/src/resources/portal-web-test-jar/
modules/web/trunk/web/src/resources/test/spi/jboss-4.2-container-servlet/
modules/web/trunk/web/src/resources/test/spi/jboss-4.2-generic/
modules/web/trunk/web/src/resources/test/spi/tomcat-6.0-container-servlet/
modules/web/trunk/web/src/resources/test/spi/tomcat-6.0-generic/
modules/web/trunk/web/src/resources/test/spi/tomcat-6.0-lifecycle-listener/
Modified:
modules/web/trunk/web/build.xml
modules/web/trunk/web/src/main/org/jboss/portal/web/IllegalRequestException.java
Log:
added support for WebRequest that provide more info about http servlet request and added
test cases for it
Modified: modules/web/trunk/web/build.xml
===================================================================
--- modules/web/trunk/web/build.xml 2007-11-19 15:25:36 UTC (rev 9025)
+++ modules/web/trunk/web/build.xml 2007-11-19 23:03:47 UTC (rev 9026)
@@ -151,7 +151,9 @@
<!-- portal-web.jar -->
<jar jarfile="${build.lib}/portal-web-lib.jar"
manifest="${build.etc}/portal-web-lib-jar.mf">
- <fileset dir="${build.classes}"/>
+ <fileset dir="${build.classes}">
+ <exclude name="org/jboss/portal/test/**"/>
+ </fileset>
</jar>
</target>
@@ -252,19 +254,12 @@
<file name="jboss-kernel.jar"/>
</filelist>
- <!-- portal-web-test-lib.jar -->
- <jar jarfile="${build.lib}/portal-web-test-lib.jar">
- <fileset dir="${build.classes}"
includes="org/jboss/portal/test/web/spi/**"/>
- <fileset dir="${build.resources}/portal-web-test-jar"/>
- </jar>
-
<!-- **************************** -->
<!-- Tomcat 6.0 container servlet -->
<!-- **************************** -->
<!-- -->
- <copy
todir="${build.resources}/test/spi/tomcat-6.0-container-servlet/server-war/WEB-INF/lib">
- <fileset dir="${build.lib}"
includes="portal-web-test-lib.jar"/>
+ <copy
todir="${build.resources}/test/support/tomcat-6.0-container-servlet/server-war/WEB-INF/lib">
<fileset dir="${jboss.portal/modules/common.lib}"
includes="portal-common-mc-lib.jar"/>
<fileset dir="${jboss.portal/modules/test.lib}"
includes="jboss-unit-lib.jar,jboss-unit-mc-lib.jar,jboss-unit-remote-lib.jar,portal-test-generic-lib.jar,portal-test-lib.jar"/>
<fileset dir="${jboss.remoting.lib}"
includes="jboss-remoting.jar"/>
@@ -283,22 +278,13 @@
<filelist refid="mc.jboss_microcontainer"/>
</copy>
<mkdir dir="${build.lib}/tomcat-6.0-container-servlet"/>
- <jar
jarfile="${build.lib}/tomcat-6.0-container-servlet/test-spi-server.war">
- <fileset
dir="${build.resources}/test/spi/tomcat-6.0-container-servlet/server-war"/>
- </jar>
- <!-- -->
- <jar
jarfile="${build.lib}/tomcat-6.0-container-servlet/test-spi-app.war">
- <fileset dir="${build.resources}/test/spi/app-war"/>
- </jar>
-
<!-- **************************** -->
<!-- Tomcat 6.0 lifecyle listener -->
<!-- **************************** -->
<!-- -->
- <copy
todir="${build.resources}/test/spi/tomcat-6.0-lifecycle-listener/server-war/WEB-INF/lib">
- <fileset dir="${build.lib}"
includes="portal-web-test-lib.jar"/>
+ <copy
todir="${build.resources}/test/support/tomcat-6.0-lifecycle-listener/server-war/WEB-INF/lib">
<fileset dir="${jboss.portal/modules/common.lib}"
includes="portal-common-mc-lib.jar"/>
<fileset dir="${jboss.portal/modules/test.lib}"
includes="jboss-unit-lib.jar,jboss-unit-mc-lib.jar,jboss-unit-remote-lib.jar,portal-test-generic-lib.jar,portal-test-lib.jar"/>
<fileset dir="${jboss.remoting.lib}"
includes="jboss-remoting.jar"/>
@@ -317,23 +303,14 @@
<filelist refid="mc.jboss_microcontainer"/>
</copy>
<mkdir dir="${build.lib}/tomcat-6.0-lifecycle-listener"/>
- <jar
jarfile="${build.lib}/tomcat-6.0-lifecycle-listener/test-spi-server.war">
- <fileset
dir="${build.resources}/test/spi/tomcat-6.0-lifecycle-listener/server-war"/>
- </jar>
- <!-- -->
- <jar
jarfile="${build.lib}/tomcat-6.0-container-servlet/test-spi-app.war">
- <fileset dir="${build.resources}/test/spi/app-war"/>
- </jar>
-
<!-- ****************** -->
<!-- Tomcat 6.0 generic -->
<!-- ****************** -->
<!-- -->
- <mkdir
dir="${build.resources}/test/spi/tomcat-6.0-generic/server-war/WEB-INF/lib"/>
- <copy
todir="${build.resources}/test/spi/tomcat-6.0-generic/server-war/WEB-INF/lib">
- <fileset dir="${build.lib}"
includes="portal-web-test-lib.jar"/>
+ <mkdir
dir="${build.resources}/test/support/tomcat-6.0-generic/server-war/WEB-INF/lib"/>
+ <copy
todir="${build.resources}/test/support/tomcat-6.0-generic/server-war/WEB-INF/lib">
<fileset dir="${jboss.portal/modules/common.lib}"
includes="portal-common-mc-lib.jar"/>
<fileset dir="${jboss.portal/modules/test.lib}"
includes="jboss-unit-lib.jar,jboss-unit-mc-lib.jar,jboss-unit-remote-lib.jar,portal-test-generic-lib.jar,portal-test-lib.jar"/>
<fileset dir="${jboss.remoting.lib}"
includes="jboss-remoting.jar"/>
@@ -352,23 +329,14 @@
<filelist refid="mc.jboss_microcontainer"/>
</copy>
<mkdir dir="${build.lib}/tomcat-6.0-generic"/>
- <jar
jarfile="${build.lib}/tomcat-6.0-generic/test-spi-server.war">
- <fileset
dir="${build.resources}/test/spi/tomcat-6.0-generic/server-war"/>
- </jar>
- <!-- -->
- <jar jarfile="${build.lib}/tomcat-6.0-generic/test-spi-app.war">
- <fileset dir="${build.resources}/test/spi/generic/app-war"/>
- </jar>
-
<!-- *************************** -->
<!-- JBoss 4.2 container servlet -->
<!-- *************************** -->
<!-- -->
- <copy
todir="${build.resources}/test/spi/jboss-4.2-container-servlet/server-war/WEB-INF/lib">
- <fileset dir="${build.lib}"
includes="portal-web-test-lib.jar"/>
- <fileset dir="${jboss.portal/modules/common.lib}"
includes="portal-common-lib.jar,portal-common-mc-lib.jar"/>
+ <copy
todir="${build.resources}/test/support/jboss-4.2-container-servlet/server-war/WEB-INF/lib">
+ <fileset dir="${jboss.portal/modules/common.lib}"
includes="portal-common-mc-lib.jar"/>
<fileset dir="${jboss.portal/modules/test.lib}"
includes="portal-test-generic-lib.jar"/>
<filelist refid="mc.trove"/>
<filelist refid="mc.javassist"/>
@@ -382,23 +350,14 @@
<filelist refid="mc.jboss_microcontainer"/>
</copy>
<mkdir dir="${build.lib}/jboss-4.2-container-servlet"/>
- <jar
jarfile="${build.lib}/jboss-4.2-container-servlet/test-spi-server.war">
- <fileset
dir="${build.resources}/test/spi/jboss-4.2-container-servlet/server-war"/>
- </jar>
- <!-- -->
- <jar
jarfile="${build.lib}/jboss-4.2-container-servlet/test-spi-app.war">
- <fileset dir="${build.resources}/test/spi/app-war"/>
- </jar>
-
<!-- ***************** -->
<!-- JBoss 4.2 generic -->
<!-- ***************** -->
<!-- -->
- <copy
todir="${build.resources}/test/spi/jboss-4.2-generic/server-war/WEB-INF/lib">
- <fileset dir="${build.lib}"
includes="portal-web-test-lib.jar"/>
- <fileset dir="${jboss.portal/modules/common.lib}"
includes="portal-common-lib.jar,portal-common-mc-lib.jar"/>
+ <copy
todir="${build.resources}/test/support/jboss-4.2-generic/server-war/WEB-INF/lib">
+ <fileset dir="${jboss.portal/modules/common.lib}"
includes="portal-common-mc-lib.jar"/>
<fileset dir="${jboss.portal/modules/test.lib}"
includes="portal-test-generic-lib.jar"/>
<filelist refid="mc.trove"/>
<filelist refid="mc.javassist"/>
@@ -412,15 +371,77 @@
<filelist refid="mc.jboss_microcontainer"/>
</copy>
<mkdir dir="${build.lib}/jboss-4.2-generic"/>
- <jar jarfile="${build.lib}/jboss-4.2-generic/test-spi-server.war">
- <fileset
dir="${build.resources}/test/spi/jboss-4.2-generic/server-war"/>
+
+ <!-- SPI Test case-->
+
+ <jar jarfile="${build.lib}/portal-test-spi-lib.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/portal/test/web/spi/**"/>
+ <include
name="org/jboss/portal/test/web/ServletTestCase.class"/>
+ <include
name="org/jboss/portal/test/web/TestServlet.class"/>
+ <include
name="org/jboss/portal/test/web/WebAppRegistry.class"/>
+ </fileset>
+ <fileset dir="${build.resources}/portal-test-spi-jar"/>
</jar>
- <!-- -->
+ <war
jarfile="${build.lib}/tomcat-6.0-container-servlet/test-spi-server.war">
+ <fileset
dir="${build.resources}/test/support/tomcat-6.0-container-servlet/server-war"/>
+ <lib dir="${build.lib}"
includes="portal-test-spi-lib.jar"/>
+ </war>
+ <jar
jarfile="${build.lib}/tomcat-6.0-container-servlet/test-spi-app.war">
+ <fileset dir="${build.resources}/test/spi/app-war"/>
+ </jar>
+ <war
jarfile="${build.lib}/tomcat-6.0-lifecycle-listener/test-spi-server.war">
+ <fileset
dir="${build.resources}/test/support/tomcat-6.0-lifecycle-listener/server-war"/>
+ <lib dir="${build.lib}"
includes="portal-test-spi-lib.jar"/>
+ </war>
+ <jar
jarfile="${build.lib}/tomcat-6.0-container-servlet/test-spi-app.war">
+ <fileset dir="${build.resources}/test/spi/app-war"/>
+ </jar>
+ <war
jarfile="${build.lib}/tomcat-6.0-generic/test-spi-server.war">
+ <fileset
dir="${build.resources}/test/support/tomcat-6.0-generic/server-war"/>
+ <lib dir="${build.lib}"
includes="portal-test-spi-lib.jar"/>
+ </war>
+ <jar jarfile="${build.lib}/tomcat-6.0-generic/test-spi-app.war">
+ <fileset dir="${build.resources}/test/spi/generic/app-war"/>
+ </jar>
+ <war
jarfile="${build.lib}/jboss-4.2-container-servlet/test-spi-server.war">
+ <fileset
dir="${build.resources}/test/support/jboss-4.2-container-servlet/server-war"/>
+ <lib dir="${build.lib}"
includes="portal-test-spi-lib.jar"/>
+ </war>
+ <jar
jarfile="${build.lib}/jboss-4.2-container-servlet/test-spi-app.war">
+ <fileset dir="${build.resources}/test/spi/app-war"/>
+ </jar>
+ <war jarfile="${build.lib}/jboss-4.2-generic/test-spi-server.war">
+ <fileset
dir="${build.resources}/test/support/jboss-4.2-generic/server-war"/>
+ <lib dir="${build.lib}"
includes="portal-test-spi-lib.jar"/>
+ </war>
<jar jarfile="${build.lib}/jboss-4.2-generic/test-spi-app.war">
<fileset dir="${build.resources}/test/spi/generic/app-war"/>
</jar>
+ <!-- Request Test case-->
+
+ <jar jarfile="${build.lib}/portal-test-request-lib.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/portal/test/web/request/**"/>
+ <include
name="org/jboss/portal/test/web/ServletTestCase.class"/>
+ <include
name="org/jboss/portal/test/web/TestServlet.class"/>
+ <include
name="org/jboss/portal/test/web/WebAppRegistry.class"/>
+ </fileset>
+ <fileset dir="${build.resources}/portal-test-request-jar"/>
+ </jar>
+
+ <war
jarfile="${build.lib}/tomcat-6.0-container-servlet/test-request-server.war">
+ <fileset
dir="${build.resources}/test/support/tomcat-6.0-container-servlet/server-war"/>
+ <lib dir="${build.lib}"
includes="portal-test-request-lib.jar"/>
+ </war>
+
+ <war
jarfile="${build.lib}/jboss-4.2-container-servlet/test-request-server.war">
+ <fileset
dir="${build.resources}/test/support/jboss-4.2-container-servlet/server-war"/>
+ <lib dir="${build.lib}"
includes="portal-test-request-lib.jar"/>
+ </war>
+
</target>
<target name="cargo.setup" depends="init">
@@ -477,7 +498,7 @@
<echo message="Starting JBoss 4.2 container-servlet tests with
${test.jboss-4.2.home}"/>
<antcall target="cargo.jboss-4.2.start">
<param name="cargo.wait" value="false"/>
- <param name="test.spi.server.path"
value="${build.lib}/jboss-4.2-container-servlet/test-spi-server.war"/>
+ <param name="test.spi.server.path"
value="${test.archive.path}"/>
</antcall>
<antcall target="tests.remote">
<param name="test.server.name"
value="${test.jboss-4.2.name}"/>
@@ -491,7 +512,7 @@
<echo message="Starting JBoss 4.2 generic tests with
${test.jboss-4.2.home}"/>
<antcall target="cargo.jboss-4.2.start">
<param name="cargo.wait" value="false"/>
- <param name="test.spi.server.path"
value="${build.lib}/jboss-4.2-generic/test-spi-server.war"/>
+ <param name="test.spi.server.path"
value="${test.archive.path}"/>
</antcall>
<antcall target="tests.remote">
<param name="test.server.name"
value="${test.jboss-4.2.name}"/>
@@ -515,29 +536,47 @@
</condition>
</fail>
<antcall target="tests.jboss-4.2.container-servlet">
- <param name="test.id"
value="JBoss-4_2_0-container-servlet"/>
+ <param name="test.id"
value="JBoss-4_2_0-spi-container-servlet"/>
<param name="test.jboss-4.2.name"
value="RemoteJBoss_4_2_0"/>
<param name="test.jboss-4.2.home"
value="${jboss-4.2.0.home}"/>
<param name="test.jboss-4.2.home.variable-name"
value="jboss-4.2.0.home"/>
+ <param name="test.archive.path"
value="${build.lib}/jboss-4.2-container-servlet/test-spi-server.war"/>
</antcall>
<antcall target="tests.jboss-4.2.container-servlet">
- <param name="test.id"
value="JBoss-4_2_1-container-servlet"/>
+ <param name="test.id"
value="JBoss-4_2_1-spi-container-servlet"/>
<param name="test.jboss-4.2.name"
value="RemoteJBoss_4_2_1"/>
<param name="test.jboss-4.2.home"
value="${jboss-4.2.1.home}"/>
<param name="test.jboss-4.2.home.variable-name"
value="jboss-4.2.1.home"/>
+ <param name="test.archive.path"
value="${build.lib}/jboss-4.2-container-servlet/test-spi-server.war"/>
</antcall>
<antcall target="tests.jboss-4.2.generic">
- <param name="test.id" value="JBoss-4_2_0-generic"/>
+ <param name="test.id"
value="JBoss-4_2_0-spi-generic"/>
<param name="test.jboss-4.2.name"
value="RemoteJBoss_4_2_0"/>
<param name="test.jboss-4.2.home"
value="${jboss-4.2.0.home}"/>
<param name="test.jboss-4.2.home.variable-name"
value="jboss-4.2.0.home"/>
+ <param name="test.archive.path"
value="${build.lib}/jboss-4.2-generic/test-spi-server.war"/>
</antcall>
<antcall target="tests.jboss-4.2.generic">
- <param name="test.id" value="JBoss-4_2_1-generic"/>
+ <param name="test.id"
value="JBoss-4_2_1-spi-generic"/>
<param name="test.jboss-4.2.name"
value="RemoteJBoss_4_2_1"/>
<param name="test.jboss-4.2.home"
value="${jboss-4.2.1.home}"/>
<param name="test.jboss-4.2.home.variable-name"
value="jboss-4.2.1.home"/>
+ <param name="test.archive.path"
value="${build.lib}/jboss-4.2-generic/test-spi-server.war"/>
</antcall>
+ <antcall target="tests.jboss-4.2.container-servlet">
+ <param name="test.id"
value="JBoss-4_2_0-request-container-servlet"/>
+ <param name="test.jboss-4.2.name"
value="RemoteJBoss_4_2_0"/>
+ <param name="test.jboss-4.2.home"
value="${jboss-4.2.0.home}"/>
+ <param name="test.jboss-4.2.home.variable-name"
value="jboss-4.2.0.home"/>
+ <param name="test.archive.path"
value="${build.lib}/jboss-4.2-container-servlet/test-request-server.war"/>
+ </antcall>
+ <antcall target="tests.jboss-4.2.container-servlet">
+ <param name="test.id"
value="JBoss-4_2_1-request-container-servlet"/>
+ <param name="test.jboss-4.2.name"
value="RemoteJBoss_4_2_1"/>
+ <param name="test.jboss-4.2.home"
value="${jboss-4.2.1.home}"/>
+ <param name="test.jboss-4.2.home.variable-name"
value="jboss-4.2.1.home"/>
+ <param name="test.archive.path"
value="${build.lib}/jboss-4.2-container-servlet/test-request-server.war"/>
+ </antcall>
</target>
<target name="tests.jboss" depends="init">
@@ -586,7 +625,7 @@
<echo message="Starting Tomcat 6 container-servlet tests with
${test.tomcat-6.home}"/>
<antcall target="cargo.tomcat-6.start">
<param name="cargo.wait" value="false"/>
- <param name="test.spi.server.path"
value="${build.lib}/tomcat-6.0-container-servlet/test-spi-server.war"/>
+ <param name="test.spi.server.path"
value="${test.archive.path}"/>
</antcall>
<antcall target="tests.remote">
<param name="test.server.name"
value="RemoteTomcat_6_0"/>
@@ -601,7 +640,7 @@
<echo message="Starting Tomcat 6 generic tests with
${test.tomcat-6.home}"/>
<antcall target="cargo.tomcat-6.start">
<param name="cargo.wait" value="false"/>
- <param name="test.spi.server.path"
value="${build.lib}/tomcat-6.0-generic/test-spi-server.war"/>
+ <param name="test.spi.server.path"
value="${test.archive.path}"/>
</antcall>
<antcall target="tests.remote">
<param name="test.server.name"
value="RemoteTomcat_6_0"/>
@@ -622,21 +661,25 @@
</condition>
</fail>
<antcall target="tests.tomcat-6.container-servlet">
- <param name="test.id"
value="Tomcat-6_0-container-servlet"/>
+ <param name="test.id"
value="Tomcat-6_0-spi-container-servlet"/>
<param name="test.tomcat-6.name"
value="RemoteTomcat_6_0"/>
<param name="test.tomcat-6.home"
value="${tomcat-6.0.home}"/>
<param name="test.tomcat-6.home.variable-name"
value="tomcat-6.0.home"/>
+ <param name="test.archive.path"
value="${build.lib}/tomcat-6.0-container-servlet/test-spi-server.war"/>
</antcall>
<antcall target="tests.tomcat-6.generic">
- <param name="test.id" value="Tomcat-6_0-generic"/>
+ <param name="test.id"
value="Tomcat-6_0-spi-generic"/>
<param name="test.tomcat-6.name"
value="RemoteTomcat_6_0"/>
<param name="test.tomcat-6.home"
value="${tomcat-6.0.home}"/>
<param name="test.tomcat-6.home.variable-name"
value="tomcat-6.0.home"/>
+ <param name="test.archive.path"
value="${build.lib}/tomcat-6.0-generic/test-spi-server.war"/>
</antcall>
- </target>
-
- <target name="tests.tomcat" depends="init">
- <antcall target="tests.tomcat-6.generic">
+ <antcall target="tests.tomcat-6.container-servlet">
+ <param name="test.id"
value="Tomcat-6_0-request-container-servlet"/>
+ <param name="test.tomcat-6.name"
value="RemoteTomcat_6_0"/>
+ <param name="test.tomcat-6.home"
value="${tomcat-6.0.home}"/>
+ <param name="test.tomcat-6.home.variable-name"
value="tomcat-6.0.home"/>
+ <param name="test.archive.path"
value="${build.lib}/tomcat-6.0-container-servlet/test-request-server.war"/>
</antcall>
</target>
Added: modules/web/trunk/web/src/main/org/jboss/portal/test/web/ServletTestCase.java
===================================================================
--- modules/web/trunk/web/src/main/org/jboss/portal/test/web/ServletTestCase.java
(rev 0)
+++
modules/web/trunk/web/src/main/org/jboss/portal/test/web/ServletTestCase.java 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,180 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.web;
+
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.DriverCommand;
+import org.jboss.unit.driver.AbstractTestDriver;
+import org.jboss.unit.info.TestCaseInfo;
+import org.jboss.unit.info.ParameterInfo;
+import org.jboss.unit.info.TestInfo;
+import org.jboss.unit.TestId;
+import org.jboss.unit.remote.ResponseContext;
+import org.jboss.unit.remote.RequestContext;
+import org.jboss.unit.remote.driver.RemoteTestDriver;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import java.io.IOException;
+import java.util.Map;
+import java.util.Set;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class ServletTestCase extends AbstractTestDriver implements
RemoteTestDriver, TestCaseInfo
+{
+
+ /** . */
+ protected TestServlet testServlet;
+
+ /** . */
+ private RequestContext requestContext;
+
+ /** . */
+ private ResponseContext responseContext;
+
+ protected ServletTestCase()
+ {
+ }
+
+ public TestInfo getInfo()
+ {
+ return this;
+ }
+
+ public DriverResponse invoke(TestId testId, DriverCommand driverCommand)
+ {
+ testServlet.currentTestCase = this;
+
+ //
+ return invoke(testServlet, driverCommand);
+ }
+
+ public String getName()
+ {
+ return getClass().getSimpleName();
+ }
+
+ public String getDescription()
+ {
+ return "No description";
+ }
+
+ public Map<String, ? extends ParameterInfo> getParameters()
+ {
+ return Collections.emptyMap();
+ }
+
+ public Set<String> getKeywords()
+ {
+ return Collections.emptySet();
+ }
+
+ public void pushContext(TestId testId, RequestContext requestContext)
+ {
+ this.requestContext = requestContext;
+ }
+
+ public ResponseContext popContext(TestId testId)
+ {
+ return responseContext;
+ }
+
+ public int getRequestCount()
+ {
+ return requestContext.getRequestCount();
+ }
+
+ protected void setResponseContext(ResponseContext responseContext)
+ {
+ this.responseContext = responseContext;
+ }
+
+ public abstract DriverResponse service(TestServlet testServlet, HttpServletRequest
req, HttpServletResponse resp) throws ServletException, IOException;
+
+ public abstract DriverResponse invoke(TestServlet testServlet, DriverCommand
driverCommand);
+
+
+ public static String RANGE_0_255 = computeFrom0To255();
+
+ public static String RANGE_256_512 = computeFrom256To512();
+
+ private static String computeFrom0To255()
+ {
+ return compute(0, 256);
+ }
+
+ private static String computeFrom256To512()
+ {
+ return compute(256, 512);
+ }
+
+ public static String compute(int from, int to)
+ {
+ if (from < 0)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (from > to)
+ {
+ throw new IllegalArgumentException();
+ }
+ StringBuffer tmp = new StringBuffer();
+ for (int i = from; i < to; i++)
+ {
+ char c = (char)i;
+ tmp.append(c);
+ }
+ return tmp.toString();
+ }
+
+ public static String compareString(String s1, String s2)
+ {
+ if (s1 == null)
+ {
+ return "s1 is null";
+ }
+ if (s2 == null)
+ {
+ return "s2 is null";
+ }
+ if (s1.length() != s2.length())
+ {
+ return "lengths don't match " + s1.length() + "!=" +
s2.length();
+ }
+ for (int i = s1.length() - 1; i >= 0; i--)
+ {
+ char c1 = s1.charAt(i);
+ char c2 = s2.charAt(i);
+ if (c1 != c2)
+ {
+ return "char at position " + i + " are diffrent " +
(int)c1 + "!=" + (int)c2;
+ }
+ }
+ return null;
+ }
+}
Added: modules/web/trunk/web/src/main/org/jboss/portal/test/web/TestServlet.java
===================================================================
--- modules/web/trunk/web/src/main/org/jboss/portal/test/web/TestServlet.java
(rev 0)
+++ modules/web/trunk/web/src/main/org/jboss/portal/test/web/TestServlet.java 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.web;
+
+import org.jboss.unit.remote.ResponseContext;
+import org.jboss.unit.driver.impl.composite.CompositeTestDriver;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.FailureResponse;
+import org.jboss.unit.Failure;
+import org.jboss.unit.info.TestInfo;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public final class TestServlet extends HttpServlet
+{
+
+ /** . */
+ private CompositeTestDriver testSuite;
+
+ /** . */
+ ServletTestCase currentTestCase;
+
+ public void init() throws ServletException
+ {
+ testSuite =
(CompositeTestDriver)getServletContext().getAttribute("TestSuite");
+
+ // Init the test cases
+ for (String name : testSuite.getNames())
+ {
+ ((ServletTestCase)testSuite.getDriver(name)).testServlet = this;
+ }
+ }
+
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws
ServletException, IOException
+ {
+ DriverResponse response;
+ try
+ {
+ response = currentTestCase.service(this, req, resp);
+ }
+ catch (AssertionError e)
+ {
+ response = new FailureResponse(Failure.createFailure(e));
+ }
+ currentTestCase.setResponseContext(new ResponseContext(response, new
HashMap<String, Serializable>()));
+ resp.setStatus(200);
+ }
+
+ public void destroy()
+ {
+ testSuite = null;
+ }
+
+ public TestInfo getInfo()
+ {
+ return testSuite.getInfo();
+ }
+}
Added: modules/web/trunk/web/src/main/org/jboss/portal/test/web/request/GetTestCase.java
===================================================================
--- modules/web/trunk/web/src/main/org/jboss/portal/test/web/request/GetTestCase.java
(rev 0)
+++
modules/web/trunk/web/src/main/org/jboss/portal/test/web/request/GetTestCase.java 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,118 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.web.request;
+
+import org.jboss.portal.test.web.ServletTestCase;
+import org.jboss.portal.test.web.TestServlet;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.common.text.FastURLEncoder;
+import org.jboss.portal.common.http.HttpRequest;
+import org.jboss.portal.web.WebRequest;
+import org.jboss.portal.web.IllegalRequestException;
+import org.jboss.portal.web.Body;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.DriverCommand;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.driver.response.FailureResponse;
+
+import static org.jboss.unit.api.Assert.*;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokePostResponse;
+import org.jboss.unit.Failure;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import java.io.IOException;
+import java.nio.charset.Charset;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class GetTestCase extends ServletTestCase
+{
+
+ /** . */
+ private final FastURLEncoder encoder = FastURLEncoder.getUTF8Instance();
+
+ public GetTestCase()
+ {
+ }
+
+ public DriverResponse service(TestServlet testServlet, HttpServletRequest req,
HttpServletResponse resp) throws ServletException, IOException
+ {
+ WebRequest webRequest = new WebRequest(req);
+
+ //
+ if (getRequestCount() == 0)
+ {
+ ParameterMap queryParameters =
assertNotNull(webRequest.getQueryParameterMap());
+ assertNull(webRequest.getBody());
+ assertTrue(queryParameters.isEmpty());
+
+ //
+ StringBuffer tmp = new StringBuffer("/test-request-server/");
+
tmp.append('?').append(encoder.encode("a")).append("=").append(encoder.encode("a_value"));
+
tmp.append('&').append(encoder.encode("b")).append("=").append(encoder.encode("b_value_1"));
+
tmp.append('&').append(encoder.encode("b")).append("=").append(encoder.encode("b_value_2"));
+
tmp.append('&').append(encoder.encode("c")).append("=").append(encoder.encode(RANGE_0_255));
+ return new InvokeGetResponse(tmp.toString());
+ }
+ else if (getRequestCount() == 1)
+ {
+ try
+ {
+ ParameterMap queryParameters =
assertNotNull(webRequest.getQueryParameterMap());
+ assertNull(webRequest.getBody());
+ assertEquals(3, queryParameters.size());
+ assertEquals(new String[]{"a_value"},
queryParameters.get("a"));
+ assertEquals(new String[]{"b_value_1","b_value_2"},
queryParameters.get("b"));
+ assertEquals(new String[]{RANGE_0_255}, queryParameters.get("c"));
+ }
+ catch (IllegalRequestException e)
+ {
+ fail(e);
+ }
+ }
+ else
+ {
+ fail();
+ }
+
+ //
+ return new EndTestResponse();
+ }
+
+ public DriverResponse invoke(TestServlet testServlet, DriverCommand driverCommand)
+ {
+ if (getRequestCount() == -1)
+ {
+ return new InvokeGetResponse("/test-request-server/");
+ }
+ else
+ {
+ return new FailureResponse(Failure.createAssertionFailure(""));
+ }
+ }
+}
Added:
modules/web/trunk/web/src/main/org/jboss/portal/test/web/request/PostApplicationXWWWFormURLEncodedTestCase.java
===================================================================
---
modules/web/trunk/web/src/main/org/jboss/portal/test/web/request/PostApplicationXWWWFormURLEncodedTestCase.java
(rev 0)
+++
modules/web/trunk/web/src/main/org/jboss/portal/test/web/request/PostApplicationXWWWFormURLEncodedTestCase.java 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,188 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.web.request;
+
+import org.jboss.portal.test.web.ServletTestCase;
+import org.jboss.portal.test.web.TestServlet;
+import org.jboss.portal.common.text.FastURLEncoder;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.common.http.HttpRequest;
+import org.jboss.portal.web.WebRequest;
+import org.jboss.portal.web.IllegalRequestException;
+import org.jboss.portal.web.Body;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.DriverCommand;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.driver.response.FailureResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokePostResponse;
+import org.jboss.unit.Failure;
+import org.jboss.unit.api.Assert;
+
+import static org.jboss.unit.api.Assert.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PostApplicationXWWWFormURLEncodedTestCase extends ServletTestCase
+{
+
+ /** . */
+ private final FastURLEncoder encoder = FastURLEncoder.getUTF8Instance();
+
+ public PostApplicationXWWWFormURLEncodedTestCase()
+ {
+ }
+
+ public DriverResponse service(TestServlet testServlet, HttpServletRequest req,
HttpServletResponse resp) throws ServletException, IOException
+ {
+ WebRequest webRequest = new WebRequest(req);
+
+ //
+ if (getRequestCount() == 0)
+ {
+ ParameterMap queryParameters =
Assert.assertNotNull(webRequest.getQueryParameterMap());
+ assertTrue(queryParameters.isEmpty());
+ Body.Form form = Assert.assertInstanceOf(webRequest.getBody(),
Body.Form.class);
+ ParameterMap formParameters = form.getParameters();
+ assertTrue(formParameters.isEmpty());
+
+ //
+ InvokePostResponse post = new
InvokePostResponse("/test-request-server/?a=a_value_query");
+ post.setBody(new HttpRequest.Form());
+ post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED);
+ return post;
+ }
+ else if (getRequestCount() == 1)
+ {
+ ParameterMap queryParameters =
Assert.assertNotNull(webRequest.getQueryParameterMap());
+ assertEquals(1, queryParameters.size());
+ assertEquals(new String[]{"a_value_query"},
queryParameters.get("a"));
+ Body.Form form = Assert.assertInstanceOf(webRequest.getBody(),
Body.Form.class);
+ ParameterMap formParameters = form.getParameters();
+ assertTrue(formParameters.isEmpty());
+
+ //
+ InvokePostResponse post = new
InvokePostResponse("/test-request-server/");
+ HttpRequest.Form requestForm = new HttpRequest.Form();
+ requestForm.addParameter("a", new
String[]{"a_value_body"});
+ post.setBody(requestForm);
+ post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED);
+ return post;
+ }
+ else if (getRequestCount() == 2)
+ {
+ ParameterMap queryParameters =
Assert.assertNotNull(webRequest.getQueryParameterMap());
+ assertTrue(queryParameters.isEmpty());
+ Body.Form form = Assert.assertInstanceOf(webRequest.getBody(),
Body.Form.class);
+ ParameterMap formParameters = form.getParameters();
+ assertEquals(1, formParameters.size());
+ assertEquals(new String[]{"a_value_body"},
formParameters.get("a"));
+
+ //
+ InvokePostResponse post = new
InvokePostResponse("/test-request-server/?a=a_value_query");
+ post.setBody(new HttpRequest.Form());
+ HttpRequest.Form requestForm = new HttpRequest.Form();
+ requestForm.addParameter("a", new
String[]{"a_value_form"});
+ post.setBody(requestForm);
+ post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED);
+ return post;
+ }
+ else if (getRequestCount() == 3)
+ {
+ ParameterMap queryParameters =
Assert.assertNotNull(webRequest.getQueryParameterMap());
+ assertEquals(1, queryParameters.size());
+ assertEquals(new String[]{"a_value_query"},
queryParameters.get("a"));
+ Body.Form form = Assert.assertInstanceOf(webRequest.getBody(),
Body.Form.class);
+ ParameterMap formParameters = form.getParameters();
+ assertEquals(1, formParameters.size());
+ assertEquals(new String[]{"a_value_form"},
formParameters.get("a"));
+
+ //
+ InvokePostResponse post = new
InvokePostResponse("/test-request-server/?a=" + encoder.encode(RANGE_0_255));
+ post.setBody(new HttpRequest.Form());
+ HttpRequest.Form requestForm = new HttpRequest.Form();
+ requestForm.addParameter("a", new String[]{RANGE_256_512});
+ post.setBody(requestForm);
+ post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED +
"; charset=UTF-8");
+ return post;
+ }
+ else if (getRequestCount() == 4)
+ {
+ ParameterMap queryParameters =
Assert.assertNotNull(webRequest.getQueryParameterMap());
+ assertEquals(1, queryParameters.size());
+ assertNull(compareString(RANGE_0_255, queryParameters.get("a")[0]));
+ Body.Form form = Assert.assertInstanceOf(webRequest.getBody(),
Body.Form.class);
+ ParameterMap formParameters = form.getParameters();
+ assertEquals(1, formParameters.size());
+ assertNull(compareString(RANGE_256_512, formParameters.get("a")[0]));
+
+ //
+ InvokePostResponse post = new
InvokePostResponse("/test-request-server/?a=" + encoder.encode(RANGE_256_512));
+ post.setBody(new HttpRequest.Form());
+ HttpRequest.Form requestForm = new HttpRequest.Form();
+ requestForm.addParameter("a", new String[]{RANGE_0_255});
+ post.setBody(requestForm);
+ post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED +
"; charset=UTF-8");
+ return post;
+ }
+ else if (getRequestCount() == 5)
+ {
+ ParameterMap queryParameters =
Assert.assertNotNull(webRequest.getQueryParameterMap());
+ assertEquals(1, queryParameters.size());
+ assertNull(compareString(RANGE_256_512,
queryParameters.get("a")[0]));
+ Body.Form form = Assert.assertInstanceOf(webRequest.getBody(),
Body.Form.class);
+ ParameterMap formParameters = form.getParameters();
+ assertEquals(1, formParameters.size());
+ assertNull(compareString(RANGE_0_255, formParameters.get("a")[0]));
+ }
+ else
+ {
+ Assert.fail();
+ }
+
+ //
+ return new EndTestResponse();
+ }
+
+ public DriverResponse invoke(TestServlet testServlet, DriverCommand driverCommand)
+ {
+ if (getRequestCount() == -1)
+ {
+ InvokePostResponse post = new
InvokePostResponse("/test-request-server/");
+ post.setBody(new HttpRequest.Form());
+ post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED);
+ return post;
+ }
+ else
+ {
+ return new FailureResponse(Failure.createAssertionFailure(""));
+ }
+ }
+
+}
Added:
modules/web/trunk/web/src/main/org/jboss/portal/test/web/request/PostMultipartFormDataTestCase.java
===================================================================
---
modules/web/trunk/web/src/main/org/jboss/portal/test/web/request/PostMultipartFormDataTestCase.java
(rev 0)
+++
modules/web/trunk/web/src/main/org/jboss/portal/test/web/request/PostMultipartFormDataTestCase.java 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,105 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.web.request;
+
+import org.jboss.portal.test.web.ServletTestCase;
+import org.jboss.portal.test.web.TestServlet;
+import org.jboss.portal.common.text.FastURLEncoder;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.common.http.HttpRequest;
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.web.WebRequest;
+import org.jboss.portal.web.Body;
+import org.jboss.portal.web.IllegalRequestException;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.DriverCommand;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.driver.response.FailureResponse;
+import org.jboss.unit.api.Assert;
+import org.jboss.unit.remote.driver.handler.http.response.InvokePostResponse;
+import org.jboss.unit.Failure;
+
+import static org.jboss.unit.api.Assert.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PostMultipartFormDataTestCase extends ServletTestCase
+{
+
+ /** . */
+ private final FastURLEncoder encoder = FastURLEncoder.getUTF8Instance();
+
+ public PostMultipartFormDataTestCase()
+ {
+ }
+
+ public DriverResponse service(TestServlet testServlet, HttpServletRequest req,
HttpServletResponse resp) throws ServletException, IOException
+ {
+ WebRequest webRequest = new WebRequest(req);
+
+ //
+ if (getRequestCount() == 0)
+ {
+ ParameterMap queryParameters =
Assert.assertNotNull(webRequest.getQueryParameterMap());
+ Assert.assertTrue(queryParameters.isEmpty());
+ Body.Raw raw = Assert.assertInstanceOf(webRequest.getBody(), Body.Raw.class);
+ InputStream in = raw.getInputStream();
+ byte[] bytes = IOTools.getBytes(in);
+ assertTrue(Arrays.equals(new byte[]{0,1,1,2,3,5,8,13,21,34},bytes));
+ }
+ else
+ {
+ Assert.fail();
+ }
+
+ //
+ return new EndTestResponse();
+ }
+
+ public DriverResponse invoke(TestServlet testServlet, DriverCommand driverCommand)
+ {
+ if (getRequestCount() == -1)
+ {
+ InvokePostResponse post = new
InvokePostResponse("/test-request-server/");
+ HttpRequest.Raw raw = new HttpRequest.Raw();
+ post.setBody(raw);
+ raw.setBytes(new byte[]{0,1,1,2,3,5,8,13,21,34});
+ post.setContentType(InvokePostResponse.MULTIPART_FORM_DATA);
+ return post;
+ }
+ else
+ {
+ return new FailureResponse(Failure.createAssertionFailure(""));
+ }
+ }
+
+}
Copied: modules/web/trunk/web/src/main/org/jboss/portal/test/web/spi/SPITestCase.java
(from rev 8742,
modules/web/trunk/web/src/main/org/jboss/portal/test/web/spi/SPITestServlet.java)
===================================================================
--- modules/web/trunk/web/src/main/org/jboss/portal/test/web/spi/SPITestCase.java
(rev 0)
+++
modules/web/trunk/web/src/main/org/jboss/portal/test/web/spi/SPITestCase.java 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,192 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.web.spi;
+
+import org.jboss.portal.test.web.WebAppRegistry;
+import org.jboss.portal.test.web.TestServlet;
+import org.jboss.portal.test.web.ServletTestCase;
+import org.jboss.portal.test.web.spi.callbacks.NormalCallback;
+import org.jboss.portal.test.web.spi.callbacks.ExceptionCallback;
+import org.jboss.portal.web.ServletContainer;
+import org.jboss.portal.web.WebApp;
+import org.jboss.portal.web.ServletContextDispatcher;
+import org.jboss.portal.web.impl.DefaultServletContainerFactory;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.DriverCommand;
+import org.jboss.unit.driver.response.FailureResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.deployer.response.UndeployResponse;
+import org.jboss.unit.remote.driver.handler.deployer.response.DeployResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import org.jboss.unit.Failure;
+import static org.jboss.unit.api.Assert.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import javax.servlet.ServletContext;
+import java.io.IOException;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class SPITestCase extends ServletTestCase
+{
+
+ /** . */
+ private WebAppRegistry registry;
+
+ /** . */
+ private Set<String> keys;
+
+ /** . */
+ private ServletContainer container;
+
+ public DriverResponse service(TestServlet testServlet, HttpServletRequest req,
HttpServletResponse resp) throws ServletException, IOException
+ {
+ if (getRequestCount() == 1)
+ {
+ // Should try
+ ServletContext appContext =
testServlet.getServletContext().getContext("/test-spi-app");
+
+ //
+ if (appContext == null)
+ {
+ fail("Cannot get access to the /test-spi-app servlet context");
+ }
+
+ //
+ WebApp webApp = registry.getWebApp("/test-spi-app");
+ NormalCallback cb1 = new NormalCallback(appContext, webApp.getClassLoader());
+ Exception ex = new Exception();
+ ExceptionCallback cb2 = new ExceptionCallback(appContext, ex, ex);
+ Error err = new Error();
+ ExceptionCallback cb3 = new ExceptionCallback(appContext, err, err);
+ RuntimeException rex = new RuntimeException();
+ ExceptionCallback cb4 = new ExceptionCallback(appContext, rex, rex);
+ IOException ioe = new IOException();
+ ExceptionCallback cb5 = new ExceptionCallback(appContext, ioe, ioe);
+
+ //
+ ServletContextDispatcher dispatcher = new ServletContextDispatcher(req, resp,
container);
+ DriverResponse response = cb1.test(null, dispatcher);
+ response = cb2.test(response, dispatcher);
+ response = cb3.test(response, dispatcher);
+ response = cb4.test(response, dispatcher);
+ response = cb5.test(response, dispatcher);
+
+ //
+ if (response != null)
+ {
+ return response;
+ }
+
+ // Now we undeploy
+ return new UndeployResponse("test-spi-app.war");
+ }
+ else if (getRequestCount() == 2)
+ {
+ if (!keys.equals(registry.getKeys()))
+ {
+ fail("The set of deployed web applications " + registry.getKeys() +
" is not equals to the expected set " + keys);
+ }
+
+ // Remove registration
+ container.removeWebAppListener(registry);
+
+ //
+ if (registry.getKeys().size() > 0)
+ {
+ fail("The set of deployed web application should be empty instead of
" + registry.getKeys());
+ }
+ else
+ {
+ return new EndTestResponse();
+ }
+ }
+
+ //
+ return new FailureResponse(Failure.createAssertionFailure(""));
+ }
+
+
+ public DriverResponse invoke(TestServlet testServlet, DriverCommand driverCommand)
+ {
+ if (getRequestCount() == -1)
+ {
+ container = DefaultServletContainerFactory.getInstance().getServletContainer();
+ if (container == null)
+ {
+ return new FailureResponse(Failure.createAssertionFailure("No servlet
container present"));
+ }
+
+ // Register and save the deployed web apps
+ registry = new WebAppRegistry();
+ container.addWebAppListener(registry);
+ keys = new HashSet<String>((Collection<? extends
String>)registry.getKeys());
+
+ // Deploy the application web app
+ return new DeployResponse("test-spi-app.war");
+ }
+ else if (getRequestCount() == 0)
+ {
+ // Compute the difference with the previous deployed web apps
+ Set diff = new HashSet<String>((Collection<? extends
String>)registry.getKeys());
+ diff.removeAll(keys);
+
+ // It should be 1
+ if (diff.size() != 1)
+ {
+ return new FailureResponse(Failure.createAssertionFailure("The size of
the new web application deployed should be 1, it is " + diff.size() + "
instead." +
+ "The previous set was " + keys + " and the new set is " +
registry.getKeys()));
+ }
+ String key = (String)diff.iterator().next();
+ if (!"/test-spi-app".equals(key))
+ {
+ return new FailureResponse(Failure.createAssertionFailure("The newly
deployed web application should be /test-spi-war and it is " + key));
+ }
+
+ //
+ WebApp webApp = registry.getWebApp("/test-spi-app");
+ if (webApp == null)
+ {
+ return new FailureResponse(Failure.createAssertionFailure("The web app
/test-spi-app was not found"));
+ }
+ if (!"/test-spi-app".equals(webApp.getContextPath()))
+ {
+ return new FailureResponse(Failure.createAssertionFailure("The web app
context is not equals to the expected value but has the value " +
webApp.getContextPath()));
+ }
+
+ //
+ return new InvokeGetResponse("/test-spi-server");
+ }
+ else
+ {
+ return new FailureResponse(Failure.createAssertionFailure(""));
+ }
+ }
+}
Deleted: modules/web/trunk/web/src/main/org/jboss/portal/test/web/spi/SPITestServlet.java
===================================================================
---
modules/web/trunk/web/src/main/org/jboss/portal/test/web/spi/SPITestServlet.java 2007-11-19
15:25:36 UTC (rev 9025)
+++
modules/web/trunk/web/src/main/org/jboss/portal/test/web/spi/SPITestServlet.java 2007-11-19
23:03:47 UTC (rev 9026)
@@ -1,271 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.web.spi;
-
-import org.jboss.portal.test.web.WebAppRegistry;
-import org.jboss.portal.test.web.spi.callbacks.NormalCallback;
-import org.jboss.portal.test.web.spi.callbacks.ExceptionCallback;
-import org.jboss.portal.web.ServletContainer;
-import org.jboss.portal.web.WebApp;
-import org.jboss.portal.web.ServletContextDispatcher;
-import org.jboss.portal.web.impl.DefaultServletContainerFactory;
-import org.jboss.unit.info.TestInfo;
-import org.jboss.unit.info.impl.SimpleTestCaseInfo;
-import org.jboss.unit.driver.DriverResponse;
-import org.jboss.unit.driver.DriverCommand;
-import org.jboss.unit.driver.DriverContext;
-import org.jboss.unit.driver.DriverException;
-import org.jboss.unit.driver.impl.composite.CompositeTestDriver;
-import org.jboss.unit.driver.response.FailureResponse;
-import org.jboss.unit.driver.response.EndTestResponse;
-import org.jboss.unit.remote.driver.RemoteTestDriverServer;
-import org.jboss.unit.remote.driver.RemoteTestDriver;
-import org.jboss.unit.remote.driver.CompositeRemoteTestDriver;
-import org.jboss.unit.remote.driver.handler.deployer.response.UndeployResponse;
-import org.jboss.unit.remote.driver.handler.deployer.response.DeployResponse;
-import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
-import org.jboss.unit.remote.ResponseContext;
-import org.jboss.unit.remote.RequestContext;
-import org.jboss.unit.Failure;
-import org.jboss.unit.TestId;
-
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletException;
-import javax.servlet.ServletContext;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.HashMap;
-import java.util.Collection;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class SPITestServlet extends HttpServlet implements RemoteTestDriver
-{
-
- /** . */
- private TestInfo info = new SimpleTestCaseInfo("test");
-
- /** . */
- private WebAppRegistry registry;
-
- /** . */
- private Set<String> keys;
-
- /** . */
- private ServletContainer container;
-
- /** . */
- private RemoteTestDriverServer driver;
-
- /** . */
- private RequestContext requestContext;
-
- /** . */
- private ResponseContext responseContext;
-
- public void init() throws ServletException
- {
- try
- {
- CompositeTestDriver suite = new CompositeTestDriver(getClass().getName());
- CompositeRemoteTestDriver remoteSuite = new CompositeRemoteTestDriver(suite);
- suite.mount(this);
- driver =
(RemoteTestDriverServer)getServletContext().getAttribute("TestDriverServer");
- driver.setDelegate(remoteSuite);
- }
- catch (DriverException e)
- {
- throw new ServletException(e);
- }
- }
-
- public void destroy()
- {
- driver.setDelegate(null);
- driver = null;
- }
-
-
- public void initDriver(DriverContext driverContext)
- {
-
- }
-
- public void destroyDriver()
- {
-
- }
-
- protected void service(HttpServletRequest req, HttpServletResponse resp) throws
ServletException, IOException
- {
- DriverResponse response = service2(req, resp);
- responseContext = new ResponseContext(response, new HashMap<String,
Serializable>());
- resp.setStatus(200);
- }
-
- private DriverResponse service2(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
- {
- if (requestContext.isRequestCount(1))
- {
- // Should try
- ServletContext appContext =
getServletContext().getContext("/test-spi-app");
-
- //
- if (appContext == null)
- {
- return new FailureResponse(Failure.createErrorFailure("Cannot get access
to the /test-spi-app servlet context"));
- }
-
- //
- WebApp webApp = registry.getWebApp("/test-spi-app");
- NormalCallback cb1 = new NormalCallback(appContext, webApp.getClassLoader());
- Exception ex = new Exception();
- ExceptionCallback cb2 = new ExceptionCallback(appContext, ex, ex);
- Error err = new Error();
- ExceptionCallback cb3 = new ExceptionCallback(appContext, err, err);
- RuntimeException rex = new RuntimeException();
- ExceptionCallback cb4 = new ExceptionCallback(appContext, rex, rex);
- IOException ioe = new IOException();
- ExceptionCallback cb5 = new ExceptionCallback(appContext, ioe, ioe);
-
- //
- ServletContextDispatcher dispatcher = new ServletContextDispatcher(req, resp,
container);
- DriverResponse response = cb1.test(null, dispatcher);
- response = cb2.test(response, dispatcher);
- response = cb3.test(response, dispatcher);
- response = cb4.test(response, dispatcher);
- response = cb5.test(response, dispatcher);
-
- //
- if (response != null)
- {
- return response;
- }
-
- // Now we undeploy
- return new UndeployResponse("test-spi-app.war");
- }
- else if (requestContext.isRequestCount(2))
- {
- if (!keys.equals(registry.getKeys()))
- {
- return new FailureResponse(Failure.createAssertionFailure("The set of
deployed web applications " + registry.getKeys() + " is not equals to the
expected set " +
- keys));
- }
-
- // Remove registration
- container.removeWebAppListener(registry);
-
- //
- if (registry.getKeys().size() > 0)
- {
- return new FailureResponse(Failure.createAssertionFailure("The set of
deployed web application should be empty instead of " + registry.getKeys()));
- }
- else
- {
- return new EndTestResponse();
- }
- }
-
- //
- return new FailureResponse(Failure.createAssertionFailure(""));
- }
-
-
- public void pushContext(TestId testId, RequestContext requestContext)
- {
- this.requestContext = requestContext;
- }
-
- public ResponseContext popContext(TestId testId)
- {
- return responseContext;
- }
-
- public TestInfo getInfo()
- {
- return info;
- }
-
- public DriverResponse invoke(TestId testId, DriverCommand driverCommand)
- {
- if (requestContext.isRequestCount(-1))
- {
- container = DefaultServletContainerFactory.getInstance().getServletContainer();
- if (container == null)
- {
- return new FailureResponse(Failure.createAssertionFailure("No servlet
container present"));
- }
-
- // Register and save the deployed web apps
- registry = new WebAppRegistry();
- container.addWebAppListener(registry);
- keys = new HashSet<String>((Collection<? extends
String>)registry.getKeys());
-
- // Deploy the application web app
- return new DeployResponse("test-spi-app.war");
- }
- else if (requestContext.isRequestCount(0))
- {
- // Compute the difference with the previous deployed web apps
- Set diff = new HashSet<String>((Collection<? extends
String>)registry.getKeys());
- diff.removeAll(keys);
-
- // It should be 1
- if (diff.size() != 1)
- {
- return new FailureResponse(Failure.createAssertionFailure("The size of
the new web application deployed should be 1, it is " + diff.size() + "
instead." +
- "The previous set was " + keys + " and the new set is " +
registry.getKeys()));
- }
- String key = (String)diff.iterator().next();
- if (!"/test-spi-app".equals(key))
- {
- return new FailureResponse(Failure.createAssertionFailure("The newly
deployed web application should be /test-spi-war and it is " + key));
- }
-
- //
- WebApp webApp = registry.getWebApp("/test-spi-app");
- if (webApp == null)
- {
- return new FailureResponse(Failure.createAssertionFailure("The web app
/test-spi-app was not found"));
- }
- if (!"/test-spi-app".equals(webApp.getContextPath()))
- {
- return new FailureResponse(Failure.createAssertionFailure("The web app
context is not equals to the expected value but has the value " +
webApp.getContextPath()));
- }
-
- //
- return new InvokeGetResponse("/test-spi-server");
- }
- else
- {
- return new FailureResponse(Failure.createAssertionFailure(""));
- }
- }
-}
Added: modules/web/trunk/web/src/main/org/jboss/portal/web/Body.java
===================================================================
--- modules/web/trunk/web/src/main/org/jboss/portal/web/Body.java
(rev 0)
+++ modules/web/trunk/web/src/main/org/jboss/portal/web/Body.java 2007-11-19 23:03:47 UTC
(rev 9026)
@@ -0,0 +1,118 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.web;
+
+import org.jboss.portal.common.util.ParameterMap;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.InputStream;
+import java.io.BufferedReader;
+import java.io.IOException;
+
+/**
+ * The body of a request.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class Body
+{
+
+ /** . */
+ private final String characterEncoding;
+
+ private Body(String characterEncoding)
+ {
+ this.characterEncoding = characterEncoding;
+ }
+
+ public String getCharacterEncoding()
+ {
+ return characterEncoding;
+ }
+
+ public static class Form extends Body
+ {
+
+ /** . */
+ private final ParameterMap parameters;
+
+ Form(String characterEncoding, ParameterMap parameters)
+ {
+ super(characterEncoding);
+
+ //
+ if (parameters == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.parameters = parameters;
+ }
+
+ public ParameterMap getParameters()
+ {
+ return parameters;
+ }
+ }
+
+ public static class Raw extends Body
+ {
+
+ /** . */
+ private final HttpServletRequest request;
+
+ /** . */
+ private boolean consumed;
+
+ Raw(String characterEncoding, HttpServletRequest request)
+ {
+ super(characterEncoding);
+
+ //
+ this.request = request;
+ }
+
+ public InputStream getInputStream() throws IOException
+ {
+ if (consumed)
+ {
+ throw new IllegalStateException();
+ }
+ consumed = true;
+ return request.getInputStream();
+ }
+
+ public BufferedReader getReader() throws IOException
+ {
+ if (consumed)
+ {
+ throw new IllegalStateException();
+ }
+ consumed = true;
+ return request.getReader();
+ }
+ }
+
+}
Modified:
modules/web/trunk/web/src/main/org/jboss/portal/web/IllegalRequestException.java
===================================================================
---
modules/web/trunk/web/src/main/org/jboss/portal/web/IllegalRequestException.java 2007-11-19
15:25:36 UTC (rev 9025)
+++
modules/web/trunk/web/src/main/org/jboss/portal/web/IllegalRequestException.java 2007-11-19
23:03:47 UTC (rev 9026)
@@ -26,7 +26,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class IllegalRequestException extends Exception
+public class IllegalRequestException extends RuntimeException
{
public IllegalRequestException()
{
Deleted: modules/web/trunk/web/src/main/org/jboss/portal/web/RequestInfo.java
===================================================================
--- modules/web/trunk/web/src/main/org/jboss/portal/web/RequestInfo.java 2007-11-19
15:25:36 UTC (rev 9025)
+++ modules/web/trunk/web/src/main/org/jboss/portal/web/RequestInfo.java 2007-11-19
23:03:47 UTC (rev 9026)
@@ -1,214 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.web;
-
-import org.jboss.portal.common.http.QueryStringParser;
-import org.jboss.portal.common.util.ParameterMap;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.Map;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.HashMap;
-import java.nio.charset.Charset;
-import java.io.UnsupportedEncodingException;
-
-/**
- * Compute useful information about an <code>HttpServletRequest</code>.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class RequestInfo
-{
-
- /** . */
- public static final int GET_METHOD = 0;
-
- /** . */
- public static final int POST_METHOD = 1;
-
- /** . */
- public static final String APPLICATION_X_WWW_FORM_URLENCODED_MEDIA_TYPE =
"application/x-www-form-urlencoded";
-
- /** . */
- public static final String MULTIPART_FORM_DATA_MEDIA_TYPE =
"multipart/form-data";
-
- /** . */
- public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8");
-
- /** . */
- private final ParameterMap queryParameterMap;
-
- /** . */
- private final ParameterMap bodyParameterMap;
-
- /** . */
- private final int method;
-
- /** . */
- private final String mediaType;
-
- public RequestInfo(HttpServletRequest req) throws UnsupportedEncodingException,
IllegalRequestException
- {
- int method;
- if ("GET".equals(req.getMethod()))
- {
- method = GET_METHOD;
- }
- else if ("POST".equals(req.getMethod()))
- {
- method = POST_METHOD;
- }
- else
- {
- throw new IllegalRequestException("HTTP Method " + req.getMethod() +
" not accepted");
- }
-
- // Compute the media type in the content type
- String mediaType = retrieveMediaType(req.getContentType());
-
- // Only affect the charset encoding if the servlet container will decode the
request
- if (method == POST_METHOD &&
APPLICATION_X_WWW_FORM_URLENCODED_MEDIA_TYPE.equals(mediaType))
- {
- // Now we must ensure that we have either an equals or a trailing space after
the media-type
- String characterEncoding = req.getCharacterEncoding();
- if (characterEncoding == null)
- {
- // Set out charset for the request
- req.setCharacterEncoding(UTF_8_CHARSET.name());
- }
- else
- {
- Charset charset = Charset.forName(characterEncoding);
- if (!UTF_8_CHARSET.equals(charset))
- {
- throw new IllegalRequestException("Charset " + characterEncoding
+ " not accepted, it should be UTF8");
- }
- }
- }
-
- // Parse the query string to have the get parameters
- // The resulting map has its parameters decoded from the x-www-form-url encoding
- Map queryParameterMap = Collections.EMPTY_MAP;
- String queryString = req.getQueryString();
- if (queryString != null)
- {
- queryParameterMap =
QueryStringParser.getInstance().parseQueryString(queryString);
- }
-
- //
- Map bodyParameterMap = null;
- if (method == POST_METHOD &&
APPLICATION_X_WWW_FORM_URLENCODED_MEDIA_TYPE.equals(mediaType))
- {
- bodyParameterMap = Collections.EMPTY_MAP;
- for (Iterator i = req.getParameterMap().entrySet().iterator(); i.hasNext();)
- {
- Map.Entry entry = (Map.Entry)i.next();
-
- // Get param name
- String paramName = (String)entry.getKey();
-
- // Values that are aggregated from the query string and the body
- String[] paramValues = (String[])entry.getValue();
-
- // Values decoded from the query string
- String[] queryValues = (String[])queryParameterMap.get(paramName);
- if (queryValues != null)
- {
- int bodyValuesLength = paramValues.length - queryValues.length;
- if (bodyValuesLength > 0)
- {
- String[] bodyValues = new String[bodyValuesLength];
- System.arraycopy(paramValues, queryValues.length, bodyValues, 0,
bodyValuesLength);
- if (bodyParameterMap.isEmpty())
- {
- bodyParameterMap = new HashMap();
- }
- bodyParameterMap.put(paramName, bodyValues);
- }
- }
- else
- {
- if (bodyParameterMap.isEmpty())
- {
- bodyParameterMap = new HashMap();
- }
- bodyParameterMap.put(paramName, paramValues);
- }
- }
-
- // Make the map unmodifiable
- bodyParameterMap = bodyParameterMap.isEmpty() ? bodyParameterMap :
Collections.unmodifiableMap(bodyParameterMap);
- }
-
- //
- this.method = method;
- this.queryParameterMap = new ParameterMap(queryParameterMap);
- this.bodyParameterMap = bodyParameterMap != null ? new
ParameterMap(bodyParameterMap) : null;
- this.mediaType = mediaType;
- }
-
- public ParameterMap getQueryParameterMap()
- {
- return queryParameterMap;
- }
-
- public ParameterMap getBodyParameterMap()
- {
- return bodyParameterMap;
- }
-
- public int getMethod()
- {
- return method;
- }
-
- public String getMediaType()
- {
- return mediaType;
- }
-
- private String retrieveMediaType(String contentType)
- {
- String mediaType = contentType;
-
- //
- if (mediaType != null)
- {
- // Remove any parameters
- int index = mediaType.indexOf(';');
- if (index != -1)
- {
- mediaType = contentType.substring(0, index);
- }
-
- // Trim
- mediaType = mediaType.trim();
-
- // Media type matching is case insensitive, so we convert to lower case
- mediaType = mediaType.toLowerCase();
- }
- return mediaType;
- }
-}
Copied: modules/web/trunk/web/src/main/org/jboss/portal/web/WebRequest.java (from rev
8948, modules/web/trunk/web/src/main/org/jboss/portal/web/RequestInfo.java)
===================================================================
--- modules/web/trunk/web/src/main/org/jboss/portal/web/WebRequest.java
(rev 0)
+++ modules/web/trunk/web/src/main/org/jboss/portal/web/WebRequest.java 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,218 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.web;
+
+import org.jboss.portal.common.http.QueryStringParser;
+import org.jboss.portal.common.util.ParameterMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import java.util.Map;
+import java.nio.charset.Charset;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * Add useful information about an <code>HttpServletRequest</code>.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class WebRequest extends HttpServletRequestWrapper
+{
+
+ public enum Verb
+ {
+ GET,
+ POST
+ }
+
+ /** . */
+ public static final String APPLICATION_X_WWW_FORM_URLENCODED_MEDIA_TYPE =
"application/x-www-form-urlencoded";
+
+ /** . */
+ public static final String MULTIPART_FORM_DATA_MEDIA_TYPE =
"multipart/form-data";
+
+ /** . */
+ public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8");
+
+ /** . */
+ private final ParameterMap queryParameterMap;
+
+ /** . */
+ private final Body body;
+
+ /** . */
+ private final Verb verb;
+
+ /** . */
+ private final String mediaType;
+
+ public WebRequest(HttpServletRequest req) throws UnsupportedEncodingException,
IllegalRequestException
+ {
+ super(req);
+
+ //
+ Verb verb;
+ if ("GET".equals(req.getMethod()))
+ {
+ verb = Verb.GET;
+ }
+ else if ("POST".equals(req.getMethod()))
+ {
+ verb = Verb.POST;
+ }
+ else
+ {
+ throw new IllegalRequestException("HTTP Method " + req.getMethod() +
" not accepted");
+ }
+
+ // Compute the media type in the content type
+ String mediaType = retrieveMediaType(req.getContentType());
+
+ // Parse the query string to have the get parameters
+ // The resulting map has its parameters decoded from the x-www-form-url encoding
+ ParameterMap queryParameterMap;
+ String queryString = req.getQueryString();
+ if (queryString != null)
+ {
+ queryParameterMap =
QueryStringParser.getInstance().parseQueryString(queryString);
+ }
+ else
+ {
+ queryParameterMap = new ParameterMap();
+ }
+
+ // Only affect the charset encoding if the servlet container will decode the
request
+ Body body = null;
+ if (verb == Verb.POST)
+ {
+ if (APPLICATION_X_WWW_FORM_URLENCODED_MEDIA_TYPE.equals(mediaType))
+ {
+ // Now we must ensure that we have either an equals or a trailing space after
the media-type
+ String characterEncoding = req.getCharacterEncoding();
+ if (characterEncoding == null)
+ {
+ // Set out charset for the request
+ req.setCharacterEncoding(UTF_8_CHARSET.name());
+ }
+ else
+ {
+ Charset charset = Charset.forName(characterEncoding);
+ if (!UTF_8_CHARSET.equals(charset))
+ {
+ throw new IllegalRequestException("Charset " +
characterEncoding + " not accepted, it should be UTF8");
+ }
+ }
+
+ //
+ ParameterMap bodyParameterMap = new ParameterMap();
+ for (Map.Entry<String, String[]> entry : ((Map<String,
String[]>)req.getParameterMap()).entrySet())
+ {
+ // Get param name
+ String paramName = entry.getKey();
+
+ // Values that are aggregated from the query string and the body
+ String[] paramValues = entry.getValue();
+
+ // Values decoded from the query string
+ String[] queryValues = queryParameterMap.get(paramName);
+ if (queryValues != null)
+ {
+ int bodyValuesLength = paramValues.length - queryValues.length;
+ if (bodyValuesLength > 0)
+ {
+ String[] bodyValues = new String[bodyValuesLength];
+ System.arraycopy(paramValues, queryValues.length, bodyValues, 0,
bodyValuesLength);
+ bodyParameterMap.put(paramName, bodyValues);
+ }
+ }
+ else
+ {
+ bodyParameterMap.put(paramName, paramValues);
+ }
+ }
+
+ //
+ body = new Body.Form(req.getCharacterEncoding(), bodyParameterMap);
+ }
+ else
+ {
+ body = new Body.Raw(req.getCharacterEncoding(), req);
+ }
+ }
+
+ //
+ this.verb = verb;
+ this.queryParameterMap = new ParameterMap(queryParameterMap);
+ this.body = body;
+ this.mediaType = mediaType;
+ }
+
+ public Verb getVerb()
+ {
+ return verb;
+ }
+
+ public Charset getCharset()
+ {
+ return UTF_8_CHARSET;
+ }
+
+ public ParameterMap getQueryParameterMap()
+ {
+ return queryParameterMap;
+ }
+
+ public Body getBody()
+ {
+ return body;
+ }
+
+ public String getMediaType()
+ {
+ return mediaType;
+ }
+
+ private String retrieveMediaType(String contentType)
+ {
+ String mediaType = contentType;
+
+ //
+ if (mediaType != null)
+ {
+ // Remove any parameters
+ int index = mediaType.indexOf(';');
+ if (index != -1)
+ {
+ mediaType = contentType.substring(0, index);
+ }
+
+ // Trim
+ mediaType = mediaType.trim();
+
+ // Media type matching is case insensitive, so we convert to lower case
+ mediaType = mediaType.toLowerCase();
+ }
+ return mediaType;
+ }
+}
Added: modules/web/trunk/web/src/main/org/jboss/portal/web/WebResponse.java
===================================================================
--- modules/web/trunk/web/src/main/org/jboss/portal/web/WebResponse.java
(rev 0)
+++ modules/web/trunk/web/src/main/org/jboss/portal/web/WebResponse.java 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.web;
+
+import javax.servlet.http.HttpServletResponseWrapper;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * todo
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class WebResponse extends HttpServletResponseWrapper
+{
+ public WebResponse(HttpServletResponse resp)
+ {
+ super(resp);
+ }
+}
Added:
modules/web/trunk/web/src/resources/portal-test-request-jar/org/jboss/portal/test/web/server-beans.xml
===================================================================
---
modules/web/trunk/web/src/resources/portal-test-request-jar/org/jboss/portal/test/web/server-beans.xml
(rev 0)
+++
modules/web/trunk/web/src/resources/portal-test-request-jar/org/jboss/portal/test/web/server-beans.xml 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<deployment
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_2_0.xsd"
+ xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="RemoteTestSuite"
class="org.jboss.unit.remote.driver.CompositeRemoteTestDriver">
+ <constructor>
+ <parameter
class="org.jboss.unit.driver.impl.composite.AbstractCompositeTestDriver"><inject
bean="TestSuite"/></parameter>
+ </constructor>
+ </bean>
+
+ <bean name="TestDriverServer"
class="org.jboss.unit.remote.driver.RemoteTestDriverServer">
+ <property name="delegate"><inject
bean="RemoteTestSuite"/></property>
+ </bean>
+
+ <bean name="TestDriverServerExporter"
class="org.jboss.portal.test.framework.impl.generic.server.GenericServiceExporter">
+ <constructor>
+ <parameter>socket://localhost:5400</parameter>
+ <parameter><inject
bean="TestDriverServer"/></parameter>
+
<parameter>org.jboss.unit.remote.driver.RemoteTestDriver</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="ServletContainerFactory"
class="org.jboss.portal.web.impl.DefaultServletContainerFactory">
+ <constructor
factoryClass="org.jboss.portal.web.impl.DefaultServletContainerFactory"
factoryMethod="getInstance"/>
+ </bean>
+
+ <bean name="ServletContainer"
class="org.jboss.portal.web.ServletContainer">
+ <constructor factoryMethod="getServletContainer">
+ <factory bean="ServletContainerFactory"/>
+ </constructor>
+ </bean>
+
+ <bean name="TestSuite"
class="org.jboss.unit.driver.impl.composite.CompositeTestDriver"/>
+
+ <bean name="GetTestCase"
class="org.jboss.portal.test.web.request.GetTestCase">
+ <install bean="TestSuite" method="mount">
+ <parameter><this/></parameter>
+ </install>
+ <uninstall bean="TestSuite" method="unmount">
+ <parameter><this/></parameter>
+ </uninstall>
+ </bean>
+
+ <bean name="PostApplicationXWWWFormURLEncodedTestCase"
class="org.jboss.portal.test.web.request.PostApplicationXWWWFormURLEncodedTestCase">
+ <install bean="TestSuite" method="mount">
+ <parameter><this/></parameter>
+ </install>
+ <uninstall bean="TestSuite" method="unmount">
+ <parameter><this/></parameter>
+ </uninstall>
+ </bean>
+
+ <bean name="PostMultipartFormDataTestCase"
class="org.jboss.portal.test.web.request.PostMultipartFormDataTestCase">
+ <install bean="TestSuite" method="mount">
+ <parameter><this/></parameter>
+ </install>
+ <uninstall bean="TestSuite" method="unmount">
+ <parameter><this/></parameter>
+ </uninstall>
+ </bean>
+
+</deployment>
Added:
modules/web/trunk/web/src/resources/portal-test-spi-jar/org/jboss/portal/test/web/server-beans.xml
===================================================================
---
modules/web/trunk/web/src/resources/portal-test-spi-jar/org/jboss/portal/test/web/server-beans.xml
(rev 0)
+++
modules/web/trunk/web/src/resources/portal-test-spi-jar/org/jboss/portal/test/web/server-beans.xml 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<deployment
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_2_0.xsd"
+ xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="RemoteTestSuite"
class="org.jboss.unit.remote.driver.CompositeRemoteTestDriver">
+ <constructor>
+ <parameter
class="org.jboss.unit.driver.impl.composite.AbstractCompositeTestDriver"><inject
bean="TestSuite"/></parameter>
+ </constructor>
+ </bean>
+
+ <bean name="TestDriverServer"
class="org.jboss.unit.remote.driver.RemoteTestDriverServer">
+ <property name="delegate"><inject
bean="RemoteTestSuite"/></property>
+ </bean>
+
+ <bean name="TestDriverServerExporter"
class="org.jboss.portal.test.framework.impl.generic.server.GenericServiceExporter">
+ <constructor>
+ <parameter>socket://localhost:5400</parameter>
+ <parameter><inject
bean="TestDriverServer"/></parameter>
+
<parameter>org.jboss.unit.remote.driver.RemoteTestDriver</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="ServletContainerFactory"
GetTestCaseclass="org.jboss.portal.web.impl.DefaultServletContainerFactory">
+ <constructor
factoryClass="org.jboss.portal.web.impl.DefaultServletContainerFactory"
factoryMethod="getInstance"/>
+ </bean>
+
+ <bean name="ServletContainer"
class="org.jboss.portal.web.ServletContainer">
+ <constructor factoryMethod="getServletContainer">
+ <factory bean="ServletContainerFactory"/>
+ </constructor>
+ </bean>
+
+ <bean name="TestSuite"
class="org.jboss.unit.driver.impl.composite.CompositeTestDriver"/>
+
+ <bean name="SPITestCase"
class="org.jboss.portal.test.web.spi.SPITestCase">
+ <install bean="TestSuite" method="mount">
+ <parameter><this/></parameter>
+ </install>
+ <uninstall bean="TestSuite" method="unmount">
+ <parameter><this/></parameter>
+ </uninstall>
+ </bean>
+
+</deployment>
Added:
modules/web/trunk/web/src/resources/test/support/jboss-4.2-container-servlet/server-war/WEB-INF/context.xml
===================================================================
---
modules/web/trunk/web/src/resources/test/support/jboss-4.2-container-servlet/server-war/WEB-INF/context.xml
(rev 0)
+++
modules/web/trunk/web/src/resources/test/support/jboss-4.2-container-servlet/server-war/WEB-INF/context.xml 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,2 @@
+<Context privileged="true"> <!-- crossContext="true"
-->
+</Context>
\ No newline at end of file
Added:
modules/web/trunk/web/src/resources/test/support/jboss-4.2-container-servlet/server-war/WEB-INF/jboss-web.xml
===================================================================
---
modules/web/trunk/web/src/resources/test/support/jboss-4.2-container-servlet/server-war/WEB-INF/jboss-web.xml
(rev 0)
+++
modules/web/trunk/web/src/resources/test/support/jboss-4.2-container-servlet/server-war/WEB-INF/jboss-web.xml 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<!DOCTYPE jboss-web PUBLIC
+ "-//JBoss//DTD Web Application 4.2//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
+<jboss-web>
+ <class-loading java2ClassLoadingCompliance="false">
+ <loader-repository>test:loader=portlet</loader-repository>
+ </class-loading>
+</jboss-web>
\ No newline at end of file
Added:
modules/web/trunk/web/src/resources/test/support/jboss-4.2-container-servlet/server-war/WEB-INF/web.xml
===================================================================
---
modules/web/trunk/web/src/resources/test/support/jboss-4.2-container-servlet/server-war/WEB-INF/web.xml
(rev 0)
+++
modules/web/trunk/web/src/resources/test/support/jboss-4.2-container-servlet/server-war/WEB-INF/web.xml 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <context-param>
+ <param-name>jboss.portal.mc.beans_resource_location</param-name>
+ <param-value>org/jboss/portal/test/web/server-beans.xml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>jboss.portal.mc.beans_resource_type</param-name>
+ <param-value>classloader</param-value>
+ </context-param>
+ <listener>
+
<listener-class>org.jboss.portal.common.mc.bootstrap.WebBootstrap</listener-class>
+ </listener>
+ <servlet>
+ <servlet-name>ContainerServlet</servlet-name>
+
<servlet-class>org.jboss.portal.web.impl.tomcat.TC6ContainerServlet</servlet-class>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>TestServlet</servlet-name>
+ <servlet-class>org.jboss.portal.test.web.TestServlet</servlet-class>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>TestServlet</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+</web-app>
Added:
modules/web/trunk/web/src/resources/test/support/jboss-4.2-generic/server-war/WEB-INF/jboss-web.xml
===================================================================
---
modules/web/trunk/web/src/resources/test/support/jboss-4.2-generic/server-war/WEB-INF/jboss-web.xml
(rev 0)
+++
modules/web/trunk/web/src/resources/test/support/jboss-4.2-generic/server-war/WEB-INF/jboss-web.xml 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<!DOCTYPE jboss-web PUBLIC
+ "-//JBoss//DTD Web Application 4.2//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
+<jboss-web>
+ <class-loading java2ClassLoadingCompliance="false">
+ <loader-repository>test:loader=portlet</loader-repository>
+ </class-loading>
+</jboss-web>
\ No newline at end of file
Added:
modules/web/trunk/web/src/resources/test/support/jboss-4.2-generic/server-war/WEB-INF/web.xml
===================================================================
---
modules/web/trunk/web/src/resources/test/support/jboss-4.2-generic/server-war/WEB-INF/web.xml
(rev 0)
+++
modules/web/trunk/web/src/resources/test/support/jboss-4.2-generic/server-war/WEB-INF/web.xml 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <context-param>
+ <param-name>jboss.portal.mc.beans_resource_location</param-name>
+ <param-value>org/jboss/portal/test/web/server-beans.xml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>jboss.portal.mc.beans_resource_type</param-name>
+ <param-value>classloader</param-value>
+ </context-param>
+ <listener>
+
<listener-class>org.jboss.portal.common.mc.bootstrap.WebBootstrap</listener-class>
+ </listener>
+ <servlet>
+ <servlet-name>TestServlet</servlet-name>
+ <servlet-class>org.jboss.portal.test.web.TestServlet</servlet-class>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>TestServlet</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+</web-app>
Added:
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/META-INF/context.xml
===================================================================
---
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/META-INF/context.xml
(rev 0)
+++
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/META-INF/context.xml 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,2 @@
+<Context privileged="true" crossContext="true">
+</Context>
\ No newline at end of file
Added:
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/WEB-INF/classes/log4j.properties
===================================================================
---
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/WEB-INF/classes/log4j.properties
(rev 0)
+++
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/WEB-INF/classes/log4j.properties 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,13 @@
+### ====================================================================== ###
+## ##
+## JBoss Bootstrap Log4j Configuration ##
+## ##
+### ====================================================================== ###
+
+log4j.rootCategory=ALL, CONSOLE
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=DEBUG
+log4j.appender.CONSOLE.Target=System.out
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
Added:
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/WEB-INF/classes/logging.properties
===================================================================
---
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/WEB-INF/classes/logging.properties
(rev 0)
+++
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/WEB-INF/classes/logging.properties 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,13 @@
+handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+org.apache.juli.FileHandler.level = FINE
+org.apache.juli.FileHandler.directory = ${catalina.base}/logs
+org.apache.juli.FileHandler.prefix = test-spi.
+
+java.util.logging.ConsoleHandler.level = FINE
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
Added:
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/WEB-INF/web.xml
===================================================================
---
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/WEB-INF/web.xml
(rev 0)
+++
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-container-servlet/server-war/WEB-INF/web.xml 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <context-param>
+ <param-name>jboss.portal.mc.beans_resource_location</param-name>
+ <param-value>org/jboss/portal/test/web/server-beans.xml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>jboss.portal.mc.beans_resource_type</param-name>
+ <param-value>classloader</param-value>
+ </context-param>
+ <listener>
+
<listener-class>org.jboss.portal.common.mc.bootstrap.WebBootstrap</listener-class>
+ </listener>
+ <servlet>
+ <servlet-name>ContainerServlet</servlet-name>
+
<servlet-class>org.jboss.portal.web.impl.tomcat.TC6ContainerServlet</servlet-class>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>SPITestServlet</servlet-name>
+ <servlet-class>org.jboss.portal.test.web.TestServlet</servlet-class>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>SPITestServlet</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+</web-app>
Added:
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/META-INF/context.xml
===================================================================
---
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/META-INF/context.xml
(rev 0)
+++
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/META-INF/context.xml 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,2 @@
+<Context crossContext="true">
+</Context>
\ No newline at end of file
Added:
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/WEB-INF/classes/log4j.properties
===================================================================
---
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/WEB-INF/classes/log4j.properties
(rev 0)
+++
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/WEB-INF/classes/log4j.properties 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,13 @@
+### ====================================================================== ###
+## ##
+## JBoss Bootstrap Log4j Configuration ##
+## ##
+### ====================================================================== ###
+
+log4j.rootCategory=ALL, CONSOLE
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=DEBUG
+log4j.appender.CONSOLE.Target=System.out
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
Added:
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/WEB-INF/classes/logging.properties
===================================================================
---
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/WEB-INF/classes/logging.properties
(rev 0)
+++
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/WEB-INF/classes/logging.properties 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,13 @@
+handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+org.apache.juli.FileHandler.level = FINE
+org.apache.juli.FileHandler.directory = ${catalina.base}/logs
+org.apache.juli.FileHandler.prefix = test-spi.
+
+java.util.logging.ConsoleHandler.level = FINE
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
Added:
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/WEB-INF/web.xml
===================================================================
---
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/WEB-INF/web.xml
(rev 0)
+++
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-generic/server-war/WEB-INF/web.xml 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <context-param>
+ <param-name>jboss.portal.mc.beans_resource_location</param-name>
+ <param-value>org/jboss/portal/test/web/server-beans.xml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>jboss.portal.mc.beans_resource_type</param-name>
+ <param-value>classloader</param-value>
+ </context-param>
+ <listener>
+
<listener-class>org.jboss.portal.common.mc.bootstrap.WebBootstrap</listener-class>
+ </listener>
+ <servlet>
+ <servlet-name>TestServlet</servlet-name>
+ <servlet-class>org.jboss.portal.test.web.TestServlet</servlet-class>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>TestServlet</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+</web-app>
Added:
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-lifecycle-listener/server-war/WEB-INF/classes/log4j.properties
===================================================================
---
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-lifecycle-listener/server-war/WEB-INF/classes/log4j.properties
(rev 0)
+++
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-lifecycle-listener/server-war/WEB-INF/classes/log4j.properties 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,13 @@
+### ====================================================================== ###
+## ##
+## JBoss Bootstrap Log4j Configuration ##
+## ##
+### ====================================================================== ###
+
+log4j.rootCategory=ALL, CONSOLE
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=DEBUG
+log4j.appender.CONSOLE.Target=System.out
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
Added:
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-lifecycle-listener/server-war/WEB-INF/classes/logging.properties
===================================================================
---
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-lifecycle-listener/server-war/WEB-INF/classes/logging.properties
(rev 0)
+++
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-lifecycle-listener/server-war/WEB-INF/classes/logging.properties 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,13 @@
+handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+org.apache.juli.FileHandler.level = FINE
+org.apache.juli.FileHandler.directory = ${catalina.base}/logs
+org.apache.juli.FileHandler.prefix = test-spi.
+
+java.util.logging.ConsoleHandler.level = FINE
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
Added:
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-lifecycle-listener/server-war/WEB-INF/web.xml
===================================================================
---
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-lifecycle-listener/server-war/WEB-INF/web.xml
(rev 0)
+++
modules/web/trunk/web/src/resources/test/support/tomcat-6.0-lifecycle-listener/server-war/WEB-INF/web.xml 2007-11-19
23:03:47 UTC (rev 9026)
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <context-param>
+ <param-name>jboss.portal.mc.beans_resource_location</param-name>
+ <param-value>org/jboss/portal/test/web/server-beans.xml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>jboss.portal.mc.beans_resource_type</param-name>
+ <param-value>classloader</param-value>
+ </context-param>
+ <listener>
+
<listener-class>org.jboss.portal.common.mc.bootstrap.WebBootstrap</listener-class>
+ </listener>
+ <servlet>
+ <servlet-name>TestServlet</servlet-name>
+ <servlet-class>org.jboss.portal.test.web.TestServlet</servlet-class>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>TestServlet</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+</web-app>