You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Bryce Fischer <br...@berzerker-soft.com> on 2003/09/11 04:11:51 UTC

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 <br...@berzerker-soft.com>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Cactus Plugin

Posted by Bryce Fischer <br...@berzerker-soft.com>.
> What do you think?

Thanks Vincent & Tobias.

I'll digest what you've written and try them out. My setup is similar to
Vincent's, where I've got a project for each ejb-jar layer, a war file
for my presentation (struts) layer, some utility jars, and one for the
ear assembler.

btw, Vincent. I'm an early access subscriber to your book JUnit in
Action. Looking forward to the remaining chapters (especially the
Testing Compontents Part)

Thanks again.
-- 
Bryce Fischer <br...@berzerker-soft.com>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Cactus Plugin

Posted by Vincent Massol <vm...@pivolis.com>.

> -----Original Message-----
> From: Bryce Fischer [mailto:bryce@berzerker-soft.com]
> Sent: 16 September 2003 04:04
> To: Maven Users List
> Subject: Re: Cactus Plugin
> 
> Sorry so late getting back on this. I'm responding on the Maven list,
as
> this deals with the Cactus Plugin, and project organization, and may
be
> of interest to others.
> 
> You mentioned:
> 
> > - Have separate projects for each J2EE module (EJB-JAR, WAR, RAR,
simple
> > jar libraries)
> 
> Done. I'm assuming the Cactus tests (for each module) go in these
> projects.

The test sources, yes. For the execution of them, not necessarily (see
below).

> 
> > - Have a project for the application (EAR in most cases) which is
the
> > aggregation of the different J2EE module projects
> 
> Done.
> 
> > - (optional) Have a project for the container holding the
application
> > (this project will contain the container's configuration files)
> 
> I assume this is for stuff like jboss.xml file, etc. I skipped this as
> I'm using XDoclet to generate those files in the specific projects.
> 
> > I would run the cactus tests in the container project as Cactus
tests
> > run in a running container.
> 
> If I understand correctly, this is different than the optional step
> above. This project would be a stand alone war file that will actually
> run the Cactus test?
> 
> When running cactus:test, It runs the tests in the specified container
> (specified in the build.properties file?). For example, I've set
> cactus.home.jboss3x, so it should run using that container?

If you want to be logical, the best place to run your Cactus tests is
when you have your application configured to run in your app server.
This is in the container project (or EAR, or WAR if your application is
only made of a single WAR).

That said, as the Cactus plugin provides a full working environment for
you, it is not strictly necessary to run in your own defined
environment. You can run in the Cactus provided one. That said, the
cactus environment is a default and basic one and if you need to modify
any config file for a container, you'll have to provide them to cactus.
And the place where you will have these files defined is in the
container project (or EAR, or WAR).

-Vincent

> 
> Thanks again for your help.
> 
> --
> Bryce Fischer <br...@berzerker-soft.com>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Cactus Plugin

Posted by Bryce Fischer <br...@berzerker-soft.com>.
Sorry so late getting back on this. I'm responding on the Maven list, as
this deals with the Cactus Plugin, and project organization, and may be
of interest to others.

You mentioned:

> - Have separate projects for each J2EE module (EJB-JAR, WAR, RAR, simple
> jar libraries)

Done. I'm assuming the Cactus tests (for each module) go in these
projects.

> - Have a project for the application (EAR in most cases) which is the
> aggregation of the different J2EE module projects

Done.

> - (optional) Have a project for the container holding the application
> (this project will contain the container's configuration files)

I assume this is for stuff like jboss.xml file, etc. I skipped this as
I'm using XDoclet to generate those files in the specific projects.

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

If I understand correctly, this is different than the optional step
above. This project would be a stand alone war file that will actually
run the Cactus test?

When running cactus:test, It runs the tests in the specified container 
(specified in the build.properties file?). For example, I've set
cactus.home.jboss3x, so it should run using that container?

Thanks again for your help.

-- 
Bryce Fischer <br...@berzerker-soft.com>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Cactus Plugin

Posted by Vincent Massol <vm...@pivolis.com>.
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:bryce@berzerker-soft.com]
> Sent: 11 September 2003 04:12
> To: users@maven.apache.org
> 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 <br...@berzerker-soft.com>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org