Author: ekoneil
Date: Thu Sep 30 19:43:09 2004
New Revision: 47616

Added:
   incubator/beehive/trunk/netui/test/ant/testRecorderCore.xml   (contents, 
props changed)
   incubator/beehive/trunk/test/ant/buildWebappCore.xml   (contents, props 
changed)
Modified:
   incubator/beehive/trunk/netui/build.xml
   incubator/beehive/trunk/netui/test/ant/test.properties
   incubator/beehive/trunk/netui/test/ant/testRecorder.xml
   incubator/beehive/trunk/test/ant/buildWebapp.xml
Log:
Fixing up some build files to take advantage of Ant 1.6.2 <import> features.

These "Core" files can then be leveraged in different environments by 
<import>ing them into wrapping build files.

I've tested these in various scenarios, but let me know if anyone sees problems 
that could be related to these webapp build changes.


BB: self
DRT: NetUI / controls / wsm pass
BVT: NetUI pass



Modified: incubator/beehive/trunk/netui/build.xml
==============================================================================
--- incubator/beehive/trunk/netui/build.xml     (original)
+++ incubator/beehive/trunk/netui/build.xml     Thu Sep 30 19:43:09 2004
@@ -34,7 +34,7 @@
         <echo message="--------------------------------------------------"/>
 
         <!-- run the JUnit DRTs -->
-        <ant dir="test/ant" target="drt" inheritAll="false">
+        <ant dir="${basedir}/test/ant/" target="drt" inheritAll="false">
             <property name="drt.cc.mode" value="true"/>
         </ant>
 

Modified: incubator/beehive/trunk/netui/test/ant/test.properties
==============================================================================
--- incubator/beehive/trunk/netui/test/ant/test.properties      (original)
+++ incubator/beehive/trunk/netui/test/ant/test.properties      Thu Sep 30 
19:43:09 2004
@@ -13,7 +13,10 @@
 #
 # External JAR dependencies
 #
-deployed.httpClient.jar=${test.external.dir}/commons-httpclient-2.0.jar
+junit.jar.name=junit.jar
+httpClient.jar.name=commons-httpclient-2.0.jar
+
+deployed.httpClient.jar=${test.external.dir}/${httpClient.jar.name}
 ant-junit.jar=${ant.home}/lib/ant-junit.jar
 
 # 
---------------------------------------------------------------------------------
@@ -73,16 +76,6 @@
 ${servlet24.jar};\
 ${jsp20.jar};\
 ${controls.jar}
-
-test.recorder.classpath=\
-${junit.jar};\
-${deployed.httpClient.jar};\
-${deployed.test-recorder.jar};\
-${deployed.commons-logging.jar};\
-${servlet24.jar};\
-${log4j.jar};\
-${xbean.jar};\
-${jsr173.jar}
 
 test.recorder.QA.classpath=\
 ${test.recorder.classpath};\

Modified: incubator/beehive/trunk/netui/test/ant/testRecorder.xml
==============================================================================
--- incubator/beehive/trunk/netui/test/ant/testRecorder.xml     (original)
+++ incubator/beehive/trunk/netui/test/ant/testRecorder.xml     Thu Sep 30 
19:43:09 2004
@@ -8,440 +8,30 @@
     <property file="${os.BEEHIVE_HOME}/netui/ant/common.properties"/>
     <property file="${os.BEEHIVE_HOME}/netui/test/ant/test.properties"/>
 
-    <property name="_testRecorder.config.dir" 
location="${build.dir}/testRecorder/config"/>
-    <property name="_testRecorder.scratch.dir" 
location="${build.dir}/testRecorder/scratch"/>
-    <property name="_testRecorder.output" 
value="TEST-org.apache.beehive.netui.tools.testrecorder.client.MasterTestRecorderJUnitTest"/>
+    <property name="_junitReport.ant" 
location="${test.dir}/ant/junitReport.xml"/>
+    <property name="_testRecorder.base.dir" 
location="${build.dir}/testRecorder"/>
+    <property name="_testRecorder.resource.dir" 
location="${qa.src.dir}/testRecorder/jsp"/>
+
+    <property name="_junit.jar" location="${junit.jar}"/>
+    <property name="_ant-junit.jar" location="${ant-junit.jar}"/>
+    <property name="_log4j.jar" location="${log4j.jar}"/>
+    <property name="_servlet24.jar" location="${servlet24.jar}"/>
+    <property name="_xbean.jar" location="${xbean.jar}"/>
+    <property name="_jsr173.jar" location="${jsr173.jar}"/>
+    <property name="_test.config.dir" location="${test.dir}/conf"/>
+    <property name="_httpClient.jar" location="${deployed.httpClient.jar}"/>
+    <property name="_testRecorder.jar" 
location="${deployed.test-recorder.jar}"/>
+    <property name="_commons-logging.jar" 
location="${deployed.commons-logging.jar}"/>
+
+    <property name="_testRecorder.jar.name" value="${test-recorder.jar.name}"/>
+    <property name="_httpClient.jar.name" value="${httpClient.jar.name}"/>
+    <property name="_junit.jar.name" value="${junit.jar.name}"/>
+    <property name="_server.maxWait" value="${drtbvt.maxWait}"/>
+    <property name="_log4j.config.verbose" 
location="${log4jconfig.verbose.junit}"/>
+    <property name="_log4j.config" location="${log4jconfig.junit}"/>
 
-    <taskdef name="junit" 
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
-        <classpath>
-            <pathelement path="${ant-junit.jar}"/>
-        </classpath>
-    </taskdef>
+    <property name="testRecorder.build.dir" location="${test.dir}/ant"/>
 
-    <!-- Run a single suite of tests against a server -->
-    <target name="run.suite">
-        <echo message="--------------------------------------------------"/>
-        <echo message=" Test Recorder running test suite 
'${playback.categories}'"/>
-        <echo message="--------------------------------------------------"/>
+    <import file="testRecorderCore.xml"/>
 
-        <echo>drt.mode: ${drt.mode}</echo>
-        <echo>drt.cc.mode: ${drt.cc.mode}</echo>
-
-        <!-- set the output flags according to whether the tests are running 
in DRT mode -->
-        <condition property="formatter.type" value="plain">
-            <and>
-                 <istrue value="${drt.mode}"/>
-                 <isfalse value="${drt.cc.mode}"/>
-            </and>
-        </condition>
-        <condition property="formatter.usefile" value="false">
-            <and>
-                 <istrue value="${drt.mode}"/>
-                 <isfalse value="${drt.cc.mode}"/>
-            </and>
-        </condition>
-        <condition property="formatter.type" value="xml">
-            <not><isset property="${formatter.type}"/></not>
-        </condition>
-        <condition property="formatter.usefile" value="true">
-            <not><isset property="${formatter.usefile}"/></not>
-        </condition>
-
-        <echo>formatter.type: ${formatter.type}</echo>
-        <echo>formatter.usefile: ${formatter.usefile}</echo>
-
-        <echo>Server ready...start playback of tests</echo>
-
-        <antcall target="playback.tests">
-            <param name="playback.categories" value="${playback.categories}"/>
-            <param name="formatter.type" value="${formatter.type}"/>
-            <param name="formatter.usefile" value="${formatter.usefile}"/>
-        </antcall>
-
-        <echo message="--------------------------------------------------"/>
-        <echo message=" Test Recorder completed test suite 
'${playback.categories}'"/>
-        <echo message="--------------------------------------------------"/>
-    </target>
-
-    <!--
-        Server Test target.  Used for DRTs and BVTs.  Starts the server, waits 
for a response
-        from the server, and upon success starts the client-side test harneess.
-
-        Param:
-            waitfor.url == the URL at which to check to see if the server has 
started
-            formatter.type == type of formatter to use when writing reslts.
-            formatter.usefile == whether to write results to an output file.
-            drt.mode == flag describing whether running the tests in DRT mode. 
 
-                        In DRT mode, the server does not stop on failure.
-            app.build.file == the build file to use for cleaning and deploying 
the
-                              application and starting and stopping the server.
-     -->
-    <target name="server.test" description="Runs Test Recorder regression 
tests">
-
-        <ant target="clean" antfile="${app.build.file}"/>
-        <ant target="build" antfile="${app.build.file}"/>
-
-        <echo>testRecorder.config.name: ${testRecorder.config.name}</echo>
-        <property name="_config.jar" 
value="${_testRecorder.config.dir}/${testRecorder.config.name}.jar"/>
-        <echo>config.jar: ${_config.jar}</echo>
-        <available property="config.jar.available" file="${_config.jar}"/>
-        <fail unless="config.jar.available" message="Can't find a test 
recorder config JAR at ${_config.jar} to copy"/>
-
-        <echo>Start a NetUI test server</echo>
-
-        <parallel>
-            <ant target="start" antfile="${app.build.file}" 
inheritAll="false"/>
-
-            <sequential>
-                <echo>Wait for server to start at URL: ${waitfor.url}</echo>
-
-                <waitfor maxwait="${drtbvt.maxWait}" maxwaitunit="second"
-                    timeoutproperty="server.timedOut" checkevery="500">
-                    <http url="${waitfor.url}"/>
-                </waitfor>
-
-                <!-- 
-                     callback to the application build file to give the 
application an opportunity to 
-                     ensure that it has been deployed before starting to run 
tests against it 
-                  -->
-                <ant antfile="${app.build.file}" target="ensure.deployed" 
inheritAll="false"/>
-
-                <echo>Start Playback</echo>
-                <echo>playback.target: ${playback.target}</echo>
-                <antcall target="_default.callback"/>
-                <antcall target="_override.callback"/>
-
-                <echo>stopping server...</echo>
-                <ant target="stop" antfile="${app.build.file}" 
inheritAll="false"/>
-                <echo>...server stopped</echo>
-            </sequential>
-
-        </parallel>
-
-        <fail if="failedjUnitDRT">ERROR: JUnit tests FAILED</fail>
-        <fail if="playback.drt.failure">ERROR: regression tests FAILED</fail>
-    </target>
-
-    <!-- Stop the server and then fail because the DRTs failed -->
-    <target name="drt.errors" if="drt.errors.stop">
-        <echo>!!!!! Errors or failures occurred running test recorder tests 
!!!!!</echo>
-        <antcall target="stop.server"/>
-        <fail message="NetUI Server DRTs Failed"/>
-    </target>
-
-    <!-- 
-        When running the DRTs in CruiseControl mode, the server instance 
-        needs to be stopped whether or not the tests passed.
-      -->
-    <target name="stop.server" if="drt.cc.mode">
-        <echo>Stop the server with the 'stop' target in this build file: 
${app.build.file}</echo>
-        <ant target="stop" antfile="${app.build.file}"/>
-    </target>
-
-    <target name="playback.tests" unless="server.timedOut" description="Plays 
back a list of pre-recorded tests.">
-
-        <condition property="_playback.fail" value="set">
-            <not>
-                <or>
-                    <isset property="playback.list"/>
-                    <isset property="playback.categories"/>
-                    <isset property="playback.webapps"/>
-                </or>
-            </not>
-        </condition>
-        <fail if="_playback.fail">
-ERROR: to run playback set playback.webapps to a list of webapps to test 
against or 'all' for all webapps and
-set some combination of the following: 'playback.list', 'playback.categories' 
to a list of tests,
-or categories, respectively.  The keyword 'all' can be used for 
'playback.categories' to include tests for
-all categories.
-        </fail>
-
-        <!-- remove old junit output -->
-        <delete>
-            <fileset dir=".">
-                <include name="${_testRecorder.output}.*"/>
-            </fileset>
-        </delete>
-
-        <condition property="log4j.config" 
value="${log4jconfig.verbose.junit}">
-            <not>
-                <isset property="log4j.quiet"/>
-            </not>
-        </condition>
-        <condition property="log4j.config" value="${log4jconfig.junit}">
-            <and>
-                <isset property="log4j.quiet"/>
-            </and>
-        </condition>
-
-        <condition property="_list" value="">
-            <not>
-                <isset property="playback.list"/>
-            </not>
-        </condition>
-        <condition property="_list" value="${playback.list}">
-            <and>
-                <isset property="playback.list"/>
-            </and>
-        </condition>
-        <condition property="_categories" value="">
-            <not>
-                <isset property="playback.categories"/>
-            </not>
-        </condition>
-        <condition property="_categories" value="${playback.categories}">
-            <and>
-                <isset property="playback.categories"/>
-            </and>
-        </condition>
-        <condition property="_results.delete" value="true">
-            <or>
-                <istrue value="${drt.mode}"/>
-                <istrue value="${drt.cc.mode}"/>
-            </or>
-        </condition>
-
-        <echo>config.jar: ${_config.jar}</echo>
-        <echo>log4j.config: ${log4j.config}</echo>
-        <echo>playback list: ${_list}</echo>
-        <echo>playback categories: ${_categories}</echo>
-        <echo>playback webapps: ${playback.webapps}</echo>
-        <echo>playback config jar: ${_config.jar}</echo>
-        <echo>test.recorder.classpath: ${test.recorder.classpath}</echo>
-
-        <junit dir="${netui.ant.dir}" fork="true" 
errorproperty="playback.drt.error" failureproperty="playback.drt.failure" 
-               showoutput="true">
-            <classpath>
-                <pathelement path="${junit.jar}"/>
-                <pathelement path="${ant-junit.jar}"/>
-                <pathelement path="${test.recorder.classpath}"/>
-                <pathelement path="${test.dir}/conf"/>
-            </classpath>
-
-            <sysproperty key="test.recorder.run.tests" value="${_list}"/>
-            <sysproperty key="test.recorder.run.categories" 
value="${_categories}"/>
-            <sysproperty key="test.recorder.run.webapps" 
value="${playback.webapps}"/>
-            <sysproperty key="test.recorder.run.results.delete" 
value="${results.delete}"/>
-            <sysproperty key="netuidrt.logdir" 
path="${build.dir}/testRecorder"/>
-            <sysproperty key="log4j.configuration" 
value="file:${log4j.config}"/>
-
-            <formatter type="${formatter.type}" 
usefile="${formatter.usefile}"/>
-
-            <test 
name="org.apache.beehive.netui.tools.testrecorder.client.MasterTestRecorderJUnitTest"/>
-        </junit>
-
-        <antcall target="make.report">
-            <param name="test.report.dir" 
value="${build.dir}/testRecorder/junit/${_categories}"/>
-        </antcall>
-
-        <!-- Determine if the tests have an error or failure -->
-        <condition property="drt.errors.found">
-            <or>
-                <isset property="playback.drt.error"/>
-                <isset property="playback.drt.failure"/>
-            </or>
-        </condition>
-        <echo>drt.errors.found: ${drt.errors.found}</echo>
-
-        <!-- Determine if we had a failure and are in DRT mode -->
-        <condition property="drt.errors.stop">
-            <and>
-                <isset property="drt.cc.mode"/>
-                <isset property="drt.errors.found"/>
-            </and>
-        </condition>
-        <echo>drt.errors.stop: ${drt.errors.stop}</echo>
-
-        <!-- Run the DRT stop if we failed in DRT mode -->
-        <antcall target="drt.errors"/>
-    </target>
-
-    <target name="playback" 
-        description="Plays back a list of pre-recorded tests, set the 
'playback.list' property to specify a list of tests.">
-
-        <fail unless="testRecorder.config.name" message="No test recorder 
config name (property: 'testRecorder.config.name') specified"/>
-        <echo>testRecorder.config.name: ${testRecorder.config.name}</echo>
-        <property name="_config.jar" 
location="${_testRecorder.config.dir}/${testRecorder.config.name}.jar"/>
-        <available property="config.jar.available" file="${_config.jar}"/>
-        <fail unless="config.jar.available" message="Can't find a test 
recorder config JAR at ${_config.jar} to copy"/>
-        <echo>_config.jar: ${_config.jar}</echo>
-
-        <antcall target="playback.tests">
-            <param name="formatter.type" value="plain"/>
-            <param name="formatter.usefile" value="false"/>
-        </antcall>
-    </target>
-
-    <!--
-        Param:
-            test.report.dir == the directory into which to generate the report
-     -->
-    <target name="make.report">
-        <property name="html.report.dir" location="${test.report.dir}/html"/>
-
-       <mkdir dir="${test.report.dir}" />
-       <mkdir dir="${html.report.dir}"/>
-
-       <ant dir="${test.dir}/ant" antfile="${test.dir}/ant/junitReport.xml" 
target="run">
-           <property name="test.report.dir" location="${test.report.dir}"/>
-           <property name="type" value="testrecorder"/>
-       </ant>
-
-       <delete>
-           <fileset dir=".">
-               <include name="${_testRecorder.output}.*"/>
-           </fileset>
-       </delete>
-
-    </target>
-
-    <!-- Deploy the Test Recorder to the specified web app
-
-         Params:
-             webapp.dir == the webapp into which to deploy the testRecorder
-       -->
-    <target name="deployTestRecorder" depends="build" description="Deploy the 
Test Recorder artifacts to the specified web app">
-        <echo>webapp.dir: ${webapp.dir}</echo>
-        <echo>testRecorder.config.name: ${testRecorder.config.name}</echo>
-
-        <fail unless="testRecorder.config.name" message="No test recorder 
config name specified"/>
-        <property name="_config.jar" 
location="${_testRecorder.config.dir}/${testRecorder.config.name}.jar"/>
-
-        <available property="config.jar.available" file="${_config.jar}"/>
-        <fail unless="config.jar.available" message="Can't find a test 
recorder config JAR at ${_config.jar} to copy"/>
-
-        <echo>config jar: ${_config.jar}</echo>
-
-        <copy file="${deployed.test-recorder.jar}" 
toDir="${webapp.dir}/WEB-INF/lib"/>
-        <copy file="${deployed.httpClient.jar}" 
toDir="${webapp.dir}/WEB-INF/lib"/>
-        <copy file="${junit.jar}" toDir="${webapp.dir}/WEB-INF/lib"/>
-        <copy file="${_config.jar}" toDir="${webapp.dir}/WEB-INF/lib"/>
-        <copy todir="${webapp.dir}/testRecorder" overwrite="true">
-            <fileset dir="${qa.src.dir}/testRecorder/jsp">
-                <include name="**/*.jsp"/>
-                <include name="**/*.inc"/>
-            </fileset>
-        </copy>
-  </target>
-
-    <!-- Undeploy the Test Recorder from the specified web app
-
-         Params:
-             webapp.dir == the webapp into which to deploy the testRecorder
-     -->
-    <target name="undeploy" description="Undeploy the Test Recorder artifacts 
from the specified webapp">
-        <echo>Undeploy testRecorder from: ${webapp.dir}</echo>
-
-        <property name="webapp.lib" location="${webapp.dir}/WEB-INF/lib"/>
-
-        <delete file="${webapp.lib}/${test-recorder.jar.name}"/>
-        <delete file="${webapp.lib}/${httpClient.jar.name}"/>
-        <delete file="${webapp.lib}/${junit.jar.name}"/>
-        <delete quiet="true">
-            <fileset dir="${webapp.dir}/testRecorder">
-                <include name="*.jsp"/>
-                <include name="*.inc"/>
-                <include name="testResults/*.*"/>
-            </fileset>
-        </delete>
-    </target>
-
-    <!-- Build the test recorder -->
-    <target name="build" description="build the Test Recorder module">
-        <ant dir="${test.dir}/ant" antfile="${test.dir}/ant/build.xml" 
target="test.build.module" inheritAll="false">
-            <property name="module.name" value="testRecorder"/>
-        </ant>
-    </target>
-
-    <!-- Clean the test recorder -->
-    <target name="clean" description="clean the Test Recorder module">
-        <ant dir="${test.dir}/ant" antfile="${test.dir}/ant/build.xml" 
target="test.clean.module" inheritAll="false">
-            <property name="module.name" value="testRecorder"/>
-        </ant>
-    </target>
-
-    <target name="build.config.jar">
-        <echo>build.dir: ${build.dir}</echo>
-        <echo>Build Test Recorder config JAR</echo>
-
-        <available property="test.file.available" file="${test.file}"/>
-        <fail unless="test.file.available" message="Can't build Test Recorder 
config JAR; the test file ${test.file} is not available"/>
-        <available property="config.file.available" file="${config.file}"/>
-        <fail unless="config.file.available" message="Can't build Test 
Recorder config JAR; the webapp file ${webapp.file} is not available"/>
-        <available property="webapp.file.available" file="${webapp.file}"/>
-        <fail unless="config.file.available" message="Can't build Test 
Recorder config JAR; the config file ${config.file} is not available"/>
-
-        <mkdir dir="${_testRecorder.config.dir}"/>
-        <delete dir="${_testRecorder.scratch.dir}"/>
-        <property name="this.scratch.dir" 
location="${_testRecorder.scratch.dir}/${testRecorder.config.name}"/>
-        <echo>scratch.dir: ${this.scratch.dir}</echo>
-        <mkdir dir="${this.scratch.dir}"/>
-
-        <copy todir="${this.scratch.dir}" overwrite="true">
-            <fileset file="${config.file}"/>
-            <fileset file="${test.file}"/>
-            <filterset>
-                <filter token="BASE_DIR" value="${build.dir}/testRecorder"/>
-            </filterset>
-        </copy>
-        <copy file="${webapp.file}" 
tofile="${this.scratch.dir}/testRecorder-webapp.xml" overwrite="true">
-            <filterset>
-                <filter token="DOMAIN_DIR" value="${app.dir}"/>
-            </filterset>
-        </copy>
-
-        <jar 
jarfile="${_testRecorder.config.dir}/${testRecorder.config.name}.jar">
-            <fileset 
dir="${_testRecorder.scratch.dir}/${testRecorder.config.name}"/>
-        </jar>
-    </target>
-
-    <!--
-        The default playback target for a test recorder suite.  This target 
simply
-        runs the "suite.callback" target with the provided parameters.  It runs
-        only the suite that was specified.
-      -->
-    <target name="_default.callback" unless="playback.target">
-        <antcall target="suite.callback"/>
-    </target>
-
-    <!--
-        A playback target that allows an application to provide a target to 
callback
-        when the tests should be executed.  This allows the application to 
-        override the default behavior of the test suite execution.  For 
example,
-        the application may compose many test suites into a single callback 
target.
-      -->
-    <target name="_override.callback" if="playback.target">
-        <echo>app.build.file: ${app.build.file}</echo>
-        <echo>playback.target: ${playback.target}</echo>
-        <ant antfile="${app.build.file}" target="${playback.target}"/>
-    </target>
-
-    <!-- 
-        The default callback to run a test suite.
-
-        This target expects to be passed a suite.name property which is the 
name of the 
-        suite of tests to execute.
-      -->
-    <target name="suite.callback" description="Run a Test Recorder test suite">
-        <fail unless="suite.name" message="No test suite name specified, set 
the -Dsuite.name=&lt;name&gt; property"/>
-
-        <!-- set the path to the config.jar file read by the test recorder -->
-        <condition property="_config.jar" 
value="${_testRecorder.config.dir}/${testRecorder.config.name}.jar">
-            <not><isset property="${_config.jar}"/></not>
-        </condition>
-
-        <!-- ensure that the application is running where it is supposed to be 
given the provided "waitfor.url" -->
-        <waitfor maxwait="5" maxwaitunit="second" 
timeoutproperty="unavailable">
-            <http url="${waitfor.url}"/>
-        </waitfor>
-        <fail if="unavailable" message="Could not reach webapp at 
${waitfor.url} to run the suite ${suite.name}"/>
-
-        <echo>Running suite: ${suite.name}</echo>
-
-        <ant dir="${test.dir}/ant" antfile="${test.dir}/ant/testRecorder.xml" 
target="run.suite">
-            <property name="playback.categories" value="${suite.name}"/>
-            <property name="playback.webapps" value="${playback.webapps}"/>
-        </ant>
-    </target>
-
-</project>
+</project>
\ No newline at end of file

Added: incubator/beehive/trunk/netui/test/ant/testRecorderCore.xml
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/netui/test/ant/testRecorderCore.xml Thu Sep 30 
19:43:09 2004
@@ -0,0 +1,498 @@
+<?xml version="1.0"?>
+
+<!--
+
+  -->
+<project name="Beehive/NetUI/TestRecorderCoreTasks" default="" basedir=".">
+
+    <!-- core test recorder build file; everything beneath here should be 
generic to the environment in which the TR runs -->
+    <path id="test.recorder.classpath">
+        <pathelement path="${_junit.jar}"/>
+        <pathelement path="${_ant-junit.jar}"/>
+        <pathelement path="${_log4j.jar}"/>
+        <pathelement path="${_servlet24.jar}"/>
+        <pathelement path="${_xbean.jar}"/>
+        <pathelement path="${_jsr173.jar}"/>
+        <pathelement path="${_test.config.dir}"/>
+        <pathelement path="${_httpClient.jar}"/>
+        <pathelement path="${_testRecorder.jar}"/>
+        <pathelement path="${_commons-logging.jar}"/>
+    </path>
+
+    <property name="_report.root.dir" 
location="${_testRecorder.base.dir}/junit"/>
+    <property name="_testRecorder.config.dir" 
location="${_testRecorder.base.dir}/config"/>
+    <property name="_testRecorder.scratch.dir" 
location="${_testRecorder.base.dir}/scratch"/>
+    <property name="_testRecorder.output" 
value="TEST-org.apache.beehive.netui.tools.testrecorder.client.MasterTestRecorderJUnitTest"/>
+
+    <taskdef name="junit" 
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
+        <classpath>
+            <pathelement path="${_ant-junit.jar}"/>
+        </classpath>
+    </taskdef>
+
+    <!-- Run a single suite of tests against a server 
+        drt.mode
+        drt.cc.mode
+        formatter.type
+        formatter.usefile
+        playback.categories
+      -->
+    <target name="run.suite">
+        <echo message="--------------------------------------------------"/>
+        <echo message=" Test Recorder running test suite 
'${playback.categories}'"/>
+        <echo message="--------------------------------------------------"/>
+
+        <echo>drt.mode: ${drt.mode}</echo>
+        <echo>drt.cc.mode: ${drt.cc.mode}</echo>
+
+        <!-- set the output flags according to whether the tests are running 
in DRT mode -->
+        <condition property="formatter.type" value="plain">
+            <and>
+                 <istrue value="${drt.mode}"/>
+                 <isfalse value="${drt.cc.mode}"/>
+            </and>
+        </condition>
+        <condition property="formatter.usefile" value="false">
+            <and>
+                 <istrue value="${drt.mode}"/>
+                 <isfalse value="${drt.cc.mode}"/>
+            </and>
+        </condition>
+        <condition property="formatter.type" value="xml">
+            <not><isset property="${formatter.type}"/></not>
+        </condition>
+        <condition property="formatter.usefile" value="true">
+            <not><isset property="${formatter.usefile}"/></not>
+        </condition>
+
+        <echo>formatter.type: ${formatter.type}</echo>
+        <echo>formatter.usefile: ${formatter.usefile}</echo>
+
+        <echo>Server ready...start playback of tests</echo>
+
+        <antcall target="playback.tests">
+            <param name="playback.categories" value="${playback.categories}"/>
+            <param name="formatter.type" value="${formatter.type}"/>
+            <param name="formatter.usefile" value="${formatter.usefile}"/>
+        </antcall>
+
+        <echo message="--------------------------------------------------"/>
+        <echo message=" Test Recorder completed test suite 
'${playback.categories}'"/>
+        <echo message="--------------------------------------------------"/>
+    </target>
+
+    <!--
+        Server Test target.  Used for DRTs and BVTs.  Starts the server, waits 
for a response
+        from the server, and upon success starts the client-side test harneess.
+
+        Param:
+            waitfor.url == the URL at which to check to see if the server has 
started
+            formatter.type == type of formatter to use when writing reslts.
+            formatter.usefile == whether to write results to an output file.
+            drt.mode == flag describing whether running the tests in DRT mode. 
 
+                        In DRT mode, the server does not stop on failure.
+            app.build.file == the build file to use for cleaning and deploying 
the
+                              application and starting and stopping the server.
+            testRecorder.config.name == 
+            playback.target == 
+     -->
+    <target name="server.test" description="Runs Test Recorder regression 
tests">
+
+        <ant target="clean" antfile="${app.build.file}"/>
+        <ant target="build" antfile="${app.build.file}"/>
+
+        <echo>testRecorder.config.name: ${testRecorder.config.name}</echo>
+        <property name="_config.jar" 
value="${_testRecorder.config.dir}/${testRecorder.config.name}.jar"/>
+
+        <echo>config.jar: ${_config.jar}</echo>
+
+        <available property="config.jar.available" file="${_config.jar}"/>
+        <fail unless="config.jar.available" message="Can't find a test 
recorder config JAR at ${_config.jar} to copy"/>
+
+        <echo>Start a NetUI test server</echo>
+
+        <parallel>
+            <ant target="start" antfile="${app.build.file}" 
inheritAll="false"/>
+
+            <sequential>
+                <echo>Wait for server to start at URL: ${waitfor.url}</echo>
+
+                <waitfor maxwait="${_server.maxWait}" maxwaitunit="second" 
timeoutproperty="server.timedOut" checkevery="500">
+                    <http url="${waitfor.url}"/>
+                </waitfor>
+
+                <!-- 
+                     callback to the application build file to give the 
application an opportunity to 
+                     ensure that it has been deployed before starting to run 
tests against it 
+                  -->
+                <ant antfile="${app.build.file}" target="ensure.deployed" 
inheritAll="false"/>
+
+                <echo>Start Playback</echo>
+                <echo>playback.target: ${playback.target}</echo>
+                <antcall target="_default.callback"/>
+                <antcall target="_override.callback"/>
+
+                <echo>stopping server...</echo>
+                <ant target="stop" antfile="${app.build.file}" 
inheritAll="false"/>
+                <echo>...server stopped</echo>
+            </sequential>
+
+        </parallel>
+
+        <fail if="failedjUnitDRT">ERROR: JUnit tests FAILED</fail>
+        <fail if="playback.drt.failure">ERROR: regression tests FAILED</fail>
+    </target>
+
+    <!-- Stop the server and then fail because the DRTs failed -->
+    <target name="drt.errors" if="drt.errors.stop">
+        <echo>!!!!! Errors or failures occurred running test recorder tests 
!!!!!</echo>
+        <antcall target="stop.server"/>
+        <fail message="NetUI Server DRTs Failed"/>
+    </target>
+
+    <!-- 
+        When running the DRTs in CruiseControl mode, the server instance 
+        needs to be stopped whether or not the tests passed.
+ 
+        app.build.file == 
+      -->
+    <target name="stop.server" if="drt.cc.mode">
+        <echo>Stop the server with the 'stop' target in this build file: 
${app.build.file}</echo>
+        <ant target="stop" antfile="${app.build.file}"/>
+    </target>
+
+    <!--
+        One of these:
+          playback.list
+          playback.categories
+
+        playback.webapps
+        log4j.quiet: 
+        drt.mode:
+        drt.cc.mode:
+      -->
+    <target name="playback.tests" unless="server.timedOut" description="Plays 
back a list of pre-recorded tests.">
+        <condition property="_playback.fail" value="set">
+            <not>
+                <or>
+                    <isset property="playback.list"/>
+                    <isset property="playback.categories"/>
+                    <isset property="playback.webapps"/>
+                </or>
+            </not>
+        </condition>
+        <fail if="_playback.fail">
+ERROR: to run playback set playback.webapps to a list of webapps to test 
against or 'all' for all webapps and
+set some combination of the following: 'playback.list', 'playback.categories' 
to a list of tests,
+or categories, respectively.  The keyword 'all' can be used for 
'playback.categories' to include tests for
+all categories.
+        </fail>
+
+        <!-- remove old junit output -->
+        <delete>
+            <fileset dir=".">
+                <include name="${_testRecorder.output}.*"/>
+            </fileset>
+        </delete>
+
+        <condition property="_log4j.config" value="${_log4j.config.verbose}">
+            <not>
+                <isset property="log4j.quiet"/>
+            </not>
+        </condition>
+        <condition property="_log4j.config" value="${_log4j.config}">
+            <and>
+                <isset property="log4j.quiet"/>
+            </and>
+        </condition>
+
+        <condition property="_list" value="">
+            <not>
+                <isset property="playback.list"/>
+            </not>
+        </condition>
+        <condition property="_list" value="${playback.list}">
+            <and>
+                <isset property="playback.list"/>
+            </and>
+        </condition>
+        <condition property="_categories" value="">
+            <not>
+                <isset property="playback.categories"/>
+            </not>
+        </condition>
+        <condition property="_categories" value="${playback.categories}">
+            <and>
+                <isset property="playback.categories"/>
+            </and>
+        </condition>
+        <condition property="_results.delete" value="true">
+            <or>
+                <istrue value="${drt.mode}"/>
+                <istrue value="${drt.cc.mode}"/>
+            </or>
+        </condition>
+
+        <echo>config.jar: ${_config.jar}</echo>
+        <echo>log4j.config: ${_log4j.config}</echo>
+        <echo>playback list: ${_list}</echo>
+        <echo>playback categories: ${_categories}</echo>
+        <echo>playback webapps: ${playback.webapps}</echo>
+        <echo>playback config jar: ${_config.jar}</echo>
+
+        <path id="_this.test.recorder.classpath">
+            <path refid="test.recorder.classpath"/>
+            <pathelement path="${_config.jar}"/>
+        </path>
+
+        <junit dir="${netui.ant.dir}" fork="true" 
errorproperty="playback.drt.error" failureproperty="playback.drt.failure" 
showoutput="true">
+            <classpath refid="_this.test.recorder.classpath"/>
+
+            <sysproperty key="test.recorder.run.webapps" 
value="${playback.webapps}"/>
+            <formatter type="${formatter.type}" 
usefile="${formatter.usefile}"/>
+
+            <sysproperty key="test.recorder.run.tests" value="${_list}"/>
+            <sysproperty key="test.recorder.run.categories" 
value="${_categories}"/>
+            <sysproperty key="test.recorder.run.results.delete" 
value="${_results.delete}"/>
+            <sysproperty key="netuidrt.logdir" 
path="${_testRecorder.base.dir}"/>
+            <sysproperty key="log4j.configuration" 
value="file:${_log4j.config}"/>
+
+            <test 
name="org.apache.beehive.netui.tools.testrecorder.client.MasterTestRecorderJUnitTest"/>
+        </junit>
+
+        <!-- Create a JUnit report based on the results of executing the test 
recorder test cases -->
+        <antcall target="make.report">
+            <param name="test.report.dir" 
value="${_report.root.dir}/${_categories}"/>
+        </antcall>
+
+        <!-- Determine if the tests have an error or failure -->
+        <condition property="drt.errors.found">
+            <or>
+                <isset property="playback.drt.error"/>
+                <isset property="playback.drt.failure"/>
+            </or>
+        </condition>
+        <echo>drt.errors.found: ${drt.errors.found}</echo>
+
+        <!-- 
+             Given whether the tests failed (or not), decide whether to stop 
the server.  This
+             value is also coupled with the drt.cc.mode value to stop the 
server when
+             running the tests in "cruisecontrol" mode.
+          -->
+        <condition property="drt.errors.stop">
+            <and>
+                <isset property="drt.cc.mode"/>
+                <isset property="drt.errors.found"/>
+            </and>
+        </condition>
+
+        <echo>drt.errors.stop: ${drt.errors.stop}</echo>
+
+        <!-- Stop the server as necessary given the value of "drt.errors.stop" 
-->
+        <antcall target="drt.errors"/>
+    </target>
+
+    <!--
+        testRecorder.config.name: 
+      -->
+    <target name="playback" description="Plays back a list of pre-recorded 
tests, set the 'playback.list' property to specify a list of tests.">
+
+        <fail unless="testRecorder.config.name" message="No test recorder 
config name (property: 'testRecorder.config.name') specified"/>
+        <echo>testRecorder.config.name: ${testRecorder.config.name}</echo>
+
+        <property name="_config.jar" 
location="${_testRecorder.config.dir}/${testRecorder.config.name}.jar"/>
+        <echo>_config.jar: ${_config.jar}</echo>
+
+        <available property="config.jar.available" file="${_config.jar}"/>
+        <fail unless="config.jar.available" message="Can't find a test 
recorder config JAR at ${_config.jar} to copy"/>
+
+        <antcall target="playback.tests">
+            <param name="formatter.type" value="plain"/>
+            <param name="formatter.usefile" value="false"/>
+        </antcall>
+    </target>
+
+    <!--
+        Param:
+            test.report.dir == the directory into which to generate the 
report.  This value is provided by the caller.
+     -->
+    <target name="make.report">
+        <property name="html.report.dir" location="${test.report.dir}/html"/>
+
+        <mkdir dir="${test.report.dir}" />
+        <mkdir dir="${html.report.dir}"/>
+
+        <ant dir="${basedir}" antfile="${_junitReport.ant}" target="run">
+            <property name="test.report.dir" location="${test.report.dir}"/>
+            <property name="type" value="testrecorder"/>
+        </ant>
+
+        <delete>
+            <fileset dir=".">
+                <include name="${_testRecorder.output}.*"/>
+            </fileset>
+        </delete>
+    </target>
+
+    <!-- Deploy the Test Recorder to the given webapp
+
+         Params:
+             webapp.dir: the webapp into which to deploy the testRecorder
+             testRecorder.config.name: the name to use when building the test 
recorder configuration JAR
+       -->
+    <target name="deployTestRecorder" depends="build" description="Deploy the 
Test Recorder artifacts to the specified web app">
+        <echo>webapp.dir: ${webapp.dir}</echo>
+        <echo>testRecorder.config.name: ${testRecorder.config.name}</echo>
+
+        <fail unless="testRecorder.config.name" message="No test recorder 
config name specified"/>
+        <property name="_config.jar" 
location="${_testRecorder.config.dir}/${testRecorder.config.name}.jar"/>
+
+        <available property="config.jar.available" file="${_config.jar}"/>
+        <fail unless="config.jar.available" message="Can't find a test 
recorder config JAR at ${_config.jar} to copy"/>
+
+        <echo>config jar: ${_config.jar}</echo>
+
+        <copy file="${_testRecorder.jar}" toDir="${webapp.dir}/WEB-INF/lib"/>
+        <copy file="${_httpClient.jar}" toDir="${webapp.dir}/WEB-INF/lib"/>
+        <copy file="${_junit.jar}" toDir="${webapp.dir}/WEB-INF/lib"/>
+        <copy file="${_config.jar}" toDir="${webapp.dir}/WEB-INF/lib"/>
+        <copy todir="${webapp.dir}/testRecorder" overwrite="true">
+            <fileset dir="${_testRecorder.resource.dir}">
+                <include name="**/*.jsp"/>
+                <include name="**/*.inc"/>
+            </fileset>
+        </copy>
+  </target>
+
+    <!-- Undeploy the Test Recorder from the specified web app
+
+         Params:
+             webapp.dir == the webapp into which to deploy the testRecorder
+     -->
+    <target name="undeploy" description="Undeploy the Test Recorder artifacts 
from the specified webapp">
+        <echo>Undeploy testRecorder from: ${webapp.dir}</echo>
+
+        <property name="webapp.lib" location="${webapp.dir}/WEB-INF/lib"/>
+
+        <delete file="${webapp.lib}/${_testRecorder.jar.name}"/>
+        <delete file="${webapp.lib}/${_httpClient.jar.name}"/>
+        <delete file="${webapp.lib}/${_junit.jar.name}"/>
+        <delete quiet="true">
+            <fileset dir="${webapp.dir}/testRecorder">
+                <include name="*.jsp"/>
+                <include name="*.inc"/>
+                <include name="testResults/*.*"/>
+            </fileset>
+        </delete>
+    </target>
+
+    <!-- Build the test recorder -->
+    <target name="build" description="build the Test Recorder module">
+        <echo>basedir: ${basedir}</echo>
+        <ant dir="${testRecorder.build.dir}" antfile="build.xml" 
target="test.build.module" inheritAll="false">
+            <property name="module.name" value="testRecorder"/>
+        </ant>
+    </target>
+
+    <!-- Clean the test recorder -->
+    <target name="clean" description="clean the Test Recorder module">
+        <ant dir="${testRecorder.build.dir}" antfile="build.xml" 
target="test.clean.module" inheritAll="false">
+            <property name="module.name" value="testRecorder"/>
+        </ant>
+    </target>
+
+    <!--
+        Internal target used to build a config JAR in the format expected by 
the test recorder
+      -->
+    <target name="build.config.jar">
+        <echo>Build Test Recorder config JAR</echo>
+
+        <available property="test.file.available" file="${test.file}"/>
+        <fail unless="test.file.available" message="Can't build Test Recorder 
config JAR; the test file ${test.file} is not available"/>
+        <available property="config.file.available" file="${config.file}"/>
+        <fail unless="config.file.available" message="Can't build Test 
Recorder config JAR; the webapp file ${webapp.file} is not available"/>
+        <available property="webapp.file.available" file="${webapp.file}"/>
+        <fail unless="config.file.available" message="Can't build Test 
Recorder config JAR; the config file ${config.file} is not available"/>
+
+        <mkdir dir="${_testRecorder.config.dir}"/>
+        <delete dir="${_testRecorder.scratch.dir}"/>
+        <property name="_scratch.dir" 
location="${_testRecorder.scratch.dir}/${testRecorder.config.name}"/>
+        <echo>scratch.dir: ${_scratch.dir}</echo>
+        <mkdir dir="${_scratch.dir}"/>
+
+        <copy todir="${_scratch.dir}" overwrite="true">
+            <fileset file="${config.file}"/>
+            <fileset file="${test.file}"/>
+            <filterset>
+                <filter token="BASE_DIR" value="${_testRecorder.base.dir}"/>
+            </filterset>
+        </copy>
+        <copy file="${webapp.file}" 
tofile="${_scratch.dir}/testRecorder-webapp.xml" overwrite="true">
+            <filterset>
+                <filter token="DOMAIN_DIR" value="${app.dir}"/>
+            </filterset>
+        </copy>
+
+        <jar 
jarfile="${_testRecorder.config.dir}/${testRecorder.config.name}.jar">
+            <fileset 
dir="${_testRecorder.scratch.dir}/${testRecorder.config.name}"/>
+        </jar>
+    </target>
+
+    <!--
+        The default playback target for a test recorder suite.  This target 
simply
+        runs the "suite.callback" target with the provided parameters.  It runs
+        only the suite that was specified.
+      -->
+    <target name="_default.callback" unless="playback.target">
+        <antcall target="suite.callback"/>
+    </target>
+
+    <!--
+        A playback target that allows an application to provide a target to 
callback
+        when the tests should be executed.  This allows the application to 
+        override the default behavior of the test suite execution.  For 
example,
+        the application may compose many test suites into a single callback 
target.
+
+        app.build.file:
+        playback.target:
+      -->
+    <target name="_override.callback" if="playback.target">
+        <echo>app.build.file: ${app.build.file}</echo>
+        <echo>playback.target: ${playback.target}</echo>
+        <ant antfile="${app.build.file}" target="${playback.target}"/>
+    </target>
+
+    <!-- 
+        The default callback to run a test suite.
+
+        This target expects to be passed a suite.name property which is the 
name of the 
+        suite of tests to execute.
+
+        suite.name:
+        testRecorder.config.name:
+        waitfor.url:
+        playback.webapps:
+      -->
+    <target name="suite.callback" description="Run a Test Recorder test suite">
+        <fail unless="suite.name" message="No test suite name specified, set 
the -Dsuite.name=&lt;name&gt; property"/>
+
+        <!-- set the path to the config.jar file read by the test recorder -->
+        <condition property="_config.jar" 
value="${_testRecorder.config.dir}/${testRecorder.config.name}.jar">
+            <not><isset property="${_config.jar}"/></not>
+        </condition>
+
+        <!-- ensure that the application is running where it is supposed to be 
given the provided "waitfor.url" -->
+        <waitfor maxwait="5" maxwaitunit="second" 
timeoutproperty="unavailable">
+            <http url="${waitfor.url}"/>
+        </waitfor>
+        <fail if="unavailable" message="Could not reach webapp at 
${waitfor.url} to run the suite ${suite.name}"/>
+
+        <echo>Running suite: ${suite.name}</echo>
+
+        <antcall target="run.suite">
+            <param name="playback.categories" value="${suite.name}"/>
+            <param name="playback.webapps" value="${playback.webapps}"/>
+        </antcall>
+    </target>
+
+</project>

Modified: incubator/beehive/trunk/test/ant/buildWebapp.xml
==============================================================================
--- incubator/beehive/trunk/test/ant/buildWebapp.xml    (original)
+++ incubator/beehive/trunk/test/ant/buildWebapp.xml    Thu Sep 30 19:43:09 2004
@@ -5,127 +5,6 @@
     <property environment="os"/>
     <property file="${os.BEEHIVE_HOME}/beehive.properties"/>
 
-    <property name="tmp.sourcegen.dir" value=".tmpbeansrc"/>
-
-    <!-- ================================================================ -->
-    <!--                                                                  -->
-    <!-- Target for building a test web application                       -->
-    <!--                                                                  -->
-    <!-- The build process includes several steps:                        -->
-    <!-- - build src in WEB-INF/src into WEB-INF/classes                  -->
-    <!-- - build XSDs anywhere in the webapp into WEB-INF/classes         -->
-    <!-- - build all controls in the webapp                               -->
-    <!-- - build all JPFs in the webapp                                   -->
-    <!-- - copy all .properties files in WEB-INF/src to WEB-INF/classes   -->
-    <!-- - copy all .xml files in WEB-INF/src to WEB-INF/classes          -->
-    <!--                                                                  -->
-    <!-- ================================================================ -->
-    <!-- params (location webapp.dir) -->
-    <target name="build.webapp">
-        <available property="webapp.dir.available" file="${webapp.dir}" 
type="dir"/>
-        <fail unless="webapp.dir.available" message="Can't find the webapp 
directory ${webapp.dir}"/>
-
-        <!-- this is the classpath to include when building webapp sources -->
-        <path id="webapp.build.classpath">
-            <pathelement location="${webapp.dir}/WEB-INF/classes"/>
-            <fileset dir="${webapp.dir}/WEB-INF/lib">
-                <include name="*.jar"/>
-            </fileset>
-            <fileset dir="${tomcat.dir}/common/lib">
-                <include name="*.jar"/>
-            </fileset>
-        </path>    
-
-        <!-- 
-            this directory needs to get whacked before every build so 
-            that control interface repackagings don't cause stale
-            files to be compiled 
-          -->
-        <delete dir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}" 
includeEmptyDirs="true"/>
-
-        <mkdir dir="${webapp.dir}/WEB-INF/classes"/>
-
-        <!-- XMLBean build -->
-        <taskdef name="xmlbeanbuild" 
classname="org.apache.xmlbeans.impl.tool.XMLBean" 
-                 classpath="${xbean.jar};${jsr173.jar}"/>
-        <!-- 
-            for schemas to be compiled in the webapp, they must reside in 
-            the WEB-INF/schemas directory.  this is an artifical limitation
-            as it's possible for them to exist anywhere below the webapp root
-            but the XMLBean schema compilation task doesn't seem to handle 
-            .java files correctly during compilation of XSDs (ie by ignoring 
them).  
-
-            @todo: Need to file an Apache bug for this.
-          -->
-        <xmlbeanbuild classpath="${xbean.jar};${jsr173.jar}" 
schema="${webapp.dir}/WEB-INF/schemas" 
-                      classgendir="${webapp.dir}/WEB-INF/classes" 
failonerror="true"/>
-
-        <!-- .java source build -->
-        <echo>========== Complie Java source in WEB-INF/src ==========</echo>
-        <javac srcdir="${webapp.dir}/WEB-INF/src" 
destdir="${webapp.dir}/WEB-INF/classes" 
-               classpathref="webapp.build.classpath"/>
-
-        <!-- this path is separate for now because it includes the velocity 
JARs used in the control compiler -->
-        <path id="controls.build.classpath">
-            <path refid="webapp.build.classpath"/>
-            <fileset dir="${beehive.dir}\external\velocity">
-                <include name="velocity*.jar"/>
-            </fileset>
-        </path>
-
-        <echo>netui-compiler.jar: ${netui-compiler.jar}</echo>
-        <echo>controls.jar: ${controls.jar}</echo>
-
-        <taskdef name="apt" 
classname="org.apache.beehive.controls.runtime.generator.AptTask" 
-                 classpath="${controls.jar};${netui-compiler.jar}" 
onerror="report"/>
-
-        <!-- Controls build -->
-        <!-- apt generates intermediate files Java files into a tmp directory; 
WEB-INF/${tmp.sourcegen.dir} here -->
-        <echo>========== Generate and compile controls ==========</echo>
-        <mkdir dir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}"/>
-        <apt srcdir="${webapp.dir}" destdir="${webapp.dir}/WEB-INF/classes" 
-             gendir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}" 
-             classpathref="controls.build.classpath" 
-             compileByExtension="true" srcExtensions="*.java,*.jcx,*.jcs">
-        </apt>
-
-        <!-- JPF build -->
-        <!-- apt generates intermediate files Java files into a tmp directory; 
WEB-INF/${tmp.sourcegen.dir} here -->
-        <path id="pageflow.build.classpath">
-            <path refid="webapp.build.classpath"/>
-            <fileset file="${netui-compiler.jar}"/>
-        </path>
-
-        <echo>========== Compile Page Flows ==========</echo>
-        <apt srcdir="${webapp.dir}" destdir="${webapp.dir}/WEB-INF/classes" 
-             gendir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}"
-             classpathref="pageflow.build.classpath" 
srcExtensions="*.jpf,*.jpfs,*.app,*.jsfb">
-        </apt>
-
-       <echo>Copy all .properties files</echo>
-        <copy todir="${webapp.dir}/WEB-INF/classes">
-            <fileset dir="${webapp.dir}/WEB-INF/src" 
includes="**/*.properties"/>
-        </copy>
-
-       <echo>Copy all .xml files</echo>
-        <copy todir="${webapp.dir}/WEB-INF/classes/" failonerror="false">
-            <fileset dir="${webapp.dir}/WEB-INF/src" includes="**/*.xml"/>
-        </copy>
-
-    </target>
-
-    <target name="clean.webapp">
-        <available property="webapp.dir.available" file="${webapp.dir}" 
type="dir"/>
-        <fail unless="webapp.dir.available" message="Can't find the webapp 
directory ${webapp.dir}"/>
-
-        <delete dir="${webapp.dir}/WEB-INF/classes" includeEmptyDirs="true"/>
-        <delete dir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}" 
includeEmptyDirs="true"/>
-    </target>
-
-    <target name="usage" description="">
-        <java fork="no" classname="org.apache.tools.ant.Main">
-            <arg line="-projecthelp"/>
-        </java>
-    </target>
+    <import file="buildWebappCore.xml"/>
 
 </project>

Added: incubator/beehive/trunk/test/ant/buildWebappCore.xml
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/test/ant/buildWebappCore.xml        Thu Sep 30 
19:43:09 2004
@@ -0,0 +1,135 @@
+<?xml version="1.0"?>
+
+<!-- ================================================================ -->
+<!--                                                                  -->
+<!--                                                                  -->
+<!--                                                                  -->
+<!--                                                                  -->
+<!--                                                                  -->
+<!-- ================================================================ -->
+<project name="Beehive/CoreWebappBuild" default="usage">
+
+    <property name="tmp.sourcegen.dir" value=".tmpbeansrc"/>
+
+    <!-- ================================================================ -->
+    <!--                                                                  -->
+    <!-- Target for building a test web application                       -->
+    <!--                                                                  -->
+    <!-- The build process includes several steps:                        -->
+    <!-- - build src in WEB-INF/src into WEB-INF/classes                  -->
+    <!-- - build XSDs anywhere in the webapp into WEB-INF/classes         -->
+    <!-- - build all controls in the webapp                               -->
+    <!-- - build all JPFs in the webapp                                   -->
+    <!-- - copy all .properties files in WEB-INF/src to WEB-INF/classes   -->
+    <!-- - copy all .xml files in WEB-INF/src to WEB-INF/classes          -->
+    <!--                                                                  -->
+    <!-- ================================================================ -->
+    <!-- params (location webapp.dir) -->
+    <target name="build.webapp">
+        <available property="webapp.dir.available" file="${webapp.dir}" 
type="dir"/>
+        <fail unless="webapp.dir.available" message="Can't find the webapp 
directory ${webapp.dir}"/>
+
+        <!-- this is the classpath to include when building webapp sources -->
+        <path id="webapp.build.classpath">
+            <pathelement location="${webapp.dir}/WEB-INF/classes"/>
+            <fileset dir="${webapp.dir}/WEB-INF/lib">
+                <include name="*.jar"/>
+            </fileset>
+            <fileset dir="${tomcat.dir}/common/lib">
+                <include name="*.jar"/>
+            </fileset>
+        </path>    
+
+        <!-- 
+            this directory needs to get whacked before every build so 
+            that control interface repackagings don't cause stale
+            files to be compiled 
+          -->
+        <delete dir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}" 
includeEmptyDirs="true"/>
+
+        <mkdir dir="${webapp.dir}/WEB-INF/classes"/>
+
+        <!-- XMLBean build -->
+        <taskdef name="xmlbeanbuild" 
classname="org.apache.xmlbeans.impl.tool.XMLBean" 
+                 classpath="${xbean.jar};${jsr173.jar}"/>
+        <!-- 
+            for schemas to be compiled in the webapp, they must reside in 
+            the WEB-INF/schemas directory.  this is an artifical limitation
+            as it's possible for them to exist anywhere below the webapp root
+            but the XMLBean schema compilation task doesn't seem to handle 
+            .java files correctly during compilation of XSDs (ie by ignoring 
them).  
+
+            @todo: Need to file an Apache bug for this.
+          -->
+        <xmlbeanbuild classpath="${xbean.jar};${jsr173.jar}" 
schema="${webapp.dir}/WEB-INF/schemas" 
+                      classgendir="${webapp.dir}/WEB-INF/classes" 
failonerror="true"/>
+
+        <!-- .java source build -->
+        <echo>========== Complie Java source in WEB-INF/src ==========</echo>
+        <javac srcdir="${webapp.dir}/WEB-INF/src" 
destdir="${webapp.dir}/WEB-INF/classes" 
+               classpathref="webapp.build.classpath"/>
+
+        <!-- this path is separate for now because it includes the velocity 
JARs used in the control compiler -->
+        <path id="controls.build.classpath">
+            <path refid="webapp.build.classpath"/>
+            <fileset dir="${beehive.dir}\external\velocity">
+                <include name="velocity*.jar"/>
+            </fileset>
+        </path>
+
+        <echo>netui-compiler.jar: ${netui-compiler.jar}</echo>
+        <echo>controls.jar: ${controls.jar}</echo>
+
+        <taskdef name="apt" 
classname="org.apache.beehive.controls.runtime.generator.AptTask" 
+                 classpath="${controls.jar};${netui-compiler.jar}" 
onerror="report"/>
+
+        <!-- Controls build -->
+        <!-- apt generates intermediate files Java files into a tmp directory; 
WEB-INF/${tmp.sourcegen.dir} here -->
+        <echo>========== Generate and compile controls ==========</echo>
+        <mkdir dir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}"/>
+        <apt srcdir="${webapp.dir}" destdir="${webapp.dir}/WEB-INF/classes" 
+             gendir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}" 
+             classpathref="controls.build.classpath" 
+             compileByExtension="true" srcExtensions="*.java,*.jcx,*.jcs">
+        </apt>
+
+        <!-- JPF build -->
+        <!-- apt generates intermediate files Java files into a tmp directory; 
WEB-INF/${tmp.sourcegen.dir} here -->
+        <path id="pageflow.build.classpath">
+            <path refid="webapp.build.classpath"/>
+            <fileset file="${netui-compiler.jar}"/>
+        </path>
+
+        <echo>========== Compile Page Flows ==========</echo>
+        <apt srcdir="${webapp.dir}" destdir="${webapp.dir}/WEB-INF/classes" 
+             gendir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}"
+             classpathref="pageflow.build.classpath" 
srcExtensions="*.jpf,*.jpfs,*.app,*.jsfb">
+        </apt>
+
+       <echo>Copy all .properties files</echo>
+        <copy todir="${webapp.dir}/WEB-INF/classes">
+            <fileset dir="${webapp.dir}/WEB-INF/src" 
includes="**/*.properties"/>
+        </copy>
+
+       <echo>Copy all .xml files</echo>
+        <copy todir="${webapp.dir}/WEB-INF/classes/" failonerror="false">
+            <fileset dir="${webapp.dir}/WEB-INF/src" includes="**/*.xml"/>
+        </copy>
+
+    </target>
+
+    <target name="clean.webapp">
+        <available property="webapp.dir.available" file="${webapp.dir}" 
type="dir"/>
+        <fail unless="webapp.dir.available" message="Can't find the webapp 
directory ${webapp.dir}"/>
+
+        <delete dir="${webapp.dir}/WEB-INF/classes" includeEmptyDirs="true"/>
+        <delete dir="${webapp.dir}/WEB-INF/${tmp.sourcegen.dir}" 
includeEmptyDirs="true"/>
+    </target>
+
+    <target name="usage" description="">
+        <java fork="no" classname="org.apache.tools.ant.Main">
+            <arg line="-projecthelp"/>
+        </java>
+    </target>
+
+</project>

Reply via email to