use of javax.naming.InitialContext in project camel by apache.
the class GreaterCamelBeanTest method createRegistry.
@Override
protected JndiRegistry createRegistry() throws Exception {
Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
InitialContext initialContext = new InitialContext(properties);
return new JndiRegistry(initialContext);
}
use of javax.naming.InitialContext in project camel by apache.
the class GreaterCamelEjbTest method createEjbContext.
private static Context createEjbContext() throws NamingException {
// here we need to define our context factory to use OpenEJB for our testing
Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
return new InitialContext(properties);
}
use of javax.naming.InitialContext in project camel by apache.
the class GreaterTest method setUp.
protected void setUp() throws Exception {
Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
initialContext = new InitialContext(properties);
}
use of javax.naming.InitialContext in project camel by apache.
the class JndiCamelSingletonInitialContextFactoryTest method createRegistry.
@Override
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry jndi = new JndiRegistry(new InitialContext(env));
jndi.bind("jdbc/myDataSource", FAKE);
return jndi;
}
use of javax.naming.InitialContext in project camel by apache.
the class ComponentFoundInRegistryTest method testGuice.
@Test
public void testGuice() throws Exception {
Hashtable<String, Object> env = new Hashtable<String, Object>();
env.put(Context.PROVIDER_URL, GuiceInitialContextFactory.class.getName());
env.put(Injectors.MODULE_CLASS_NAMES, MyModule.class.getName());
InitialContext context = new InitialContext(env);
Injector injector = (Injector) context.lookup(Injector.class.getName());
assertNotNull("Found injector", injector);
Object value = context.lookup("foo");
assertNotNull("Should have found a value for foo!", value);
CamelContext camelContext = injector.getInstance(CamelContext.class);
Component component = camelContext.getComponent("foo");
assertThat(component, is(MockComponent.class));
Endpoint endpoint = camelContext.getEndpoint("foo:cheese");
assertThat(endpoint, is(MockEndpoint.class));
}
Aggregations