Search in sources :

Example 16 with FailedToCreateRouteException

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

the class TimerWithTimeOptionTest method testFiredInFutureIllegalTime.

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

        @Override
        public void configure() throws Exception {
            fromF("timer://foo?time=%s", "20090101").to("mock:result");
        }
    });
    try {
        context.start();
        fail("Should throw an exception");
    } catch (FailedToCreateRouteException e) {
        assertIsInstanceOf(ParseException.class, e.getCause().getCause());
    }
}
Also used : FailedToCreateRouteException(org.apache.camel.FailedToCreateRouteException) RouteBuilder(org.apache.camel.builder.RouteBuilder) ParseException(java.text.ParseException) FailedToCreateRouteException(org.apache.camel.FailedToCreateRouteException) ParseException(java.text.ParseException)

Example 17 with FailedToCreateRouteException

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

the class XsltFileNotFoundTest method testNoXsltFile.

public void testNoXsltFile() throws Exception {
    try {
        RouteBuilder builder = createRouteBuilder();
        CamelContext context = new DefaultCamelContext();
        context.addRoutes(builder);
        context.start();
        fail("Should have thrown an exception due XSLT file not found");
    } catch (FailedToCreateRouteException e) {
        assertIsInstanceOf(TransformerException.class, e.getCause());
        assertIsInstanceOf(FileNotFoundException.class, e.getCause().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) FileNotFoundException(java.io.FileNotFoundException) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) TransformerException(javax.xml.transform.TransformerException)

Example 18 with FailedToCreateRouteException

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

the class ProcessorTypeConfigurationTest method testProcessorRefMissConfigured.

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

            public void configure() throws Exception {
                from("direct:in").process("hello");
            }
        });
        fail("Should have thrown IllegalArgumentException");
    } catch (FailedToCreateRouteException e) {
        assertEquals("No bean could be found in the registry for: hello of type: org.apache.camel.Processor", e.getCause().getMessage());
    }
}
Also used : FailedToCreateRouteException(org.apache.camel.FailedToCreateRouteException) RouteBuilder(org.apache.camel.builder.RouteBuilder) FailedToCreateRouteException(org.apache.camel.FailedToCreateRouteException)

Example 19 with FailedToCreateRouteException

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

the class StartingRoutesErrorReportedTest method testInvalidTo.

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

            @Override
            public void configure() throws Exception {
                from("direct:start").routeId("route2").to("direct:result?foo=bar");
            }
        });
        context.start();
        fail();
    } catch (FailedToCreateRouteException e) {
        assertTrue(e.getMessage().startsWith("Failed to create route route2 at: >>> To[direct:result?foo=bar] <<< in route:" + " Route(route2)[[From[direct:start]] -> [To[direct:result?foo=... because of"));
    }
}
Also used : FailedToCreateRouteException(org.apache.camel.FailedToCreateRouteException) RouteBuilder(org.apache.camel.builder.RouteBuilder) FailedToCreateRouteException(org.apache.camel.FailedToCreateRouteException)

Example 20 with FailedToCreateRouteException

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

the class StartingRoutesErrorReportedTest method testUnavailableDataFormatOnClasspath.

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

            @Override
            public void configure() throws Exception {
                from("direct:start").routeId("route3").unmarshal().jaxb().log("Will never get here");
            }
        });
        context.start();
        fail("Should have thrown exception");
    } catch (FailedToCreateRouteException e) {
        assertTrue(e.getMessage().contains("Ensure that the data format is valid and the associated Camel component is present on the classpath"));
    }
}
Also used : FailedToCreateRouteException(org.apache.camel.FailedToCreateRouteException) RouteBuilder(org.apache.camel.builder.RouteBuilder) FailedToCreateRouteException(org.apache.camel.FailedToCreateRouteException)

Aggregations

FailedToCreateRouteException (org.apache.camel.FailedToCreateRouteException)66 RouteBuilder (org.apache.camel.builder.RouteBuilder)63 ResolveEndpointFailedException (org.apache.camel.ResolveEndpointFailedException)13 Test (org.junit.Test)9 IOException (java.io.IOException)6 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)6 SOAPException (javax.xml.soap.SOAPException)5 CamelContext (org.apache.camel.CamelContext)5 FileNotFoundException (java.io.FileNotFoundException)3 NoSuchBeanException (org.apache.camel.NoSuchBeanException)3 ArrayList (java.util.ArrayList)2 TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)2 CamelExecutionException (org.apache.camel.CamelExecutionException)2 NoSuchEndpointException (org.apache.camel.NoSuchEndpointException)2 RuntimeCamelException (org.apache.camel.RuntimeCamelException)2 DefaultRouteContext (org.apache.camel.impl.DefaultRouteContext)2 SimpleRegistry (org.apache.camel.impl.SimpleRegistry)2 RouteContext (org.apache.camel.spi.RouteContext)2 EventBus (com.google.common.eventbus.EventBus)1 HttpException (com.meterware.httpunit.HttpException)1