Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CamelBeanRegistryInjectionTest extends CamelTestSupport {
- Processor processorTest = exchange -> System.out.println("coucou test");
- @Override
- protected JndiRegistry createRegistry() throws Exception {
- final JndiRegistry registry = super.createRegistry();
- registry.bind("processorTest", processorTest);
- return registry;
- }
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start")
- .to("bean:processorTest")
- .to("mock:result");
- }
- };
- }
- @Test
- public void testRegistry() throws InterruptedException {
- ProducerTemplate producerTemplate = context.createProducerTemplate();
- producerTemplate.send("direct:start", exchange -> exchange.getIn().setBody("dummy body"));
- final MockEndpoint mockEndpoint = getMockEndpoint("mock:result");
- mockEndpoint.expectedMessageCount(1);
- mockEndpoint.assertIsSatisfied();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement