Examples of SpringCamelContext


Examples of org.apache.camel.spring.SpringCamelContext

     * 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 (!configurationProperties.isJmxEnabled()) {
            camelContext.disableJMX();
        }

        return camelContext;
    }
View Full Code Here

Examples of org.apache.camel.spring.SpringCamelContext

    @Test
    public void testSpringCxfEndpoint() throws Exception {

        ClassPathXmlApplicationContext ctx =
            new ClassPathXmlApplicationContext(new String[]{"org/apache/camel/component/cxf/CxfEndpointBeans.xml"});
        CxfComponent cxfComponent = new CxfComponent(new SpringCamelContext(ctx));
        CxfSpringEndpoint endpoint = (CxfSpringEndpoint)cxfComponent.createEndpoint("cxf://bean:serviceEndpoint");

        assertEquals("Got the wrong endpoint address", endpoint.getAddress(),
                     "http://localhost:" + port2 + "/CxfEndpointTest/helloworld");
        assertEquals("Got the wrong endpont service class",
View Full Code Here

Examples of org.apache.camel.spring.SpringCamelContext

        };
    }

    protected CamelContext createCamelContext() throws Exception {
        spring = new ClassPathXmlApplicationContext("org/apache/camel/component/jms/spring.xml");
        SpringCamelContext ctx = SpringCamelContext.springCamelContext(spring);
        PlatformTransactionManager transactionManager = (PlatformTransactionManager)spring.getBean("jmsTransactionManager");
        ConnectionFactory connectionFactory = (ConnectionFactory)spring.getBean("jmsConnectionFactory");
        JmsComponent component = JmsComponent.jmsComponentTransacted(connectionFactory, transactionManager);
        component.getConfiguration().setConcurrentConsumers(1);
        ctx.addComponent("activemq", component);
        return ctx;
    }
View Full Code Here

Examples of org.apache.camel.spring.SpringCamelContext

    }

    protected List<Route> getRoutesFromContext(String classpathConfigFile) {
        applicationContext = new ClassPathXmlApplicationContext(classpathConfigFile);
        String name = "camel";
        SpringCamelContext context = (SpringCamelContext) applicationContext.getBean(name);
        assertNotNull("No Camel Context for name: " + name + " in file: " + classpathConfigFile, context);
        List<Route> routes = context.getRoutes();
        assertNotNull("No routes available for context: " + name + " in file: " + classpathConfigFile, routes);
        return routes;
    }
View Full Code Here

Examples of org.apache.camel.spring.SpringCamelContext

    @Test
    public void testSpringCxfEndpoint() throws Exception {

        ClassPathXmlApplicationContext ctx =
            new ClassPathXmlApplicationContext(new String[]{"org/apache/camel/component/cxf/CxfEndpointBeans.xml"});
        CxfComponent cxfComponent = new CxfComponent(new SpringCamelContext(ctx));
        CxfSpringEndpoint endpoint = (CxfSpringEndpoint)cxfComponent.createEndpoint("cxf://bean:serviceEndpoint");

        assertEquals("Got the wrong endpoint address", endpoint.getAddress(),
                     "http://localhost:" + port2 + "/CxfEndpointTest/helloworld");
        assertEquals("Got the wrong endpont service class",
View Full Code Here

Examples of org.apache.camel.spring.SpringCamelContext

            // Get the bean from the Spring context
            beanId = address.substring(CxfConstants.SPRING_CONTEXT_ENDPOINT.length());
            if (beanId.startsWith("//")) {
                beanId = beanId.substring(2);
            }
            SpringCamelContext context = (SpringCamelContext) this.getCamelContext();
            configurer = new ConfigurerImpl(context.getApplicationContext());
            cxfEndpointBean = (CxfEndpointBean) context.getApplicationContext().getBean(beanId);
            assert cxfEndpointBean != null;
        }
    }
View Full Code Here

Examples of org.apache.camel.spring.SpringCamelContext

        configurer.configureBean(beanId, beanInstance);
    }

    public ApplicationContext getApplicationContext() {
        if (getCamelContext() instanceof SpringCamelContext) {
            SpringCamelContext context = (SpringCamelContext) getCamelContext();
            return context.getApplicationContext();
        } else {
            return null;
        }
    }
View Full Code Here

Examples of org.apache.camel.spring.SpringCamelContext

        this.bundleContext = bundleContext;
    }


    protected SpringCamelContext createContext() {
        SpringCamelContext context = super.createContext();
        if (bundleContext != null) {
            context.setComponentResolver(new OsgiComponentResolver(bundleContext));
        }
        return context;
    }
View Full Code Here

Examples of org.apache.camel.spring.SpringCamelContext

    }

    protected List<Route> getRoutesFromContext(String classpathConfigFile) {
        applicationContext = new ClassPathXmlApplicationContext(classpathConfigFile);
        String name = "camel";
        SpringCamelContext context = (SpringCamelContext) applicationContext.getBean(name);
        assertNotNull("No Camel Context for name: " + name + " in file: " + classpathConfigFile, context);
        List<Route> routes = context.getRoutes();
        assertNotNull("No routes available for context: " + name + " in file: " + classpathConfigFile, routes);
        return routes;
    }
View Full Code Here

Examples of org.apache.camel.spring.SpringCamelContext

    }

    public void testShouldStartContext() throws Exception {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/spring/camelContextFactoryBean.xml");

        SpringCamelContext context = (SpringCamelContext) applicationContext.getBean("camel4");
        assertNotNull("No context found!", context);       
        assertFalse("The context should not start yet", context.getShouldStartContext());
        assertEquals("There should have not route", context.getRoutes().size(), 0);
        context = (SpringCamelContext) applicationContext.getBean("camel3");
        assertTrue("The context should started",  context.getShouldStartContext());
        assertEquals("There should have one route", context.getRoutes().size(), 1);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.