Search in sources :

Example 1 with FailedToStartRouteException

use of org.apache.camel.FailedToStartRouteException in project camel by apache.

the class DisruptorConcurrentConsumersNPEIssueTest method testSendToDisruptor.

@Test
public void testSendToDisruptor() throws Exception {
    final MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedBodiesReceived("Hello World");
    template.sendBody("disruptor:foo", "Hello World");
    assertMockEndpointsSatisfied();
    try {
        context.startRoute("first");
        fail("Should have thrown exception");
    } catch (FailedToStartRouteException e) {
        assertEquals("Failed to start route first because of Multiple consumers for the same endpoint is not allowed:" + " disruptor://foo?concurrentConsumers=5", e.getMessage());
    }
}
Also used : FailedToStartRouteException(org.apache.camel.FailedToStartRouteException) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 2 with FailedToStartRouteException

use of org.apache.camel.FailedToStartRouteException in project camel by apache.

the class SedaConcurrentConsumersNPEIssueTest method testSendToSeda.

public void testSendToSeda() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedBodiesReceived("Hello World");
    template.sendBody("seda:foo", "Hello World");
    assertMockEndpointsSatisfied();
    try {
        context.startRoute("first");
        fail("Should have thrown exception");
    } catch (FailedToStartRouteException e) {
        assertEquals("Failed to start route first because of Multiple consumers for the same endpoint is not allowed:" + " seda://foo?concurrentConsumers=5", e.getMessage());
    }
}
Also used : FailedToStartRouteException(org.apache.camel.FailedToStartRouteException) MockEndpoint(org.apache.camel.component.mock.MockEndpoint)

Example 3 with FailedToStartRouteException

use of org.apache.camel.FailedToStartRouteException in project camel by apache.

the class SedaConcurrentConsumersNPEIssueTest method testStartThird.

public void testStartThird() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedBodiesReceived("Hello World");
    template.sendBody("seda:foo", "Hello World");
    assertMockEndpointsSatisfied();
    // this should be okay
    context.startRoute("third");
    try {
        context.startRoute("first");
        fail("Should have thrown exception");
    } catch (FailedToStartRouteException e) {
        assertEquals("Failed to start route first because of Multiple consumers for the same endpoint is not allowed:" + " seda://foo?concurrentConsumers=5", e.getMessage());
    }
}
Also used : FailedToStartRouteException(org.apache.camel.FailedToStartRouteException) MockEndpoint(org.apache.camel.component.mock.MockEndpoint)

Example 4 with FailedToStartRouteException

use of org.apache.camel.FailedToStartRouteException 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 5 with FailedToStartRouteException

use of org.apache.camel.FailedToStartRouteException in project camel by apache.

the class DirectEndpointRouteInlinedTest method testDirectExistingExists.

public void testDirectExistingExists() throws Exception {
    try {
        context.addRoutes(new RouteBuilder() {

            @Override
            public void configure() throws Exception {
                from("direct:start").to("mock:result");
                from("direct:start").to("mock:bar");
            }
        });
        fail("Should have thrown exception");
    } catch (FailedToStartRouteException e) {
        assertEquals("Failed to start route route2 because of Multiple consumers for the same endpoint is not allowed: direct://start", e.getMessage());
    }
}
Also used : FailedToStartRouteException(org.apache.camel.FailedToStartRouteException) RouteBuilder(org.apache.camel.builder.RouteBuilder) FailedToStartRouteException(org.apache.camel.FailedToStartRouteException)

Aggregations

FailedToStartRouteException (org.apache.camel.FailedToStartRouteException)12 RouteBuilder (org.apache.camel.builder.RouteBuilder)7 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)4 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 CamelContext (org.apache.camel.CamelContext)1 Consumer (org.apache.camel.Consumer)1 Endpoint (org.apache.camel.Endpoint)1 PollingConsumer (org.apache.camel.PollingConsumer)1 Route (org.apache.camel.Route)1 ServiceStatus (org.apache.camel.ServiceStatus)1 ShutdownRoute (org.apache.camel.ShutdownRoute)1 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)1