jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bret Kumler" <bkum...@firstam.com>
Subject RE: catifywar question
Date Wed, 17 Sep 2003 22:59:30 GMT
Here's my temp-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
 	<servlet>
		<servlet-name>ServletTestRunner</servlet-name>

<servlet-class>org.apache.cactus.server.runner.ServletTestRunner</servlet-cl
ass>
   	</servlet>
	<servlet>
        <servlet-name>ServletRedirector</servlet-name>

<servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class
>
        <init-param>
            <param-name>param1</param-name>
            <param-value>value1 used for testing</param-value>
        </init-param>
    </servlet>
    <servlet>
        <servlet-name>ServletRedirectorSecure</servlet-name>

<servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class
>
    </servlet>
    <servlet>
        <servlet-name>JspRedirector</servlet-name>
        <jsp-file>/jspRedirector.jsp</jsp-file>
        <init-param>
            <param-name>param1</param-name>
            <param-value>value1 used for testing</param-value>
        </init-param>
    </servlet>
    <servlet>
        <servlet-name>ServletRedirector_TestOverride</servlet-name>

<servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class
>
        <init-param>
            <param-name>param2</param-name>
            <param-value>value2 used for testing</param-value>
        </init-param>
    </servlet>
   <servlet-mapping>
	<servlet-name>ServletTestRunner</servlet-name>
	<url-pattern>/ServletTestRunner</url-pattern>
   </servlet-mapping>
    <servlet-mapping>
        <servlet-name>ServletRedirector</servlet-name>
        <url-pattern>/ServletRedirector</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>ServletRedirectorSecure</servlet-name>
        <url-pattern>/ServletRedirectorSecure</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>JspRedirector</servlet-name>
        <url-pattern>/JspRedirector</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>ServletRedirector_TestOverride</servlet-name>
        <url-pattern>/ServletRedirectorOverride</url-pattern>
    </servlet-mapping>
</web-app>





Here's my sample build.xml use any war file.





<?xml version="1.0"?>
<!--

============================================================================
=
    Build file for the Cactus Servlet Sample subproject. It shows how to use
    Cactus for unit testing the Servlet API (Servlets, Filters and Taglibs).

    The following Ant tasks need to be available in your ant installation
(i.e.
    the Ant task themselves and their dependent jars need to be put in
    ANT_HOME/lib):

        junit                  [REQUIRED] JUnit Ant task

    Check the build.properties file to find out what properties need to be
set
    in order to successfully run this script.

    This script should be started with the following command line:

        ant <target>

    Run "ant -projecthelp" to get a list of available targets.

============================================================================
=
-->
<project name="Test" default="x" basedir=".">
  <!-- Libraries required for the Cactus tests -->
  <property name="aspectjrt.jar"
      location="C:/Tools/cactus-13-1.6dev/lib/aspectjrt-1.0.6.jar"/>
  <property name="cactus.jar"
      location="C:/Tools/cactus-13-1.6dev/lib/cactus-1.6dev-20030907.jar"/>
  <property name="cactus.ant.jar"

location="C:/Tools/cactus-13-1.6dev/lib/cactus-ant-1.6dev-20030907.jar"/>
  <property name="commons.httpclient.jar"

location="C:/Tools/cactus-13-1.6dev/lib/commons-httpclient-2.0-rc1.jar"/>
  <property name="commons.logging.jar"
      location="C:/Tools/cactus-13-1.6dev/lib/commons-logging-1.0.3.jar"/>
  <property name="httpunit.jar"
      location="C:/Tools/cactus-13-1.6dev/lib/httpunit-1.5.3.jar"/>
  <property name="junit.jar"
      location="C:/Tools/cactus-13-1.6dev/lib/junit-3.8.1.jar"/>
  <property name="nekohtml.jar"
      location="C:/Tools/cactus-13-1.6dev/lib/nekohtml-0.7.4.jar"/>
  <property name="cactus.properties.path"
      location="C:/Tools/cactus-13-1.6dev/properties/cactus.properties"/>
  <path id="cactus.classpath">
    <pathelement location="${aspectjrt.jar}"/>
    <pathelement location="${cactus.jar}"/>
    <pathelement location="${cactus.ant.jar}"/>
    <pathelement location="${commons.httpclient.jar}"/>
    <pathelement location="${commons.logging.jar}"/>
    <pathelement location="${junit.jar}"/>
  </path>

<target name="init">
	<taskdef resource="cactus.tasks" classpathref="cactus.classpath"/>
	<tstamp/>
</target>

<target name="test" depends="init">

    <!-- Cactify the web-app archive -->
    <cactifywar srcfile="upload.war"
        destfile="test.war"
        mergewebxml="./WEB-INF/temp-web.xml">
    </cactifywar>

  </target>
</project>

-----Original Message-----
From: Christopher Lenz [mailto:cmlenz@gmx.de]
Sent: Wednesday, September 17, 2003 2:16 PM
To: Cactus Users List
Subject: Re: catifywar question


Bret Kumler wrote:
> Vincent,
>
> 	I tried it out, it works, but there's a couple problems.
>
> For example,
>
> 	I have the following below in my temp-web.xml, after the merge I have all
> the other redirectors, which I might not need.

Indeed, <cactifywar> currently adds at least the ServletRedirector and
the JspRedirector, and also the FilterRedirector if the web.xml is of
Servlet-API 2.3.

That shouldn't be a serious problem, but you can file an enhancement
request about this issue. [1]

> <servlet>
>     <servlet-name>ServletRedirector</servlet-name>
>
>
<servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class
>
>          <init-param>
>            <param-name>param1</param-name>
>            <param-value>value1 used for testing</param-value>
>          </init-param>
> </servlet>
>
> <servlet-mapping>
>         <servlet-name>ServletRedirector</servlet-name>
>         <url-pattern>/ServletRedirector</url-pattern>
> </servlet-mapping>
>
>
>
> If my temp-web.xml has ALL the redirectors defined in it already & I
merge,
> there's duplicate entries for each redirector.

Hmm, this is not the first time I hear about this. It's pretty weird
though, as there are a helluva lot of tests that verify that such
duplicate definitions do not occur in the merging process, and I've
personally never experienced this issue in my usage of the task.

Can you please post your full temp-web.xml and the snippet of your build
file where <cactifywar> is used? And maybe file a bug report?

[1] http://nagoya.apache.org/bugzilla/index.html

Thanks,
-chris

--
Christopher Lenz
/=/ cmlenz at gmx.de


---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-user-help@jakarta.apache.org




Mime
View raw message