jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@octo.com>
Subject RE: Running cactus in a separate tree from source
Date Wed, 24 Apr 2002 20:12:17 GMT


> -----Original Message-----
> From: laurent.duperval@masq.ca [mailto:laurent.duperval@masq.ca]
> Sent: 24 April 2002 14:21
> To: cactus-user@jakarta.apache.org
> Subject: Re: Running cactus in a separate tree from source
> 
> On 23 Apr, Vincent Massol wrote:
> > Laurent,
> >
> > I hope you'll submit some FAQ entries after all these questions !
:-)
> >
> 
> Sure, if that can help.
> 
> > The constraint is not Cactus. It is your container classloader. Once
you
> > understand that you understand all valid possibilities. However, it
is a
> > bit tricky to understand ... :-)
> >
> > The one thing that would not work is if you put the Cactus tests in
one
> > J2EE module and the classes to test in another. This is because
Cactus
> > needs a Redirector (let's say a servlet). Let's say you configure
Cactus
> > web.xml in a cactus.war module and that your application is in
> > myapp1.war. I think the J2EE spec says that a webapp is independent
of
> > another one and thus they're not supposed to share the same
classloader.
> > Thus it is impossible to view the classes in one webapp from another
> > webapp.
> >
> 
> Ok, I can dig that.
> 
> > What Cactus 1.3 should support (if your container supports Context
> > classloaders) is to be put in the your container system classpath (I
> > haven't tried it though) so that you can "share" cactus.jar for
several
> > webapps.
> >
> 
> Ok.
> 
> > Your underlying question, if I understand correctly is : how do I
test
> > several webapps ?
> >
> 
> Right. But with a twist: I'd like to keep the cactus stuff separate
from
> the
> source code. Our source code structure looks like this:
> 
> project/modules/moduleA
>                /moduleB
>                .
>                .
>                .
>                /cactus
> 
> 
> In cactus, I want to put all the code to do the cactus tests.
> 
> > The solution :
> >
> > - Have several <junit> tasks and use several "cactus.properties"
files
> > (you can pass them to Cactus using the cactus.config java parameter
(See
> > http://jakarta.apache.org/cactus/howto_config.html).
> >
> 
> So I am stuck with having to intersperse the cactus tests with the
code,
> right? 

yes

> Each WebApp needs its deployment descriptor to operate properly,
> right? 

yes

> So I will have to put the cactus code with the rest of the code, so
> that the Webapp will be constructed correctly. ... I don't really see
a
> way
> around it. I wanted to keep the cactus code from being deployed with
the
> production code, without having to do a lot of gymnastics.
> 

The solution that we are all using is by making the "gymnastic" with
Ant. What I do is simply to have 2 targets and in the production one I
don't include the Cactus jars and the test classes. I have 2 web.xml.
You can also using the replace task (can't remember the exact name) to
replace a portion of text in a file, thus you can have a single web.xml
file (someone posted an example a while ago). It is really not difficult
at all.

What you shoud be able to do with Cactus this far is to remove the
cactus jars and the test classes from your webapp and put them in the
system classloader. However you will still need a modified web.xml.

> The <junit> thing you're talking about is taken care of by the way our
> code
> is structured. Probably what I'll need to do is to start Weblogic from
my
> toplevel build.xml, then the runtests target will run the tests in
each of
> the modules, and then it will stop weblogic in the toplevel build
file.
> 

yep run all your tests (<junit> tasks) in the runTarget target.

> If there's another way, let me know.
> 
> Thanks for the reply,
> 
> L
> 

-Vincent


> 
> --
> Laurent Duperval <mailto:laurent.duperval@masq.ca>
> 
> "When women say they love you just the way you are, they really mean
it...
> then they try to change you."
>                      -Paraphrased from "Coach"
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>



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


Mime
View raw message