Java Code Examples for org.apache.camel.impl.JndiRegistry#bind()

The following examples show how to use org.apache.camel.impl.JndiRegistry#bind() . 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: JndiRegistryTest.java    From camelinaction2 with Apache License 2.0 6 votes vote down vote up
@Override
protected void setUp() throws Exception {
    // create the registry to be JndiRegistry in standalone mode
    JndiRegistry registry = new JndiRegistry(true);
    // register our HelloBean under the name helloBean
    registry.bind("helloBean", new HelloBean());

    // tell Camel to use our JndiRegistry
    context = new DefaultCamelContext(registry);

    // create a producer template to use for testing
    template = context.createProducerTemplate();

    // add the route using an inlined RouteBuilder
    context.addRoutes(new RouteBuilder() {
        public void configure() throws Exception {
            from("direct:hello").bean("helloBean", "hello");
        }
    });
    // star Camel
    context.start();
}
 
Example 2
Source File: HttpsTest.java    From camelinaction2 with Apache License 2.0 6 votes vote down vote up
@Override
protected JndiRegistry createRegistry() throws Exception {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource("./cia_keystore.jks");
    ksp.setPassword("supersecret");
    KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyPassword("secret");
    kmp.setKeyStore(ksp);

    KeyStoreParameters tsp = new KeyStoreParameters();
    tsp.setResource("./cia_truststore.jks");
    tsp.setPassword("supersecret");      
    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(tsp);
    
    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setKeyManagers(kmp);
    sslContextParameters.setTrustManagers(tmp);
    
    JndiRegistry registry = super.createRegistry();
    registry.bind("ssl", sslContextParameters);

    return registry;
}
 
Example 3
Source File: JdbcTest.java    From camelinaction2 with Apache License 2.0 5 votes vote down vote up
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();
    jndi.bind("orderToSql", new OrderToSqlBean());
    
    DriverManagerDataSource ds = new DriverManagerDataSource();
    ds.setDriverClassName("org.apache.derby.jdbc.EmbeddedDriver");
    ds.setUrl("jdbc:derby:memory:order;create=true");
    ds.setUsername("sa");
    ds.setPassword("");

    jndi.bind("dataSource", ds);
    return jndi;
}
 
Example 4
Source File: EnrichWithAggregatorTest.java    From camel-cookbook-examples with Apache License 2.0 5 votes vote down vote up
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndiRegistry = super.createRegistry();

    // register beanId for use by EnrichRoute
    // you could also use Spring or Blueprint 'bean' to create and configure
    // these references where the '<bean id="<ref id>">'
    jndiRegistry.bind("myMerger", new MergeInReplacementText());

    return jndiRegistry;
}
 
Example 5
Source File: RouteScopeTest.java    From camelinaction with Apache License 2.0 5 votes vote down vote up
@Override
protected JndiRegistry createRegistry() throws Exception {
    // register our order service bean in the Camel registry
    JndiRegistry jndi = super.createRegistry();
    jndi.bind("orderService", new OrderService());
    return jndi;
}
 
Example 6
Source File: JdbcTest.java    From camelinaction with Apache License 2.0 5 votes vote down vote up
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();
    jndi.bind("orderToSql", new OrderToSqlBean()); 
    
    DriverManagerDataSource ds = new DriverManagerDataSource();
    ds.setDriverClassName("org.hsqldb.jdbcDriver");
    ds.setUrl("jdbc:hsqldb:mem:order");
    ds.setUsername("sa");
    ds.setPassword("");

    jndi.bind("dataSource", ds);
    return jndi;
}
 
Example 7
Source File: ReuseErrorHandlerTest.java    From camelinaction2 with Apache License 2.0 5 votes vote down vote up
@Override
protected JndiRegistry createRegistry() throws Exception {
    // register our order service bean in the Camel registry
    JndiRegistry jndi = super.createRegistry();
    jndi.bind("orderService", new OrderService());
    return jndi;
}
 
Example 8
Source File: MessageEncryptionTest.java    From camelinaction2 with Apache License 2.0 5 votes vote down vote up
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();
    
    KeyStoreParameters keystore = new KeyStoreParameters();
    keystore.setPassword("supersecret");
    keystore.setResource("./cia_secrets.jceks");
    keystore.setType("JCEKS");
    
    KeyStore store = keystore.createKeyStore();
    secretKey = store.getKey("ciasecrets", "secret".toCharArray());
    registry.bind("secretKey", secretKey);
    return registry;
}
 
Example 9
Source File: OrderServiceTest.java    From camelinaction2 with Apache License 2.0 5 votes vote down vote up
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();
    // bidn the order service to the registry
    jndi.bind("orderService", orderService);
    // bind the jetty security handler to the registry
    jndi.bind("securityHandler", JettySecurity.createSecurityHandler());
    return jndi;
}
 
Example 10
Source File: CafeTest.java    From camel-cookbook-examples with Apache License 2.0 5 votes vote down vote up
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();

    registry.bind("menuService", new MenuService());

    return registry;
}
 
Example 11
Source File: CamelHystrixWithFallbackTest.java    From camelinaction2 with Apache License 2.0 5 votes vote down vote up
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();
    // register the counter service
    jndi.bind("counter", new CounterService());
    return jndi;
}
 
Example 12
Source File: CamelHystrixTest.java    From camelinaction2 with Apache License 2.0 5 votes vote down vote up
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();
    // register the counter service
    jndi.bind("counter", new CounterService());
    return jndi;
}
 
Example 13
Source File: EnrichTest.java    From camel-cookbook-examples with Apache License 2.0 5 votes vote down vote up
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndiRegistry = super.createRegistry();

    // register beanId for use by EnrichRoute
    // you could also use Spring or Blueprint 'bean' to create and configure
    // these references where the '<bean id="<ref id>">'
    jndiRegistry.bind("myExpander", new AbbreviationExpander());

    return jndiRegistry;
}
 
Example 14
Source File: SpringHandleFaultTest.java    From camelinaction with Apache License 2.0 4 votes vote down vote up
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();
    jndi.bind("orderService", new OrderService());
    return jndi;
}
 
Example 15
Source File: SyncVSAsyncDelayedRedeliveryTest.java    From camelinaction with Apache License 2.0 4 votes vote down vote up
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();
    jndi.bind("orderService", new OrderService());
    return jndi;
}
 
Example 16
Source File: DefaultErrorHandlerAsyncTest.java    From camelinaction with Apache License 2.0 4 votes vote down vote up
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();
    jndi.bind("orderService", new OrderService());
    return jndi;
}
 
Example 17
Source File: HelloBeanTest.java    From camelinaction2 with Apache License 2.0 4 votes vote down vote up
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();
    jndi.bind("hello", new HelloBean());
    return jndi;
}
 
Example 18
Source File: RestOrderServiceTest.java    From camelinaction2 with Apache License 2.0 4 votes vote down vote up
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();
    jndi.bind("orderService", orderService);
    return jndi;
}
 
Example 19
Source File: OrderServiceTest.java    From camelinaction2 with Apache License 2.0 4 votes vote down vote up
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();
    jndi.bind("orderService", orderService);
    return jndi;
}
 
Example 20
Source File: OrderServiceTest.java    From camelinaction2 with Apache License 2.0 4 votes vote down vote up
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();
    jndi.bind("orderService", orderService);
    return jndi;
}