Search in sources :

Example 31 with ClassPathXmlApplicationContext

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

the class Main method getParentApplicationContext.

public AbstractApplicationContext getParentApplicationContext() {
    if (parentApplicationContext == null) {
        if (parentApplicationContextUri != null) {
            parentApplicationContext = new ClassPathXmlApplicationContext(parentApplicationContextUri);
            parentApplicationContext.start();
        }
    }
    return parentApplicationContext;
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext)

Example 32 with ClassPathXmlApplicationContext

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

the class Main method createDefaultApplicationContext.

protected AbstractApplicationContext createDefaultApplicationContext() throws IOException {
    ApplicationContext parentContext = getParentApplicationContext();
    // file based
    if (getFileApplicationContextUri() != null) {
        String[] args = getFileApplicationContextUri().split(";");
        if (parentContext != null) {
            return new FileSystemXmlApplicationContext(args, parentContext);
        } else {
            return new FileSystemXmlApplicationContext(args);
        }
    }
    // default to classpath based
    String[] args = getApplicationContextUri().split(";");
    if (parentContext != null) {
        return new ClassPathXmlApplicationContext(args, parentContext);
    } else {
        return new ClassPathXmlApplicationContext(args);
    }
}
Also used : FileSystemXmlApplicationContext(org.springframework.context.support.FileSystemXmlApplicationContext) FileSystemXmlApplicationContext(org.springframework.context.support.FileSystemXmlApplicationContext) ApplicationContext(org.springframework.context.ApplicationContext) AbstractApplicationContext(org.springframework.context.support.AbstractApplicationContext) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext)

Example 33 with ClassPathXmlApplicationContext

use of org.springframework.context.support.ClassPathXmlApplicationContext 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 34 with ClassPathXmlApplicationContext

use of org.springframework.context.support.ClassPathXmlApplicationContext 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 35 with ClassPathXmlApplicationContext

use of org.springframework.context.support.ClassPathXmlApplicationContext 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

ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)561 Test (org.junit.Test)265 ApplicationContext (org.springframework.context.ApplicationContext)167 Before (org.junit.Before)53 ConfigurableMessenger (org.springframework.scripting.ConfigurableMessenger)33 ITestBean (org.springframework.tests.sample.beans.ITestBean)30 Messenger (org.springframework.scripting.Messenger)29 CamelContext (org.apache.camel.CamelContext)25 Refreshable (org.springframework.aop.target.dynamic.Refreshable)23 AbstractXmlApplicationContext (org.springframework.context.support.AbstractXmlApplicationContext)22 DataSource (javax.sql.DataSource)18 SpringCamelContext (org.apache.camel.spring.SpringCamelContext)16 AbstractApplicationContext (org.springframework.context.support.AbstractApplicationContext)16 Bus (org.apache.cxf.Bus)14 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)14 ArrayList (java.util.ArrayList)13 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)12 DemoService (com.alibaba.dubbo.config.spring.api.DemoService)11 IOException (java.io.IOException)10 ProducerTemplate (org.apache.camel.ProducerTemplate)10