Package org.springframework.context.support

Examples of org.springframework.context.support.AbstractXmlApplicationContext


* @version
*/
public class SpringRemotingBeanConverterTest extends TestCase {
   
    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();
        applicationContext.destroy();
    }
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

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringRemotingTwoCamelContextTest extends TestCase {
   
    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();
        applicationContext.destroy();
    }
View Full Code Here

        // noop
    }

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

* @version
*/
public class SpringRemotingRouteTest extends TestCase {
   
    public void testBeanRoutes() throws Exception {
        AbstractXmlApplicationContext applicationContext = createApplicationContext();
        CamelContext camelContext = SpringCamelContext.springCamelContext(applicationContext);

        // START SNIPPET: invoke
        ISay proxy = applicationContext.getBean("sayProxy", ISay.class);
        String rc = proxy.say();
        assertEquals("Hello", rc);
        // END SNIPPET: invoke

        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 = ac.getBean("myCamel-1", CamelContext.class);
        CamelContext camel2 = 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

    }

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

        final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(
                "org/apache/camel/dataformat/jibx/SpringJibxConfigurationTest.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 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 SpringMarshalDomainObjectTest extends MarshalDomainObjectTest {

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

        final AbstractXmlApplicationContext applicationContext =
                new ClassPathXmlApplicationContext("org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.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

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.