Package org.apache.camel

Examples of org.apache.camel.CamelContext.start()


*/
public class ResourceHelperTest extends TestSupport {

    public void testLoadFile() throws Exception {
        CamelContext context = new DefaultCamelContext();
        context.start();

        InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(context.getClassResolver(), "file:src/test/resources/log4j.properties");
        assertNotNull(is);

        String text = context.getTypeConverter().convertTo(String.class, is);
View Full Code Here


        context.stop();
    }

    public void testLoadClasspath() throws Exception {
        CamelContext context = new DefaultCamelContext();
        context.start();

        InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(context.getClassResolver(), "classpath:log4j.properties");
        assertNotNull(is);

        String text = context.getTypeConverter().convertTo(String.class, is);
View Full Code Here

        context.stop();
    }

    public void testLoadClasspathDefault() throws Exception {
        CamelContext context = new DefaultCamelContext();
        context.start();

        InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(context.getClassResolver(), "log4j.properties");
        assertNotNull(is);

        String text = context.getTypeConverter().convertTo(String.class, is);
View Full Code Here

        context.stop();
    }

    public void testLoadFileNotFound() throws Exception {
        CamelContext context = new DefaultCamelContext();
        context.start();

        try {
            ResourceHelper.resolveMandatoryResourceAsInputStream(context.getClassResolver(), "file:src/test/resources/notfound.txt");
            fail("Should not find file");
        } catch (FileNotFoundException e) {
View Full Code Here

        return context;
    }

    public void testMultipleLifecycleStrategies() throws Exception {
        CamelContext context = createCamelContext();
        context.start();

        Component log = new LogComponent();
        context.addComponent("log", log);
        context.addEndpoint("log:/foo", log.createEndpoint("log://foo"));
        context.removeComponent("log");
View Full Code Here

        context.stop();
    }

    public void testLoadClasspathNotFound() throws Exception {
        CamelContext context = new DefaultCamelContext();
        context.start();

        try {
            ResourceHelper.resolveMandatoryResourceAsInputStream(context.getClassResolver(), "classpath:notfound.txt");
            fail("Should not find file");
        } catch (FileNotFoundException e) {
View Full Code Here

        context.stop();
    }

    public void testLoadFileAsUrl() throws Exception {
        CamelContext context = new DefaultCamelContext();
        context.start();

        URL url = ResourceHelper.resolveMandatoryResourceAsUrl(context.getClassResolver(), "file:src/test/resources/log4j.properties");
        assertNotNull(url);

        String text = context.getTypeConverter().convertTo(String.class, url);
View Full Code Here

        context.stop();
    }

    public void testLoadClasspathAsUrl() throws Exception {
        CamelContext context = new DefaultCamelContext();
        context.start();

        URL url = ResourceHelper.resolveMandatoryResourceAsUrl(context.getClassResolver(), "classpath:log4j.properties");
        assertNotNull(url);

        String text = context.getTypeConverter().convertTo(String.class, url);
View Full Code Here

    }

    public void testLifecycleStrategyFailOnStartup() throws Exception {
        CamelContext context = createCamelContext();
        try {
            context.start();
            fail("Should have thrown exception");
        } catch (IllegalArgumentException e) {
            assertEquals("Forced", e.getMessage());
        }
    }
View Full Code Here

        CamelContext camelContext = new DefaultCamelContext(context);
        // END SNIPPET: register

        camelContext.addRoutes(getRouteBuilder(camelContext));

        camelContext.start();

        // START SNIPPET: invoke
        Endpoint endpoint = camelContext.getEndpoint("direct:hello");
        ISay proxy = ProxyHelper.createProxy(endpoint, ISay.class);
        String rc = proxy.say();
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.