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 vaneet sharma <ma...@googlemail.com> on 2006/09/29 12:24:01 UTC
Fail to connect to localhost:8080 ( tomcat , cactus 13 1.7.2, ANT ) sample servlet example
I am using the following tasks to connect to my tomcat 5.0 using cactus and
ANT.
Question 1)
Which directory should i point to : target.dir.normalized
Question 2)
What shall in change in target test and test.prepare to make it working ?
thanks,
please find the below targets which i found from cactus servel sample with
cactus 13 1.7.2
<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="${base.dir}">
<include name="logging_*.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.java, 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="${webinf.dir}/cactus-web.xml">
<fileset dir="${src.webapp.dir}">
<exclude name="WEB-INF/cactus-web.xml"/>
<exclude name="WEB-INF/web.xml"/>
</fileset>
<classes dir="${target.classes.java.dir}"/>
<!-- Provide a secured servlet redirector in addition to the
default servlet redirector -->
<servletredirector/>
<servletredirector name="ServletRedirectorSecure"
mapping="/ServletRedirectorSecure" roles="test"/>
<!-- Needed for Clover coverage reports -->
<lib file="${clover.jar}"/>
</cactifywar>
<!-- Prepare the directories for the JUnit reports -->
<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" haltonerror="true">
<!-- 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="${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"/>
<!-- Due to some Cactus synchronization bug, the 'unit' tests need
to run before the 'sample' tests -->
<!--
<batchtest>
<fileset dir="${src.java.dir}">
<include name="com/zabidoo/mobile/server/Test*.java" />
<exclude name="com/zabidoo/mobile/server/Test*All.java"/>
</fileset>
</batchtest>
-->
<batchtest>
<fileset dir="${src.java.dir}">
<include name="com/zabidoo/mobile/server/Test*.java" />
<exclude name="com/zabidoo/mobile/server/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>
--
Vaneet Sharma
J2ee Application Developer/ Software Consultant
20 Donaldson Road
Queen's Park
London
NW66 ND
U.K
Mobile: 07821316060