You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by fe...@apache.org on 2006/04/15 18:53:24 UTC
svn commit: r394330 - in /jakarta/cactus/trunk:
documentation/docs/xdocs/integration/ant/
documentation/docs/xdocs/participating/ integration/ant/ integration/maven/
samples/ejb/ samples/servlet/
Author: felipeal
Date: Sat Apr 15 09:53:21 2006
New Revision: 394330
URL: http://svn.apache.org/viewcvs?rev=394330&view=rev
Log:
CACTUS-151: fixed mispelled class, add cargo.ant on samples and commit other Xuan's patches (that weren't included in last commit)
Modified:
jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/howto_ant_cactus.xml
jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/index.xml
jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/navigation.xml
jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/task_runservertests.xml
jakarta/cactus/trunk/documentation/docs/xdocs/participating/contributors.xml
jakarta/cactus/trunk/integration/ant/build.xml
jakarta/cactus/trunk/integration/maven/plugin.jelly
jakarta/cactus/trunk/samples/ejb/build.xml
jakarta/cactus/trunk/samples/servlet/build.xml
Modified: jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/howto_ant_cactus.xml
URL: http://svn.apache.org/viewcvs/jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/howto_ant_cactus.xml?rev=394330&r1=394329&r2=394330&view=diff
==============================================================================
--- jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/howto_ant_cactus.xml (original)
+++ jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/howto_ant_cactus.xml Sat Apr 15 09:53:21 2006
@@ -392,25 +392,34 @@
<p>
However, you will probably want to automate the deployment of the
cactified WAR, and maybe also the startup and shutdown of the
- container. This can be done with some Ant scripting in combination
- with the <strong><runservertests></strong> task provided by
- Cactus. But Cactus also provides a higher-level abstraction for
- running the tests with the <strong><cactus></strong> task.
+ container. This can be done in Ant scripting with the support from
+ Cargo. Cactus also provides a convenient task for
+ running the tests in combination with Cargo task through <strong><
+ cactustests></strong> task.
</p>
<p>
- The <strong><cactus></strong> task extends the optional Ant
- task <strong><junit></strong>, adding support for in-container
- tests and hiding some of the details such as the system properties
- used for configuring Cactus:
+ The <strong><cactustests></strong> task extends the optional
+ Ant task <strong><junit></strong>, adding support for
+ in-container tests and hiding some of the details such as the system
+ properties used for configuring Cactus:
</p>
<source><![CDATA[
<target name="test" depends="test.prepare"
description="Run the tests on the defined containers">
-
+ <!-- Start tomcat container -->
+ <cargo-tomcat4x id="myContainer" home="c:/apps/tomcat-4x"
+ output="${target.dir}/output.log"
+ log="${target.dir}/cargo_start.log" action="start">
+ <configuration>
+ <property name="cargo.servlet.port" value="8080"/>
+ <property name="cargo.logging" value="high"/>
+ <deployable type="war" file="${target.dir}/cactified-test.war/>
+ </configuration>
+ </cargo-tomcat4x>
<!-- Run the tests -->
- <cactus warfile="${target.dir}/test.war" fork="yes"
- failureproperty="tests.failed">
+ <cactustests warfile="${target.dir}/cactified-test.war" toDir="${report.dir}"
+ fork="yes" failureproperty="tests.failed">
<classpath>
<path refid="project.classpath"/>
<pathelement location="${httpunit.jar}"/>
@@ -418,12 +427,6 @@
<pathelement location="${target.classes.java.dir}"/>
<pathelement location="${target.classes.cactus.dir}"/>
</classpath>
- <containerset timeout="180000">
- <tomcat4x if="cactus.home.tomcat4x"
- dir="${cactus.home.tomcat4x}" port="${cactus.port}"
- output="${target.testreports.dir}/tomcat4x.out"
- todir="${target.testreports.dir}/tomcat4x"/>
- </containerset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<batchtest>
@@ -432,8 +435,11 @@
<exclude name="**/Test*All.java"/>
</fileset>
</batchtest>
- </cactus>
-
+ </cactustests>
+
+ <!-- Stop tomcat container -->
+ <cargo-tomcat4x refid="myContainer" log="${target.dir}/cargo_stop.log"
+ action="stop"/>
</target>]]></source>
<p>
@@ -442,31 +448,21 @@
cactified WAR. The task will extract information about the mappings
of the test redirectors from the deployment descriptor of the
web-application, and automically setup the corresponding system
- properties.
- </p>
- <p>
- Next, we add a nested <strong><containerset></strong> element,
- which allows us to specify one or more containers against which the
- tests will be executed. Here we only test against Apache Tomcat 4.x.
+ properties. Here we only test against Apache Tomcat 4.x using Cargo
We specify the installation directory of Tomcat using the
<strong>dir</strong> attribute, as well as the port to which the
container should be bound using the <strong>port</strong> attribute.
+ More information about using Cargo can be found in its homepage
+ project.
</p>
<p>
What happens behind the scenes is this:
<ol>
<li>
Tomcat is installed to a temporary directory using a minimal
- configuration.
- </li>
- <li>
- The specified WAR is copied into the Tomcat <code>webapps</code>
- directory, so that it will be deployed when Tomcat is started up.
- </li>
- <li>
- Tomcat is started. The task assumes that the startup is complete
- as soon as HTTP requests to the test web-application are
- successful.
+ configuration and is started up by Cargo. The task assumes that
+ the startup is complete as soon as HTTP requests to the test
+ web-application are successful.
</li>
<li>
Now the tests are executed. The required system properties such
@@ -475,12 +471,9 @@
</li>
<li>
After the tests have terminated (successfully or not), Tomcat is
- shut down.
+ shut down by Cargo.
</li>
</ol>
- If we had defined more than one container in the
- <strong><containerset></strong> element, this procedure would
- be repeated for every container in the list.
</p>
</section>
Modified: jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/index.xml
URL: http://svn.apache.org/viewcvs/jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/index.xml?rev=394330&r1=394329&r2=394330&view=diff
==============================================================================
--- jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/index.xml (original)
+++ jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/index.xml Sat Apr 15 09:53:21 2006
@@ -129,6 +129,8 @@
|- lib
| |- cactus.jar
| |- cactus-ant.jar
+ | |- cargo.jar
+ | |- cargo-ant.jar
| |- commons-httpclient.jar
| |- commons-logging.jar
| |- junit.jar
@@ -159,6 +161,8 @@
<classpath>
<pathelement location="lib/cactus.jar"/>
<pathelement location="lib/cactus-ant.jar"/>
+ <pathelement location="lib/cargo.jar"/>
+ <pathelement location="lib/cargo-ant.jar"/>
<pathelement location="lib/commons-httpclient.jar"/>
<pathelement location="lib/commons-logging.jar"/>
<pathelement location="lib/aspectjrt.jar"/>
@@ -220,6 +224,14 @@
</td>
</tr>
<tr>
+ <th>CactusTests</th>
+ <td>
+ This task extends the standard <code><junit></code> task
+ and is used in combination with Cargo for start/stop containers when
+ executes tests.
+ </td>
+ </tr>
+ <tr>
<th>RunServerTests</th>
<td>
This task is an alternative to the <code><cactus></code>
@@ -257,9 +269,13 @@
<code><unwar></code>)
</li>
<li>
- Start the target container, deploy the application, run the tests
- and stop the container (using either <code><cactus></code> or
- <code><runservertests></code>)
+ Use Cargo to start the target container and deploy the application.
+ </li>
+ <li>
+ Run the tests with <code><cactustests></code>.
+ </li>
+ <li>
+ Use cargo to stop the container
</li>
</ol>
</p>
Modified: jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/navigation.xml
URL: http://svn.apache.org/viewcvs/jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/navigation.xml?rev=394330&r1=394329&r2=394330&view=diff
==============================================================================
--- jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/navigation.xml (original)
+++ jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/navigation.xml Sat Apr 15 09:53:21 2006
@@ -36,7 +36,7 @@
<menu label="Ant Tasks">
<item id="task_cactifywar" label="CactifyWar"/>
<item id="task_cactifyear" label="CactifyEar"/>
- <item id="task_cactus" label="Cactus"/>
+ <item id="task_cactustests" label="CactusTests"/>
<item id="task_runservertests" label="RunServerTests"/>
<item id="task_webxmlmerge" label="WebXmlMerge"/>
<item id="task_resin" label="Resin[2x|3x]"/>
Modified: jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/task_runservertests.xml
URL: http://svn.apache.org/viewcvs/jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/task_runservertests.xml?rev=394330&r1=394329&r2=394330&view=diff
==============================================================================
--- jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/task_runservertests.xml (original)
+++ jakarta/cactus/trunk/documentation/docs/xdocs/integration/ant/task_runservertests.xml Sat Apr 15 09:53:21 2006
@@ -152,7 +152,67 @@
stoptarget="stop.tomcat.40"
testtarget="test"/>
]]></source>
+ <p>
+ If we use Cargo to start and stop the container, the first and third targets
+ can be:
+
+ <source><![CDATA[
+<target name="start.tomcat.40">
+ <mkdir dir="${target.dir}/tomcat4x"/>
+ <mkdir dir="${target.dir}/tomcat4x/config"/>
+ <cargo id="tomcat4x" containerId="tomcat4x" action="start"
+ homeDir="/home/shared/g_ciamassvr/j2ee/jakarta-tomcat-4.1.31"
+ log="${target.dir}/tomcat4x/cargo_start.log"
+ output="${target.dir}/tomcat4x/container_start.log">
+ <configuration dir="${target.dir}/tomcat4x/config">
+ <property name="cargo.servlet.port" value="${cactus.port}"/>
+ <property name="cargo.servlet.users" value="${cactus.securitytest.users}"/>
+ <property name="cargo.logging" value="high"/>
+ <war warfile="${target.dir}/${project.name.file}-cactified.war"/>
+ </configuration>
+ <!-- Configure Cactus for logging -->
+ <syspropertyset file="${target.dir.normalized}/logging_server.properties"/>
+ </cargo>
+</target>
+<target name="stop.tomcat.40">
+ <cargo refid="tomcat4x" action="stop"
+ log="${target.dir}/tomcat4x/cargo_stop.log"
+ output="${target.dir}/tomcat4x/container_stop.log"/>
+</target>
+]]></source>
+ </p>
+ In particular, CactusTests can be used for the test target as following:
+ <p>
+<source><![CDATA[
+ <target name="run-testcases">
+ <mkdir dir="${target.testreports.dir}"/>
+ <mkdir dir="${target.testreports.dir}/tomcat4x"/>
+ <cactustests fork="yes" failureproperty="tests.failed" haltonerror="true"
+ servletport="${cactus.port}"
+ warfile="${target.dir}/${project.name.file}-cactified.war"
+ todir="${target.testreports.dir}/tomcat4x"
+ logs="${target.dir.normalized}/logging_client.properties">
+ <classpath>
+ <path refid="project.classpath"/>
+ <path refid="cactus.classpath"/>
+ <pathelement location="${httpunit.jar}"/>
+ <pathelement location="${nekohtml.jar}"/>
+ <pathelement location="${target.classes.java.dir}"/>
+ <pathelement location="${target.classes.cactus.dir}"/>
+ <pathelement location="${log4j.jar}"/>
+ </classpath>
+ <formatter type="xml"/>
+ <batchtest>
+ <fileset dir="${src.cactus.dir}">
+ <include name="**/servlet/unit/Test*.java"/>
+ <exclude name="**/servlet/unit/Test*All.java"/>
+ </fileset>
+ </batchtest>
+ </cactustests>
+ </target>
+]]></source>
+ </p>
</section>
</section>
Modified: jakarta/cactus/trunk/documentation/docs/xdocs/participating/contributors.xml
URL: http://svn.apache.org/viewcvs/jakarta/cactus/trunk/documentation/docs/xdocs/participating/contributors.xml?rev=394330&r1=394329&r2=394330&view=diff
==============================================================================
--- jakarta/cactus/trunk/documentation/docs/xdocs/participating/contributors.xml (original)
+++ jakarta/cactus/trunk/documentation/docs/xdocs/participating/contributors.xml Sat Apr 15 09:53:21 2006
@@ -144,6 +144,9 @@
<li>
<link href="mailto:sean.zhang@verizon.com">Sean Zhang</link>
</li>
+ <li>
+ <link href="mailto:xthnguyen@yahoo.com">Xuan Thang Nguyen</link>
+ </li>
</ul>
</section>
Modified: jakarta/cactus/trunk/integration/ant/build.xml
URL: http://svn.apache.org/viewcvs/jakarta/cactus/trunk/integration/ant/build.xml?rev=394330&r1=394329&r2=394330&view=diff
==============================================================================
--- jakarta/cactus/trunk/integration/ant/build.xml (original)
+++ jakarta/cactus/trunk/integration/ant/build.xml Sat Apr 15 09:53:21 2006
@@ -159,7 +159,7 @@
<entry key="cactifyear"
value="org.apache.cactus.integration.ant.CactifyEarTask"/>
<entry key="runservertests"
- value="org.apache.cactus.integration.ant.RunServerTestTask"/>
+ value="org.apache.cactus.integration.ant.RunServerTestsTask"/>
<entry key="webxmlmerge"
value="org.apache.cactus.integration.ant.WebXmlMergeTask"/>
</propertyfile>
@@ -219,7 +219,7 @@
<entry key="cactustests"
value="org.apache.cactus.integration.ant.CactusTestTask"/>
<entry key="runservertests"
- value="org.apache.cactus.integration.ant.RunServerTestTask"/>
+ value="org.apache.cactus.integration.ant.RunServerTestsTask"/>
<entry key="webxmlmerge"
value="org.apache.cactus.integration.ant.WebXmlMergeTask"/>
</propertyfile>
Modified: jakarta/cactus/trunk/integration/maven/plugin.jelly
URL: http://svn.apache.org/viewcvs/jakarta/cactus/trunk/integration/maven/plugin.jelly?rev=394330&r1=394329&r2=394330&view=diff
==============================================================================
--- jakarta/cactus/trunk/integration/maven/plugin.jelly (original)
+++ jakarta/cactus/trunk/integration/maven/plugin.jelly Sat Apr 15 09:53:21 2006
@@ -1134,7 +1134,7 @@
<j:set var="containerDir" value="${context.getVariable(containerDirVar)}"/>
<j:if test="${containerDir != null and !containerDir.trim().equals('')}">
- <ant:fileset dir="${cactus.reports.dir}/{containerId}">
+ <ant:fileset dir="${cactus.reports.dir}/${containerId}">
<ant:include name="TEST-*.xml"/>
</ant:fileset>
</j:if>
Modified: jakarta/cactus/trunk/samples/ejb/build.xml
URL: http://svn.apache.org/viewcvs/jakarta/cactus/trunk/samples/ejb/build.xml?rev=394330&r1=394329&r2=394330&view=diff
==============================================================================
--- jakarta/cactus/trunk/samples/ejb/build.xml (original)
+++ jakarta/cactus/trunk/samples/ejb/build.xml Sat Apr 15 09:53:21 2006
@@ -136,6 +136,7 @@
file="${commons.logging.jar}"/>
<basename property="junit.jar.name" file="${junit.jar}"/>
<basename property="cargo.jar.name" file="${cargo.jar}"/>
+ <basename property="cargo.ant.jar.name" file="${cargo.ant.jar}"/>
<filterset id="jar.names">
<filter token="j2ee.jar.name" value="${j2ee.jar.name}"/>
@@ -144,6 +145,7 @@
<filter token="cactus.ant.jar.name" value="${cactus.ant.jar.name}.jar"/>
<filter token="cactus.jar.name" value="${cactus.jar.name}.jar"/>
<filter token="cargo.jar.name" value="${cargo.jar.name}"/>
+ <filter token="cargo.ant.jar.name" value="${cargo.ant.jar.name}"/>
<filter token="commons.httpclient.jar.name"
value="${commons.httpclient.jar.name}"/>
<filter token="commons.logging.jar.name"
@@ -168,6 +170,7 @@
<echo> cactus.jar = [${cactus.jar}]</echo>
<echo> cactus.ant.jar = [${cactus.ant.jar}]</echo>
<echo> cargo.jar = [${cargo.jar}]</echo>
+ <echo> cargo.ant.jar = [${cargo.ant.jar}]</echo>
<echo> commons.httpclient.jar = [${commons.httpclient.jar}]</echo>
<echo> commons.logging.jar = [${commons.logging.jar}]</echo>
<echo> j2ee.jar = [${j2ee.jar}]</echo>
Modified: jakarta/cactus/trunk/samples/servlet/build.xml
URL: http://svn.apache.org/viewcvs/jakarta/cactus/trunk/samples/servlet/build.xml?rev=394330&r1=394329&r2=394330&view=diff
==============================================================================
--- jakarta/cactus/trunk/samples/servlet/build.xml (original)
+++ jakarta/cactus/trunk/samples/servlet/build.xml Sat Apr 15 09:53:21 2006
@@ -126,6 +126,7 @@
<!-- Copy scripts -->
<basename property="cargo.jar.name" file="${cargo.jar}"/>
+ <basename property="cargo.ant.jar.name" file="${cargo.ant.jar}"/>
<basename property="jstl.jar.name" file="${jstl.jar}"/>
<basename property="standard.jar.name" file="${standard.jar}"/>
<basename property="servlet.jar.name" file="${servlet.jar}"/>
@@ -142,7 +143,7 @@
<filterset id="jar.names">
<filter token="cargo.jar.name" value="${cargo.jar.name}"/>
- <filter token="cargo.ant.name" value="${cargo.ant.name}"/>
+ <filter token="cargo.ant.jar.name" value="${cargo.ant.jar.name}"/>
<filter token="jstl.jar.name" value="${jstl.jar.name}"/>
<filter token="standard.jar.name" value="${standard.jar.name}"/>
<filter token="servlet.jar.name" value="${servlet.jar.name}"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org