Mike Raath

Greenhorn
+ Follow
since Apr 07, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mike Raath

Thanks Brahim for your reply. Just for clarity, what I was trying to do was create that non-existent JNDI context within the test suite, but I have been approaching this the wrong way. I should not be using JUnit for these tests, but Cactus.
19 years ago
I'm struggling like mad setting up test cases for a web application I'm trying to test using JUnit.
To briefly describe the setup: we have a number of possible data servers, all defined in jndi-definitions.xml and loaded into JNDI on web-app start up. Our DB class takes an argument to the constructor: the name of the server to use and does a context.lookup to get the DataSource. This is all wrapped up in a jar which is referenced from the web-application.
This all works fine and dandy as a web application, but when I try to run a test suite (not as a web app) which creates my Services object (which in turn invokes the DB class) I get a node not found error - this is because nowhere in the Test have I registered the JNDI definitions.
My question is - how can I? If I try to create the DataSource and do a bind or rebind on the context, I get a javax.naming.OperationNotSupportedException: The "java:comp" naming context and its subcontexts are read-only.
As the test suite runs as a standalone application and intends to test my Service (which has no Http awareness) I'm at a loss how to do it. Any help would be greatly appreciated.
19 years ago