Package org.springframework.context.support

Examples of org.springframework.context.support.AbstractXmlApplicationContext


    protected boolean useJmx() {
        return true;
    }

    protected AbstractXmlApplicationContext createApplicationContext() {
        AbstractXmlApplicationContext answer = null;
        try {
            answer = new ClassPathXmlApplicationContext("org/apache/camel/spring/management/SpringCamelContextStartingFailedEventTest.xml");
            fail("Should thrown an exception");
        } catch (Exception e) {
            assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause().getCause());
View Full Code Here


* @version $Revision: 938746 $
*/
public class SpringRemotingRouteTest extends TestCase {
   
    public void testBeanRoutes() throws Exception {
        AbstractXmlApplicationContext applicationContext = createApplicationContext();
/*
        Object service = applicationContext.getBean("say");
        log.info("Found service!: " + service);
        assertTrue("not an ISay!", service instanceof ISay);
*/

        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

    protected void tearDown() throws Exception {
        context.close();
    }

    public void testSendSync() throws Exception {
        AbstractXmlApplicationContext ctx = new ClassPathXmlApplicationContext("org/apache/servicemix/jbi/nmr/flow/jms/client.xml");
        try {
            ServiceMixClient client = (ServiceMixClient) ctx.getBean("client");
            Thread.sleep(2000);
            InOut exchange = client.createInOutExchange();
            exchange.setService(new QName("http://www.habuma.com/foo", "pingService"));
            NormalizedMessage in = exchange.getInMessage();
            in.setContent(new StringSource("<ping>Pinging you</ping>"));
            LOGGER.info("SENDING; exchange.status={}", exchange.getStatus());
            client.sendSync(exchange);
            assertNotNull(exchange.getOutMessage());
            LOGGER.info("GOT RESPONSE; exchange.out={}", new SourceTransformer().toString(exchange.getOutMessage().getContent()));
            client.done(exchange);
            // Wait for done to be delivered
            Thread.sleep(50);
        } finally {
            ctx.close();
        }
    }
View Full Code Here

                version = ": " + p.getImplementationVersion();
            }
            System.out.println("Starting Apache ServiceMix ESB" + version);
            System.out.println();

            final AbstractXmlApplicationContext context;
            if (args.length <= 0) {
                System.out.println("Loading Apache ServiceMix from servicemix.xml on the CLASSPATH");
                context = new ClassPathXmlApplicationContext(new String[] {"servicemix.xml"}, false);
            } else {
                String file = args[0];

                if ("-?".equals(file) || "?".equals(file) || "--help".equals(file) || "-h".equals(file)) {
                    System.out.println("Usage: Main [-v1] [xmlConfigFile]");
                    System.out.println("If an XML config file is not specified then servicemix.xml is used from the CLASSPATH");
                    return;
                }
               
                List processors = new ArrayList();
                processors.add(new ClassLoaderXmlPreprocessor(new File(".")));
                System.out.println("Loading Apache ServiceMix from file: " + file);
                context = new FileSystemXmlApplicationContext(new String[] {file}, false, processors);
            }
            context.setValidating(false);
            context.refresh();
           
            SpringJBIContainer container = (SpringJBIContainer) context.getBean("jbi");           
            container.onShutDown(new Runnable() {
                public void run() {
                    if (context instanceof DisposableBean) {
                        try {
                            ((DisposableBean) context).destroy();
View Full Code Here

*/
public class SpringRemotingRouteTest extends TestCase {
    private static final Log LOG = LogFactory.getLog(SpringRemotingRouteTest.class);

    public void testBeanRoutes() throws Exception {
        AbstractXmlApplicationContext applicationContext = createApplicationContext();
/*
        Object service = applicationContext.getBean("say");
        log.info("Found service!: " + service);
        assertTrue("not an ISay!", service instanceof ISay);
*/

        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

public class SpringJacksonJsonDataFormatTest extends JacksonJsonDataFormatTest {

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

        final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/component/jackson/SpringJacksonJsonDataFormatTest.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

* @version $Revision: 882492 $
*/
public class SpringCamelContextStartingFailedEventTest extends SpringTestSupport {

    protected AbstractXmlApplicationContext createApplicationContext() {
        AbstractXmlApplicationContext answer = null;
        try {
            answer = new ClassPathXmlApplicationContext("org/apache/camel/spring/management/SpringCamelContextStartingFailedEventTest.xml");
            fail("Should thrown an exception");
        } catch (Exception e) {
            assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause().getCause());
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

    }

    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

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

        final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(
            "org/apache/camel/component/cxf/SoapMessageProviderConvertString.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

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.