< prev index next >

test/jdk/javax/naming/spi/DummyContextFactory.java

Print this page




 109             throw new RuntimeException("Expected NoInitialContextException");
 110         } catch (NoInitialContextException e) {
 111             if (!(e.getCause() instanceof ClassNotFoundException)) {
 112                 throw new RuntimeException("unexpected cause", e.getCause());
 113             }
 114         }
 115     }
 116 
 117     public DummyContextFactory() {
 118         System.out.println("New DummyContextFactory " + (++counter));
 119         //new Throwable().printStackTrace(System.out);
 120     }
 121 
 122     @Override
 123     public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException {
 124         return new DummyContext(environment);
 125     }
 126 
 127     public class DummyContext extends InitialContext {
 128 
 129         private Hashtable env;
 130 
 131         DummyContext(Hashtable env) throws NamingException {
 132             this.env = env;
 133         }
 134 
 135         public Hashtable getEnvironment() {
 136             return env;
 137         }
 138     }
 139 }


 109             throw new RuntimeException("Expected NoInitialContextException");
 110         } catch (NoInitialContextException e) {
 111             if (!(e.getCause() instanceof ClassNotFoundException)) {
 112                 throw new RuntimeException("unexpected cause", e.getCause());
 113             }
 114         }
 115     }
 116 
 117     public DummyContextFactory() {
 118         System.out.println("New DummyContextFactory " + (++counter));
 119         //new Throwable().printStackTrace(System.out);
 120     }
 121 
 122     @Override
 123     public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException {
 124         return new DummyContext(environment);
 125     }
 126 
 127     public class DummyContext extends InitialContext {
 128 
 129         private Hashtable<?, ?> env;
 130 
 131         DummyContext(Hashtable<?, ?> env) throws NamingException {
 132             this.env = env;
 133         }
 134 
 135         public Hashtable<?, ?> getEnvironment() {
 136             return env;
 137         }
 138     }
 139 }
< prev index next >