Author: jsong
Date: Fri Jan 28 14:30:55 2005
New Revision: 148942

URL: http://svn.apache.org/viewcvs?view=rev&rev=148942
Log:
Make the test infrastructure more modular.  There are now properties that 
specify
  - Where the test source (junit) lives
  - Where the controls live
  - Where the webapps live
  - Where the build dir is

All these properties are based off of ${controls.test.root}.

CR: Alek Icev

Contributed by Joe Pemberton


Modified:
   incubator/beehive/trunk/controls/test/build.xml
   incubator/beehive/trunk/controls/test/common/path.properties
   incubator/beehive/trunk/controls/test/infra/tch/runtime/build.xml
   incubator/beehive/trunk/controls/test/perf/webapps/build.xml
   incubator/beehive/trunk/controls/test/webapps/build.xml

Modified: incubator/beehive/trunk/controls/test/build.xml
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/build.xml?view=diff&rev=148942&p1=incubator/beehive/trunk/controls/test/build.xml&r1=148941&p2=incubator/beehive/trunk/controls/test/build.xml&r2=148942
==============================================================================
--- incubator/beehive/trunk/controls/test/build.xml     (original)
+++ incubator/beehive/trunk/controls/test/build.xml     Fri Jan 28 14:30:55 2005
@@ -19,54 +19,30 @@
     <taskdef name="mantis"
                 classname="org.apache.beehive.test.tools.mantis.MantisTask"
                 classpathref="mantis.classpath"/>
+                
+    <property name="test.logs" location="${controls.test.root}/logs"/>
+
+    <property name="derby.data" location="${controls.test.root}/test"/>
     <!-- BeeHive test specific properties -->
-    <property name="controls.test.root" location="${basedir}"/>
-    <property name="controls.test.src" location="${controls.test.root}/src"/>
-    <property name="controls.test.units" 
location="${controls.test.src}/units"/>
-    <property name="controls.test.drivers" 
location="${controls.test.src}/drivers"/>
-    <property name="controls.test.controls" 
location="${controls.test.src}/controls"/>
-    <property name="controls.test.auxilaries" 
location="${controls.test.src}/auxilaries"/>
-    <property name="build.dir" location="${basedir}/build"/>
-    <property name="build.classes" location="${build.dir}/classes"/>
-    <property name="build.beans" location="${build.dir}/classes/beans"/>
-    <property name="build.tests" location="${build.dir}/classes/tests"/>
-    <property name="build.drivers" location="${build.dir}/classes/drivers"/>
-    <property name="build.beansrc" location="${build.dir}/beansrc"/>
-    <property name="build.testsrc" location="${build.dir}/testsrc"/>
-    <property name="build.jars" location="${build.dir}/jars"/>
-    <property name="controlstestbeans.jar" 
location="${build.dir}/controlstestbeans.jar"/>
-    <property name="controlstestdrivers.jar" 
location="${build.dir}/controlstestdrivers.jar"/>
-    <property name="test.logs" location="${basedir}/logs"/>
-
-    <property name="mantis.milton.srcgen.dir" location="${build.dir}"/>
-    <property name="mantis.milton.bingen.dir" location="${build.dir}"/>
-    <property name="mantis.milton.control.test.units" 
location="${mantis.milton.srcgen.dir}/testsrcgen"/>
-    <property name="mantis.tch.srcgendir" 
location="${basedir}/mantis.tch.cases"/>
-    <property name="mantis.tch.bingendir" 
location="${basedir}/mantis.bingen.dir"/>
-
-    <property name="mantis.srcgen.dir" location="${basedir}/mantis.tch.cases"/>
-    <property name="mantis.bingen.dir" location="${basedir}/mantis-bingen"/>
-    <property name="mantis.log.dir" location="${basedir}/mantis.tch.logs"/>
 
     <path id="mantis.classpath">
         <pathelement path="${mantis.jar}"/>
-       <path refid="ant-jar.dependency.path"/>
-       <path refid="junit.dependency.path"/>
-       <path refid="servlet.dependency.path"/>
-       <pathelement path="${milton.jar}"/>
-       <pathelement path="${tch.schema.jar}"/>
-       <pathelement path="${mantis.jar}"/>
-       <fileset refid="xbean.fileset"/>
-       <fileset refid="jsr173.fileset"/>
-       <pathelement path="../build/jars/controls.jar"/>
-       <pathelement path="${build.beans}"/>
+        <path refid="ant-jar.dependency.path"/>
+        <path refid="junit.dependency.path"/>
+        <path refid="servlet.dependency.path"/>
+        <pathelement path="${milton.jar}"/>
+        <pathelement path="${tch.schema.jar}"/>
+        <pathelement path="${mantis.jar}"/>
+        <fileset refid="xbean.fileset"/>
+        <fileset refid="jsr173.fileset"/>
+        <pathelement path="../build/jars/controls.jar"/>
+        <pathelement path="${build.beans}"/>
                <pathelement path="${build.drivers}"/>
         <fileset refid="velocity.fileset"/>
     </path>
 
     <property name="mantis.run.classpath" refid="mantis.classpath"/>
 
-    <property name="derby.data" location="${basedir}/test"/>
     <property name="db.control.dir" location="../../samples/controls-db"/>
     <property name="db.control.jar" 
location="${db.control.dir}/build/dbControl.jar"/>
 
@@ -88,6 +64,7 @@
        </not>
     </condition>
 
+    <property name="extra.test.classpath" value=""/>
     <path id="test.classpath">
         <path refid="controls.dependency.path"/>
         <path refid="velocity.dependency.path"/>
@@ -98,6 +75,7 @@
         <pathelement location="${milton.jar}"/>
         <pathelement location="${db.control.jar}"/>
         <pathelement path="${build.beans}"/>
+        <pathelement path="${extra.test.classpath}"/>
     </path>
 
     <path id="tch.run.classpath">
@@ -158,8 +136,11 @@
     <target name="clean" >
         <delete dir="${build.dir}"/>
         <delete dir="${test.logs}"/>
-        <delete dir="${mantis.tch.logs}"/>
-        <delete dir="${mantis.tch.cases}"/>
+        <delete dir="${mantis.tch.log.dir}"/>
+        <delete dir="${mantis.tch.cases.dir}"/>
+        <delete dir="${mantis.milton.log.dir}"/>
+        <delete dir="${mantis.milton.cases.dir}"/>
+
         <delete dir="${derby.data}"/>
         <delete file="derby.log"/>
         <delete file="velocity.log"/>
@@ -174,48 +155,45 @@
     <target name="build" depends="dirs">
         <ant target="build-test-auxilaries"/>
         <ant target="build-test-beans" />
-       <ant target="mantis.milton" />
+        <ant target="mantis.milton" />
         <ant target="build-test-drivers" />
         <ant target="build-test-units" />
         <ant target="mantis.tch" />
     </target>
 
-    <target name="dirs">
-        <mkdir dir="${build.classes}" />
-        <mkdir dir="${build.beans}" />
-        <mkdir dir="${build.drivers}" />
-        <mkdir dir="${build.tests}" />
-        <mkdir dir="${build.beansrc}" />
-        <mkdir dir="${build.testsrc}" />
-        <mkdir dir="${build.jars}" />
-        <mkdir dir="${test.logs}" />
-    </target>
-    
-    <!--
-        Note that properties are passed to dbControl manually. The reason for
-        doing it is: in a dev environment, there is no BEEHIVE_HOME. We don't
-        want to change the sample since it is used as part of the distribution.
-    -->
-    <target name="dbControl">
-        <ant dir="${db.control.dir}" 
-             antfile="build-svn.xml" 
-             target="build"
-             inheritall="false"/>
-    </target>
-    <target name="dbControl-clean">
-        <ant 
-          dir="${db.control.dir}" 
-          antfile="build-svn.xml" 
-          target="clean"
-          inheritall="false"/>
-    </target>
+      <target name="dirs">
+          <mkdir dir="${build.classes}" />
+          <mkdir dir="${build.beans}" />
+          <mkdir dir="${build.drivers}" />
+          <mkdir dir="${build.tests}" />
+          <mkdir dir="${build.beansrc}" />
+          <mkdir dir="${build.testsrc}" />
+          <mkdir dir="${build.jars}" />
+          <mkdir dir="${test.logs}" />
+      </target>
+      
+      <!--
+          Note that properties are passed to dbControl manually. The reason for
+          doing it is: in a dev environment, there is no BEEHIVE_HOME. We don't
+          want to change the sample since it is used as part of the 
distribution.
+      -->
+      <target name="dbControl">
+          <ant dir="${db.control.dir}" 
+               antfile="build-svn.xml" 
+               target="build"
+               inheritall="false"/>
+      </target>
+      <target name="dbControl-clean">
+          <ant 
+            dir="${db.control.dir}" 
+            antfile="build-svn.xml" 
+            target="clean"
+            inheritall="false"/>
+      </target>
 
     <target name="build-test-beans" depends="dirs,build-test-auxilaries">
 
-        <!-- Build the InnerControl controls used by composition tests.  This 
is only
-             necessary because the bean types are needed to compile a public 
interface -->
-        <echo message="** Phase One **"/>
-        <property name="cp" refid="test.classpath"/>
+          <property name="cp" refid="test.classpath"/>
         <echo message="classpath=${cp}"/>
 
         <apt srcdir="${controls.test.controls}" destdir="${build.beans}" 
gendir="${build.beansrc}"
@@ -449,27 +427,25 @@
     </target>
 
     <target name="run">
-
         <gethostname/> <!-- set ${hostname} -->
-
-       <property name="gtlf.dtd.use.remote" value="true"/>
-       <property name="gtlf.dtd.remote" 
value="http://incubator.apache.org/beehive/dtd/gtlf/gtlf-config-2.0.dtd"/>
-       <property name="gtlf.dtd.local" value="infra/gtlf/gtlf-config-2.0.dtd"/>
+        <property name="gtlf.dtd.use.remote" value="true"/>
+        <property name="gtlf.dtd.remote" 
value="http://incubator.apache.org/beehive/dtd/gtlf/gtlf-config-2.0.dtd"/>
+        <property name="gtlf.dtd.local" 
value="infra/gtlf/gtlf-config-2.0.dtd"/>
 
         <property name="test.hostname" value="${hostname}" />
         <property name="test.hostname.port" value="8080" /> <!-- tomcat 
default port -->
-        <property name="test-suite" value="${mantis.srcgen.dir}/root.xml"/>
-       <property name="tch.base-logfile-name" value="tch"/>
+        <property name="test-suite" value="${mantis.tch.srcgen.dir}/root.xml"/>
+        <property name="tch.base-logfile-name" value="tch"/>
 
        <tch tchHome="${tch.home}"
             testfile="${test-suite}"
             fork="true"
             classpathref="tch.run.classpath"
             failureproperty="run.failed"
-            dir="${basedir}">
+            dir="${controls.test.root}">
 
              <arg value="-emacs"/>
-             <property name="tch.replication.entry-point" value="ant -f 
${controls.test.dir}/build.xml run"/>
+             <property name="tch.replication.entry-point" value="ant -f 
${controls.test.root}/build.xml run"/>
              <property name="tch.filter.frequencies" value="${test.freq}"/>
             <sysproperty key="TEST_HOSTNAME" value="${test.hostname}" />
             <sysproperty key="TEST_HOSTNAME_PORT" 
value="${test.hostname.port}" />
@@ -479,9 +455,9 @@
             <sysproperty key="gtlf.dtd.local" value="${gtlf.dtd.local}"/>
        </tch>
        
-       <ant antfile="${controls.test.infra.dir}/tch/runtime/build.xml" 
target="generate-html-log" dir="${basedir}">
-               <property name="gtlf.file" 
value="${basedir}/${tch.base-logfile-name}.xml"/>
-               <property name="output.file" 
value="${basedir}/${tch.base-logfile-name}.html"/>
+       <ant antfile="${controls.test.infra.dir}/tch/runtime/build.xml" 
target="generate-html-log" dir="${controls.test.root}">
+               <property name="gtlf.file" 
value="${controls.test.root}/${tch.base-logfile-name}.xml"/>
+               <property name="output.file" 
value="${controls.test.root}/${tch.base-logfile-name}.html"/>
         </ant>
     </target>  
 
@@ -489,8 +465,6 @@
     <!-- TCH and Mantis targets for running tests -->
     <!-- =============================================== -->
 
-    <property name="junit.src.dir" value="${basedir}/src/units"/>
-  
     <taskdef name="tch"
              classname="org.apache.beehive.test.tools.tch.TchVMTask"
              classpathref="tch.run.classpath"/>
@@ -500,30 +474,33 @@
   <!-- =========================================================== -->
 
   <target name="mantis.tch" description="autogen TCH xml based on test source 
annotations">
-               <delete dir="${mantis.srcgen.dir}"/>
-               <delete dir="${mantis.bingen.dir}"/>
-               <delete dir="${mantis.log.dir}"/>
+               <delete dir="$mantis.tch.srcgen.dir}"/>
+               <delete dir="${mantis.tch.bingen.dir}"/>
+               <delete dir="${mantis.tch.log.dir}"/>
 
     <mantis srcdir="${controls.test.root}"
-               srcgen="${mantis.srcgen.dir}"
-               bingen="${mantis.bingen.dir}"
+               srcgen="${mantis.tch.srcgen.dir}"
+               bingen="${mantis.tch.bingen.dir}"
                classpath="${mantis.run.classpath}"
-               logdir="${mantis.log.dir}"
+               logdir="${mantis.tch.log.dir}"
                config="${mantis.config}"
                timeout="10000"
                aptcommand="${os.JAVA_HOME}/bin/apt">
        <include name="build/testsrcgen/**/*.java"/>
        <include name="src/units/**/*.java"/>
-    </mantis>
+       </mantis>
   </target>
 
   <target name="mantis.milton" description="autogen client code for controls 
drivers">
+               <delete dir="${mantis.milton.srcgen.dir}"/>
+               <delete dir="${mantis.milton.bingen.dir}"/>
+               <delete dir="${mantis.milton.log.dir}"/>
         <mantis srcdir="${controls.test.drivers}"
                includes="**/*.java"
                srcgen="${mantis.milton.srcgen.dir}"
                        bingen="${mantis.milton.bingen.dir}"
                classpath="${mantis.run.classpath}"
-               logdir="${mantis.log.dir}"
+               logdir="${mantis.milton.log.dir}"
                config="${mantis.config}"
                timeout="10000"
                
processor="org.apache.beehive.test.tools.milton.mantis.MiltonProcessor"

Modified: incubator/beehive/trunk/controls/test/common/path.properties
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/common/path.properties?view=diff&rev=148942&p1=incubator/beehive/trunk/controls/test/common/path.properties&r1=148941&p2=incubator/beehive/trunk/controls/test/common/path.properties&r2=148942
==============================================================================
--- incubator/beehive/trunk/controls/test/common/path.properties        
(original)
+++ incubator/beehive/trunk/controls/test/common/path.properties        Fri Jan 
28 14:30:55 2005
@@ -3,8 +3,28 @@
 
 #directories
 controls.dir=${beehive.home}/controls
-controls.test.dir=${controls.dir}/test
-controls.test.infra.dir=${controls.test.dir}/infra
+controls.test.root=${controls.dir}/test
+controls.test.infra.dir=${controls.dir}/test/infra
+
+!-- BeeHive test specific properties -->
+controls.test.src=${controls.test.root}/src
+controls.test.units=${controls.test.src}/units
+controls.test.drivers=${controls.test.src}/drivers
+controls.test.controls=${controls.test.src}/controls
+controls.test.auxilaries=${controls.test.src}/auxilaries
+
+controls.test.webapp.root=${controls.test.root}/webapps
+
+build.dir=${controls.test.root}/build
+build.classes=${build.dir}/classes
+build.beans=${build.dir}/classes/beans
+build.tests=${build.dir}/classes/tests
+build.drivers=${build.dir}/classes/drivers
+build.beansrc=${build.dir}/beansrc
+build.testsrc=${build.dir}/testsrc
+build.jars=${build.dir}/jars
+controlstestbeans.jar=${build.dir}/controlstestbeans.jar
+controlstestdrivers.jar=${build.dir}/controlstestdrivers.jar
 
 external.dir=${beehive.home}/external
 
@@ -15,7 +35,7 @@
 tch.xbean.jar=${tch.home}/xbean-1.0.2.jar
 
 milton.jar=${controls.test.infra.dir}/milton/milton.jar
-milton.templates=${controls.test.dir}/webapps/common/milton
+milton.templates=${controls.test.root}/webapps/common/milton
 
 crimson.jar=${external.dir}/crimson/crimson-1.1.jar
 jakarta.jar=${external.dir}/jakarta/jakarta-regexp-1.2.jar
@@ -31,3 +51,15 @@
 tchschema.jar=${mantis.home}/tchschema.jar
 mantis.xbean.jar=${mantis.home}/xbean-1.0.2.jar
 mantis.config=${mantis.home}/mantis.properties
+
+
+mantis.runtime.basedir=${controls.test.root}
+
+mantis.milton.srcgen.dir=${build.dir}/mantis.milton.srcgen
+mantis.milton.bingen.dir=${build.dir}/mantis.milton.bingen
+mantis.milton.log.dir=${build.dir}/mantis.milton.logs
+mantis.milton.control.test.units=${mantis.milton.srcgen.dir}/testsrcgen
+    
+mantis.tch.srcgen.dir=${build.dir}/mantis.tch.cases
+mantis.tch.bingen.dir=${build.dir}/mantis.tch.bingen
+mantis.tch.log.dir=${build.dir}/mantis.tch.logs

Modified: incubator/beehive/trunk/controls/test/infra/tch/runtime/build.xml
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/infra/tch/runtime/build.xml?view=diff&rev=148942&p1=incubator/beehive/trunk/controls/test/infra/tch/runtime/build.xml&r1=148941&p2=incubator/beehive/trunk/controls/test/infra/tch/runtime/build.xml&r2=148942
==============================================================================
--- incubator/beehive/trunk/controls/test/infra/tch/runtime/build.xml   
(original)
+++ incubator/beehive/trunk/controls/test/infra/tch/runtime/build.xml   Fri Jan 
28 14:30:55 2005
@@ -8,7 +8,7 @@
   <property name="tch.base-logfile-name" value="tch"/>
 
   <!-- the tch logs go into the dir ant is run from by default -->
-  <property name="log.basedir.default" location="${controls.test.dir}"/>
+  <property name="log.basedir.default" location="${controls.test.root}"/>
 
   <!-- the tch logs go into the dir ant is run from -->
   <property name="tch.log.basedir" value="${log.basedir.default}"/>

Modified: incubator/beehive/trunk/controls/test/perf/webapps/build.xml
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/perf/webapps/build.xml?view=diff&rev=148942&p1=incubator/beehive/trunk/controls/test/perf/webapps/build.xml&r1=148941&p2=incubator/beehive/trunk/controls/test/perf/webapps/build.xml&r2=148942
==============================================================================
--- incubator/beehive/trunk/controls/test/perf/webapps/build.xml        
(original)
+++ incubator/beehive/trunk/controls/test/perf/webapps/build.xml        Fri Jan 
28 14:30:55 2005
@@ -72,7 +72,7 @@
                </copy>
 
                <!-- inject stuff -->
-    <ant antfile="${controls.test.dir}/webapps/build.xml" 
target="-inject.milton" inheritAll="false">
+    <ant antfile="${controls.test.root}/webapps/build.xml" 
target="-inject.milton" inheritAll="false">
         <property name="webapp.dir" 
location="${webapp.stage.dir}/${webapp.name}"/>
         <property name="do.inject.milton" value="true"/>
     </ant>
@@ -90,6 +90,10 @@
                </copy>
 
                <!-- inject stuff -->
+    <ant antfile="${controls.test.root}/webapps/build.xml" 
target="-inject.milton" inheritAll="false">
+        <property name="webapp.dir" 
location="${webapp.stage.dir}/${webapp.name}"/>
+        <property name="do.inject.milton" value="true"/>
+    </ant>
            <ant antfile="${controls.test.dir}/webapps/build.xml" 
target="-inject.milton" inheritAll="false">
                <property name="webapp.dir" 
location="${webapp.stage.dir}/${webapp.name}"/>
                <property name="do.inject.milton" value="true"/>

Modified: incubator/beehive/trunk/controls/test/webapps/build.xml
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/webapps/build.xml?view=diff&rev=148942&p1=incubator/beehive/trunk/controls/test/webapps/build.xml&r1=148941&p2=incubator/beehive/trunk/controls/test/webapps/build.xml&r2=148942
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/build.xml     (original)
+++ incubator/beehive/trunk/controls/test/webapps/build.xml     Fri Jan 28 
14:30:55 2005
@@ -42,14 +42,14 @@
 
     <target name="-init">
 
-        <property name="webapp.build.dir" location="../build/webapps"/>
+        <property name="webapp.build.dir" location="${build.dir}/webapps"/>
         <property name="webapp.dir" 
location="${webapp.build.dir}/${webapp.name}"/>
        
         <available file="${webapp.dir}" property="webapp.dir.present"/>
 
         <mkdir dir="${webapp.build.dir}"/>
 
-        <property file="${webapp.name}/app.properties"/>
+        <property 
file="${controls.test.webapp.root}/${webapp.name}/app.properties"/>
 
         <condition property="do.inject.netui">
            <istrue value="${app.inject.netui}"/>
@@ -78,12 +78,15 @@
         <condition property="do.inject.test.drivers.jar">
            <equals arg1="${app.inject.test.drivers}" arg2="jar"/>
         </condition>
+        <condition property="do.inject.test.controlhaus.jars">
+           <istrue value="${app.inject.controlhaus.jars}"/>
+        </condition>
     </target>
 
     <!-- webapps are copied into a staging directory where additional build 
steps can be performed -->
     <target name="stage.webapp" depends="-init">
         <copy todir="${webapp.dir}" overwrite="true">
-           <fileset dir="${webapp.name}"/>
+           <fileset dir="${controls.test.webapp.root}/${webapp.name}"/>
         </copy>
     </target>
 
@@ -97,7 +100,9 @@
         <echo message="|    Beehive Controls controlsWeb build starting    |"/>
         <echo message="-----------------------------------------------------"/>
 
-       <antcall target="stage.webapp"/>
+        <!-- webapps are copied into a staging directory where additional 
build steps 
+             can be performed -->
+        <antcall target="stage.webapp"/>
         <antcall target="-inject.netui"/>
         <antcall target="-inject.wsm"/>
         <antcall target="-inject.milton"/>
@@ -105,6 +110,7 @@
         <antcall target="-inject.dbControl"/>        
         <antcall target="-inject.test.controls"/>
         <antcall target="-inject.test.drivers"/>
+        <antcall target="-inject.test.controlhaus"/>
         <antcall target="-build.webapp"/>
 
         <echo message="----------------------------------------------"/>
@@ -204,18 +210,27 @@
               verbose="true" overwrite="true"/>
     </target>
 
+    <target name="-inject.test.controlhaus" 
if="do.inject.test.controlhaus.jars">
+        <echo message="Injecting Controlhaus Jars"/>
+        <copy todir="${webapp.dir}/WEB-INF/lib" overwrite="true" 
verbose="true">
+            <fileset dir="${controlhaus.jars}">
+                <include name="*.jar"/>
+            </fileset>
+        </copy>
+    </target>
+
     <target name="clean" description="Clean webapp" depends="-init" 
if="webapp.dir.present">
         <echo message="----------------------------------------------"/>
-        <echo message="|     Controls controlsWeb clean starting    |"/>
+        <echo message="|     Controls ${webapp.name} clean starting    |"/>
         <echo message="----------------------------------------------"/>
 
         <undeploy-netui webappDir="${webapp.dir}"/>
 
-        <delete dir="${staging.dir}"/>
+        <delete dir="${webapp.build.dir}"/>
         <delete file="velocity.log"/>
 
         <echo message="----------------------------------------------"/>
-        <echo message="|     Controls controlsWeb clean ending      |"/>
+        <echo message="|     Controls ${webapp.name} clean ending      |"/>
         <echo message="----------------------------------------------"/>
     </target>
 

Reply via email to