Package org.springframework.context.support

Examples of org.springframework.context.support.AbstractXmlApplicationContext


* @version $Revision: 989470 $
*/
public class SpringRemotingBeanConverterTest extends TestCase {
   
    public void testBeanRoutes() throws Exception {
        AbstractXmlApplicationContext applicationContext = createApplicationContext();

        CamelContext camelContext = SpringCamelContext.springCamelContext(applicationContext);
       
        Invoker invoker = (Invoker) applicationContext.getBean("invokerProxy");
        String response = invoker.invoke(new Bean.SubClass());
        assertEquals("Hello from Sub" , response);

        camelContext.stop();
        applicationContext.destroy();
    }
View Full Code Here


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

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

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

        Endpoint start1 = camel1.getEndpoint("direct:start");
        Endpoint start2 = camel2.getEndpoint("direct:start");
        assertNotSame(start1, start2);
       
        MockEndpoint mock1 = camel1.getEndpoint("mock:result", MockEndpoint.class);
        mock1.expectedBodiesReceived("Hello World");

        MockEndpoint mock2 = camel2.getEndpoint("mock:result", 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

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();
    }
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.