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: Cactus Newbie Question?
Date Tue, 21 Jan 2003 23:54:13 GMT
Hi Michael,

> -----Original Message-----
> From: Michael Marrotte [mailto:marrotte@nicusa.com]
> Sent: 17 January 2003 16:59
> To: cactus-user@jakarta.apache.org
> Subject: Cactus Newbie Question?
> Hello,
> I am a Junit and Ant user, but have never used Cactus.  However, I am
> considering Cactus to solve a testing problem I have developing web
> applications.
> The problem is that I would like to unit test a DataSource that I
> configure
> in a web app (web.xml) contained by Resin, preferably called by Ant
> display the results back to the same console from where Ant is
> For example:
> I would like to input, say,
> "$ant testConnect"
> from an xterm and get visual feedback, say,
> "testConnect:
>      [java] .
>      [java] OK (1 tests)"
>      [java] ."
> So, I'm looking for helping solving this problem, maybe with Cactus.
> It seems like Cactus is an ideal framework to set up this type of
> Do you think Cactus is a good framework to use to try and solve this
> particular problem?

Yep, Cactus is a good tool for this.

> I've read most of the general Cactus documentation, but I'm still not
> exactly what approach I should take to try and solve this problem with
> the Cactus bells and whistles.
> Any ideas?
> Is there an example that covers this exact (DataSource testing via
> app)
> problem?
> What Cactus docs should I focus on?

If I understand correctly, you want 1/ to verify that a DataSource is
correctly configured and 2/ to call the test from Ant. This is very
easily done with Cactus.

Simply write a ServletTestCase as in:

public class TestXXX extends ServletTestCase
  public void testDataSource()
    // Perform the JNDI lookup here to get the DataSource
    // Get a JDBC connection for example
    // Perform some SQL queries if you wish

That's all on the java part.

Now for the Ant integration, I suggest you have a look at the
servlet-sample application that is part of the Cactus distribution. It
uses Ant to start Cactus tests. You can also check the Ant howto on the
Cactus web site.

Hope it helps,

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

View raw message