Search in sources :

Example 56 with DefaultCamelContext

use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.

the class DirectNoMultipleConsumersTest method testNoMultipleConsumersTest.

public void testNoMultipleConsumersTest() throws Exception {
    CamelContext container = new DefaultCamelContext();
    container.disableJMX();
    container.addRoutes(new RouteBuilder() {

        public void configure() throws Exception {
            from("direct:in").to("mock:result");
            from("direct:in").to("mock:result");
        }
    });
    try {
        container.start();
        fail("Should have thrown an FailedToStartRouteException");
    } catch (FailedToStartRouteException e) {
    // expected
    } finally {
        container.stop();
    }
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) FailedToStartRouteException(org.apache.camel.FailedToStartRouteException) RouteBuilder(org.apache.camel.builder.RouteBuilder) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) FailedToStartRouteException(org.apache.camel.FailedToStartRouteException)

Example 57 with DefaultCamelContext

use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.

the class TwoCamelContextDirectEndpointTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    camel1 = new DefaultCamelContext();
    camel1.addRoutes(new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            from("direct:start").to("direct:foo");
            from("direct:foo").to("mock:a");
        }
    });
    camel1.start();
    camel2 = new DefaultCamelContext();
    camel2.addRoutes(new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            from("direct:start").to("direct:foo");
            from("direct:foo").to("mock:b");
        }
    });
    camel2.start();
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext)

Example 58 with DefaultCamelContext

use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.

the class AbstractDirectVmTestSupport method setUp.

@Override
@Before
protected void setUp() throws Exception {
    super.setUp();
    doPostSetup();
    context2 = new DefaultCamelContext();
    template2 = context2.createProducerTemplate();
    ServiceHelper.startServices(template2, context2);
    // add routes after CamelContext has been started
    RouteBuilder routeBuilder = createRouteBuilderForSecondContext();
    if (routeBuilder != null) {
        context2.addRoutes(routeBuilder);
    }
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Before(org.junit.Before)

Example 59 with DefaultCamelContext

use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.

the class AbstractVmTestSupport method setUp.

@Override
@Before
protected void setUp() throws Exception {
    super.setUp();
    context2 = new DefaultCamelContext();
    template2 = context2.createProducerTemplate();
    ServiceHelper.startServices(template2, context2);
    // add routes after CamelContext has been started
    RouteBuilder routeBuilder = createRouteBuilderForSecondContext();
    if (routeBuilder != null) {
        context2.addRoutes(routeBuilder);
    }
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Before(org.junit.Before)

Example 60 with DefaultCamelContext

use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.

the class InvalidXsltFileTest method testInvalidStylesheet.

public void testInvalidStylesheet() throws Exception {
    try {
        RouteBuilder builder = createRouteBuilder();
        CamelContext context = new DefaultCamelContext();
        context.addRoutes(builder);
        context.start();
        fail("Should have thrown an exception due XSL compilation error");
    } catch (FailedToCreateRouteException e) {
        // expected
        assertIsInstanceOf(TransformerConfigurationException.class, e.getCause());
    }
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) FailedToCreateRouteException(org.apache.camel.FailedToCreateRouteException) RouteBuilder(org.apache.camel.builder.RouteBuilder) TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext)

Aggregations

DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)474 CamelContext (org.apache.camel.CamelContext)206 Test (org.junit.Test)183 DefaultExchange (org.apache.camel.impl.DefaultExchange)128 RouteBuilder (org.apache.camel.builder.RouteBuilder)101 Exchange (org.apache.camel.Exchange)91 Before (org.junit.Before)70 SimpleRegistry (org.apache.camel.impl.SimpleRegistry)61 RegisteredDelivery (org.jsmpp.bean.RegisteredDelivery)39 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)38 ESMClass (org.jsmpp.bean.ESMClass)30 ProducerTemplate (org.apache.camel.ProducerTemplate)27 CountDownLatch (java.util.concurrent.CountDownLatch)15 Endpoint (org.apache.camel.Endpoint)13 FailedToCreateRouteException (org.apache.camel.FailedToCreateRouteException)13 Processor (org.apache.camel.Processor)12 RouteStartupOrder (org.apache.camel.spi.RouteStartupOrder)12 Address (org.jsmpp.bean.Address)11 SubmitMultiResult (org.jsmpp.bean.SubmitMultiResult)11 Date (java.util.Date)10