Search in sources :

Example 11 with AbstractXmlApplicationContext

use of org.springframework.context.support.AbstractXmlApplicationContext in project camel by apache.

the class SpringRemotingTwoCamelContextTest method testProxyWithTwoCamelContext.

public void testProxyWithTwoCamelContext() throws Exception {
    AbstractXmlApplicationContext applicationContext = createApplicationContext();
    CamelContext camelContext = SpringCamelContext.springCamelContext(applicationContext);
    ISay proxy = applicationContext.getBean("sayProxy1", ISay.class);
    String rc = proxy.say();
    assertEquals("context-1", rc);
    proxy = applicationContext.getBean("sayProxy2", ISay.class);
    rc = proxy.say();
    assertEquals("context-2", rc);
    camelContext.stop();
    IOHelper.close(applicationContext);
}
Also used : CamelContext(org.apache.camel.CamelContext) SpringCamelContext(org.apache.camel.spring.SpringCamelContext) AbstractXmlApplicationContext(org.springframework.context.support.AbstractXmlApplicationContext)

Example 12 with AbstractXmlApplicationContext

use of org.springframework.context.support.AbstractXmlApplicationContext in project camel by apache.

the class SpringRemotingBeanConverterTest method testBeanRoutes.

public void testBeanRoutes() throws Exception {
    AbstractXmlApplicationContext applicationContext = createApplicationContext();
    CamelContext camelContext = SpringCamelContext.springCamelContext(applicationContext);
    Invoker invoker = applicationContext.getBean("invokerProxy", Invoker.class);
    String response = invoker.invoke(new Bean.SubClass());
    assertEquals("Hello from Sub", response);
    camelContext.stop();
    IOHelper.close(applicationContext);
}
Also used : CamelContext(org.apache.camel.CamelContext) SpringCamelContext(org.apache.camel.spring.SpringCamelContext) AbstractXmlApplicationContext(org.springframework.context.support.AbstractXmlApplicationContext)

Example 13 with AbstractXmlApplicationContext

use of org.springframework.context.support.AbstractXmlApplicationContext in project camel by apache.

the class SpringMarshalDomainObjectJSONTest method createCamelContext.

protected CamelContext createCamelContext() throws Exception {
    setUseRouteBuilder(false);
    final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/dataformat/xstream/SpringMarshalDomainObjectJSONTest.xml");
    setCamelContextService(new Service() {

        public void start() throws Exception {
            applicationContext.start();
        }

        public void stop() throws Exception {
            applicationContext.stop();
        }
    });
    return SpringCamelContext.springCamelContext(applicationContext);
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) Service(org.apache.camel.Service) AbstractXmlApplicationContext(org.springframework.context.support.AbstractXmlApplicationContext)

Example 14 with AbstractXmlApplicationContext

use of org.springframework.context.support.AbstractXmlApplicationContext in project camel by apache.

the class SpringMarshalListTest method createCamelContext.

protected CamelContext createCamelContext() throws Exception {
    setUseRouteBuilder(false);
    final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/dataformat/xstream/SpringMarshalListTest.xml");
    setCamelContextService(new Service() {

        public void start() throws Exception {
            applicationContext.start();
        }

        public void stop() throws Exception {
            applicationContext.stop();
        }
    });
    return SpringCamelContext.springCamelContext(applicationContext);
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) Service(org.apache.camel.Service) AbstractXmlApplicationContext(org.springframework.context.support.AbstractXmlApplicationContext)

Example 15 with AbstractXmlApplicationContext

use of org.springframework.context.support.AbstractXmlApplicationContext in project camel by apache.

the class SpringXStreamConfigurationTest method createCamelContext.

protected CamelContext createCamelContext() throws Exception {
    setUseRouteBuilder(false);
    final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/dataformat/xstream/SpringXStreamConfigurationTest.xml");
    setCamelContextService(new Service() {

        public void start() throws Exception {
            applicationContext.start();
        }

        public void stop() throws Exception {
            applicationContext.stop();
        }
    });
    return SpringCamelContext.springCamelContext(applicationContext);
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) Service(org.apache.camel.Service) AbstractXmlApplicationContext(org.springframework.context.support.AbstractXmlApplicationContext)

Aggregations

AbstractXmlApplicationContext (org.springframework.context.support.AbstractXmlApplicationContext)28 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)22 CamelContext (org.apache.camel.CamelContext)17 Test (org.junit.Test)11 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)10 Service (org.apache.camel.Service)8 SimpleTrigger (org.quartz.SimpleTrigger)4 Endpoint (org.apache.camel.Endpoint)3 SpringCamelContext (org.apache.camel.spring.SpringCamelContext)3 ProducerTemplate (org.apache.camel.ProducerTemplate)2 CronTrigger (org.quartz.CronTrigger)2 IOException (java.io.IOException)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 SAXException (org.xml.sax.SAXException)1