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 Vincent Massol <vm...@octo.com> on 2002/01/11 00:49:01 UTC

Best way to run Cactus in an IDE (WAS RE: Using Cactus to test EJB deployed to Weblogic6.1)

Here is I think the best way to run Cactus tests from an IDE. I'll use
WebLogic 6.1 as an example but it works with any other application
server although you need to adapt it a bit (you can have a look at the
Ant scripts provided as part of the Cactus distribution to learn how to
start your servlet engine/application server in a directory other than
the default).

A - Setup
-----------

1/ Have the following kind of directory structure :

myproject
 |_ src
 |_ output
   |_config
     |_ mydomain
       |_ applications
         |_ mywebapp
            |_ WEB-INF
              |_ classes
              |_ web.xml
              |_ lib
       |_ config.xml
       |_ SerializedsystemIni.dat
       |_ fileRealm.properties

2/ In your IDE, set the output classes directory to be
myproject/output/config/mydomain/applications/mywebapp/WEB-INF/classes

3/ Ensure that you have the cactus redirectors defined in web.xml

4/ Copy cactus.properties to
myproject/output/config/mydomain/applications/mywebapp/WEB-INF/classes

5/ Ensure that you have cactus.jar, junit.jar, commons-httpclient.jar
(and optionally log4j.jar) in
myproject/output/config/mydomain/applications/mywebapp/WEB-INF/lib

6/ Create an entry in your IDE to start weblogic, using the following
parameters :

class name : weblogic.Server
class path : weblogic_sp.jar (if it exists) and weblogic.jar 
jvm arguments : 

"-hotspot"
"-ms64m"
"-mx64m"
"-Djava.library.path=<bea home>/wlserver6.1/bin"
"-Dweblogic.RootDirectory=myproject/output"
"-Dweblogic.Domain=mydomain"
"-Dweblogic.Name=testserver" (name defined in your WL config.xml file)
"-Dbea.home=<bea home>"
"-Dweblogic.management.password=<your password>"
"-Djava.security.policy==./lib/weblogic.policy"

B- Running a test
------------------

1/ Start weblogic from the defined entry above (in step A-6). You only
need to do this once and do not need to repeat it for each test.
Modified classes should be reloaded automatically. If your IDE does not
support this, you may have to start weblogic manually beforehand, using
a script for example.

*WARNING* : Make sure that your IDE does not prepend your output classes
directory to the classpath being used to start weblogic. Otherwisem your
classes will be loaded using the system classloader and won't be
reloadable, which means you would have to repeat this step for each test
run.

2/ Choose a test case class with a main method and run it. Normally your
IDE will prepend to the classpath the output classes directory. Normally
you would also have included the cactus.jar, junit.jar,
commons-httpclient.jar  in your project classpath (to compile the
project), thus they would also be added. As you put cactus.properties in
WEB-INF/classes (i.e. in your class output directory) the client part of
cactus will find it. Configure cactus.properties to point to
http://localhost:<port used in config.xml>/mywebapp/ServletRedirector

3/ Try modifying the test class or a class under test and rerun it
without stopping weblogic. The changes should be picked up.

C- Conclusion
-------------

I'm writing this from memory so I may be forgetting stuff. Tell me if it
works. I'll try it when I have some time ... If you tell me it works,
I'll put these instructions on the cactus web site.

Thanks
-Vincent

> -----Original Message-----
> From: Sean Zhang [mailto:sean.zhang@verizon.com]
> Sent: 10 January 2002 20:26
> To: Cactus Users List
> Subject: RE: Using Cactus to test EJB deployed to Weblogic6.1
> 
> Thanks Vincent!
> 
> I have set up Jbuilder5 with Cactus and my plan is to run my test in
> Jbuilder to test EJBs deployed on Weblogic.  Please help with
following
> questions:
> 
> 1.	I edited cactus.properties like following
> 	Cactus.servletRedirectorURL =
> http://localhost:7001/ServletRedirector/  (assuming I deploy EJBs
classes
> to
> classes directory under default app)  Is this correct?
> 2.	Do I need to copy cactus.jar, junit.jar to lib directory under
the
> Web-inf under DefaultWebApp?  Another other jar files need to be moved
> there?
> 3.	I also edited web.xml file in Web-inf directory on Weblogic to
add
> the redirector mapping.
> 
> Any other configuration I need to modify?
> 
> Thanks,
> 
> Sean
> 
> 		-----Original Message-----
> 		From:	Vincent Massol [mailto:vmassol@octo.com]
> 		Sent:	Wednesday, January 09, 2002 3:59 PM
> 		To:	'Cactus Users List'
> 		Subject:	RE: Using Cactus to test EJB deployed to
> Weblogic6.1
> 
> 		I know that this message is addressed to David but maybe
I
> can still
> 		help a bit ... :-)
> 
> 		> -----Original Message-----
> 		> From: Sean Zhang [mailto:sean.zhang@verizon.com]
> 		> Sent: 09 January 2002 21:45
> 		> To: Cactus Users List
> 		> Subject: RE: Using Cactus to test EJB deployed to
> Weblogic6.1
> 		>
> 		> Hi, David,
> 		>
> 		> Thanks for your message.  I'm actually at Dallas
(former
> GTE).  Are
> 		you
> 		> working at Verizon as well?
> 		>
> 		> Do you think Cactus is a good testing tool for EJBs?
> 
> 		Yes, for unit testing EJBs. No for stress/load testing.
> 
> 		> Can Cactus be used
> 		> to
> 		> test regular beans deployed to Weblogic as well?
> 
> 		yes
> 
> 		> Does it use the same way
> 		> to test regular beans as EJBs?
> 
> 		Yes
> 
> 		> Sorry that I throw a lot of questions.
> 		> I'm
> 		> new to this.
> 		>
> 		> By the way, have you set up Cactus with your IDE?
> (specifically
> 		Jbuilder5
> 		> which we are using now)
> 
> 		I did set it up with JBuilder4 but haven't tried it with
> JBuilder5 nor 6
> 		yet (although I don't see why it would be a problem). On
> this subject
> 		you can check
> http://jakarta.apache.org/cactus/howto_ide.html
> 
> 		-Vincent
> 
> 		>
> 		> Thanks and have a great afternoon,
> 		>
> 		> Sean
> 		>
> 		> 		-----Original Message-----
> 		> 		From:	David L. Wasler
> [mailto:dwasler@yahoo.com]
> 		> 		Sent:	Wednesday, January 09, 2002 3:35
PM
> 		> 		To:	Cactus Users List
> 		> 		Subject:	Re: Using Cactus to test
EJB
> deployed to
> 		> Weblogic6.1
> 		>
> 		> 		Hi Sean:
> 		>
> 		> 		I have been using Cactus on WL 6.1, I'm
not
> an expert
> 		> 		on Cactus, but it does work on WL 6.1
> 		>
> 		> 		Which Verizon location are you at VA
near
> DC.
> 		>
> 		> 		Cheers
> 		> 		David L. Wasler
> 		> 		dwasler@yahoo.com
> 		>
> 		>
> 		> 		--- Sean Zhang <se...@verizon.com>
> wrote:
> 		> 		> Hi,
> 		> 		>
> 		> 		> I researching Cactus for testing EJBs
> deployed to
> 		> 		> Weblogic 6.1.  Anyone has
> 		> 		> done that successfully and can you
share
> some of
> 		> 		> your experience with me?
> 		> 		>
> 		> 		> Thanks,
> 		> 		>
> 		> 		> Sean
> 		> 		>
> 		> 		> --
> 		> 		> To unsubscribe, e-mail:
> 		> 		>
> <ma...@jakarta.apache.org>
> 		> 		> For additional commands, e-mail:
> 		> 		>
> <ma...@jakarta.apache.org>
> 		> 		>
> 		>
> 		>
> 		>
> __________________________________________________
> 		> 		Do You Yahoo!?
> 		> 		Send FREE video emails in Yahoo! Mail!
> 		> 		http://promo.yahoo.com/videomail/
> 		>
> 		> 		--
> 		> 		To unsubscribe, e-mail:
> 		> <ma...@jakarta.apache.org>
> 		> 		For additional commands, e-mail:
> 		> <ma...@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>
> 		>
> 
> 
> 
> 
> 		--
> 		To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> 		For additional commands, e-mail:
> <ma...@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>
> 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>