You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by su...@accenture.com on 2007/08/27 14:38:45 UTC

Unable to run cactus tests on Tomcat 5.5.23(Urgent help required)

Hi,

  I am trying to execute cactus test cases using an ant build script. I am using jakarta-cactus-12-1.7 and ant 1.6.5. I am running the test scripts on Tomcat 5.5.23.... The build script successfully generates the war and cactify war file, however it hangs while executing the test cases. It displays the message as shown below:

test:
   [cactus] -----------------------------------------------------------------
   [cactus] Running tests against Tomcat 5.5.23 @ http://localhost:8080
   [cactus] -----------------------------------------------------------------


My build files is as follows:

<?xml version="1.0"?>
<project name="bwStripesCactus" default="dist" basedir=".">

      <!-- Give user a chance to override without editing this file
       (and without typing -D each time it compiles it) -->
      <property file="build.properties" />
      <property file="D:\workspaceLombo\bwStripesCactus\build.properties"/>

      <!-- Global project properties -->
      <property name="project.name.text" value="bwStripesCactus"/>
      <property name="project.name.file" value="bwStripesCactus"/>
      <property name="project.version" value="1.7"/>

      <!-- Prefix to add to all distributable files -->
      <property name="project.prefix" value="barclays-"/>

      <!-- Generic properties -->
      <property name="year" value="2000-2007"/>
      <property name="debug" value="on"/>
      <property name="optimize" value="off"/>
      <property name="deprecation" value="off"/>

      <!-- Properties for the Cactus tests -->
      <property name="cactus.port" value="8080"/>

      <!-- Location where the logging properties files are located -->
      <property name="base.dir" location="."/>

      <!--
     ========================================================================
       Set the properties related to the source tree.
     ========================================================================
  -->
      <property name="src.dir" location="src"/>
      <property name="src.java.dir" location="${src.dir}"/>
      <property name="src.conf.dir" location="${src.dir}/conf"/>
      <property name="src.cactus.dir" location="test-cactus"/>
      <property name="test.conf.dir" location="${src.cactus.dir}/config"/>
      <property name="src.webapp.dir" location="WebContent"/>
      <property name="src.webinf.dir" location="${src.webapp.dir}/WEB-INF"/>

      <!--
     ========================================================================
       Set the properties related to the target area
     ========================================================================
  -->
      <!-- Destination locations for the build -->
      <property name="target.dir" location="target"/>
      <property name="target.classes.dir" location="${target.dir}/classes"/>
      <property name="target.classes.java.dir"
      location="${target.classes.dir}"/>
      <property name="target.classes.cactus.dir"
      location="${target.classes.dir}/cactus"/>
      <property name="target.testreports.dir"
      location="${target.dir}/test-reports"/>
      <property name="cactus.lib.dir"
      location="C:/Program Files/jakarta-cactus-12-1.7/lib"/> 
      <property name="ant.lib.dir"
      location="C:/Program Files/apache-ant-1.6.5/lib"/>
      <property name="tomcat.lib.dir"
      location="C:/Program Files/Apache Software Foundation/apache-tomcat-5.5.23/common/lib"/>
      <property name="tomcat.web.dir"
      location="C:/Program Files/Apache Software Foundation/apache-tomcat-5.5.23/webapps"/>
      <property name="tomcat.work.dir"
      location="C:/Program Files/Apache Software Foundation/apache-tomcat-5.5.23/work/Catalina/localhost"/>
      <!-- Distribution directory, i.e. where the expanded distibutable files
       are located -->
      <property name="dist.dir" location="dist"/>

      <!--
     ========================================================================
       Set the properties related to the required libraries
     ========================================================================
  -->

      <!-- Libraries required for the sample project -->
      <property name="servlet.jar"
      location="${cactus.lib.dir}/servletapi-2.2.jar"/>
      
      <!--<property name="jstl.jar"
      location="${cactus.lib.dir}/jstl-1.0.2.jar"/>
  <property name="standard.jar"
      location="${cactus.lib.dir}/standard.jar"/>
  -->
      <path id="project.classpath">
            <pathelement location="${servlet.jar}"/>
            <!--   <pathelement location="${jstl.jar}"/>
 <pathelement location="${standard.jar}"/>  -->
      </path>

      <!-- Libraries required for the Cactus tests -->
      <property name="aspectjrt.jar"
      location="${cactus.lib.dir}/aspectjrt-1.2.1.jar"/>
      <property name="cactus.jar"
      location="${cactus.lib.dir}/cactus-1.7.jar"/>
      <property name="cactus.ant.jar"
      location="${cactus.lib.dir}/cactus-ant-1.7.jar"/>
      <property name="cargo.jar"
      location="${cactus.lib.dir}/cargo-0.5.jar"/>
      <property name="commons.httpclient.jar"
      location="${cactus.lib.dir}/commons-httpclient-2.0.2.jar"/>
      <property name="commons.logging.jar"
      location="${cactus.lib.dir}/commons-logging-1.0.4.jar"/>
      <property name="httpunit.jar"
      location="${cactus.lib.dir}/httpunit-1.6.jar"/>
      <property name="junit.jar"
      location="${cactus.lib.dir}/junit-3.8.1.jar"/>
      <property name="nekohtml.jar"
      location="${cactus.lib.dir}/nekohtml-0.9.1.jar"/>
      <property name="clover.jar"
      location="${cactus.lib.dir}/clover.jar"/>
      <!-- This is optional and only needed if you wish to debug and use 
       Log4J for logging -->
      <property name="log4j.jar"
      location="${cactus.lib.dir}/log4j-1.2.14.jar"/>

      <path id="cactus.classpath">
            <path refid="project.classpath"/>
            <pathelement location="${aspectjrt.jar}"/>
            <pathelement location="${cactus.jar}"/>
            <pathelement location="${cactus.ant.jar}"/>
            <pathelement location="${cargo.jar}"/>
            <pathelement location="${commons.httpclient.jar}"/>
            <pathelement location="${commons.logging.jar}"/>
            <pathelement location="${junit.jar}"/>
      </path>

      <!--
     ========================================================================
       Initialize the build. Must be called by all targets
     ========================================================================
  -->
      <target name="init">
            
            <condition property="properties.ok">
                  <and>
                        <available file="${servlet.jar}"/>
                        <!--   <available file="${jstl.jar}"/>
            <available file="${standard.jar}"/>  -->
                  </and>
            </condition>
            <fail unless="properties.ok">Missing property or property pointing to an invalid file
(check your build.properties file)</fail>

            <taskdef resource="cactus.tasks" classpathref="cactus.classpath"/>

            <tstamp/>

      </target>

      <!--
     ========================================================================
       Compiles the sources
     ========================================================================
  -->
      <!-- Compiles the java sources -->
      <target name="compile.java" depends="init">

            <mkdir dir="${target.classes.java.dir}"/>
            <javac destdir="${target.classes.java.dir}"
        deprecation="${deprecation}" optimize="${optimize}">
                  <src path="${src.java.dir}"/>
                  <classpath>
                        <path refid="project.classpath"/>
                  </classpath>
            </javac>

      </target>

      <!-- Compiles the Cactus test sources -->
      <target name="compile.cactus" depends="compile.java">

            <mkdir dir="${target.classes.cactus.dir}"/>
            <javac destdir="${target.classes.cactus.dir}"
        deprecation="${deprecation}" optimize="${optimize}">
                  <src path="${src.cactus.dir}"/>
                  <classpath>
                        <path refid="cactus.classpath"/>
                        <pathelement location="${httpunit.jar}"/>
                        <pathelement location="${nekohtml.jar}"/>
                        <pathelement location="${target.classes.java.dir}"/>
                  </classpath>
            </javac>

      </target>

      <target name="compile" depends="compile.java, compile.cactus"
      description="Compile the sources"/>

      <!--
     ========================================================================
       Create the runtime war file
     ========================================================================
  -->
      <target name="war" depends="compile.java"
      description="Generate the runtime war">
            <war destfile="${target.dir}/${project.name.file}.war" basedir="${basedir}"
         webxml="${src.webinf.dir}/web.xml" casesensitive="off" update="false">
                  <fileset dir="${src.webapp.dir}" casesensitive="false" >
                        <exclude name="${src.webapp.dir}\cactus-report.xsl"/>
                        <exclude name="${src.webinf.dir}\web.xml"/>
                        <exclude name="${src.webinf.dir}\cactus-web.xml"/>
                  </fileset>
                  <classes dir="${target.classes.java.dir}"/>
                  <!--     <lib file="${jstl.jar}"/>
  <lib file="${standard.jar}"/> -->
            </war>

      </target>

      <!--
     ========================================================================
       Generate the distributable files
     ========================================================================
  <target name="dist" depends="clean, war, test.prepare"
  -->
      <target name="dist" depends="clean, war, test"
      description="Generate the distributable files">
            <copy todir="${dist.dir}"
        file="${target.dir}/${project.name.file}.war"/>
            <copy todir="${cactus.home.tomcat5x}/webapps"
        file="${target.dir}/${project.name.file}.war"/>
      </target>

      <!--
     ========================================================================
       Clean generated files (including distributables)
     ========================================================================
  -->
      <target name="clean" depends="init" description="Clean all generated files">

            <delete dir="${target.dir}" quiet="true"/>
            <delete dir="${dist.dir}" quiet="true"/>
            <delete dir="${tomcat.web.dir}/bwStripesCactus" quiet="true"/>
            <delete dir="${tomcat.web.dir}/bwStripesCactus-cactified" quiet="true"/>
            <delete file="${tomcat.web.dir}/bwStripesCactus.war" quiet="true"/>
            <delete file="${tomcat.web.dir}/bwStripesCactus-cactified.war" quiet="true"/>
            <delete dir="${tomcat.work.dir}/bwStripesCactus" quiet="true"/>
            <delete dir="${tomcat.work.dir}/bwStripesCactus-cactified" quiet="true"/>
      </target>

      <!--
     ========================================================================
       Run the tests on the containers for which the Ant property
       "cactus.home.[container name]" has been defined.
     ========================================================================
  -->
      <target name="test.prepare.logging">

            <!-- Convert the path to logging_*.properties to use forward slashes
           so that it works when loaded as a String in Java (backslashes
           won't work. -->
            <pathconvert property="target.dir.normalized" dirsep="/">
                  <path>
                        <pathelement location="${target.dir}"/>
                  </path>
            </pathconvert>
            <copy todir="${target.dir}" filtering="on" failonerror="false">
                  <fileset dir="${test.conf.dir}">
                        <include name="logging_client.properties"/>
                        <include name="logging_server.properties"/>
                        <include name="cactus.properties"/>
                  </fileset>
                  <filterset>
                        <filter token="target.dir" value="${target.dir.normalized}"/>
                  </filterset>
            </copy>
            <!-- Make sure logging_*.properties files exist, even if empty -->
            <touch file="${target.dir}/logging_client.properties"/>
            <touch file="${target.dir}/logging_server.properties"/>

      </target>

      <target name="test.prepare" 
      depends="war, compile.cactus, test.prepare.logging">

            <!-- Cactify the web-app archive -->
            <cactifywar srcfile="${target.dir}/${project.name.file}.war"
        destfile="${target.dir}/${project.name.file}-cactified.war"
        mergewebxml="${src.webinf.dir}/cactus-web.xml">

                  <classes dir="${target.classes.cactus.dir}" includes="**/*.class"/>
                  <lib file="${httpunit.jar}"/>
                  <lib file="${log4j.jar}"/>
                  <!-- Provide a secured servlet redirector in addition to the
           default servlet redirector -->
                  <servletredirector/>
                  <servletredirector name="ServletRedirectorSecure"
          mapping="/ServletRedirectorSecure" roles="test"/>
                  <filterredirector mapping="/test/filterRedirector.jsp"/>
                  <!-- Needed for Clover coverage reports -->
                  <lib file="${clover.jar}"/>
            </cactifywar>
            <copy todir="${cactus.home.tomcat5x}/webapps"
        file="${target.dir}/${project.name.file}-cactified.war"/>
            <!-- Prepare the directories for the JUnit reports -->
            <mkdir dir="${target.testreports.dir}"/>
            <mkdir dir="${target.testreports.dir}/tomcat5x"/>
      </target>

      <target name="test" depends="test.prepare"
      description="Run the tests on the defined containers">

            <!-- Run the tests -->
            <cactus warfile="${target.dir}/${project.name.file}-cactified.war"
        fork="yes" failureproperty="tests.failed" haltonfailure="off" showoutput="on" printsummary="withOutAndErr">

                  <!-- Configure the cactus task for logging -->
                  <cactusproperty server="false"
          propertiesFile="${target.dir.normalized}/logging_client.properties"/>
                  <cactusproperty server="true"
          propertiesFile="${target.dir.normalized}/logging_server.properties"/>

                  <!-- Additional jars that will be added to the classpath used to start the
           container (in addition to the container jars themseleves which are
           automatically added by the <cactus> task -->
                  <containerclasspath>
                        <pathelement location="${clover.jar}"/>
                  </containerclasspath>

                  <classpath>
                        <path refid="project.classpath"/>
                        <pathelement location="${clover.jar}"/>
                        <pathelement location="${httpunit.jar}"/>
                        <pathelement location="${nekohtml.jar}"/>
                        <pathelement location="${target.classes.java.dir}"/>
                        <pathelement location="${target.classes.cactus.dir}"/>
                        <pathelement location="${log4j.jar}"/>
                  </classpath>

                  <containerset>
                        <tomcat5x if="cactus.home.tomcat5x" 
            dir="${cactus.home.tomcat5x}" port="${cactus.port}"
            output="${target.testreports.dir}/tomcat5x.out"
            todir="${target.testreports.dir}/tomcat5x"/>
                  </containerset>

                  <formatter type="brief" usefile="false"/>
                  <formatter type="xml"/>

                  <batchtest>
                        <fileset dir="${src.cactus.dir}">
                              <!-- Due to some Cactus synchronization bug, the 'unit' tests need
               to run before the 'sample' tests -->
                              <include name="**/Test*.java"/>
                              <exclude name="**/Test*All.java"/>
                        </fileset>
                  </batchtest>
                  <batchtest>
                        <fileset dir="${src.cactus.dir}">
                              <include name="**/Test*.java"/>
                              <exclude name="**/Test*All.java"/>
                        </fileset>
                  </batchtest>

            </cactus>

            <!-- Generate the JUnit reports -->
            <junitreport todir="${target.testreports.dir}/tomcat5x">
                  <fileset dir="${target.testreports.dir}/tomcat5x"
          includes="TEST-*.xml"/>
                  <report todir="${target.testreports.dir}/tomcat5x"
          format="frames"/>
            </junitreport>

            <fail if="tests.failed">At least one test failed!</fail>

      </target>
</project>

Please let me know if anybody has come across this issue.. I am not getting any clue as nothing is getting generated in logs anywhere... Quick response is much appreciated...

Thanks
Sujeet


This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.