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 Andrew van der Voort <an...@astarte.co.nz> on 2003/03/20 04:30:01 UTC

Separating Cactus tests from the application

Hi. I have integrated the first of hopefully many tests into out
environment. Since I am testing struts actions, I should also say that I
have strutstestcase on the front of this, but I don't think it changes the
problem I am having.

My working environment is to have my application .war file built as normal.
Since I am using Cactus, I have added to the .war the following:
- Updated web.xml that specifies the ServletRedirector servlet mapping
- Required cactus and strutstestcase jars in WEB-INF/lib
- Test Cases built into a separate package structure

Naturally this .war is packaged up into a .ear for deployment on JBoss.
Everything works fine. However the problem with this approach is that the
.war file is not suitable for distribution to clients. It contains cactus
jars and classes that are not necessary.

What we want to do is prepare the application .ear without anything related
to unit testing  in it, and package a separate .war or .ear with all the
testing classes and jars in it. This is so that once the testing is
complete, we can be confident that the .ear we have is good, and can be
distributed as-is.

Otherwise the only alternative is to package the .ear for testing, test,
and then repackage the .ear for distribution.

Can this be done?

Thanks, Andrew

Re: Separating Cactus tests from the application

Posted by Joseph Milora <jo...@cox.net>.
You can try using XDoclet. Using merge files you can do the following:

<XDtConfig:ifConfigParamEquals paramName="enable.cactus"

                                                value="true">


<servlet-mapping>

 <servlet-name>


           ServletRedirector


      </servlet-name>


       <url-pattern>


             /ServletRedirector


         </url-pattern>


</servlet-mapping>


</XDtConfig:ifConfigParamEquals>

If you set enable.cactus =true in your ant build file, the servlet mappings will be included in the web.xml file. Otherwise, they'll be excluded. You also need to set 

conditions in your build file to include/exclude the necessary libraries during your tests. 

When you need production ear files, you just set enable.cactus(or whatever you name the property) to false. None of the cactus files, libraries, or deployment entries

will be included in the build.

You can also use ant to dynamically set your cactus.properties file for different deployment options.

Joe Milora





----- Original Message ----- 
From: "Andrew van der Voort" <an...@astarte.co.nz>
To: <ca...@jakarta.apache.org>
Sent: Wednesday, March 19, 2003 7:30 PM
Subject: Separating Cactus tests from the application


Hi. I have integrated the first of hopefully many tests into out
environment. Since I am testing struts actions, I should also say that I
have strutstestcase on the front of this, but I don't think it changes the
problem I am having.

My working environment is to have my application .war file built as normal.
Since I am using Cactus, I have added to the .war the following:
- Updated web.xml that specifies the ServletRedirector servlet mapping
- Required cactus and strutstestcase jars in WEB-INF/lib
- Test Cases built into a separate package structure

Naturally this .war is packaged up into a .ear for deployment on JBoss.
Everything works fine. However the problem with this approach is that the
.war file is not suitable for distribution to clients. It contains cactus
jars and classes that are not necessary.

What we want to do is prepare the application .ear without anything related
to unit testing  in it, and package a separate .war or .ear with all the
testing classes and jars in it. This is so that once the testing is
complete, we can be confident that the .ear we have is good, and can be
distributed as-is.

Otherwise the only alternative is to package the .ear for testing, test,
and then repackage the .ear for distribution.

Can this be done?

Thanks, Andrew

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

RE: Separating Cactus tests from the application

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Andrew,

We have a solution in Cactus 1.5 (which you can download in the nightly
build area). In 1.5, there is a new Ant Integration Module, which
provides a fully reusable and generic Ant integration.

There is no doc yet for it but if you look at the cactus sample, you'll
see how to use it. 

It completely cactifies your application war by:
- adding the cactus jars
- performing a merge of your application web.xml with the definitions
needed by Cactus (such as the redirectors). This merge has been written
by Chris Lenz recently and I'm not sure if it is working yet nor not.

Thanks
-Vincent

> -----Original Message-----
> From: Andrew van der Voort [mailto:andrew@astarte.co.nz]
> Sent: 20 March 2003 04:30
> To: cactus-user@jakarta.apache.org
> Subject: Separating Cactus tests from the application
> 
> Hi. I have integrated the first of hopefully many tests into out
> environment. Since I am testing struts actions, I should also say that
I
> have strutstestcase on the front of this, but I don't think it changes
the
> problem I am having.
> 
> My working environment is to have my application .war file built as
> normal.
> Since I am using Cactus, I have added to the .war the following:
> - Updated web.xml that specifies the ServletRedirector servlet mapping
> - Required cactus and strutstestcase jars in WEB-INF/lib
> - Test Cases built into a separate package structure
> 
> Naturally this .war is packaged up into a .ear for deployment on
JBoss.
> Everything works fine. However the problem with this approach is that
the
> .war file is not suitable for distribution to clients. It contains
cactus
> jars and classes that are not necessary.
> 
> What we want to do is prepare the application .ear without anything
> related
> to unit testing  in it, and package a separate .war or .ear with all
the
> testing classes and jars in it. This is so that once the testing is
> complete, we can be confident that the .ear we have is good, and can
be
> distributed as-is.
> 
> Otherwise the only alternative is to package the .ear for testing,
test,
> and then repackage the .ear for distribution.
> 
> Can this be done?
> 
> Thanks, Andrew
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org