-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Wesley,

(Sorry, I accidentally sent my previous message before I was finished
writing).

Wesley Wannemacher wrote:
> The main reason that I am currently leaning toward the iBATIS solution
> is that I am finding jUnit tests difficult to write for my persistence
> layer. If I tell iBATIS to find the database connections in the Tomcat
> context, iBATIS can't find them when I am running unit tests (since the
> unit tests don't load the tomcat context).

I assume that you aren't using any Tomcat-specific code in your
classes... just the standard InitialContext, etc. If that's the case,
you ought to be able to get a minimal JNDI interface going for your unit
tests. I would imagine that there is an OSS component out there for this
kind of thing.

One trick I have used in the past is to use my own "connection factory"
to get connections. When running in unit test mode, I replace the
connection factory with one that returns placeholder connections (often
stuffed full of mock objects) and in deployment mode, I use one that
just delegates to JNDI to get a connection.

Hope that helps,
- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFnoVU9CaO5/Lv0PARAjXgAJ9HanEkzg4xMsQZaUpvMlvilIyatACfWUId
vul8ZtI/nKRyhU24Yjmo+fw=
=H7OP
-----END PGP SIGNATURE-----

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

Reply via email to