Advertisement
bltijo

Untitled

Aug 23rd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.15 KB | None | 0 0
  1.  
  2. public class CamelBeanRegistryInjectionTest  extends CamelTestSupport {
  3.  
  4.     Processor processorTest = exchange -> System.out.println("coucou test");
  5.  
  6.     @Override
  7.     protected JndiRegistry createRegistry() throws Exception {
  8.         final JndiRegistry registry = super.createRegistry();
  9.         registry.bind("processorTest", processorTest);
  10.         return registry;
  11.     }
  12.  
  13.     @Override
  14.     protected RouteBuilder createRouteBuilder() throws Exception {
  15.         return new RouteBuilder() {
  16.             @Override
  17.             public void configure() throws Exception {
  18.                 from("direct:start")
  19.                     .to("bean:processorTest")
  20.                     .to("mock:result");
  21.             }
  22.         };
  23.     }
  24.  
  25.     @Test
  26.     public void testRegistry() throws InterruptedException {
  27.         ProducerTemplate producerTemplate = context.createProducerTemplate();
  28.         producerTemplate.send("direct:start", exchange -> exchange.getIn().setBody("dummy body"));
  29.         final MockEndpoint mockEndpoint = getMockEndpoint("mock:result");
  30.         mockEndpoint.expectedMessageCount(1);
  31.         mockEndpoint.assertIsSatisfied();
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement