Hi Bryce,

ATM, the Cactus plugin only supports deploying WAR files. It won't
deploy EAR files yet. This support is there in the <cactus> Ant task
that the plugin uses but I've simply not exposed this feature yet in the
plugin (lack of time only).

For big J2EE projects, my strategy is the following:

- Have separate projects for each J2EE module (EJB-JAR, WAR, RAR, simple
jar libraries)
- Have a project for the application (EAR in most cases) which is the
aggregation of the different J2EE module projects
- (optional) Have a project for the container holding the application
(this project will contain the container's configuration files)

Solution 1 for Cactus plugin:
-----------------------------

I would run the cactus tests in the container project as Cactus tests
run in a running container.

Now, I've just discovered that I have laid out a strategy that won't
exactly work yet with the current Cactus plugin... :-) The way to make
it work (which I can implement quickly if you all agree) would be:

- Put your cactus unit tests in each J2EE module project (in
src/test-cactus). I need to add a cactus:jar goal (and
cactus:jar-deploy, cactus:jar-install) to the Cactus plugin. Thus in a
reactor/multiproject configuration, you would run
"jar:deploy,cactus:jar-deploy", which would lead to the cactus jar (i.e.
a jar containing the cactus test classes) being deployed to your local
repository.

- In the project.xml for the container project, you would need to create
<dependency> entries. For example:

    <dependency>
      <groupId>myproject</groupId>>
      <artifactId>a_j2ee_module_project_cactus_jar</artifactId>
      <version>whatever</version>
      <properties>
        <cactus.bundle>true</cactus.bundle>
      </properties>
    </dependency>

(that leads to putting the cactus jars in the war's WEB-INF/lib
directory).

- You would run the Cactus tests by running "cactus:test" in the
container project. 

Of course, you can also run this in your application project if you
don't have a container project. And if your application is simply a war,
you don't even need a specific application project either, so you would
run the Cactus tests directly in the war project.

Solution 2 for Cactus plugin:
-----------------------------

Run the Cactus tests in each J2EE module project. Fortunately the Cactus
plugin recreates a full container environment so that should work. There
are several drawbacks:

- if you have some container-specific configuration, like a special data
source, etc then you'll need to duplicate this configuration in all the
projects. More generally if the environment is a bit complex you would
want to define it in a container project.

- it takes longer as each project will package, deploy, start the
container and stop the container. In solution 1, this is done once.

What do you think?

Thanks
-Vincent

> -----Original Message-----
> From: Bryce Fischer [mailto:[EMAIL PROTECTED]
> Sent: 11 September 2003 04:12
> To: [EMAIL PROTECTED]
> Subject: Cactus Plugin
> 
> Anyone using the Cactus plugin to test EJBs?
> 
> I've setup several different projects. One for persistence classes
(CMP
> Beans), one for business classes (Session Beans), etc...
> 
> I want to use Cactus to perform some integration testing with my
> persistence classes. I'm thinking the best way is to create a seperate
> project just tied to cactus tests for each main project. I think that
> would be easiest, as I could create an ejb-jar for my persistence
> classes, and a war file for my cactus tests that depend on the
ejb-jar...
> 
> Anyone who's using Cactus care to comment on their project setup?
> 
> --
> Bryce Fischer <[EMAIL PROTECTED]>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to