We have a context that is defined in Tomcat as java:comp/env/jdbc/DbPool We also use Sun's fscontext to allow the code to run invisibly in JUnit. In test I have the DataSource defined and read from jdbc/DbPool, but it would be better if I could keep the local context reference in code and configure fscontext to provide access to the DataSource from the same location.
Any thoughts on the best way to get the tests running without impacting the production code?
it turns out fscontext appears to resolve the context directly, so it created the binding at <context root directory>/java:comp/env/jdbc/DBPool where 'java:env' is just another directory. I haven't run the tests yet, but the DataSource has been bound.