X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=test%2Fenterprise%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fsupport%2Fjndi%2FStubInitialContextFactory.java;h=23d3cf6eec265f0f15b497673fd12a6d00e526e3;hb=8de36ff0206c996baf3ee4adc3e2293b12ff5f39;hp=c7e4e2fde323bd3c390cebcf8b59dde3adf24b73;hpb=89c06d4d52b46c154128c97d6e758fa1f4fc7a6e;p=utils diff --git a/test/enterprise/src/main/java/org/wamblee/support/jndi/StubInitialContextFactory.java b/test/enterprise/src/main/java/org/wamblee/support/jndi/StubInitialContextFactory.java index c7e4e2fd..23d3cf6e 100644 --- a/test/enterprise/src/main/java/org/wamblee/support/jndi/StubInitialContextFactory.java +++ b/test/enterprise/src/main/java/org/wamblee/support/jndi/StubInitialContextFactory.java @@ -23,41 +23,41 @@ import javax.naming.spi.InitialContextFactory; */ public class StubInitialContextFactory implements InitialContextFactory { - private static Context context; - - private static void initialize() { - try { - context = new StubInitialContext(); - } catch (NamingException e) { // can't happen. - throw new RuntimeException(e); - } - } - - /** - * This method must be called to register this initial context factory as - * the default implementation for JNDI. - * - * @throws Exception - */ - public static void register() { - // sets up the InitialContextFactoryForTest as default factory. - System.setProperty(Context.INITIAL_CONTEXT_FACTORY, - StubInitialContextFactory.class.getName()); - if (context == null) { - initialize(); - } - } - - /** - * Unregisters the initial context factory - */ - public static void unregister() { - System.setProperty(Context.INITIAL_CONTEXT_FACTORY, ""); - context = null; - } - - public Context getInitialContext(Hashtable environment) - throws NamingException { - return context; - } + private static Context context; + + private static void initialize() { + try { + context = new StubInitialContext(); + } catch (NamingException e) { // can't happen. + throw new RuntimeException(e); + } + } + + /** + * This method must be called to register this initial context factory as + * the default implementation for JNDI. + * + * @throws Exception + */ + public static void register() { + // sets up the InitialContextFactoryForTest as default factory. + System.setProperty(Context.INITIAL_CONTEXT_FACTORY, + StubInitialContextFactory.class.getName()); + if (context == null) { + initialize(); + } + } + + /** + * Unregisters the initial context factory + */ + public static void unregister() { + System.setProperty(Context.INITIAL_CONTEXT_FACTORY, ""); + context = null; + } + + public Context getInitialContext(Hashtable environment) + throws NamingException { + return context; + } }