当前位置: 首页>>代码示例>>Java>>正文


Java JndiContext.bind方法代码示例

本文整理汇总了Java中org.apache.camel.util.jndi.JndiContext.bind方法的典型用法代码示例。如果您正苦于以下问题:Java JndiContext.bind方法的具体用法?Java JndiContext.bind怎么用?Java JndiContext.bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.camel.util.jndi.JndiContext的用法示例。


在下文中一共展示了JndiContext.bind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCamelWithJndi

import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
public void testCamelWithJndi() throws Exception {
    JndiContext jndi = new JndiContext();
    jndi.bind("foo", new MyOtherDummyBean());

    CamelContext camel = new DefaultCamelContext(jndi);
    camel.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start").bean("foo");
        }
    });
    camel.start();

    String reply = camel.createProducerTemplate().requestBody("direct:start", "Camel", String.class);
    assertEquals("Hello Camel", reply);

    camel.stop();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:BeanLookupUsingJndiRegistryIssueTest.java

示例2: testPojoRoutes

import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
@Test
public void testPojoRoutes() throws Exception {

    JndiContext jndctx = new JndiContext();
    jndctx.bind("bye", new SayService("Good Bye!"));

    CamelContext camelContext = new DefaultCamelContext(jndctx);
    camelContext.addRoutes(createRouteBuilder(camelContext));

    camelContext.start();
    try {
        Endpoint endpoint = camelContext.getEndpoint("direct:hello");
        ISay proxy = ProxyHelper.createProxy(endpoint, false, ISay.class);
        String rc = proxy.say();
        Assert.assertEquals("Good Bye!", rc);
    } finally {
        camelContext.stop();
    }
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:20,代码来源:RmiIntegrationTest.java

示例3: createJndiContext

import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
@Override
protected Context createJndiContext() throws Exception {
    JndiContext answer = new JndiContext();

    // add ActiveMQ with embedded broker
    ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
    JmsComponent amq = jmsComponentAutoAcknowledge(connectionFactory);
    amq.setCamelContext(context);

    answer.bind("jms", amq);
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:JmsHttpPostIssueWithMockTest.java

示例4: testPojoRoutes

import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
@Test
public void testPojoRoutes() throws Exception {
    if (classPathHasSpaces()) {
        return;
    }

    // Boot up a local RMI registry
    LocateRegistry.createRegistry(getPort());

    // START SNIPPET: register
    JndiContext context = new JndiContext();
    context.bind("bye", new SayService("Good Bye!"));

    CamelContext camelContext = new DefaultCamelContext(context);
    // END SNIPPET: register

    camelContext.addRoutes(getRouteBuilder(camelContext));

    camelContext.start();

    // START SNIPPET: invoke
    Endpoint endpoint = camelContext.getEndpoint("direct:hello");
    ISay proxy = ProxyHelper.createProxy(endpoint, false, ISay.class);
    String rc = proxy.say();
    assertEquals("Good Bye!", rc);
    // END SNIPPET: invoke

    camelContext.stop();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:30,代码来源:RmiRouteTest.java

示例5: createJndiContext

import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
@Override
protected Context createJndiContext() throws Exception {
    JndiContext answer = new JndiContext();
    answer.bind("myBean", myBean);
    answer.bind("myOtherBean", myOtherBean);
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:BeanOgnMethodWithXPathInjectionTest.java

示例6: createJndiContext

import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
@Override
protected Context createJndiContext() throws Exception {
    JndiContext answer = new JndiContext();
    answer.bind("myBean", myBean);

    // add ActiveMQ with embedded broker
    ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
    JmsComponent amq = jmsComponentAutoAcknowledge(connectionFactory);
    amq.setCamelContext(context);

    answer.bind("jms", amq);
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:14,代码来源:JmsIntegrationTest.java

示例7: createJndiContext

import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
protected Context createJndiContext() throws Exception {
    JndiContext answer = new JndiContext();
    answer.bind("foo", new FooBean());
    answer.bind("bar", new BarBean());
    answer.bind("baz", new BazBean());
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:BeanPipelineTest.java

示例8: testCamelForBean

import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
/**
 * Camel简单入门
 * @throws Exception
 */
@Test
public void testCamelForBean() throws Exception {
    JndiContext context = new JndiContext();
    CamelLeaveBean leave = new CamelLeaveBean();
    context.bind("leave", leave);

    CamelContext camelContext = new DefaultCamelContext(context);

    camelContext.addRoutes(new CamelLeaveRoute());
    camelContext.start();
    ProducerTemplate tpl = camelContext.createProducerTemplate();

    // true
    tpl.sendBody("direct:start", Collections.singletonMap("days", 2));
    assertFalse(leave.getResult());

    // false
    tpl.sendBody("direct:start", Collections.singletonMap("days", 5));
    assertTrue(leave.getResult());

    // Set<LeaveBean> byType = camelContext.getRegistry().findByType(LeaveBean.class);
    // System.out.println("aa=" + ((LeaveBean)byType.iterator().next()).getResult());

    /*tpl.sendBody("direct:forProperty", Collections.singletonMap("days", 2));
    String result = System.getProperty("ok");
    assertEquals("false", result);

    tpl.sendBody("direct:forProperty", Collections.singletonMap("days", 5));
    result = System.getProperty("ok");
    assertEquals("true", result);*/

    camelContext.stop();
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:38,代码来源:CamelTest.java

示例9: createJndiContext

import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
@Override
protected Context createJndiContext() throws Exception {
    JndiContext answer = new JndiContext();
    answer.bind("addTime", new TimerBean());
    return answer;
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:7,代码来源:ThrottleTest.java

示例10: createJndiContext

import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
@Override
protected Context createJndiContext() throws Exception {
    jndiContext = new JndiContext();
    jndiContext.bind("myBean", new MyBean());
    return jndiContext;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:7,代码来源:NewInstanceTest.java

示例11: createJndiContext

import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
@Override
protected Context createJndiContext() throws Exception {
    JndiContext answer = new JndiContext();
    answer.bind("myBean", myBean);
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:7,代码来源:RoutingSlipDataModificationTest.java

示例12: createJndiContext

import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
@Override
protected Context createJndiContext() throws Exception {
    JndiContext answer = new JndiContext();
    answer.bind("myBean", new MyBean());
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:7,代码来源:BeanRecipientListInterfaceAnnotationTest.java

示例13: createJndiContext

import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
protected Context createJndiContext() throws Exception {
    JndiContext answer = new JndiContext();
    answer.bind("foo", new MyBean("foo"));
    answer.bind("bar", new MyBean("bar"));
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:7,代码来源:SimulatorTest.java

示例14: createJndiContext

import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
protected Context createJndiContext() throws Exception {
    JndiContext answer = new JndiContext();
    answer.bind("myBean", new MyBean());
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:6,代码来源:BeanToFileTest.java

示例15: createJndiContext

import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
protected Context createJndiContext() throws Exception {
    JndiContext answer = new JndiContext();
    answer.bind("processor", new AttachmentProcessor());
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:6,代码来源:BeanMethodWithExchangeTest.java


注:本文中的org.apache.camel.util.jndi.JndiContext.bind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。