jvanzyl     02/01/17 08:43:22

  Modified:    .        build-test.xml build.xml default.properties
  Log:
  - change the build-test.xml file to reflect the changes while
    adding the runtime test system
  - updated the default.properties to reflect additional jars required
    for testing.
  
  Revision  Changes    Path
  1.8       +251 -16   jakarta-turbine-3/build-test.xml
  
  Index: build-test.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/build-test.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- build-test.xml    3 Jan 2002 04:34:53 -0000       1.7
  +++ build-test.xml    17 Jan 2002 16:43:22 -0000      1.8
  @@ -19,11 +19,46 @@
       <pathelement location="${fulcrum.jar}"/>
       <pathelement location="${servlet.jar}"/>
       <pathelement location="${stratum.jar}"/>
  +    <pathelement location="${cactus.jar}"/>
  +    <pathelement location="${cactus-ant.jar}"/>
  +    <pathelement location="${httpunit.jar}"/>
  +    <pathelement location="${httpclient.jar}"/>
  +    <pathelement location="${tidy.jar}"/>
  +    <pathelement location="${junit.jar}"/>
       <pathelement location="${build.dest}"/>
     </path>
   
     <!-- ================================================================== -->
  -  <!-- T E S T                                                            -->
  +  <!-- C O M P I L E  T E S T S                                           -->
  +  <!-- ================================================================== -->
  +
  +  <target
  +    name="compile"
  +    description="==> compiles the test source code">
  +    
  +    <ant antfile="build.xml" target="compile"/>
  +
  +    <copy todir="${build.src}/org">
  +      <fileset dir="${test.dir}/org"/>
  +      <fileset dir="${rttest.dir}/org"/>
  +    </copy>
  +
  +    <javac srcdir="${build.src}"
  +      destdir="${build.dest}"
  +      includes="**/*Test.java"
  +      excludes="**/package.html"
  +      debug="${debug}"
  +      deprecation="${deprecation}"
  +      optimize="${optimize}">
  +      <classpath refid="classpath"/>
  +      <classpath>
  +        <pathelement path="${build.dest}"/>
  +      </classpath>
  +    </javac>
  +  </target>
  +
  +  <!-- ================================================================== -->
  +  <!-- U N I T  T E S T S                                                 -->
     <!-- ================================================================== -->
   
     <target 
  @@ -44,33 +79,233 @@
         <batchtest todir="${test.reportsDirectory}">
           <fileset dir="${build.dest}">
             <include name="**/*Test*.class"/>
  -          <exclude name="**/BaseTestCase.class"/>
  +          <exclude name="**/*ServletTest.class"/>
           </fileset>
         </batchtest>
       </junit>
     </target>
   
     <!-- ================================================================== -->
  -  <!-- C O M P I L E  T E S T S                                           -->
  +  <!-- S E R V L E T  T E S T S                                           -->
     <!-- ================================================================== -->
   
  -  <target
  -    name="compile"
  -    description="==> compiles the test source code">
  +  <target 
  +    name="test-servlet"
  +    depends="compile,prepare-tests-tomcat-40"
  +    description="--> runs turbine servlet tests">
  +
  +    <taskdef 
  +      name="RunServerTests" 
  +      className="org.apache.cactus.ant.RunServerTestsTask">
  +      <classpath refid="classpath"/>
  +    </taskdef>
  + 
  +    <!--
  +      
  +      Start the servlet engine, wait for it to be started, run the
  +      unit tests, stop the servlet engine, wait for it to be stopped.
  +      The servlet engine is stopped if the tests fail for any reason 
       
  -    <ant antfile="build.xml" target="compile"/>
  +    -->
  + 
  +    <RunServerTests 
  +      testURL="http://localhost:${test.port}/test";
  +      startTarget="start-tomcat-40"
  +      stopTarget="stop-tomcat-40"
  +      testTarget="turbine-servlet-tests"/>
  + 
  +  </target>
  +
  +  <target 
  +    name="turbine-servlet-tests">
       
  -    <javac srcdir="${test.dir}"
  -      destdir="${build.dest}"
  -      excludes="**/package.html"
  -      debug="${debug}"
  -      deprecation="${deprecation}"
  -      optimize="${optimize}">
  -      <classpath refid="classpath"/>
  +    <junit 
  +      printsummary="no" 
  +      haltonfailure="yes" 
  +      haltonerror="yes" 
  +      fork="yes" 
  +      dir="./">
  +      
         <classpath>
  -        <pathelement path="${build.dest}"/>
  +        <path refid="classpath"/>
         </classpath>
  -    </javac>
  +
  +      <sysproperty key="java.compiler" value="NONE" />
  +      <sysproperty key="java.net.namelookup.cache" value="0" />
  +      <sysproperty key="sun.net.inetaddr.ttl" value="0" />
  +      <sysproperty key="test.port" value="${test.port}" />
  +
  +      <formatter type="plain" usefile="false"/>
  +      <batchtest>
  +        <fileset dir="${build.dest}">
  +          <include name="**/*ServletTest.class"/>
  +        </fileset>
  +      </batchtest>
  +    </junit>
  +  </target>
  +
  +  <!-- =================================================================== -->
  +  <!-- S T A R T  T O M C A T  4 . 0                                       -->
  +  <!-- =================================================================== -->
  +  <target 
  +    name="start-tomcat-40">
  + 
  +    <java 
  +      classname="org.apache.catalina.startup.Bootstrap" 
  +      fork="yes">
  +      
  +      <jvmarg value="-Dcatalina.home=${tomcat.home.40}"/>
  +      <arg value="-config"/>
  +      <arg value="${out.tomcat40.full.dir}/conf/server.xml"/>
  +      <arg value="start"/>
  +      <classpath>
  +        <pathelement location="${java.home}/../lib/tools.jar"/>
  +        <fileset dir="${tomcat.home.40}">
  +          <include name="bin/bootstrap.jar"/>                  
  +        </fileset>
  +      </classpath>
  +    </java>
  + 
  +  </target>
  + 
  +  <!-- =================================================================== -->
  +  <!-- S T O P  T O M C A T  4 . 0                                         -->
  +  <!-- =================================================================== -->
  +  <target 
  +    name="stop-tomcat-40">
  + 
  +    <java 
  +      classname="org.apache.catalina.startup.Bootstrap" 
  +      fork="yes">
  +      <jvmarg value="-Dcatalina.home=${tomcat.home.40}"/>
  +      <arg value="stop"/>
  +      <classpath>
  +        <fileset dir="${tomcat.home.40}">
  +          <include name="bin/bootstrap.jar"/>
  +          <include name="server/catalina.jar"/>
  +        </fileset>
  +      </classpath>
  +    </java>
  + 
  +  </target>
  +
  +
  +  <!-- =================================================================== -->
  +  <!-- Display a warning message if the needed servlet engine home         -->
  +  <!-- property is not set                                                 -->
  +  <!-- =================================================================== -->
  +  <target 
  +    name="check-tests-tomcat-40"
  +    depends="testwar"
  +    unless="tomcat.home.40">
  + 
  +    <echo>
  +      
  +      *********************************************************
  +      WARNING : The 'tomcat.home.40' property has not been set.
  +                No test will be run on that servlet engine.
  +      *********************************************************
  +    
  +    </echo>
  + 
  +  </target>
  +
  +  <!-- =================================================================== -->
  +  <!-- C R E A T E  T E S T  W A R  F I L E                                -->
  +  <!-- =================================================================== -->
  +  <target 
  +    name="testwar" 
  +    depends="compile">
  +
  +    <!-- Make sure the directory for the war exist -->
  +    <delete dir="${out.test.dir}"/>
  +    <mkdir dir="${out.test.dir}"/>
  +
  +    <!-- Create the WEB-INF/lib directory that will be used
  +         with the testapp -->
  +    
  +    <mkdir dir="${build.dir}/rttest/lib"/>
  +    <copy file="${cactus.jar}" todir="${build.dir}/rttest/lib"/>
  +    <copy file="${commons-beanutils.jar}" todir="${build.dir}/rttest/lib"/>
  +    <copy file="${commons-collections.jar}" todir="${build.dir}/rttest/lib"/>
  +    <copy file="${commons-util.jar}" todir="${build.dir}/rttest/lib"/>
  +    <copy file="${dom4j.jar}" todir="${build.dir}/rttest/lib"/>
  +    <copy file="${fulcrum.jar}" todir="${build.dir}/rttest/lib"/>
  +    <copy file="${junit.jar}" todir="${build.dir}/rttest/lib"/>
  +    <copy file="${log4j.jar}" todir="${build.dir}/rttest/lib"/>
  +    <copy file="${stratum.jar}" todir="${build.dir}/rttest/lib"/>
  +    <copy file="${velocity.jar}" todir="${build.dir}/rttest/lib"/>
  +
  +    <war 
  +      warfile="${out.test.dir}/test.war" 
  +      webxml="${conf.test.dir}/web.xml">
  +      
  +      <lib dir="${build.dir}/rttest/lib"/>
  +      
  +      <!-- We want to test Turbine's core classes -->
  +      <classes dir="${build.dest}"/>
  +
  +      <fileset dir="${webapp.dir}">
  +        <exclude name="**/CVS/*"/>
  +        <exclude name="**/WEB-INF/web.xml"/>
  +      </fileset>
  +   </war>
  + </target>
  +
  +  <!-- =================================================================== -->
  +  <!-- Prepare directories and variables for running the tests             -->
  +  <!-- =================================================================== -->
  +
  +  <target 
  +    name="prepare-tests-tomcat-40" 
  +    depends="check-tests-tomcat-40" 
  +    if="tomcat.home.40">
  +    
  +    <echo message="tomcat.home.40 = ${tomcat.home.40}"/>
  +
  +    <property name="out.tomcat40.dir" value="${out.test.dir}/tomcat40"/>
  +    <property name="conf.tomcat40.dir" value="${conf.test.dir}/tomcat40"/>
  +    <property name="out.tomcat40.full.dir" value="${basedir}/${out.tomcat40.dir}"/>
  + 
  +    <filter token="out.tomcat40.full.dir" value="${out.tomcat40.full.dir}"/>
  +    <filter token="test.port" value="${test.port}"/>
  + 
  +    <!-- Create work and conf directories and copy configuration files -->
  +    <mkdir dir="${out.tomcat40.dir}/conf"/>
  +    <mkdir dir="${out.tomcat40.dir}/work"/>
  +    <mkdir dir="${out.tomcat40.dir}/webapps"/>
  + 
  +    <!-- Delete some config file so that they will be copied every time -->
  +    <delete file="${out.tomcat40.dir}/conf/server.xml"/>
  + 
  +    <!-- Remove the auto deployed webapp so that it is redeployed every -->
  +    <!-- time.                                                          -->
  +    <delete dir="${out.tomcat40.dir}/webapps/test"/>
  + 
  +    <!-- Copy the default tomcat web.xml to our test conf/ directory. -->
  +    <!-- This is needed otherwise tomcat does not start.              -->
  +    <copy 
  +      file="${tomcat.home.40}/conf/web.xml"
  +      tofile="${out.tomcat40.dir}/conf/web.xml" 
  +      filtering="on"/>
  + 
  +    <copy 
  +      file="${conf.tomcat40.dir}/server.xml"
  +      tofile="${out.tomcat40.dir}/conf/server.xml" 
  +      filtering="on"/>
  + 
  +    <!-- Copy the war file -->
  +    <copy 
  +      file="${out.test.dir}/test.war" 
  +      tofile="${out.tomcat40.dir}/webapps/test.war"/>
  +
  +    <!-- As this classes directory will be used to run the client side
  +         of Cactus, we need to copy the cactus.properties -->
  +    <copy 
  +      todir="${build.dest}" 
  +      file="${conf.test.dir}/cactus.properties" 
  +      filtering="on"/>
  +
     </target>
   
   </project>
  
  
  
  1.17      +8 -2      jakarta-turbine-3/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/build.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- build.xml 16 Jan 2002 16:42:20 -0000      1.16
  +++ build.xml 17 Jan 2002 16:43:22 -0000      1.17
  @@ -35,6 +35,9 @@
       <pathelement location="${stratum.jar}"/>
       <pathelement location="${velocity.jar}"/>
       <pathelement location="${xerces.jar}"/>
  +    <pathelement location="${commons-collections.jar}"/>
  +    <pathelement location="${commons-util.jar}"/>
  +    <pathelement location="${stratum.jar}"/>
       <pathelement location="tdk.jar"/>
     </path>
   
  @@ -373,8 +376,11 @@
       </javac>
   
       <!-- Include the pipeline and valve XML descriptors -->
  -    <copy todir="${build.dest}/org" filtering="yes">
  -      <fileset dir="${src.java.dir}/org" includes="**/*.xml"/>
  +    <copy todir="${build.dest}/conf" filtering="yes">
  +      <fileset dir="${conf.dir}">
  +        <include name="**/*pipeline.xml"/>
  +        <include name="**/*valve.xml"/>
  +      </fileset>
       </copy>
   
     </target>
  
  
  
  1.9       +23 -7     jakarta-turbine-3/default.properties
  
  Index: default.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/default.properties,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- default.properties        16 Jan 2002 16:42:20 -0000      1.8
  +++ default.properties        17 Jan 2002 16:43:22 -0000      1.9
  @@ -10,7 +10,7 @@
   version = 3.0-dev
   project = turbine
   package = org.apache.${project}
  -build.dir = ./bin
  +build.dir = ./target
   build.src = ${build.dir}/src
   build.dest = ${build.dir}/classes
   src.dir = ./src
  @@ -24,10 +24,6 @@
   debug = on
   optimize = off
   deprecation = off
  -adapterCode = true
  -
  -test.dir = ${src.dir}/test
  -test.reportsDirectory = test-reports
   
   # Please see the BUILDING.txt file for information
   # on the locations of where to find each of these 
  @@ -43,10 +39,30 @@
   xerces.jar = ${lib.repo}/xerces-1.4.4.jar
   commons-collections.jar = ${lib.repo}/commons-collections.jar
   commons-util.jar = ${lib.repo}/commons-util-0.1-dev.jar
  -
   stratum.jar = ${lib.repo}/stratum-0.1-dev.jar
   dom4j.jar = ${lib.repo}/dom4j-1.1.jar
   commons-beanutils.jar = ${lib.repo}/commons-beanutils.jar
  +httpclient.jar = ${lib.repo}/httpclient.jar
  +
  +# -------------------------------------------------------------------
  +# T E S T I N G
  +# -------------------------------------------------------------------
  +test.dir = ${src.dir}/test
  +test.reportsDirectory = test-reports
  +rttest.dir = ${src.dir}/rttest
   
  -# Testing
   junit.jar = ${lib.repo}/junit-3.7.jar
  +cactus.jar = ${lib.repo}/cactus.jar
  +cactus-ant.jar = ${lib.repo}/cactus-ant.jar
  +httpunit.jar = ${lib.repo}/httpunit.jar
  +tidy.jar = ${lib.repo}/tidy.jar
  +
  +tomcat.home.40 = ${tdk.home}
  +webapp.dir = ${rttest.dir}/testapp
  +conf.test.dir = ${rttest.dir}/cactus
  +out.test.dir = ${build.dir}/rttest
  +
  +# Port that will be used to start the servlet engines for testing. This is
  +# optional and if omitted will default to 8080. This is used when you don't
  +# want to interfere with a running servlet engine on port 8080.
  +test.port=8180
  
  
  

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

Reply via email to