Examples of SpringCamelContext


Examples of org.apache.camel.spring.SpringCamelContext

    public void setBundleContext(BundleContext bundleContext) {
        this.bundleContext = bundleContext;
    }
   
    protected SpringCamelContext createContext() {
        SpringCamelContext context = super.createContext();
        if (bundleContext != null) {
            context.setComponentResolver(new OsgiComponentResolver());
            context.setLanguageResolver(new OsgiLanguageResolver());
            addOsgiAnnotationTypeConverterLoader(context, bundleContext);
            context.setFactoryFinderClass(OsgiFactoryFinder.class);
        }
       
        return context;
    }   
View Full Code Here

Examples of org.apache.camel.spring.SpringCamelContext

public class CxfEndpointTest extends TestCase {

    public void testSpringCxfEndpoint() throws Exception {
        ClassPathXmlApplicationContext ctx =
            new ClassPathXmlApplicationContext(new String[]{"org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml"});
        CamelContext camelContext = new SpringCamelContext(ctx);
        CxfComponent cxfComponent = new CxfComponent(camelContext);
        CxfEndpoint endpoint = (CxfEndpoint)cxfComponent.createEndpoint("cxf://bean:serviceEndpoint");

        assertTrue("The endpoint should be the spring context endpoint", endpoint.isSpringContextEndpoint());
        ServerFactoryBean svf = new ServerFactoryBean();
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

            // 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");
        }
    }
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

        try {
            List<CamelJbiEndpoint> services = new ArrayList<CamelJbiEndpoint>(activatedEndpoints);
            activatedEndpoints.clear();

            ApplicationContext applicationContext = springLoader.getApplicationContext();
            SpringCamelContext camelContext = SpringCamelContext.springCamelContext(applicationContext);

            // now lets iterate through all the endpoints
            Collection<Endpoint> endpoints = camelContext.getSingletonEndpoints();

            for (Endpoint endpoint : endpoints) {
                if (component.isEndpointExposedOnNmr(endpoint)) {
                    services.add(component.createJbiEndpointFromCamel(endpoint));
                }
            }

            // lets add a control bus endpoint to ensure we have at least one endpoint to deploy
            BeanComponent beanComponent = camelContext.getComponent("bean", BeanComponent.class);
            Endpoint endpoint = beanComponent.createEndpoint(new CamelControlBus(camelContext), "camel:controlBus");
            services.add(component.createJbiEndpointFromCamel(endpoint));
           
            return services;
        } catch (Exception e) {
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

    }

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

        SpringCamelContext context = applicationContext.getBean("camel4", SpringCamelContext.class);
        assertFalse(context.isAutoStartup());
        // there is 1 route but its not started
        assertEquals(1, context.getRoutes().size());

        context = applicationContext.getBean("camel3", SpringCamelContext.class);
        assertTrue(context.isAutoStartup());
        // there is 1 route but and its started
        assertEquals(1, context.getRoutes().size());
    }
View Full Code Here

Examples of org.apache.camel.spring.SpringCamelContext

        assertEquals("Hello World", reply);
       
        // test sending inOnly message
        MyProxySender anotherSender = ac.getBean("myAnotherProxySender", MyProxySender.class);
        SpringCamelContext context = ac.getBeansOfType(SpringCamelContext.class).values().iterator().next();
        MockEndpoint result = TestSupport.resolveMandatoryEndpoint(context, "mock:result", MockEndpoint.class);
        result.expectedBodiesReceived("Hello my friends!");
       
        anotherSender.greeting("Hello my friends!");
        result.assertIsSatisfied();
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
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.