>>>>> On Thu, 3 Feb 2011 12:54:39 -0800, Sheetal Vartak <sheetal.vartak_at_oracle.com> said:
SV> Please review the changes at
SV>
http://java.net/jira/browse/JAVASERVERFACES-1907 The test suite now
SV> runs the systest-per-webapp tests in multi-virtual server mode.
The major problem with this approach is that it only creates one virtual
server and it doesn't modify the deploy.artifact macro to use the
--virtualservers argument.
I have taken your changebundle and made significant changes to address
these shortcomings.
Here is the changebundle I have tested thoroughly on the branch.
Once it passes Hudson jobs there, I'll commit it to the trunk.
http://java.net/jira/browse/JAVASERVERFACES-1907
SECTION: Modified Files
----------------------------
M common/ant/glassfish/container.xml
M common/ant/glassfishV3prelude/container.xml
M common/ant/tomcat6/container.xml
M common/ant/glassfishV3.1/container.xml
M common/ant/glassfishV3/container.xml
- Include dummy ant content for the following
use-virtual-servers attribute on deploy.artifact macro
targets define.scenario.aware.port and define.virtual-server.aware.port
M common/ant/common.xml
- move the container version discovery nonsense up here.
- rename cluster.aware.port to scenario.aware.port
- add <sysproperty virtual-server, and corresponding attribute, to jsf.junit macro.
M common/ant/glassfishV3.1_no_cluster/container.xml
- This is the only scenario where virtual server testing is done. I
have been unable to observe it working in the clustered scenario.
Sheetal contributed some logic, but I modified it significantly, thus
I feel justified in taking ownership of the bug.
M jsf-ri/build-tests.xml
- rename cluster.aware.port to scenario.aware.port
M jsf-ri/build.xml
- Of all the files in this changebundle, this one has the most of
Sheetal's contribution. Thank you very much for the content.
M jsf-ri/systest-per-webapp/build.xml
- I empirically arrived at the set of systest-per-webapp tests in
"applications-for-V3.1_no_cluster-virtual-server" by seeing which ones
failed and removing them from the set.
I have filed a this bug to re-instate them.
http://java.net/jira/browse/JAVASERVERFACES-1939
The set of tests that were removed is
absolute-ordering
add-elresolver-and-replace-variableresolver-programmatically
disable-unicode-escaping
document-ordering
flash
jsp-flash
replace-variableresolver-and-add-elresolver-programmatically
replace-variableresolver-programmatically
request-char-encoding-no-session
M jsf-ri/systest-per-webapp/build-tests.xml
- Very complex changes.
M jsf-ri/systest/src/com/sun/faces/htmlunit/AbstractTestCase.java
- Account for port complexities when running in virtual-server scenario
or cluster scenario. In virtual-server scenario, you want the port
accessed by the application to be the same for the life of the test
instance. In the cluster scenario, you want the port to be as random
as possible among the nodes in the cluster. This change does that.
M jsf-ri/systest/build-tests.xml
- rename cluster.aware to scenario.aware
SECTION: Diffs
----------------------------
Property changes on: .
___________________________________________________________________
Added: svn:mergeinfo
Merged /trunk:r8837
Index: common/ant/glassfish/container.xml
===================================================================
--- common/ant/glassfish/container.xml (revision 8837)
+++ common/ant/glassfish/container.xml (working copy)
@@ -60,6 +60,9 @@
description="The WAR to deploy"/>
<attribute name="appName"
description="The name of the application"/>
+ <attribute name="use-virtual-servers"
+ description="If true, deploy to the virtual servers."
+ default="false"/>
<sequential>
<condition property="exec.name" value="cmd.exe">
<os family="windows"/>
@@ -279,10 +282,13 @@
</sequential>
</macrodef>
- <target name="define.cluster.aware.port">
- <property name="cluster.aware.port" value="${container.port}" />
+ <target name="define.scenario.aware.port">
+ <property name="scenario.aware.port" value="${container.port}" />
</target>
+ <target name="define.virtual-server.aware.port">
+ <property name="scenario.aware.port" value="${container.port}" />
+ </target>
<!-- 'PRIVATE' targets -->
<macrodef name="start.domain">
Index: common/ant/common.xml
===================================================================
--- common/ant/common.xml (revision 8837)
+++ common/ant/common.xml (working copy)
@@ -247,6 +247,35 @@
<!-- Common Targets -->
+ <target name="discover.container.version"
+ depends="query.is.V2,query.is.V3,query.is.V3.1,query.is.V3.1_no_cluster"/>
+
+ <target name="query.is.V2">
+ <condition property="container.is.V2">
+ <equals arg1="glassfish" arg2="${container.name}" />
+ </condition>
+ </target>
+
+ <target name="query.is.V3">
+ <condition property="container.is.V3">
+ <equals arg1="glassfishV3" arg2="${container.name}" />
+ </condition>
+ </target>
+
+ <target name="query.is.V3.1">
+ <condition property="container.is.V3.1">
+ <equals arg1="glassfishV3.1" arg2="${container.name}" />
+ </condition>
+ </target>
+
+ <target name="query.is.V3.1_no_cluster">
+ <condition property="container.is.V3.1_no_cluster">
+ <equals arg1="glassfishV3.1_no_cluster" arg2="${container.name}" />
+ </condition>
+ </target>
+
+
+
<!-- Convenience macro for javac -->
<macrodef name="jsf.javac">
<attribute name="srcdir"/>
@@ -280,7 +309,8 @@
<attribute name="explodedWarDir" default=""/>
<attribute name="force.no.cluster" default="${force.no.cluster}"/>
<attribute name="instance.numbers" default="${instance.numbers}" />
- <attribute name="custom.port" default="${cluster.aware.port}" />
+ <attribute name="custom.port" default="${scenario.aware.port}" />
+ <attribute name="virtual-server" default="" />
<element name="tests" optional="true"/>
<element name="custom-sysproperties" optional="true"/>
<element name="suite" optional="true"/>
@@ -304,6 +334,7 @@
value="@{force.no.cluster}"/>
<sysproperty key="container" value="${container.name}" />
<sysproperty key="instance.numbers" value="@{instance.numbers}" />
+ <sysproperty key="virtual-server" value="@{virtual-server}" />
<custom-sysproperties/>
<batchtest todir="@{test-results-dir}">
<tests/>
@@ -452,7 +483,7 @@
<attribute name="status" default=""/>
<attribute name="force.no.cluster" default="${force.no.cluster}"/>
<attribute name="instance.numbers" default="${instance.numbers}" />
- <attribute name="custom.port" default="${cluster.aware.port}" />
+ <attribute name="custom.port" default="${scenario.aware.port}" />
<element name="custom-sysproperties" optional="true"/>
<sequential>
<var name="testname" unset="true" />
Index: common/ant/glassfishV3.1_no_cluster/container.xml
===================================================================
--- common/ant/glassfishV3.1_no_cluster/container.xml (revision 8837)
+++ common/ant/glassfishV3.1_no_cluster/container.xml (working copy)
@@ -41,7 +41,7 @@
-->
-<project name="GlassFishV3.1" basedir=".">
+<project name="glassfishV3.1_no_cluster" basedir=".">
<!-- JARs that may be packaged in WEB-INF/lib
in order for the implementation to run
@@ -53,12 +53,19 @@
<property name="webapp.jars" value=""/>
+ <property name="glassfish.virtual.server.port"
+ value="8888" />
+ <property name="glassfish.virtual.server" value="myVirtualServer" />
+
<!-- Required Targets -->
<macrodef name="deploy.artifact">
<attribute name="artifact"
description="The WAR to deploy"/>
<attribute name="appName"
description="The name of the application"/>
+ <attribute name="use-virtual-servers"
+ description="If true, deploy to the virtual servers."
+ default="false"/>
<sequential>
<condition property="exec.name" value="cmd.exe">
<os family="windows"/>
@@ -74,9 +81,34 @@
---------------- Glassfish - Deploying @{appName} ----------------
</echo>
+ <if>
+ <equals arg1="@{use-virtual-servers}"
+ casesensitive="false" trim="true"
+ arg2="true" />
+ <then>
+ <sequential>
+ <var name="virtualservers-rhs" value="" />
+ <for list="${instance.numbers}" param="num" trim="true">
+ <sequential>
+ <var name="virtualservers-rhs"
+ value="${virtualservers-rhs},${glassfish.virtual.server}@{num}" />
+ </sequential>
+ </for>
+ <propertyregex property="virtualservers-rhs-trimmed"
+ input="${virtualservers-rhs}"
+ regexp="^[,](.*)"
+ select="\1"
+ casesensitive="false" />
+ <property name="use-virtual-servers-value" value="--virtualservers ${virtualservers-rhs-trimmed}" />
+ </sequential>
+ </then>
+ </if>
+ <property name="use-virtual-servers-value" value="" />
+ <echo message="use-virtual-servers-value: ${use-virtual-servers-value}" />
<exec executable="${exec.name}" failonerror="true">
<arg line="${exec.arg.1}"/>
<arg line="deploy"/>
+ <arg line="${use-virtual-servers-value}"/>
<arg line="--user ${glassfish.admin.user}"/>
<arg line="--passwordfile ${glassfish.password.file}"/>
<arg line="--host ${glassfish.admin.host}"/>
@@ -188,10 +220,16 @@
</if>
</target>
- <target name="define.cluster.aware.port">
- <property name="cluster.aware.port" value="${container.port}" />
+ <target name="define.scenario.aware.port">
+ <property name="scenario.aware.port" value="${container.port}" />
</target>
+ <target name="define.virtual-server.aware.port">
+ <property name="scenario.aware.port"
+ value="${glassfish.virtual.server.port}" />
+ <echo message="scenario.aware.port = ${scenario.aware.port}" />
+ </target>
+
<target name="container.deploy.test.dependencies"
description="Deploy any container level dependencies to the container.">
<if>
@@ -214,46 +252,109 @@
</if>
</target>
+ <target name="create.virtual.servers">
+ <property name="instance.numbers" value="1,2" />
+
+ <create.virtual.servers />
+ </target>
+
+ <target name="delete.virtual.servers">
+ <property name="instance.numbers" value="1,2" />
+
+ <delete.virtual.servers />
+ </target>
+
<target name="container.start"
description="Start the GlassFish container">
- <container.start/>
+ <var name="create-virtual-server-value" value="false" />
+
+ <if>
+ <equals arg1="${create-virtual-server}"
+ casesensitive="false" trim="true"
+ arg2="true" />
+ <then>
+ <var name="create-virtual-server-value" value="true" />
+ </then>
+ </if>
+ <echo>
+--------- Starting container create-virtual-server: ${create-virtual-server-value}
+ </echo>
+ <container.start
+ create-virtual-server="${create-virtual-server-value}" />
</target>
+ <target name="container.debug"
+ description="Start the GlassFish container">
+ <var name="create-virtual-server-value" value="false" />
+
+ <if>
+ <equals arg1="${create-virtual-server}"
+ casesensitive="false" trim="true"
+ arg2="true" />
+ <then>
+ <var name="create-virtual-server-value" value="true" />
+ </then>
+ </if>
+ <echo>
+--------- Starting container create-virtual-server: ${create-virtual-server-value}
+ </echo>
+ <container.debug
+ create-virtual-server="${create-virtual-server-value}" />
+ </target>
+
<target name="container.stop"
description="Stop the GlassFish container">
- <container.stop/>
+ <var name="create-virtual-server-value" value="false" />
+ <if>
+ <equals arg1="${create-virtual-server}"
+ casesensitive="false" trim="true"
+ arg2="true" />
+ <then>
+ <var name="create-virtual-server-value" value="true" />
+ </then>
+ </if>
+ <echo>
+--------- stopping container create-virtual-server: ${create-virtual-server-value}
+ </echo>
+
+ <container.stop create-virtual-server="${create-virtual-server-value}" />
+
</target>
<target name="container.restart"
description="Stop the GlassFish container">
<container.stop/>
- <container.start/>
+ <container.start />
</target>
<macrodef name="container.start"
description="Start the GlassFish container">
+ <attribute name="create-virtual-server" default="false"/>
<sequential>
- <start.domain/>
+ <start.domain create-virtual-server="@{create-virtual-server}"/>
</sequential>
</macrodef>
<macrodef name="container.debug"
description="Start the GlassFish container in debug mode">
+ <attribute name="create-virtual-server" default="false"/>
<sequential>
- <debug.domain/>
+ <debug.domain create-virtual-server="@{create-virtual-server}"/>
</sequential>
</macrodef>
<macrodef name="container.stop"
description="Stop the GlassFish container">
+ <attribute name="create-virtual-server" default="false" />
<sequential>
- <stop.domain/>
+ <stop.domain create-virtual-server="@{create-virtual-server}"/>
</sequential>
</macrodef>
<!-- 'PRIVATE' targets -->
<macrodef name="start.domain">
+ <attribute name="create-virtual-server" default="false"/>
<sequential>
<echo>
@@ -285,10 +386,140 @@
</waitfor>
</else>
</if>
+ <if>
+ <equals arg1="@{create-virtual-server}"
+ casesensitive="false" trim="true"
+ arg2="true" />
+ <then>
+ <sequential>
+ <create.virtual.servers />
+ <for list="${instance.numbers}" param="num" trim="true">
+ <sequential>
+ <waitfor>
+ <http url="
http://${container.host}:@{num}${glassfish.virtual.server.port}"/>
+ </waitfor>
+ </sequential>
+ </for>
+ </sequential>
+ </then>
+ </if>
</sequential>
</macrodef>
+ <macrodef name="create.virtual.servers">
+ <sequential>
+ <if>
+ <os family="unix"/>
+ <then>
+ <for list="${instance.numbers}" param="num" trim="true">
+ <sequential>
+ <echo>
+
+"------------ Creating ${glassfish.virtual.server}@{num} --listenerport @{num}${glassfish.virtual.server.port} ------------"
+
+ </echo>
+ <exec executable="${container.home}/bin/asadmin"
+ failonerror="true">
+ <arg line="create-virtual-server"/>
+ <arg line="--user ${glassfish.admin.user}"/>
+ <arg line="--hosts localhost"/>
+ <arg line="${glassfish.virtual.server}@{num}"/>
+ </exec>
+ <exec executable="${container.home}/bin/asadmin"
+ failonerror="true">
+ <arg line="create-http-listener"/>
+ <arg line="--listeneraddress 0.0.0.0"/>
+ <arg line="--user ${glassfish.admin.user}"/>
+ <arg line="--listenerport @{num}${glassfish.virtual.server.port}"/>
+ <arg line="--defaultvs ${glassfish.virtual.server}@{num} --servername localhost.localdomain"/>
+ <arg line="--acceptorthreads 1 myHttpListener@{num}"/>
+ </exec>
+ </sequential>
+ </for>
+ </then>
+ <else>
+ <for list="${instance.numbers}" param="num" trim="true">
+ <sequential>
+ <echo>
+
+"------------ Creating ${glassfish.virtual.server}@{num} ------------"
+
+ </echo>
+ <exec executable="${container.home}/bin/asadmin.bat"
+ spawn="true">
+ <arg line="create-virtual-server"/>
+ <arg line="--user ${glassfish.admin.user}"/>
+ <arg line="--hosts localhost"/>
+ <arg line="${glassfish.virtual.server}@{num}"/>
+ </exec>
+ <exec executable="${container.home}/bin/asadmin.bat"
+ spawn="true">
+ <arg line="create-http-listener"/>
+ <arg line="--listeneraddress 0.0.0.0"/>
+ <arg line="--user ${glassfish.admin.user}"/>
+ <arg line="--listenerport @{num}${glassfish.virtual.server.port}"/>
+ <arg line="--defaultvs ${glassfish.virtual.server}@{num} --servername localhost.localdomain"/>
+ <arg line="--acceptorthreads 1 myHttpListener@{num}"/>
+ </exec>
+ </sequential>
+ </for>
+ </else>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="delete.virtual.servers">
+ <sequential>
+ <if>
+ <os family="unix"/>
+ <then>
+ <for list="${instance.numbers}" param="num" trim="true">
+ <sequential>
+ <echo>
+
+"------------ Deleting ${glassfish.virtual.server}@{num} ------------"
+
+ </echo>
+ <exec executable="${container.home}/bin/asadmin"
+ failonerror="false">
+ <arg line="delete-http-listener"/>
+ <arg line="myHttpListener@{num}"/>
+ </exec>
+ <exec executable="${container.home}/bin/asadmin"
+ failonerror="false">
+ <arg line="delete-virtual-server"/>
+ <arg line="${glassfish.virtual.server}@{num}"/>
+ </exec>
+ </sequential>
+ </for>
+ </then>
+ <else>
+ <for list="${instance.numbers}" param="num" trim="true">
+ <sequential>
+ <echo>
+
+"------------ Deleting ${glassfish.virtual.server}@{num} ------------"
+
+ </echo>
+ <exec executable="${container.home}/bin/asadmin.bat"
+ spawn="true">
+ <arg line="delete-http-listener"/>
+ <arg line="myHttpListener@{num}"/>
+ </exec>
+ <exec executable="${container.home}/bin/asadmin.bat"
+ spawn="true">
+ <arg line="delete-virtual-server"/>
+ <arg line="${glassfish.virtual.server}@{num}"/>
+ </exec>
+ </sequential>
+ </for>
+ </else>
+ </if>
+ </sequential>
+ </macrodef>
+
<macrodef name="debug.domain">
+ <attribute name="create-virtual-server" default="false"/>
<sequential>
<echo>
@@ -322,25 +553,63 @@
</waitfor>
</else>
</if>
+ <if>
+ <equals arg1="@{create-virtual-server}"
+ casesensitive="false" trim="true"
+ arg2="true" />
+ <then>
+ <sequential>
+ <create.virtual.servers />
+ <for list="${instance.numbers}" param="num" trim="true">
+ <sequential>
+ <waitfor>
+ <http url="
http://${container.host}:@{num}${glassfish.virtual.server.port}"/>
+ </waitfor>
+ </sequential>
+ </for>
+ </sequential>
+ </then>
+ </if>
</sequential>
</macrodef>
<macrodef name="stop.domain">
+ <attribute name="create-virtual-server" default="false"/>
<sequential>
<echo>
-"------------ Stopping ${glassfish.domain} ------------"
+"------------ create-virtual-server: @{create-virtual-server} ------------"
</echo>
<if>
<os family="unix"/>
<then>
+ <if>
+ <equals arg1="@{create-virtual-server}"
+ casesensitive="false" trim="true"
+ arg2="true" />
+ <then>
+ <sequential>
+ <delete.virtual.servers />
+ </sequential>
+ </then>
+ </if>
<exec executable="${container.home}/bin/asadmin">
<arg line="stop-domain"/>
<arg line="${glassfish.domain}"/>
</exec>
</then>
<else>
+ <if>
+ <equals arg1="@{create-virtual-server}"
+ casesensitive="false" trim="true"
+ arg2="true" />
+ <then>
+ <sequential>
+ <delete.virtual.servers />
+ </sequential>
+ </then>
+ </if>
<exec executable="${container.home}/bin/asadmin.bat"
spawn="true">
<arg line="stop-domain"/>
Index: common/ant/glassfishV3.1/container.xml
===================================================================
--- common/ant/glassfishV3.1/container.xml (revision 8837)
+++ common/ant/glassfishV3.1/container.xml (working copy)
@@ -77,6 +77,9 @@
description="The WAR to deploy"/>
<attribute name="appName"
description="The name of the application"/>
+ <attribute name="use-virtual-servers"
+ description="If true, deploy to the virtual servers."
+ default="false"/>
<sequential>
<condition property="exec.name" value="cmd.exe">
<os family="windows"/>
@@ -351,8 +354,8 @@
<container.start/>
</target>
- <target name="define.cluster.aware.port">
- <condition property="cluster.aware.port" value="${glassfish.portbase.tenthousandsplace}0080">
+ <target name="define.scenario.aware.port">
+ <condition property="scenario.aware.port" value="${glassfish.portbase.tenthousandsplace}0080">
<equals arg1="${force.no.cluster}" casesensitive="false" trim="true"
arg2="true" />
</condition>
@@ -362,13 +365,18 @@
arg2="true" />
</not>
<then>
- <property name="cluster.aware.port"
+ <property name="scenario.aware.port"
value="${container.port}" />
</then>
</if>
- <echo message="cluster.aware.port = ${cluster.aware.port}" />
+ <echo message="scenario.aware.port = ${scenario.aware.port}" />
</target>
+ <target name="define.virtual-server.aware.port">
+ <property name="scenario.aware.port" value="${container.port}" />
+ </target>
+
+
<macrodef name="container.start"
description="Start the GlassFish container">
<attribute name="create-domain" default="true"/>
Index: common/ant/glassfishV3/container.xml
===================================================================
--- common/ant/glassfishV3/container.xml (revision 8837)
+++ common/ant/glassfishV3/container.xml (working copy)
@@ -59,6 +59,9 @@
description="The WAR to deploy"/>
<attribute name="appName"
description="The name of the application"/>
+ <attribute name="use-virtual-servers"
+ description="If true, deploy to the virtual servers."
+ default="false"/>
<sequential>
<condition property="exec.name" value="cmd.exe">
<os family="windows"/>
@@ -226,10 +229,6 @@
<container.start/>
</target>
- <target name="define.cluster.aware.port">
- <property name="cluster.aware.port" value="${container.port}" />
- </target>
-
<macrodef name="container.start"
description="Start the GlassFish container">
<sequential>
@@ -352,7 +351,14 @@
</sequential>
</macrodef>
+ <target name="define.scenario.aware.port">
+ <property name="scenario.aware.port" value="${container.port}"/>
+ </target>
+ <target name="define.virtual-server.aware.port">
+ <property name="scenario.aware.port" value="${container.port}" />
+ </target>
+
<!-- ************ Compiler Defaults *************************************** -->
Index: common/ant/glassfishV3prelude/container.xml
===================================================================
--- common/ant/glassfishV3prelude/container.xml (revision 8837)
+++ common/ant/glassfishV3prelude/container.xml (working copy)
@@ -59,6 +59,9 @@
description="The WAR to deploy"/>
<attribute name="appName"
description="The name of the application"/>
+ <attribute name="use-virtual-servers"
+ description="If true, deploy to the virtual servers."
+ default="false"/>
<sequential>
<condition property="exec.name" value="cmd.exe">
<os family="windows"/>
@@ -225,10 +228,14 @@
<container.start/>
</target>
- <target name="define.cluster.aware.port">
- <property name="cluster.aware.port" value="${container.port}" />
+ <target name="define.scenario.aware.port">
+ <property name="scenario.aware.port" value="${container.port}" />
</target>
+ <target name="define.virtual-server.aware.port">
+ <property name="scenario.aware.port" value="${container.port}" />
+ </target>
+
<macrodef name="container.start"
description="Start the GlassFish container">
<sequential>
Index: common/ant/tomcat6/container.xml
===================================================================
--- common/ant/tomcat6/container.xml (revision 8837)
+++ common/ant/tomcat6/container.xml (working copy)
@@ -60,6 +60,9 @@
description="The WAR to deploy"/>
<attribute name="appName"
description="The name of the application"/>
+ <attribute name="use-virtual-servers"
+ description="If true, deploy to the virtual servers."
+ default="false"/>
<sequential>
<echo>
@@ -158,10 +161,14 @@
<container.start/>
</target>
- <target name="define.cluster.aware.port">
- <property name="cluster.aware.port" value="${container.port}" />
+ <target name="define.scenario.aware.port">
+ <property name="scenario.aware.port" value="${container.port}" />
</target>
+ <target name="define.virtual-server.aware.port">
+ <property name="scenario.aware.port" value="${container.port}" />
+ </target>
+
<!--
OPTIONAL
Start the container
Index: jsf-ri/build-tests.xml
===================================================================
--- jsf-ri/build-tests.xml (revision 8837)
+++ jsf-ri/build-tests.xml (working copy)
@@ -280,14 +280,14 @@
<!--
Start the Cactus test using JUnit test runner.
-->
- <target name="run.cactus.test" depends="define.cluster.aware.port">
+ <target name="run.cactus.test" depends="define.scenario.aware.port">
<jsf.junit classpath-refid="test.runtime.classpath"
test-results-dir="${impl.test.results.dir}"
explodedWarDir="${basedir}/build/target/test"
- custom.port="${cluster.aware.port}">
+ custom.port="${scenario.aware.port}">
<custom-sysproperties>
<sysproperty key="cactus.contextURL"
- value="
http://${container.host}:${cluster.aware.port}/test"/>
+ value="
http://${container.host}:${scenario.aware.port}/test"/>
</custom-sysproperties>
<suite>
<test todir="${impl.test.results.dir}"
@@ -460,14 +460,14 @@
</jsf.junit>
</target>
- <target name="run.cactus.test.single" depends="define.cluster.aware.port">
+ <target name="run.cactus.test.single" depends="define.scenario.aware.port">
<jsf.junit classpath-refid="test.runtime.classpath"
test-results-dir="${impl.test.results.dir}"
explodedWarDir="${basedir}/build/target/test"
- custom.port="${cluster.aware.port}">
+ custom.port="${scenario.aware.port}">
<custom-sysproperties>
<sysproperty key="cactus.contextURL"
- value="
http://${container.host}:${cluster.aware.port}/test"/>
+ value="
http://${container.host}:${scenario.aware.port}/test"/>
</custom-sysproperties>
<suite>
<test todir="${impl.test.results.dir}"
@@ -481,7 +481,7 @@
<target name="run.test" depends="compile.test,config.compile">
<jsf.junit classpath-refid="test.runtime.classpath"
test-results-dir="${impl.test.results.dir}" assert.classes="-ea:com.sun.faces.el.ChainAwareVariableResolver"
- custom.port="${cluster.aware.port}">
+ custom.port="${scenario.aware.port}">
<suite>
<test todir="${impl.test.results.dir}"
name="com.sun.faces.util.TestUtil_local"/>
@@ -550,7 +550,7 @@
</junitreport>
</target>
- <target name="passthru" depends="define.cluster.aware.port">
+ <target name="passthru" depends="define.scenario.aware.port">
<antcall target="undeploy"/>
<antcall target="deploy"/>
@@ -558,10 +558,10 @@
<jsf.junit classpath-refid="test.runtime.classpath"
test-results-dir="${impl.test.results.dir}"
explodedWarDir="${basedir}/build/target/test"
- custom.port="${cluster.aware.port}">
+ custom.port="${scenario.aware.port}">
<custom-sysproperties>
<sysproperty key="cactus.contextURL"
- value="
http://${container.host}:${cluster.aware.port}/test"/>
+ value="
http://${container.host}:${scenario.aware.port}/test"/>
</custom-sysproperties>
<suite>
<test todir="${impl.test.results.dir}"
Index: jsf-ri/build.xml
===================================================================
--- jsf-ri/build.xml (revision 8837)
+++ jsf-ri/build.xml (working copy)
@@ -523,7 +523,7 @@
</target>
<target name="test"
- depends="update,init.test,compile.test,run.systest,run.junit.test,run.systest-per-webapp,run.cactus.test"
+ depends="update,init.test,compile.test,run.systest,run.junit.test,run.systest-per-webapp,run.systest-per-webapp-on-virtual-server,run.cactus.test"
description="Run all unit and system tests"/>
<target name="test.generate.reports"
@@ -545,19 +545,45 @@
<ant dir="${basedir}/systest-per-webapp" inheritall="false"
target="test">
<property name="force.no.cluster" value="${force.no.cluster}" />
+ </ant>
+
+ <ant dir="${basedir}/systest-per-webapp" inheritall="false"
+ target="remove">
+ <property name="force.no.cluster" value="${force.no.cluster}" />
</ant>
+ </target>
+ <target name="run.systest-per-webapp-on-virtual-server"
+ depends="discover.container.version"
+ if="container.is.V3.1_no_cluster"
+ description="Run per-webapp system tests on 3 virtual servers">
<ant dir="${basedir}/systest-per-webapp" inheritall="false"
target="remove">
<property name="force.no.cluster" value="${force.no.cluster}" />
</ant>
-
+ <container.stop />
+ <var name="force.no.cluster" value="true" />
+ <container.start />
+ <ant dir="${basedir}/systest-per-webapp" inheritall="true"
+ target="install-virtual-server">
+ <property name="force.no.cluster" value="true" />
+ </ant>
+ <ant dir="${basedir}/systest-per-webapp" inheritall="false"
+ target="test-virtual-server">
+ <property name="force.no.cluster" value="true" />
+ <property name="instance.numbers" value="1,2" />
+ </ant>
+ <ant dir="${basedir}/systest-per-webapp" inheritall="false"
+ target="remove-virtual-server">
+ <property name="force.no.cluster" value="${force.no.cluster}" />
+ </ant>
</target>
<target name="run.junit.test"
description="Run unit tests not requiring cactus">
- <ant antfile="build-tests.xml" target="run.test"/>
+ <ant antfile="build-tests.xml" target="run.test">
+ </ant>
</target>
<target name="run.cactus.test"
Index: jsf-ri/systest-per-webapp/build.xml
===================================================================
--- jsf-ri/systest-per-webapp/build.xml (revision 8837)
+++ jsf-ri/systest-per-webapp/build.xml (working copy)
@@ -83,6 +83,11 @@
no-web-xml,
cluster-no-agressive-session-dirtying" />
+ <property name="applications-for-V3.1_no_cluster-only"
+ value="disable-bean-validator,
+ injection,
+ no-web-xml" />
+
<property name="container-agnostic-applications"
value="
annotation-restrictions,
@@ -130,6 +135,35 @@
jsp-flash
-->
+ <property name="applications-for-V3.1_no_cluster-virtual-server"
+ value="
+ annotation-restrictions,
+ clientside-statesaving,
+ empty-string-as-null,
+ resource-locale-prefix,
+ nested-loadbundles,
+ replace-application,
+ replace-statemanager,
+ invalid-mapping,
+ nested-datatables,
+ jar-ordering,
+ replace-lifecycle,
+ string-converter,
+ replace-variableresolver,
+ converter-property-editor,
+ late-bindings,
+ property-resolver-jsp,
+ never-unwrap-exceptions,
+ write-attribute-script-disabled,
+ write-attribute-script-enabled,
+ wcag-datatable,
+ suppress-xml-decl,
+ replace-vdl,
+ process-as-jspx,
+ bogus-render-kit-id,
+ characterCombat"/>
+
+
<!-- ************ Executable Targets ************************************** -->
@@ -182,6 +216,7 @@
<macrodef name="deploy.app">
<attribute name="base-app-dir"/>
<attribute name="appname"/>
+ <attribute name="use-virtual-servers" default="false"/>
<sequential>
<if>
<contains string="${deploy-exploded-applications}" substring="@{appname}" />
@@ -193,7 +228,8 @@
<else>
<deploy.artifact
artifact="@{base-app-dir}/build/jsf-@{appname}.war"
- appName="jsf-@{appname}"/>
+ appName="jsf-@{appname}"
+ use-virtual-servers="@{use-virtual-servers}"/>
</else>
</if>
</sequential>
@@ -217,29 +253,13 @@
</jsf.javac>
</target>
- <target name="define.applications" depends="discover.container.version,define.V2.applications,define.V3.applications,define.V3.1.applications" />
+ <target name="define.applications" depends="discover.container.version,define.V2.applications,define.V3.applications,define.V3.1.applications,define.V3.1_no_cluster.applications" />
- <target name="discover.container.version"
- depends="query.is.V2,query.is.V3,query.is.V3.1"/>
-
- <target name="query.is.V2">
- <condition property="container.is.V2">
- <equals arg1="glassfish" arg2="${container.name}" />
- </condition>
+ <target name="define.applications.virtual-server" depends="discover.container.version,define.V3.1_no_cluster.applications.virtual.server">
+ <property name="applications" value="" />
+ <property name="instance.numbers" value="1,2" />
</target>
- <target name="query.is.V3">
- <condition property="container.is.V3">
- <equals arg1="glassfishV3" arg2="${container.name}" />
- </condition>
- </target>
-
- <target name="query.is.V3.1">
- <condition property="container.is.V3.1">
- <equals arg1="glassfishV3.1" arg2="${container.name}" />
- </condition>
- </target>
-
<target name="define.V2.applications" if="container.is.V2">
<property name="applications" value="${container-agnostic-applications}" />
</target>
@@ -254,6 +274,19 @@
value="${container-agnostic-applications},${applications-for-V3.1-only}" />
</target>
+ <target name="define.V3.1_no_cluster.applications.virtual.server"
+ if="container.is.V3.1_no_cluster">
+ <property name="applications"
+ value="${applications-for-V3.1_no_cluster-virtual-server}" />
+ </target>
+
+
+
+ <target name="define.V3.1_no_cluster.applications" if="container.is.V3.1_no_cluster">
+ <property name="applications"
+ value="${container-agnostic-applications},${applications-for-V3.1_no_cluster-only}" />
+ </target>
+
<target name="install" depends="compile.base.sources,define.applications">
<for list="${applications}" param="app" trim="true">
@@ -267,6 +300,21 @@
</for>
</target>
+ <target name="install-virtual-server" depends="compile.base.sources,define.applications.virtual-server">
+ <delete.virtual.servers/>
+ <create.virtual.servers/>
+
+ <for list="${applications}" param="app" trim="true">
+ <sequential>
+ <undeploy.app appname="@{app}"/>
+ <build.app appname="@{app}"
+ base-app-dir="${basedir}/@{app}"/>
+ <deploy.app appname="@{app}" use-virtual-servers="true"
+ base-app-dir="${basedir}/@{app}"/>
+ </sequential>
+ </for>
+
+ </target>
<target name="build" depends="define.applications,compile.base.sources">
@@ -289,6 +337,19 @@
</target>
+ <target name="remove-virtual-server" depends="define.applications.virtual-server">
+
+ <for list="${applications}" param="app" trim="true">
+ <sequential>
+ <undeploy.app appname="@{app}"/>
+ </sequential>
+ </for>
+
+ <delete.virtual.servers/>
+
+
+ </target>
+
<target name="clean" depends="define.applications"
description="Clean build and distribution directories">
@@ -322,6 +383,15 @@
<property name="applications" value="${applications}" />
</ant>
- </target>
+ </target>
+
+ <target name="test-virtual-server" depends="define.applications.virtual-server"
+ description="Execute all tests against installed /jsf-* applications">
+
+ <ant antfile="build-tests.xml" target="test-virtual-server">
+ <property name="glassfishV3.1-virtual-server" value="true" />
+ </ant>
+ </target>
+
</project>
Index: jsf-ri/systest-per-webapp/build-tests.xml
===================================================================
--- jsf-ri/systest-per-webapp/build-tests.xml (revision 8837)
+++ jsf-ri/systest-per-webapp/build-tests.xml (working copy)
@@ -155,9 +155,13 @@
<!-- ======================== Test Execution ============================== -->
- <target name="test" depends="define.cluster.aware.port"
+ <target name="test" depends="define.scenario.aware.port"
description="Execute all tests against installed applications">
+ <property name="systest-per-webapp.results.dir"
+ value="${impl.test.results.dir}/systest-per-webapp" />
+ <mkdir dir="${systest-per-webapp.results.dir}" />
+
<for list="${applications}" param="app" trim="true">
<sequential>
<propertycopy name="test.name"
@@ -165,16 +169,65 @@
override="true"/>
<test-webapp app-name="@{app}"
app-base-dir="${basedir}/@{app}"
- test-case="${test.name}"/>
+ test-case="${test.name}"
+ test-results-dir="${systest-per-webapp.results.dir}" />
</sequential>
</for>
+ <rename.test-results prefix="non-virtual-server"
+ destdir="${impl.test.results.dir}"
+ srcdir="${systest-per-webapp.results.dir}" />
+ <delete failonerror="false" dir="${systest-per-webapp.results.dir}" />
+
</target>
+ <target name="test-virtual-server" depends="define.virtual-server.aware.port"
+ description="Execute all tests against installed applications">
+ <property name="systest-per-webapp.results.dir"
+ value="${impl.test.results.dir}/systest-per-webapp-virtual-server" />
+
+ <mkdir dir="${systest-per-webapp.results.dir}" />
+
+ <for list="${applications}" param="app" trim="true">
+ <sequential>
+ <propertycopy name="test.name"
+ from="@{app}"
+ override="true"/>
+ <test-webapp app-name="@{app}"
+ app-base-dir="${basedir}/@{app}"
+ test-case="${test.name}" virtual-server="true"
+ test-results-dir="${systest-per-webapp.results.dir}"/>
+ </sequential>
+ </for>
+ <rename.test-results prefix="virtual-server"
+ destdir="${impl.test.results.dir}"
+ srcdir="${systest-per-webapp.results.dir}" />
+ <delete failonerror="false" dir="${systest-per-webapp.results.dir}" />
+
+
+ </target>
+
+ <macrodef name="rename.test-results">
+ <attribute name="prefix" />
+ <attribute name="srcdir" />
+ <attribute name="destdir" />
+ <sequential>
+ <move todir="@{destdir}"
+ includeemptydirs="false" overwrite="true">
+ <fileset dir="@{srcdir}">
+ <exclude name="**/TEST-@{prefix}-*.xml"/>
+ </fileset>
+ <mapper type="glob" from="TEST-*.xml" to="TEST-@{prefix}-*.xml"/>
+ </move>
+ </sequential>
+ </macrodef>
+
<macrodef name="test-webapp">
<attribute name="app-name"/>
<attribute name="app-base-dir"/>
<attribute name="test-case"/>
+ <attribute name="virtual-server" default=""/>
+ <attribute name="test-results-dir" default="${impl.test.results.dir}"/>
<sequential>
<path id="test.classpath">
<pathelement location="@{app-base-dir}/build/classes"/>
@@ -184,8 +237,9 @@
<jsf.junit classpath-refid="test.classpath"
context-path="/jsf-@{app-name}"
instance.numbers="${instance.numbers}"
- test-results-dir="${impl.test.results.dir}"
- custom.port="${cluster.aware.port}">
+ test-results-dir="@{test-results-dir}"
+ custom.port="${scenario.aware.port}"
+ virtual-server="@{virtual-server}">
<tests>
<fileset dir="@{app-base-dir}/build/classes"
includes="@{test-case}"/>
Index: jsf-ri/systest/src/com/sun/faces/htmlunit/AbstractTestCase.java
===================================================================
--- jsf-ri/systest/src/com/sun/faces/htmlunit/AbstractTestCase.java (revision 8837)
+++ jsf-ri/systest/src/com/sun/faces/htmlunit/AbstractTestCase.java (working copy)
@@ -60,7 +60,6 @@
import java.net.URL;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -103,6 +102,7 @@
protected String contextPath = null;
protected String host = null;
protected int port = 0;
+ protected Integer virtualServerPort = null;
// The current session identifier
protected String sessionId = null;
@@ -133,17 +133,22 @@
private Random rand = new Random();
+ protected boolean isVirtualServer = false;
+
// ---------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case.
*/
+ @Override
public void setUp() throws Exception {
BrowserVersion browserVersion;
+ isVirtualServer = Boolean.parseBoolean(System.getProperty("virtual-server"));
+
String instanceNumbersStr = System.getProperty("instance.numbers");
if (null != instanceNumbersStr && 0 < instanceNumbersStr.length() &&
!("${instance.numbers}".equals(instanceNumbersStr))) {
@@ -308,9 +313,15 @@
}
protected int getPort() {
+
+ if (null != virtualServerPort) {
+ return virtualServerPort.intValue();
+ }
+
int result = port;
List<Integer> instNums = getInstanceNumbers();
- if (!instNums.isEmpty() && !forceNoCluster) {
+ if (!instNums.isEmpty() &&
+ (!forceNoCluster || isVirtualServer)) {
int instanceNumberIndex = rand.nextInt(instNums.size());
try {
String num = instNums.get(instanceNumberIndex).toString() + port;
@@ -321,6 +332,11 @@
throw e;
}
}
+
+ if (isVirtualServer) {
+ virtualServerPort = (Integer) result;
+ }
+
return result;
}
Index: jsf-ri/systest/build-tests.xml
===================================================================
--- jsf-ri/systest/build-tests.xml (revision 8837)
+++ jsf-ri/systest/build-tests.xml (working copy)
@@ -72,7 +72,7 @@
<!-- DO NOT REORDER test.annotations -->
<target name="test"
description="Execute all tests against installed application"
- depends="define.cluster.aware.port,
+ depends="define.scenario.aware.port,
test.annotations,
test.ajax,
test.composite,
@@ -1207,7 +1207,7 @@
</jsf.junit>
</target>
- <target name="passthru" depends="define.cluster.aware.port">
+ <target name="passthru" depends="define.scenario.aware.port">
<antcall target="test.renderkit" />
--
| edward.burns_at_oracle.com | office: +1 407 458 0017
| homepage: | http://ridingthecrest.com/