This patch starts up a copy of tomcat with the watchdog war files, runs 
watchdog against it, and shuts down tomcat afterwards. It uses the Launcher 
to run tomcat in the background, and puts the webapps, work, logs and conf 
directories in a tmp dir so as not to muck up the build.

The only part I really don't like is that there isn't a good way to know that 
tomcat is up and running, so for now there's a sleep between launching tomcat 
and starting the watchdog tests.

Index: build.xml
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-5/build.xml,v
retrieving revision 1.26
diff -u -w -r1.26 build.xml
--- build.xml	13 Aug 2002 16:59:12 -0000	1.26
+++ build.xml	14 Aug 2002 05:05:42 -0000
@@ -29,6 +29,8 @@
            value="${basedir}/../jakarta-tomcat-jasper/jasper2"/>
   <property name="jtc.home"
            value="${basedir}/../jakarta-tomcat-connectors"/>
+  <property name="watchdog.home"
+	   value="${basedir}/../jakarta-watchdog-4.0"/>
 
   <!-- Build Defaults -->
   <property name="catalina.build"   value="${catalina.home}/build"/>
@@ -51,6 +53,7 @@
     <echo message="catalina.home=${catalina.home}"/>
     <echo message="jasper.home=${jasper.home}"/>
     <echo message="jtc.home=${jtc.home}"/>
+    <echo message="watchdog.home=${watchdog.home}"/>
 
     <ant dir="${catalina.home}" target="flags.display"/>
 
@@ -151,6 +154,66 @@
     </ant>
   </target>
 
+  <!-- ======================= WATCHDOG: Run Watchdog Tests================ -->
+  <target name="watchdog"
+   description="Watchdog Servlet Container Tests">
+    <ant dir="${watchdog.home}" target="dist">
+      <property name="servlet23api.home" value="${api.home}"/>
+      <property name="servlet22api.home" value="${basedir}/../jakarta-servletapi"/>
+    </ant>
+    <delete dir="${basedir}/tmp/tomcat"/>
+    <mkdir dir="${basedir}/tmp/tomcat"/>
+    <copy todir="${basedir}/tmp/tomcat/conf">
+      <fileset dir="${tomcat.build}/conf"/>
+    </copy>
+    <copy todir="${basedir}/tmp/tomcat/webapps">
+      <fileset dir="${tomcat.build}/webapps"/> 
+    </copy>
+    <copy todir="${basedir}/tmp/tomcat/work">
+      <fileset dir="${tomcat.build}/work"/> 
+    </copy>
+    <copy todir="${basedir}/tmp/tomcat/logs">
+      <fileset dir="${tomcat.build}/logs"/> 
+    </copy>
+    <copy todir="${basedir}/tmp/tomcat/webapps">
+      <fileset dir="${watchdog.home}/dist/webapps"/>
+    </copy>
+    
+
+    <java classname="LauncherBootstrap" fork="yes">
+      <jvmarg value="-Dcatalina.home=${tomcat.build}"/>
+      <jvmarg value="-Dcatalina.base=${basedir}/tmp/tomcat"/>
+      <arg value="-launchfile"/>
+      <arg value="catalina.xml"/>
+      <arg value="-verbose"/>
+      <arg value="catalina"/>
+      <arg value="start"/>
+      <classpath>
+        <pathelement path="${java.class.path}"/>
+	<pathelement path="${tomcat.build}/bin"/>
+      </classpath>
+    </java>
+
+    <sleep seconds="15"/>
+
+    <ant dir="${watchdog.home}/dist" target="all"/>
+   
+    <java classname="LauncherBootstrap" fork="yes">
+      <jvmarg value="-Dcatalina.home=${tomcat.build}"/>
+      <jvmarg value="-Dcatalina.base=${basedir}/tmp/tomcat"/>
+      <arg value="-launchfile"/>
+      <arg value="catalina.xml"/>
+      <arg value="-verbose"/>
+      <arg value="catalina"/>
+      <arg value="stop"/>
+      <classpath>
+        <pathelement path="${java.class.path}"/>
+	<pathelement path="${tomcat.build}/bin"/>
+      </classpath>
+    </java>
+    
+  </target>
+
 
   <!-- ====================== DIST: Create Directories ==================== -->
   <target name="dist-prepare">

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to