Author: stocco
Date: Mon Dec 13 15:54:54 2004
New Revision: 111765

URL: http://svn.apache.org/viewcvs?view=rev&rev=111765
Log:
This change was submitted by Julie Zhuo.

Code Reviewed by Eddie O'Neil and Steve Tocco

This adds the ability to test NetUI tests against the distribution in a very 
decoupled fashion as the tests are bundled and can be run external from the SVN 
tree.

This will hopefully lead to a unified model to test all aspects against the 
distribution (controls, jws), but that may be a while.

The readme for using this is located in
netui/test/dist-test

To build the test package, launch build.test.dist at the trunk.
Added:
   incubator/beehive/trunk/netui/test/dist-test/
   incubator/beehive/trunk/netui/test/dist-test/README.txt   (contents, props 
changed)
   incubator/beehive/trunk/netui/test/dist-test/ant/
   incubator/beehive/trunk/netui/test/dist-test/ant/build.xml   (contents, 
props changed)
   incubator/beehive/trunk/netui/test/dist-test/ant/buildTestDist.xml   
(contents, props changed)
   incubator/beehive/trunk/netui/test/dist-test/ant/test-dist.properties   
(contents, props changed)
   incubator/beehive/trunk/netui/test/dist-test/ant/testWebBuild.xml   
(contents, props changed)
Modified:
   incubator/beehive/trunk/build.xml

Modified: incubator/beehive/trunk/build.xml
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/build.xml?view=diff&rev=111765&p1=incubator/beehive/trunk/build.xml&r1=111764&p2=incubator/beehive/trunk/build.xml&r2=111765
==============================================================================
--- incubator/beehive/trunk/build.xml   (original)
+++ incubator/beehive/trunk/build.xml   Mon Dec 13 15:54:54 2004
@@ -456,6 +456,19 @@
         <echo message="${testDistro.output}" file="${distroStdout.file}"/>
     </target>
 
+    <!-- =========================================== -->
+    <!--                                             -->
+    <!-- Build Test Module for Distribution Test     -->
+    <!--                                             -->
+    <!-- =========================================== -->
+    <target name="build.test.dist" depends="build.dist" 
+            description="Build and package the test module for testing 
distribution">
+       <ant  dir="${os.BEEHIVE_HOME}/netui/test/dist-test/ant" 
+             antfile="buildTestDist.xml" 
+                 target="build.test.dist"
+                 inheritall="false"/>
+    </target>
+
     <!-- ============================================= -->
     <!--                                               -->
     <!-- Default usage target                          -->

Added: incubator/beehive/trunk/netui/test/dist-test/README.txt
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/dist-test/README.txt?view=auto&rev=111765
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/netui/test/dist-test/README.txt     Mon Dec 13 
15:54:54 2004
@@ -0,0 +1,48 @@
+Follow the following steps to test you Beehive Distribution
+
+1. Extract the Beehive distribution if you are going to test one that not 
included in the package
+2. Make sure the following environment variables are set for the shell,
+         %BEEHIVE_TEST_HOME% ($BEEHIVE_TEST_HOME for unix)
+         %BEEHIVE_HOME% ($BEEHIVE_HOME for unix)
+         %CATALINA_HOME% ($CATALINA_HOME for unix)
+         %ANT_HOME% ($ANT_HOME for unix)
+         %JAVA_HOME% {$JAVA_HOME for unix}
+
+    also make sure that you %JAVA_HOME%\bin and %ANT_HOME%\bin is in your path.
+
+  Here is an example of the script that you might want to use to set your 
environment,
+  *********************
+    @echo off
+    REM
+    REM Customize this file based on where you install various 3rd party 
components
+    REM such as the JDK, Ant and Tomcat, and also the location of the 
distribution 
+    REM you are going to test against.
+    REM
+
+    REM the root of Beehive Test Distribution
+    set BEEHIVE_TEST_HOME=C:\beehive-test-dist
+
+    REM the root of Beehive distribution
+    set 
BEEHIVE_HOME=C:\beehive-test-dist\apache-beehive-incubating-alpha-svn-snapshot
+
+    REM location of a JDK
+    set JAVA_HOME=C:\jdk1.5.0-B64
+
+    REM location of Ant
+    set ANT_HOME=C:\apache-ant-1.6.2
+
+    REM location of Tomcat
+    set CATALINA_HOME=C:\jakarta-tomcat-5.0.25
+
+    set PATH=%PATH%;%JAVA_HOME%\bin;%ANT_HOME%\bin
+  **************************
+
+4. run 'cd %BEEHIVE_TEST_HOME'
+5. run 'ant run.tests'
+
+You will find the test reports in %BEEHIVE_TEST_HOME%\build\testResults 
directory,
+                       testResults\drt.testResults\html\junit-noframes.html 
(Junit drt test results)
+                       testResults\bvt.testResults\html\junit-noframes.html 
(Junit bvt test results)
+                       testResults\testRecorder\drt/html\junit-noframes.html 
(Test Recorder drt test results)
+                       testResults\bvt.testResults\html\junit-noframes.html 
(Junit bvt test results)
+

Added: incubator/beehive/trunk/netui/test/dist-test/ant/build.xml
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/dist-test/ant/build.xml?view=auto&rev=111765
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/netui/test/dist-test/ant/build.xml  Mon Dec 13 
15:54:54 2004
@@ -0,0 +1,100 @@
+<?xml version="1.0"?>
+
+<!-- ================================================================
+
+  This project is a test for Beehive distribution using the test 
+  recorder against a Tomcat web application.  
+
+================================================================ -->
+<project name="Beehive/NetUI/testDistribution" default="usage" basedir=".">
+
+    <property environment="os"/>
+    <property file="test-dist.properties"/>
+    <property file="${os.BEEHIVE_HOME}/beehive.properties"/>
+
+     <path id="test.classpath">
+           <pathelement path="${test.classes.dir}/junitTests"/>
+           <fileset dir="${dist.home}/lib">
+               <include name="**/*.jar"/>
+           </fileset>
+           <pathelement path="${junit.jar}"/>
+           <pathelement path="${servlet24.jar}"/>
+           <pathelement path="${jsp20.jar}"/>
+     </path>
+
+    <!-- ================================================================ -->
+    <!--                                                                  -->
+    <!-- Target to run all drt/bvt tests                                  -->
+    <!--                                                                  -->
+    <!-- ================================================================ -->
+    <target name="run.tests" description="Run all tests">
+       <available property="build.present" file="${build.dir}"/>
+       <antcall target="clean"/>
+       <antcall target="prepare.build"/>
+       <antcall target="dist.drt"/>
+       <antcall target="dist.bvt"/>
+    </target>
+
+    <target name="dist.drt" description="Run the drt tests">
+       <antcall target="junit.drt"/>
+       <antcall target="testRecorder.drt"/>
+    </target>
+
+    <target name="dist.bvt" description="Run the bvt tests">
+       <antcall target="junit.bvt"/>
+       <antcall target="testRecorder.bvt"/>
+    </target>
+
+    <target name="prepare.build" description="Prepare test build area">
+
+       <mkdir dir="build"/>
+       <copy todir="build/webapps">
+           <fileset dir="webapps"/>
+       </copy>
+    </target>
+
+    <target name="clean" if="build.present" description="Clean webapp">
+        <delete dir="${build.dir}"/>
+    </target>
+
+
+    <!-- ================================================================ -->
+    <!--                                                                  -->
+    <!-- Targets for running JUnit test suites                            -->
+    <!--                                                                  -->
+    <!-- ================================================================ -->
+
+    <target name="junit.drt" description="Run JUnit drt test suite">
+      <ant dir="${test.dir}/ant" antfile="junitCore.xml" target="run.tests">
+         <property name="testout.dir" value="${drt.testResults.dir}"/>
+         <reference refid="test.classpath"/> 
+         <property name="formatter.type" value="xml"/>  
+         <property name="fail" value="true"/>
+      </ant>
+    </target>
+
+    <target name="junit.bvt" description="Run JUnit bvt test suite">
+      <ant dir="${test.dir}/ant" antfile="junitCore.xml" target="run.tests">
+         <property name="testout.dir" value="${bvt.testResults.dir}"/>
+         <reference refid="test.classpath"/> 
+         <property name="formatter.type" value="xml"/>  
+         <property name="fail" value="false"/>  
+      </ant>
+    </target>
+
+
+    <!-- ================================================================ -->
+    <!--                                                                  -->
+    <!-- Targets for running test recorder test suites                    -->
+    <!--                                                                  -->
+    <!-- ================================================================ -->
+
+    <target name="testRecorder.drt" description="Run the drt suite with full 
server start / stop support.">
+        <ant antfile="${test.dir}/ant/testWebBuild.xml" inheritAll="false" 
target="drt"/>
+    </target>
+
+    <target name="testRecorder.bvt" description="Run the bvt suite with full 
server start / stop support.">
+        <ant antfile="${test.dir}/ant/testWebBuild.xml" inheritAll="false" 
target="bvt"/>
+     </target>
+
+</project>

Added: incubator/beehive/trunk/netui/test/dist-test/ant/buildTestDist.xml
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/dist-test/ant/buildTestDist.xml?view=auto&rev=111765
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/netui/test/dist-test/ant/buildTestDist.xml  Mon Dec 
13 15:54:54 2004
@@ -0,0 +1,114 @@
+<?xml version="1.0"?>
+
+<project name="Beehive/NetUI/BuildTestDist" default="build.test.dist" 
basedir=".">
+    
+    <property environment="os"/>
+    <property file="${os.BEEHIVE_HOME}/beehive.properties"/>
+    <property file="${os.BEEHIVE_HOME}/netui/ant/netui.properties"/>
+    <property file="${os.BEEHIVE_HOME}/netui/test/ant/test.properties"/>
+
+    <!-- ========================================= -->
+    <!-- Targets for building the standalone test  -->
+    <!-- package for testing Beehive distribution. -->
+    <!-- ========================================= -->   
+    <target name="build.test.dist" description="Build the test package for 
distribution test">
+        <property name="test.dist.base.dir" value="${build.dir}/test-dist"/>
+   
+        <!-- Build the Junit tests and testRecorder -->
+        <ant antfile="${test.dir}/ant/build.xml" target="test.build" 
inheritAll="false"/>
+
+        <!-- Build testRecorder config jar file  -->
+        <ant antfile="${test.dir}/ant/testRecorder.xml" 
target="build.config.jar" inheritAll="false">
+            <property name="testRecorder.config.name" 
value="netui-server-drt-config"/>
+            <property name="test.file" 
location="${app.dir}/drt/testRecorder/config/testRecorder-tests.xml"/>
+            <property name="config.file" 
location="${app.dir}/drt/testRecorder/config/testRecorder-config.xml"/>
+            <property name="webapp.file" 
location="${app.dir}/drt/testRecorder/config/testRecorder-webapp.xml"/>
+        </ant>
+
+        <!-- Clean coreWeb -->
+        <ant antfile="${app.dir}/drt/build.xml" target="clean"/>
+
+        <antcall target="assemble.test.dist"/>
+        <antcall target="package.test.dist"/>
+    </target>
+
+    <target name="assemble.test.dist" description="Build the test package for 
distribution test">
+       <mkdir dir="${test.dist.base.dir}/beehive-test-dist"/>
+
+       <copy todir="${test.dist.base.dir}/beehive-test-dist">
+            <fileset dir="${test.dir}/dist-test" 
+                     includes="README.txt"/>
+            <fileset dir="${test.dir}/dist-test/ant" 
+                     includes="build.xml,test-dist.properties"/>
+       </copy> 
+
+       <copy todir="${test.dist.base.dir}/beehive-test-dist/ant">
+            <fileset dir="${test.dir}/dist-test/ant" 
excludes="build.xml,test-dist.properties,buildTestDist.xml"/>
+       </copy> 
+
+       <copy todir="${test.dist.base.dir}/beehive-test-dist/ant">
+            <fileset dir="${test.dir}/dist-test/ant"
+                 includes="testWebBuild.xml"/>
+       </copy> 
+
+       <copy todir="${test.dist.base.dir}/beehive-test-dist/ant">
+            <fileset dir="${test.dir}/ant"
+                 
includes="testRecorder.xml,testRecorderCore.xml,junitCore.xml"/>
+       </copy> 
+      
+       <copy todir="${test.dist.base.dir}/beehive-test-dist/webapps/coreWeb">
+            <fileset dir="${app.dir}/drt/coreWeb"/>
+       </copy>
+
+       <copy 
todir="${test.dist.base.dir}/beehive-test-dist/junit/junitTests/com">
+            <fileset dir="${test.classes.dir}/junitTests/com"/>
+       </copy>
+
+       <copy 
todir="${test.dist.base.dir}/beehive-test-dist/junit/junitTests/org">
+            <fileset dir="${test.classes.dir}/junitTests/org"/>
+       </copy>
+
+       <copy 
todir="${test.dist.base.dir}/beehive-test-dist/testRecorder/config">
+            <fileset dir="${build.dir}/testRecorder/config"/>
+       </copy>
+
+       <copy 
todir="${test.dist.base.dir}/beehive-test-dist/testRecorder/testRecorder-jsp">
+            <fileset dir="${test.lib.dir}/testRecorder-jsp"/>
+       </copy>
+
+       <copy todir="${test.dist.base.dir}/beehive-test-dist/testRecorder/lib">
+            <fileset dir="${test.lib.dir}" includes="testRecorder.jar"/>
+       </copy>
+
+       <copy todir="${test.dist.base.dir}/beehive-test-dist/testRecorder/lib"
+             file="${httpClient.jar}"/>
+
+       <copy todir="${test.dist.base.dir}/beehive-test-dist/junit/lib"
+             file="${junit.jar}"/>
+
+       <copy todir="${test.dist.base.dir}/beehive-test-dist/conf">
+            <fileset dir="${test.dir}/conf"/>
+       </copy>
+
+       <copy 
todir="${test.dist.base.dir}/beehive-test-dist/testRecorder/tests">
+            <fileset dir="${app.dir}/drt/testRecorder/tests"/>
+       </copy>
+
+       <copy todir="${test.dist.base.dir}/beehive-test-dist">
+            <fileset dir="${dist.base.dir}"/>
+       </copy>
+
+    </target>
+
+    <target name="package.test.dist" description="Build the test package for 
distribution test">
+        <mkdir dir="${beehive.dir}/build/testDistArchives"/>
+        <zip 
destfile="${beehive.dir}/build/testDistArchives/${dist.name}-test.zip" 
+             basedir="${test.dist.base.dir}"
+             excludes="**/*.gz,**/*.sh"/>
+
+        <tar 
destfile="${beehive.dir}/build/testDistArchives/${dist.name}-test.tar.gz" 
+                  basedir="${test.dist.base.dir}" 
+                  excludes="**/*.zip,**/*.cmd" compression="gzip"/>
+    </target>
+
+</project>

Added: incubator/beehive/trunk/netui/test/dist-test/ant/test-dist.properties
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/dist-test/ant/test-dist.properties?view=auto&rev=111765
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/netui/test/dist-test/ant/test-dist.properties       
Mon Dec 13 15:54:54 2004
@@ -0,0 +1,67 @@
+#
+#
+# NetUI Distribution Test Properties
+#
+#
+
+#  Test directory locations
+test.dir=${os.BEEHIVE_TEST_HOME}
+dist.home=${os.BEEHIVE_HOME}
+test.classes.dir=${test.dir}/junit
+build.dir=${test.dir}/build
+
+# Test Webapp properties
+webapp.name=coreWeb
+webapp.dir=${build.dir}/webapps/${webapp.name}
+webapp.waitfor.url=http://localhost:8080/${webapp.name}
+
+# Webapp build properties
+netuiconfig.xml.name=netui-config.xml
+# webappTemplate.webinf.lib=${webapp.dir}/WEB-INF/lib
+
+buildWebapp.ant=${dist.home}/ant/buildWebapp.xml
+
+webapp.waitfor.url=http://localhost:8080/${webapp.name}
+app.build.file=${test.dir}/ant/testWebBuild.xml
+
+tomcat.dir=${os.CATALINA_HOME}
+
+# External JARs
+junit.jar.name=junit.jar
+junit.jar=${test.dir}/junit/lib/${junit.jar.name}
+
+ant-junit.jar=${os.ANT_HOME}/lib/ant-junit.jar
+
+log4j.jar=${webapp.dir}/WEB-INF/lib/log4j-1.2.8.jar
+jsr173.jar=${webapp.dir}/WEB-INF/lib/jsr173_1.0_api.jar
+xbean.jar=${webapp.dir}/WEB-INF/lib/apache-xbean.jar
+
+servlet24.jar=${tomcat.dir}/common/lib/servlet-api.jar
+jsp20.jar=${tomcat.dir}/common/lib/jsp-api.jar
+
+
+# Netui test JARs/resources
+testRecorder.config.name=netui-server-drt-config
+_testRecorder.base.dir=${test.dir}/testRecorder
+_testRecorder.resource.dir=${_testRecorder.base.dir}/testRecorder-jsp
+
+test-recorder.jar.name=testRecorder.jar
+test-recorder.jar=${_testRecorder.base.dir}/lib/${test-recorder.jar.name}
+
+commons-logging.jar=${webapp.dir}/WEB-INF/lib/commons-logging.jar
+httpClient.jar.name=commons-httpclient-2.0.jar
+httpClient.jar=${_testRecorder.base.dir}/lib/${httpClient.jar.name}
+
+drt.testResults.dir=${build.dir}/testResults/drt.testResults
+bvt.testResults.dir=${build.dir}/testResults/bvt.testResults
+
+netui.ant.dir=${test.dir}/ant
+
+drtbvt.maxWait=300
+
+log4jconfig.verbose.junit=${test.dir}/conf/junitLogCfgVerbose.xml
+log4jconfig.junit=${test.dir}/conf/junitLogCfg.xml
+
+
+
+

Added: incubator/beehive/trunk/netui/test/dist-test/ant/testWebBuild.xml
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/dist-test/ant/testWebBuild.xml?view=auto&rev=111765
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/netui/test/dist-test/ant/testWebBuild.xml   Mon Dec 
13 15:54:54 2004
@@ -0,0 +1,204 @@
+<?xml version="1.0"?>
+
+<!-- 
+================================================================
+
+  This project has the dummy build/clean targets and the tomcat
+  start/deploy/redeploy/stop targets to work with testRecorder
+  build files from SVN
+================================================================ 
+-->
+<project name="Beehive/NetUI/TestRecorder-webapp" default="usage" basedir=".">
+
+    <property environment="os"/>
+    <property file="${os.BEEHIVE_TEST_HOME}/test-dist.properties"/>
+    <property file="${os.BEEHIVE_HOME}/beehive.properties"/>
+
+    <!-- ================================================================ -->
+    <!--                                                                  -->
+    <!-- Targets for building a webapp                                    -->
+    <!--                                                                  -->
+    <!-- ================================================================ -->
+    <target name="build" description="Build the coreWeb using the 
distribution">
+
+        <echo message="--------------------------------------------------"/>
+        <echo message="|     NetUI test webApp build starting           |"/>
+        <echo message="--------------------------------------------------"/>
+      
+        <antcall target="update.runtime"/>
+        <antcall target="deploy.testrecorder"/>
+        <ant antfile="${buildWebapp.ant}" target="build.webapp" 
inheritAll="false">
+            <property name="webapp.dir" location="${webapp.dir}"/>
+            <property name="os.BEEHIVE_HOME" location="${dist.home}"/>
+        </ant>
+
+        <echo message="--------------------------------------------------"/>
+        <echo message="|     NetUI test webApp build ending             |"/>
+        <echo message="--------------------------------------------------"/>
+    </target>
+
+    <target name="deploy.testrecorder" description="Deploy the test recorder 
to the test webapp - coreWeb at this time">
+        <echo>Deploying the test recorder to webapp at root: 
${webapp.dir}</echo>
+        <ant antfile="${test.dir}/ant/testRecorder.xml" 
target="deployTestRecorder" inheritAll="false">
+            <property name="os.BEEHIVE_TEST_HOME" location="${test.dir}"/>
+            <property name="os.BEEHIVE_HOME" location="${dist.home}"/>
+            <property file="${test.dir}/test-dist.properties"/>
+        </ant>
+    </target>
+
+    <target name="update.runtime" description="Update the NetUI runtime in the 
webapp without building the resources">
+         <ant antfile="${buildWebapp.ant}" 
target="deploy.beehive.webapp.runtime" inheritAll="false">
+            <property name="webapp.dir" location="${webapp.dir}"/>
+            <property name="os.BEEHIVE_HOME" location="${dist.home}"/>
+        </ant>
+
+        <copy file="${webapp.dir}/WEB-INF/local-netui-config.xml" 
+              tofile="${webapp.dir}/WEB-INF/${netuiconfig.xml.name}" 
+              overwrite="true" failonerror="false"/>
+    </target>
+
+    <target name="clean" description="Dummy Clean">
+        <echo message="Clean the webapp!"/>
+        <delete dir="${webapp.dir}/WEB-INF/lib"/>
+        <delete>
+           <fileset dir="${webapp.dir}/WEB-INF" 
includes="beehive-netui-tags*.*"/>
+        </delete>
+        <delete dir="${webapp.dir}/WEB-INF/classes"/>
+        <delete dir="${webapp.dir}/WEB-INF/.tmpbeansrc"/>
+        <delete dir="${webapp.dir}/WEB-INF/.pageflow-struts-generated"/>
+    </target>
+
+    <!-- ================================================================ -->
+    <!--                                                                  -->
+    <!-- Targets for running test recorder test suites                    -->
+    <!--                                                                  -->
+    <!-- ================================================================ -->
+
+    <target name="drt" description="Run the drt suite with full server start / 
stop support.">
+        <ant dir="${test.dir}" antfile="${test.dir}/ant/testRecorder.xml" 
inheritAll="false" target="server.test">
+             <property name="waitfor.url" value="${webapp.waitfor.url}"/>
+            <property name="suite.name" value="drt"/>
+            <property name="playback.webapps" value="${webapp.name}"/>
+            <property name="drt.mode" value="true"/>
+            <property name="drt.cc.mode" value="true"/>
+            <property name="formatter.type" value="xml"/>           
+            <property name="formatter.usefile" value="true"/> 
+            <property name="os.BEEHIVE_TEST_HOME" value="${test.dir}"/>
+            <property name="os.CATALINA_HOME" value="${tomcat.dir}"/>
+            <property name="os.BEEHIVE_HOME" value="${dist.home}"/>
+            <property name="_report.root.dir" 
value="${test.dir}/build/testResults/testRecorder"/>
+            <property file="${test.dir}/test-dist.properties"/>
+        </ant>
+    </target>
+
+    <target name="bvt" description="Run the bvt suite with full server start / 
stop support.">
+        <ant antfile="${test.dir}/ant/testRecorder.xml" inheritAll="false" 
target="server.test">
+            <property name="waitfor.url" value="${webapp.waitfor.url}"/>
+            <property name="suite.name" value="bvt"/>
+            <property name="playback.webapps" value="${webapp.name}"/>
+            <property name="drt.mode" value="true"/>
+            <property name="drt.cc.mode" value="true"/>
+            <property name="formatter.type" value="xml"/>           
+            <property name="formatter.usefile" value="true"/> 
+            <property name="os.BEEHIVE_TEST_HOME" value="${test.dir}"/>
+            <property name="os.CATALINA_HOME" value="${tomcat.dir}"/>
+            <property name="os.BEEHIVE_HOME" value="${dist.home}"/>
+            <property name="_report.root.dir" 
value="${test.dir}/build/testResults/testRecorder"/>
+            <property file="${test.dir}/test-dist.properties"/>
+        </ant>
+    </target>
+
+    <!-- ================================================================ -->
+    <!--                                                                  -->
+    <!-- Targets for deploying the webapp on a server                     -->
+    <!--                                                                  -->
+    <!-- ================================================================ -->
+    <target name="deploy" description="Deploy webapp">
+        <ant antfile="${buildWebapp.ant}" target="deploy" inheritAll="false">
+            <property name="webapp.dir" location="${webapp.dir}"/>
+            <property name="context.path" value="${webapp.name}"/>
+            <property name="os.BEEHIVE_HOME" value="${dist.home}"/>
+        </ant>
+    </target>
+
+    <target name="undeploy" description="Undeploy webapp">
+        <ant antfile="${buildWebapp.ant}" target="undeploy" inheritAll="false">
+            <property name="webapp.dir" location="${webapp.dir}"/>
+            <property name="context.path" value="${webapp.name}"/>
+            <property name="os.BEEHIVE_HOME" value="${dist.home}"/>
+        </ant>
+    </target>
+
+    <target name="redeploy" description="Redeploy webapp">
+        <ant antfile="${buildWebapp.ant}" target="redeploy" inheritAll="false">
+            <property name="webapp.dir" location="${webapp.dir}"/>
+            <property name="context.path" value="${webapp.name}"/>
+            <property name="os.BEEHIVE_HOME" value="${dist.home}"/>
+        </ant>
+    </target>
+
+    <!-- ================================================================ -->
+    <!--                                                                  -->
+    <!-- Targets for starting / stopping a server                         -->
+    <!--                                                                  -->
+    <!-- ================================================================ -->
+
+    <target name="start" description="Start server with asserts enabled for 
org.apache.beehive.netui">
+        <ant antfile="${buildWebapp.ant}" target="start" inheritAll="false">
+            <property name="java.options" 
value="-ea:org.apache.beehive.netui..."/>
+            <property name="os.CATALINA_HOME" value="${tomcat.dir}"/>
+            <property name="os.BEEHIVE_HOME" value="${dist.home}"/>
+        </ant>
+    </target>
+
+    <target name="stop" description="Stop server">
+        <ant antfile="${buildWebapp.ant}" target="stop" inheritAll="false">
+            <property name="os.CATALINA_HOME" value="${tomcat.dir}"/>
+            <property name="os.BEEHIVE_HOME" value="${dist.home}"/>
+        </ant>
+    </target>
+
+    <target name="ensure.deployed" description="Deploy webapp for the test 
recorder">
+        <echo>Ensuring that the webapp ${webapp.name} is deployed on a running 
server at the url ${webapp.waitfor.url}</echo>
+
+        <waitfor maxwait="5" maxwaitunit="second" 
timeoutproperty="unavailable">
+            <http url="${webapp.waitfor.url}"/>
+        </waitfor>
+        <antcall target="do.deploy"/>
+        <antcall target="do.redeploy"/>
+        <fail if="still.unavailable" message="Couldn't find webapp with path 
${webapp.waitfor.url}"/>
+    </target>
+
+    <target name="do.deploy" if="unavailable">
+        <echo>Webapp is not deployed; deploying</echo>
+
+        <antcall target="deploy"/>
+        <echo>...deploy complete</echo>
+
+        <waitfor maxwait="120" maxwaitunit="second" 
timeoutproperty="still.unavailable">
+            <http url="${webapp.waitfor.url}"/>
+        </waitfor>
+    </target>
+
+    <target name="do.redeploy" unless="unavailable">
+        <echo>Webapp is deployed; undeploy and redeploy</echo>
+
+        <antcall target="undeploy"/>
+        <echo>...undeploy complete</echo>
+
+        <antcall target="deploy"/>
+        <echo>...deploy complete</echo>
+
+        <waitfor maxwait="120" maxwaitunit="second" 
timeoutproperty="still.unavailable">
+            <http url="${webapp.waitfor.url}"/>
+        </waitfor>
+    </target>
+
+    <target name="fix.crlf">
+        <echo>Fix CRLF on file(s) ${file}</echo>
+        <fixcrlf srcdir="." eol="unix">
+            <include name="${file}"/>
+        </fixcrlf>
+    </target>
+
+</project>

Reply via email to