protected SpringCamelContext newCamelContext() { return new SpringCamelContext(getApplicationContext()); }
/** * @deprecated its better to create and boot Spring the standard Spring way and to get hold of CamelContext * using the Spring API. */ @Deprecated public static SpringCamelContext springCamelContext(ApplicationContext applicationContext, boolean maybeStart) throws Exception { if (applicationContext != null) { // lets try and look up a configured camel context in the context String[] names = applicationContext.getBeanNamesForType(SpringCamelContext.class); if (names.length == 1) { return applicationContext.getBean(names[0], SpringCamelContext.class); } } SpringCamelContext answer = new SpringCamelContext(); answer.setApplicationContext(applicationContext); if (maybeStart) { answer.start(); } return answer; }
/** * Factory method returning {@link CamelContext} used by this configuration. * * @return {@link CamelContext} used by this configuration. By default {@link SpringCamelContext} instance is * created, to fully integrate Spring application context and Camel registry. */ protected CamelContext createCamelContext() throws Exception { return new SpringCamelContext(getApplicationContext()); }
/** * Spring-aware Camel context for the application. Auto-detects and loads all routes available in the Spring * context. */ @Bean CamelContext camelContext() throws Exception { CamelContext camelContext = new SpringCamelContext(applicationContext); if (routesBuilders != null) { for (RoutesBuilder routesBuilder : routesBuilders) { camelContext.addRoutes(routesBuilder); } } return camelContext; }
/** * Spring-aware Camel context for the application. Auto-detects and loads all routes available in the Spring context. */ // We explicitly declare the destroyMethod to be "" as the Spring @Bean // annotation defaults to AbstractBeanDefinition.INFER_METHOD otherwise // and in that case CamelContext::shutdown or CamelContext::stop would // be used for bean destruction. As SpringCamelContext is a lifecycle // bean (implements Lifecycle) additional invocations of shutdown or // close would be superfluous. @Bean(destroyMethod = "") @ConditionalOnMissingBean(CamelContext.class) CamelContext camelContext(ApplicationContext applicationContext, CamelConfigurationProperties config) throws Exception { CamelContext camelContext = new SpringCamelContext(applicationContext); return doConfigureCamelContext(applicationContext, camelContext, config); }
@Test public void testTemplateStepBasic() throws Exception { CamelContext context = new SpringCamelContext(applicationContext);
@Test public void testDataMapperStep() throws Exception { final CamelContext context = new SpringCamelContext(applicationContext);
@Test public void testTokenizeBodyStep() throws Exception { final CamelContext context = new SpringCamelContext(applicationContext); try { final RouteBuilder routes = new IntegrationRouteBuilder( "classpath:/syndesis/integration/SplitStepHandlerJsonTest.json", Collections.emptyList() ); // Set up the camel context context.addRoutes(routes); context.start(); // Dump routes as XML for troubleshooting dumpRoutes(context); final ProducerTemplate template = context.createProducerTemplate(); final MockEndpoint result = context.getEndpoint("mock:expression", MockEndpoint.class); final String[] expected = { "a","b","c" }; final List<String> body = Arrays.asList(expected); result.expectedMessageCount(3); result.expectedBodiesReceived((Object[])expected); template.sendBody("direct:expression", body); result.assertIsSatisfied(); } finally { context.stop(); } }
@Test public void testCapture() throws Exception { final CamelContext context = new SpringCamelContext(applicationContext);
@Test public void testConnectorStepHandler() throws Exception { final CamelContext context = new SpringCamelContext(applicationContext);
@Test public void testExpressionFilterStep() throws Exception { final CamelContext context = new SpringCamelContext(applicationContext);
@Test public void testPlaintextFilterStep() throws Exception { final CamelContext context = new SpringCamelContext(applicationContext);
@Test public void testRuleFilterStepWithJsonSimplePath() throws Exception { final CamelContext context = new SpringCamelContext(applicationContext);
@Test public void testRuleFilterStepWithJsonComplexPath() throws Exception { final CamelContext context = new SpringCamelContext(applicationContext);
@Test public void testRuleFilterStepWithPOJO() throws Exception { final CamelContext context = new SpringCamelContext(applicationContext);
@Test public void testRemoveHeadersStepHandler() throws Exception { final CamelContext context = new SpringCamelContext(applicationContext);
@Test public void testTokenizeBodyStep() throws Exception { final CamelContext context = new SpringCamelContext(applicationContext);
@Test public void testTokenizeSplitStep() throws Exception { final CamelContext context = new SpringCamelContext(applicationContext);
@Test public void testSimpleEndpointStep() throws Exception { final CamelContext context = new SpringCamelContext(applicationContext);
@Test public void testSetHeadersStepHandler() throws Exception { final CamelContext context = new SpringCamelContext(applicationContext);