01: package com.mockrunner.test.ejb;
02:
03: import java.util.Hashtable;
04:
05: import javax.naming.Context;
06: import javax.naming.InitialContext;
07:
08: import org.mockejb.jndi.MockContextFactory;
09:
10: import com.mockrunner.ejb.EJBTestCaseAdapter;
11: import com.mockrunner.test.ejb.TestJNDI.TestContextFactory;
12:
13: public class EJBTestCaseAdapterDelegateEnvJNDITest extends
14: EJBTestCaseAdapter {
15: protected void setUp() throws Exception {
16: Hashtable env = new Hashtable();
17: env.put(Context.INITIAL_CONTEXT_FACTORY,
18: TestContextFactory.class.getName());
19: MockContextFactory.setDelegateEnvironment(env);
20: super .setUp();
21: }
22:
23: protected void tearDown() throws Exception {
24: MockContextFactory.setDelegateContext(null);
25: MockContextFactory.setDelegateEnvironment(null);
26: super .tearDown();
27: }
28:
29: public void testLookupExternal() throws Exception {
30: InitialContext context = new InitialContext();
31: Object object = context.lookup("test");
32: assertEquals("TestObject", object);
33: }
34: }
|