Search in sources :

Example 11 with ResolveEndpointFailedException

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

the class RouteWithMistypedComponentNameTest method testNoSuchEndpointType.

public void testNoSuchEndpointType() throws Exception {
    CamelContext context = new DefaultCamelContext();
    try {
        context.addRoutes(new RouteBuilder() {

            @Override
            public void configure() throws Exception {
                from("direct:hello").to("mock:result");
                // unknown component
                endpoint("mistyped:hello", Endpoint.class);
            }
        });
        fail("Should have thrown a ResolveEndpointFailedException");
    } catch (ResolveEndpointFailedException e) {
    // expected
    }
}
Also used : CamelContext(org.apache.camel.CamelContext) ResolveEndpointFailedException(org.apache.camel.ResolveEndpointFailedException) RouteBuilder(org.apache.camel.builder.RouteBuilder) Endpoint(org.apache.camel.Endpoint) ResolveEndpointFailedException(org.apache.camel.ResolveEndpointFailedException)

Example 12 with ResolveEndpointFailedException

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

the class RouteWithMistypedComponentNameTest method testNoSuchEndpoint.

public void testNoSuchEndpoint() throws Exception {
    CamelContext context = new DefaultCamelContext();
    try {
        context.addRoutes(new RouteBuilder() {

            @Override
            public void configure() throws Exception {
                from("direct:hello").to("mock:result");
                // unknown component
                endpoint("mistyped:hello");
            }
        });
        fail("Should have thrown a ResolveEndpointFailedException");
    } catch (ResolveEndpointFailedException e) {
    // expected
    }
}
Also used : CamelContext(org.apache.camel.CamelContext) ResolveEndpointFailedException(org.apache.camel.ResolveEndpointFailedException) RouteBuilder(org.apache.camel.builder.RouteBuilder) ResolveEndpointFailedException(org.apache.camel.ResolveEndpointFailedException)

Example 13 with ResolveEndpointFailedException

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

the class RecipientListIgnoreInvalidEndpointsTest method testRecipientListWithoutIgnoreInvalidEndpointsOption.

public void testRecipientListWithoutIgnoreInvalidEndpointsOption() throws Exception {
    MockEndpoint result = getMockEndpoint("mock:result");
    result.expectedMessageCount(0);
    MockEndpoint endpointA = getMockEndpoint("mock:endpointA");
    endpointA.expectedMessageCount(0);
    try {
        template.requestBody("direct:startB", "Hello World", String.class);
        fail("Expect the exception here.");
    } catch (Exception ex) {
        assertTrue("Get a wrong cause of the exception", ex.getCause() instanceof ResolveEndpointFailedException);
    }
    assertMockEndpointsSatisfied();
}
Also used : ResolveEndpointFailedException(org.apache.camel.ResolveEndpointFailedException) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) ResolveEndpointFailedException(org.apache.camel.ResolveEndpointFailedException)

Example 14 with ResolveEndpointFailedException

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

the class PropertiesComponentDefaultTest method testPropertiesComponentDefaultNoFileFound.

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

        @Override
        public void configure() throws Exception {
            from("direct:start").to("properties:bar.end?locations=org/apache/camel/component/properties/unknown.properties");
        }
    });
    try {
        context.start();
        fail("Should throw exception");
    } catch (FailedToCreateRouteException e) {
        ResolveEndpointFailedException cause = assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
        FileNotFoundException fnfe = assertIsInstanceOf(FileNotFoundException.class, cause.getCause());
        assertEquals("Properties file org/apache/camel/component/properties/unknown.properties not found in classpath", fnfe.getMessage());
    }
}
Also used : FailedToCreateRouteException(org.apache.camel.FailedToCreateRouteException) ResolveEndpointFailedException(org.apache.camel.ResolveEndpointFailedException) RouteBuilder(org.apache.camel.builder.RouteBuilder) FileNotFoundException(java.io.FileNotFoundException) FailedToCreateRouteException(org.apache.camel.FailedToCreateRouteException) FileNotFoundException(java.io.FileNotFoundException) ResolveEndpointFailedException(org.apache.camel.ResolveEndpointFailedException)

Example 15 with ResolveEndpointFailedException

use of org.apache.camel.ResolveEndpointFailedException in project wildfly-camel by wildfly-extras.

the class CustomComponentsTest method testMQTTComponentDoesNotLoad.

@Test
public void testMQTTComponentDoesNotLoad() throws Exception {
    CamelContext camelctx = new DefaultCamelContext();
    try {
        camelctx.getEndpoint("mqtt://dummy");
        Assert.fail("Expected a ResolveEndpointFailedException");
    } catch (ResolveEndpointFailedException e) {
    // expected
    }
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) ResolveEndpointFailedException(org.apache.camel.ResolveEndpointFailedException) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Aggregations

ResolveEndpointFailedException (org.apache.camel.ResolveEndpointFailedException)25 RouteBuilder (org.apache.camel.builder.RouteBuilder)12 FailedToCreateRouteException (org.apache.camel.FailedToCreateRouteException)9 Endpoint (org.apache.camel.Endpoint)5 Test (org.junit.Test)4 HashMap (java.util.HashMap)3 CamelContext (org.apache.camel.CamelContext)3 Component (org.apache.camel.Component)3 URI (java.net.URI)2 NoSuchEndpointException (org.apache.camel.NoSuchEndpointException)2 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)2 HttpBinding (org.apache.camel.http.common.HttpBinding)2 HttpRestHeaderFilterStrategy (org.apache.camel.http.common.HttpRestHeaderFilterStrategy)2 UrlRewrite (org.apache.camel.http.common.UrlRewrite)2 HeaderFilterStrategy (org.apache.camel.spi.HeaderFilterStrategy)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 Field (java.lang.reflect.Field)1 URISyntaxException (java.net.URISyntaxException)1 LinkedHashSet (java.util.LinkedHashSet)1