javax.naming.spi.InitialContextFactoryBuilder Java Examples

The following examples show how to use javax.naming.spi.InitialContextFactoryBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DatabaseTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  conn = mockConnection( mock( DatabaseMetaData.class ) );
  when( log.getLogLevel() ).thenReturn( LogLevel.NOTHING );
  when( dbMetaMock.getDatabaseInterface() ).thenReturn( databaseInterface );
  if ( !NamingManager.hasInitialContextFactoryBuilder() ) {
    // If JNDI is not initialized, use simpleJNDI
    System.setProperty( Context.INITIAL_CONTEXT_FACTORY,
      "org.osjava.sj.memory.MemoryContextFactory" ); // pentaho#simple-jndi;1.0.0
    System.setProperty( "org.osjava.sj.jndi.shared", "true" );
    InitialContextFactoryBuilder simpleBuilder = new SimpleNamingContextBuilder();
    NamingManager.setInitialContextFactoryBuilder( simpleBuilder );
  }
}