Examples of SpringCamelContext


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);
            ObjectHelper.notNull(cxfEndpointBean, "cxfEndpointBean");
        }
       
        initializeHeadersRelaysMap();
    }
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

        BusFactory busFactory = BusFactory.newInstance();
        // need to check if the camelContext is SpringCamelContext and
        // update the bus configuration with the applicationContext
        // which SpringCamelContext holds
        if (getCamelContext() instanceof SpringCamelContext) {
            SpringCamelContext springCamelContext = (SpringCamelContext)getCamelContext();
            ApplicationContext applicationContext = springCamelContext.getApplicationContext();
            busFactory = new org.apache.cxf.bus.spring.SpringBusFactory(applicationContext);
        }
        return busFactory.createBus();
       
    }
View Full Code Here

Examples of org.apache.camel.spring.SpringCamelContext

    private static final transient Log LOG = LogFactory.getLog(CamelContextAutoStartupTest.class);

    public void testAutoStartupFalse() throws Exception {
        ApplicationContext ac = new ClassPathXmlApplicationContext("org/apache/camel/spring/config/CamelContextAutoStartupTestFalse.xml");

        SpringCamelContext camel = (SpringCamelContext) ac.getBean("myCamel");
        assertEquals("myCamel", camel.getName());
        assertEquals(false, camel.isStarted());
        assertEquals(Boolean.FALSE, camel.isAutoStartup());
        assertEquals(0, camel.getRoutes().size());

        // now start Camel
        LOG.info("******** now starting Camel manually *********");
        camel.start();

        // now its started
        assertEquals(true, camel.isStarted());
        // but auto startup is still fasle
        assertEquals(Boolean.FALSE, camel.isAutoStartup());
        // but now we have one route
        assertEquals(1, camel.getRoutes().size());

        // and now we can send a message to the route and see that it works
        MockEndpoint mock = camel.getEndpoint("mock:result", MockEndpoint.class);
        mock.expectedMessageCount(1);

        ProducerTemplate template = camel.createProducerTemplate();
        template.start();
        template.sendBody("direct:start", "Hello World");
        template.stop();

        mock.assertIsSatisfied();
View Full Code Here

Examples of org.apache.camel.spring.SpringCamelContext

    }

    public void testAutoStartupTrue() throws Exception {
        ApplicationContext ac = new ClassPathXmlApplicationContext("org/apache/camel/spring/config/CamelContextAutoStartupTestTrue.xml");

        SpringCamelContext camel = (SpringCamelContext) ac.getBean("myCamel");
        assertEquals("myCamel", camel.getName());
        assertEquals(true, camel.isStarted());
        assertEquals(Boolean.TRUE, camel.isAutoStartup());
        assertEquals(1, camel.getRoutes().size());

        // send a message to the route and see that it works
        MockEndpoint mock = camel.getEndpoint("mock:result", MockEndpoint.class);
        mock.expectedMessageCount(1);

        ProducerTemplate template = camel.createProducerTemplate();
        template.start();
        template.sendBody("direct:start", "Hello World");
        template.stop();

        mock.assertIsSatisfied();
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/spring/CxfEndpointBeans.xml"});
        CxfComponent cxfComponent = new CxfComponent(new SpringCamelContext(ctx));
        CxfSpringEndpoint endpoint = (CxfSpringEndpoint)cxfComponent.createEndpoint("cxf://bean:serviceEndpoint");

        ServerFactoryBean svf = new ServerFactoryBean();
        endpoint.configure(svf);
        assertEquals("Got the wrong endpoint address", svf.getAddress(), "http://localhost:9002/helloworld");
View Full Code Here

Examples of org.apache.camel.spring.SpringCamelContext

    protected void setupCamelContext(CamelContext camelContext) throws Exception {
       
    }
   
    protected CamelContext createCamelContext() throws Exception {
        return new SpringCamelContext(getApplicationContext());
    }
View Full Code Here

Examples of org.apache.camel.spring.SpringCamelContext

    }

    @Override
    protected CamelContext createCamelContext() throws Exception {
        spring = new ClassPathXmlApplicationContext("org/apache/camel/component/javaspace/spring.xml");
        SpringCamelContext ctx = SpringCamelContext.springCamelContext(spring);
        return ctx;
    }
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
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.