jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pedro Nevado" <pnev...@javato.com>
Subject Problem with runservertests task _and solution.
Date Tue, 07 Sep 2004 10:25:46 GMT
I will answer myself my yesterday post, in case someone suffer from the same
naivety I do in respect of the internals of Tomcat. So, please, expert
readers allow me some obviousness.

The ant script to run Cactus tests with Servlet 2.4 especification is:

<target name="run_testCactus" depends="new_contextCactus">
        <runservertests
            testurl="${cactus.contextURL}"
            starttarget="start.tomcat5"
            stoptarget="stop.tomcat5"
            testtarget="testCactus"/>
    </target>

    <target name="testCactus" depends="clean_testCactus">
        <mkdir dir="${testCactus.reports.dir}"/>
        <junit printsummary="false" haltonerror="false"
haltonfailure="false"
               fork="${junit.fork}"
               errorproperty="testCactus.failed"
               failureproperty="testCactus.failed"
            >
            <formatter type="plain" usefile="false" />
            <formatter type="xml" />
            <classpath>
                <pathelement path="${testCactus.path}"/>
                <pathelement location="${log4j.jar}" />
            </classpath>
            <assertions>
                <enable package="com.espivo.vivoen"/>
            </assertions>
            <batchtest todir="${testCactus.reports.dir}" unless="testClass"
>
               <fileset dir="${testCactus.build.class.dir}"
includes="**/*Test.class" />
            </batchtest>
        </junit>
        <junitreport todir="${testCactus.reports.dir}">
            <fileset dir="${testCactus.reports.dir}" includes="TEST-*.xml"/>
            <report todir="${testCactus.reports.dir}/html" format="frames"/>
        </junitreport>
        <fail if="testCactus.failed">At least one test failed after making
report!</fail>
    </target>

    <target name="start.tomcat5">
        <java classname="org.apache.catalina.startup.Bootstrap"
            failonerror="yes" fork="true">
            <jvmarg value="-Dcatalina.home=${env.CATALINA_HOME}"/>
            <jvmarg value="-Dcatalina.base=${env.CATALINA_HOME}"/>
            <arg value="-config"/>
            <arg value="${env.CATALINA_HOME}/conf/server.xml"/>
            <arg value="start"/>
            <classpath>
              <pathelement path="${java_comp.path}"/>
              <fileset dir="${env.CATALINA_HOME}"
includes="bin/bootstrap.jar"/>
            </classpath>
        </java>
    </target>
    <target name="stop.tomcat5">
        <java classname="org.apache.catalina.startup.Bootstrap" fork="yes">
            <jvmarg value="-Dcatalina.home=${env.CATALINA_HOME}"/>
            <jvmarg value="-Dcatalina.base=${env.CATALINA_HOME}"/>
            <arg value="-config"/>
            <arg value="${env.CATALINA_HOME}/conf/server.xml"/>
            <arg value="stop"/>
            <classpath>
              <pathelement path="${java_comp.path}"/>
              <fileset dir="${env.CATALINA_HOME}">
                  <include name="bin/bootstrap.jar"/>
              </fileset>
            </classpath>
        </java>
    </target>

With this script you elude the parsing of the cactus and warcactification
tasks, which treat 2.4 web.xml as is they were 2.2.
It is compatible with unpacked applications referenced in context.xml
archives in your catalina_home/conf/catalina/localhost, so no need for a
previous .war or a customised server.xml.
Thanks to the people who wrote the build-tests.xml file in the Struts 1.2.2
distribution.

Regards,
Pedro Nevado



Mime
View raw message