Examples of AbstractXmlApplicationContext


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 = (Invoker) applicationContext.getBean("invokerProxy");
        String response = invoker.invoke(new Bean.SubClass());
        assertEquals("Hello from Sub" , response);

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

Examples of org.springframework.context.support.AbstractXmlApplicationContext

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

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

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

Examples of org.springframework.context.support.AbstractXmlApplicationContext

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

Examples of org.springframework.context.support.AbstractXmlApplicationContext

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

Examples of org.springframework.context.support.AbstractXmlApplicationContext

    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

Examples of org.springframework.context.support.AbstractXmlApplicationContext

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

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();
        IOHelper.close(applicationContext);
View Full Code Here

Examples of org.springframework.context.support.AbstractXmlApplicationContext

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

Examples of org.springframework.context.support.AbstractXmlApplicationContext

* @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();
View Full Code Here

Examples of org.springframework.context.support.AbstractXmlApplicationContext

    protected AbstractXmlApplicationContext createApplicationContext() {
        return new ClassPathXmlApplicationContext("org/apache/camel/spring/config/RouteRefPropertyPlaceholderMultipleCamelContextRefsTest.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:end-1", MockEndpoint.class);
        mock1.expectedBodiesReceived("Hello World");

        MockEndpoint mock2 = camel2.getEndpoint("mock:end-2", 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
Copyright © 2018 www.massapi.com. 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.