You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kevin Jackson <fo...@gmail.com> on 2007/10/23 13:08:58 UTC

Unit Testing DataSourceRealm

Hi,

We have to add functionality to the provided realms.  We started with
a JDBCRealm, extended it and added our custom functionality.

Now I've changed from a JDBCRealm (as the super class) to a
DataSourceRealm as the super class.

The problem is - how can I unit test a DataSourceRealm outside of the
tomcat container?

With the extended jdbc realm it was simple to inject the jdbc driver
class name etc in the setUp, but with the DataSourceRealm, I cannot
create an InitialContext without either using the tomcat container
itself (a bit of overkill for a unit test), or using suns fscontext,
but that doesn't even seem to be available (certainly not via any m2
repos)

So any ideas?

Kev

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Unit Testing DataSourceRealm

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kevin,

Kevin Jackson wrote:
> with the DataSourceRealm, I cannot
> create an InitialContext without either using the tomcat container
> itself (a bit of overkill for a unit test), or using suns fscontext,
> but that doesn't even seem to be available (certainly not via any m2
> repos)

Why not just write your own class that extends InitialContext and does
whatever it wants?

- -chris

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

iD8DBQFHHiVA9CaO5/Lv0PARAux7AKCX0i6BMNsm4NWv2iYK8ENY3dmncACbB2ba
/Mp4kZ3YV8dHrvxp+lBbMzg=
=Z12J
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org