@After public void close() { TestableInitialContextFactory.clearAll(); if (this.initialContextFactory != null) { System.setProperty(Context.INITIAL_CONTEXT_FACTORY, this.initialContextFactory); } else { System.clearProperty(Context.INITIAL_CONTEXT_FACTORY); } if (this.context != null) { this.context.close(); } Thread.currentThread().setContextClassLoader(this.threadContextClassLoader); }
private Session configureJndiSession(String name) throws IllegalStateException, NamingException { Properties properties = new Properties(); Session session = Session.getDefaultInstance(properties); TestableInitialContextFactory.bind(name, session); return session; }
@Test public void jndiLocationBound() { setupJndi(); TestableInitialContextFactory.bind("java:/FooManager", new Object()); load(JndiConditionConfiguration.class); assertPresent(true); }
@Before public void setupJndi() { this.initialContextFactory = System.getProperty(Context.INITIAL_CONTEXT_FACTORY); System.setProperty(Context.INITIAL_CONTEXT_FACTORY, TestableInitialContextFactory.class.getName()); }
private void configureJndi(String name, DataSource dataSource) throws IllegalStateException, NamingException { TestableInitialContextFactory.bind(name, dataSource); }
private void setupJndi() { this.initialContextFactory = System.getProperty(Context.INITIAL_CONTEXT_FACTORY); System.setProperty(Context.INITIAL_CONTEXT_FACTORY, TestableInitialContextFactory.class.getName()); }