beehive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Hogue" <>
Subject Testing Controls that use JNDI
Date Wed, 26 Jul 2006 15:38:40 GMT
I'm curious what others are doing to test controls that use JNDI, and
what the Beehive folks would recommend.  In particular I'm thinking
about the JdbcControl, but it should apply to the other system
controls where they use JNDI as well.

A couple of approaches I've heard others using are:

1. Don't use JNDI, use the ConnectionDriver properties (on the
JdbcControl). Looks like you can set the @ConnectionDriver annotation
on the @Control field in the test case, but you still have to
programmatically null out the ConnectionDataSource, requiring you to
reference the generated bean.  So it's a little different usage
(hopefully trivial) than you would be using in a normal @Control usage
where you reference the Interface.

I wonder if there's a way for the control to recognize that the
connection driver properties are meant to supersede the connection
data source. For example, can it tell that it's been set on the field
rather than the interface itself?   This may make it a little easier
to test out-of-container.

2. Create a JNDI environment in the test case. This can be
accomplished with the Apache Naming component, though it takes a
little more setup and dependencies than #1.  I think there may also be
some JUnit helpers that help to set up a context.

Are there any other recommended approaches that people have run across?



View raw message