Package org.springframework.context.support

Examples of org.springframework.context.support.AbstractXmlApplicationContext


public class CamelJaxbSpringTest extends CamelJaxbTest {
   
    protected CamelContext createCamelContext() throws Exception {
        setUseRouteBuilder(false);
        final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/jaxb/CamelJaxbTest.xml");
        setCamelContextService(new Service() {
            public void start() throws Exception {
                applicationContext.start();
            }

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

        return SpringCamelContext.springCamelContext(applicationContext);
       
View Full Code Here


public class SpringXStreamConfigurationTest extends XStreamConfigurationTest {

    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);
    }
View Full Code Here

public class SpringMarshalListTest extends MarshalListTest {
   
    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);       
    }
View Full Code Here

public class SpringMarshalDomainObjectJSONTest extends MarshalDomainObjectJSONTest {

    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);       
    }
View Full Code Here

public class SpringMarshalOmitFieldsTest extends XStreamDataFormatOmitFieldsTest {

    protected CamelContext createCamelContext() throws Exception {
        setUseRouteBuilder(false);

        final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(
            "org/apache/camel/dataformat/xstream/SpringMarshalOmitFieldsTest.xml");

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

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

        return SpringCamelContext.springCamelContext(applicationContext);
    }
View Full Code Here

    }

    protected CamelContext createCamelContext() throws Exception {
        setUseRouteBuilder(false);
       
        final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/component/jetty/jetty-https.xml");
        setCamelContextService(new Service() {
            public void start() throws Exception {
                applicationContext.start();

            }

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

        return SpringCamelContext.springCamelContext(applicationContext);       
    }
View Full Code Here

    }
   
    public static CamelContext createSpringCamelContext(ContextTestSupport test, String classpathUri) throws Exception {
        test.setUseRouteBuilder(false);

        final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(classpathUri);
        test.setCamelContextService(new Service() {
            public void start() throws Exception {
                applicationContext.start();

            }

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

        return SpringCamelContext.springCamelContext(applicationContext);
    }
View Full Code Here

        // noop
    }

    @Override
    protected AbstractXmlApplicationContext createApplicationContext() {
        AbstractXmlApplicationContext answer;
        try {
            answer = new ClassPathXmlApplicationContext("org/apache/camel/spring/config/SpringRouteNoOutputTest.xml");
            fail("Should have thrown exception");
        } catch (Exception e) {
            IllegalArgumentException iae = (IllegalArgumentException) e.getCause().getCause();
View Full Code Here

public class SpringQuartzPersistentStoreRestartAppTest extends TestSupport {

    @Test
    public void testQuartzPersistentStoreRestart() throws Exception {
        // load spring app
        AbstractXmlApplicationContext app = new ClassPathXmlApplicationContext("org/apache/camel/component/quartz/SpringQuartzPersistentStoreTest.xml");

        app.start();

        CamelContext camel = app.getBean("camelContext", CamelContext.class);
        assertNotNull(camel);

        MockEndpoint mock = camel.getEndpoint("mock:result", MockEndpoint.class);
        mock.expectedMinimumMessageCount(2);

        mock.assertIsSatisfied();

        app.stop();
       
        log.info("Restarting ...");
        log.info("Restarting ...");
        log.info("Restarting ...");

        // NOTE:
        // To test a restart where the app has crashed, then you can in QuartzEndpoint
        // in the doShutdown method, then remove the following code line
        //  deleteTrigger(getTrigger());
        // then when we restart then there is old stale data which QuartzComponent
        // is supposed to handle and start again

        // load spring app
        AbstractXmlApplicationContext app2 = new ClassPathXmlApplicationContext("org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartTest.xml");

        app2.start();

        CamelContext camel2 = app2.getBean("camelContext", CamelContext.class);
        assertNotNull(camel2);

        MockEndpoint mock2 = camel2.getEndpoint("mock:result", MockEndpoint.class);
        mock2.expectedMinimumMessageCount(2);

        mock2.assertIsSatisfied();

        app2.stop();

        // we're done so let's properly close the application contexts
        app.close();
        app2.close();
    }
View Full Code Here

    protected AbstractXmlApplicationContext createApplicationContext() {
        return new ClassPathXmlApplicationContext("org/apache/camel/spring/issues/SpringTwoCamelContextDirectEndpointTest.xml");
    }

    public void testSpringTwoCamelContextDirectEndpoint() throws Exception {
        AbstractXmlApplicationContext ac = createApplicationContext();
        ac.start();

        CamelContext camel1 = ac.getBean("camel-1", CamelContext.class);
        CamelContext camel2 = ac.getBean("camel-2", CamelContext.class);

        Endpoint start1 = camel1.getEndpoint("direct:start");
        Endpoint start2 = camel2.getEndpoint("direct:start");
        assertNotSame(start1, start2);
        Endpoint foo1 = camel1.getEndpoint("direct:foo");
        Endpoint foo2 = camel2.getEndpoint("direct:foo");
        assertNotSame(foo1, foo2);

        MockEndpoint mock1 = camel1.getEndpoint("mock:a", MockEndpoint.class);
        mock1.expectedBodiesReceived("Hello World");

        MockEndpoint mock2 = camel2.getEndpoint("mock:b", MockEndpoint.class);
        mock2.expectedBodiesReceived("Bye World");

        camel1.createProducerTemplate().sendBody("direct:start", "Hello World");
        camel2.createProducerTemplate().sendBody("direct:start", "Bye World");

        mock1.assertIsSatisfied();
        mock2.assertIsSatisfied();

        ac.stop();
    }
View Full Code Here

TOP

Related Classes of org.springframework.context.support.AbstractXmlApplicationContext

Copyright © 2018 www.massapicom. 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.