Java 类org.apache.camel.ValidationException 实例源码

项目:Camel    文件:ValidationWithMultipleHandlesTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            context.setTracing(true);

            from("direct:start")
                .doTry()
                    .process(validator)
                .doCatch(ValidationException.class)
                    .setHeader("xxx", constant("yyy"))
                .end()
                .doTry()
                    .process(validator).to("mock:valid")
                .doCatch(ValidationException.class)
                    .pipeline("seda:a", "mock:invalid");
        }
    };
}
项目:Camel    文件:ValidationWithNestedFinallyBlockPipelineTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            from("direct:start")
                .doTry()
                    .to("direct:embedded")
                .doCatch(ValidationException.class)
                    .to("mock:invalid");

            from("direct:embedded")
                .errorHandler(noErrorHandler())
                .doTry()
                    .process(validator)
                    .to("mock:valid")
                .doFinally()
                    .setHeader("valid", constant(false))
                .end();
        }
    };
}
项目:Camel    文件:ValidationWithHandlePipelineAndExceptionTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            errorHandler(deadLetterChannel("mock:error").redeliveryDelay(0).maximumRedeliveries(3));

            onException(ValidationException.class).to("mock:outer");

            from("direct:start")
                .doTry()
                    .process(validator)
                    .to("mock:valid")
                .doCatch(ValidationException.class)
                    .to("mock:invalid")
                    .process(validator);
        }
    };
}
项目:Camel    文件:ValidationWithFinallyBlockPipelineTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            from("direct:start")
                .doTry()
                    .process(validator)
                    .setHeader("valid", constant(true))
                .doCatch(ValidationException.class)
                    .setHeader("valid", constant(false))
                .doFinally()
                    .setBody(body())
                    .choice()
                    .when(header("valid").isEqualTo(true))
                    .to("mock:valid")
                    .otherwise()
                    .to("mock:invalid");
        }
    };
}
项目:Camel    文件:ValidationWithErrorInHandleAndFinallyBlockTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            from("direct:start")
                .errorHandler(noErrorHandler())
                .doTry()
                    .process(validator)
                .doCatch(ValidationException.class)
                    .process(validator)
                .doFinally()
                    .choice()
                    .when(header("foo").isEqualTo("bar"))
                    .to("mock:valid")
                    .otherwise()
                    .to("mock:invalid");
        }
    };
}
项目:Camel    文件:ValidationWithTryCatchTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            from("direct:start").process(new Processor() {
                public void process(Exchange exchange) throws Exception {
                    try {
                        validator.process(exchange);

                        template.send("mock:valid", exchange);
                    } catch (ValidationException e) {
                        template.send("mock:invalid", exchange);
                    }
                }
            });
        }
    };
}
项目:Camel    文件:ValidatorWithResourceResolverRouteTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    // we have to do it here, because we need the context created first
    CatalogManager.getStaticManager().setIgnoreMissingProperties(true);
    CatalogResolver catalogResolver = new CatalogResolver(true);
    URL catalogUrl = ResourceHelper.resolveMandatoryResourceAsUrl(context.getClassResolver(), "org/apache/camel/component/validator/catalog.cat");
    catalogResolver.getCatalog().parseCatalog(catalogUrl);
    LSResourceResolver resourceResolver = new CatalogLSResourceResolver(catalogResolver);
    JndiRegistry registry = (JndiRegistry) ((PropertyPlaceholderDelegateRegistry) context.getRegistry()).getRegistry();
    registry.bind("resourceResolver", resourceResolver);

    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
                .doTry()
                    .to("validator:org/apache/camel/component/validator/report.xsd?resourceResolver=#resourceResolver")
                    .to("mock:valid")
                .doCatch(ValidationException.class)
                    .to("mock:invalid")
                .doFinally()
                    .to("mock:finally")
                .end();
        }
    };
}
项目:Camel    文件:FileValidatorRouteTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("file:target/validator?noop=true")
                .doTry()
                    .to("validator:org/apache/camel/component/validator/schema.xsd")
                    .to("mock:valid")
                .doCatch(ValidationException.class)
                    .to("mock:invalid")
                .doFinally()
                    .to("mock:finally")
                .end();
        }
    };
}
项目:Camel    文件:ValidatorIncludeRouteTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
                .doTry()
                    .to("validator:org/apache/camel/component/validator/person.xsd")
                    .to("mock:valid")
                .doCatch(ValidationException.class)
                    .to("mock:invalid")
                .doFinally()
                    .to("mock:finally")
                .end();
        }
    };
}
项目:Camel    文件:ValidatorIncludeRelativeRouteTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
                .doTry()
                    .to("validator:org/apache/camel/component/validator/xsds/person.xsd")
                    .to("mock:valid")
                .doCatch(ValidationException.class)
                    .to("mock:invalid")
                .doFinally()
                    .to("mock:finally")
                .end();
        }
    };
}
项目:Camel    文件:FileConsumerFailureHandledTest.java   
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        public void configure() throws Exception {
            // make sure mock:error is the dead letter channel
            // use no delay for fast unit testing
            errorHandler(deadLetterChannel("mock:error").maximumRedeliveries(2).redeliveryDelay(0).logStackTrace(false));

            // special for not handled when we got beer
            onException(ValidationException.class).onWhen(exceptionMessage().contains("beer"))
                .handled(false).to("mock:beer");

            // special failure handler for ValidationException
            onException(ValidationException.class).handled(true).to("mock:invalid");

            // our route logic to process files from the input folder
            from("file:target/messages/input/?delete=true").
                process(new MyValidatorProcessor()).
                to("mock:valid");
        }
    };
}
项目:Camel    文件:ValidatorSchemaImportTest.java   
/**
 * Test for the valid schema location
 * @throws Exception
 */
@Test
public void testRelativeParentSchemaImport() throws Exception {
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
                .doTry()
                    .to("validator:org/apache/camel/component/validator/relativeparent/child/child.xsd")
                    .to("mock:valid")
                .doCatch(ValidationException.class)
                    .to("mock:invalid")
                .doFinally()
                    .to("mock:finally")
                .end();
        }
    });
    validEndpoint.expectedMessageCount(1);
    finallyEndpoint.expectedMessageCount(1);

    template.sendBody("direct:start",
            "<childuser xmlns='http://foo.com/bar'><user><id>1</id><username>Test User</username></user></childuser>");

    MockEndpoint.assertIsSatisfied(validEndpoint, invalidEndpoint, finallyEndpoint);
}
项目:Camel    文件:ValidatorSchemaImportTest.java   
/**
 * Test for the invalid schema import location.
 * 
 * @throws Exception
 */
@Test
public void testDotSlashSchemaImport() throws Exception {
    this.context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start").doTry()
                .to("validator:org/apache/camel/component/validator/dotslash/child.xsd").to("mock:valid")
                .doCatch(ValidationException.class).to("mock:invalid").doFinally().to("mock:finally")
                .end();
        }
    });
    validEndpoint.expectedMessageCount(1);
    finallyEndpoint.expectedMessageCount(1);

    template
        .sendBody("direct:start",
                  "<childuser xmlns='http://foo.com/bar'><user><id>1</id><username>Test User</username></user></childuser>");

    MockEndpoint.assertIsSatisfied(validEndpoint, invalidEndpoint, finallyEndpoint);
}
项目:Camel    文件:ValidatorSchemaImportTest.java   
/**
 * Test for the invalid schema import location.
 * 
 * @throws Exception
 */
@Test
public void testRelativeDoubleSlashSchemaImport() throws Exception {
    this.context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start").doTry()
                .to("validator:org/apache/camel/component/validator/doubleslash/child.xsd")
                .to("mock:valid").doCatch(ValidationException.class).to("mock:invalid").doFinally()
                .to("mock:finally").end();
        }
    });
    validEndpoint.expectedMessageCount(1);
    finallyEndpoint.expectedMessageCount(1);

    template
        .sendBody("direct:start",
                  "<childuser xmlns='http://foo.com/bar'><user><id>1</id><username>Test User</username></user></childuser>");

    MockEndpoint.assertIsSatisfied(validEndpoint, invalidEndpoint, finallyEndpoint);
}
项目:Camel    文件:ValidatorSchemaImportTest.java   
/**
 * Test for the valid schema location relative to a path other than the validating schema
 * @throws Exception
 */
@Test
public void testChildParentUncleSchemaImport() throws Exception {
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
                .doTry()
                    .to("validator:org/apache/camel/component/validator/childparentuncle/child/child.xsd")
                    .to("mock:valid")
                .doCatch(ValidationException.class)
                    .to("mock:invalid")
                .doFinally()
                    .to("mock:finally")
                .end();
        }
    });
    validEndpoint.expectedMessageCount(1);
    finallyEndpoint.expectedMessageCount(1);

    template.sendBody("direct:start",
            "<childuser xmlns='http://foo.com/bar'><user><id>1</id><username>Test User</username></user></childuser>");

    MockEndpoint.assertIsSatisfied(validEndpoint, invalidEndpoint, finallyEndpoint);
}
项目:Camel    文件:JmsValidatorTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("jms:queue:inbox")
                .convertBodyTo(String.class)
                .doTry()
                    .to("validator:file:src/test/resources/myschema.xsd")
                    .to("jms:queue:valid")
                .doCatch(ValidationException.class)
                    .to("jms:queue:invalid")
                .doFinally()
                    .to("jms:queue:finally")
                .end();

            from("jms:queue:valid").to("mock:valid");
            from("jms:queue:invalid").to("mock:invalid");
            from("jms:queue:finally").to("mock:finally");
        }
    };
}
项目:Camel    文件:JettyValidatorTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    port = AvailablePortFinder.getNextAvailable(8000);

    return new RouteBuilder() {
        public void configure() {
            from("jetty:http://localhost:" + port + "/test")
                .convertBodyTo(String.class)
                .to("log:in")
                .doTry()
                    .to("validator:OptimizationRequest.xsd")
                    .transform(constant("<ok/>"))
                .doCatch(ValidationException.class)
                    .transform(constant("<error/>"))
                .end()
                .to("log:out");
        }
    };
}
项目:cleverbus    文件:ExceptionTranslator.java   
/**
 * Gets {@link ErrorExtEnum} of specified exception.
 *
 * @param ex the exception
 * @return InternalErrorEnum
 */
public static ErrorExtEnum getError(Throwable ex) {
    if (ex instanceof IntegrationException) {
        return ((IntegrationException) ex).getError();

    } else if (ex instanceof ValidationException) {
        return InternalErrorEnum.E102;

    } else if (ex instanceof IOException || ex instanceof WebServiceIOException) {
        return InternalErrorEnum.E103;

    } else if (ex instanceof CamelAuthorizationException || ex instanceof AccessDeniedException) {
        return InternalErrorEnum.E117;

    } else {
        return InternalErrorEnum.E100;
    }
}
项目:jentrata    文件:XmlSchemaValidatorTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    final XmlSchemaValidator xmlSchemaValidator = new XmlSchemaValidator(EbmsUtils.fileFromClasspath("schemas/ebms-header-3_0-200704.xsd"));
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:testValidator")
                .doTry()
                    .setBody(xpath("//*[local-name()='Messaging']"))
                    .convertBodyTo(InputStream.class)
                    .process(xmlSchemaValidator)
                    .to(mockValid)
                .doCatch(ValidationException.class)
                    .to(mockInvalid)
            .routeId("testValidator");
        }
    };
}
项目:wildfly-camel    文件:JingIntegrationTest.java   
private CamelContext createCamelContext(boolean isCompact) throws Exception {
    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            String jingURI = "jing:classpath:";
            if (isCompact) {
                jingURI += "/schema.rnc?compactSyntax=true";
            } else {
                jingURI += "/schema.rng";
            }

            from("direct:start")
            .doTry()
                .to(jingURI)
                .to("mock:valid")
            .doCatch(ValidationException.class)
                .to("mock:invalid");
        }
    });

    return camelctx;
}
项目:Camel    文件:ValidatingProcessorTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            errorHandler(deadLetterChannel("mock:error").redeliveryDelay(0).maximumRedeliveries(3));

            onException(ValidationException.class).to("mock:invalid");

            from("direct:start").
                process(validating).
                to("mock:valid");
        }
    };
}
项目:Camel    文件:ValidationTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            from("direct:start")
                .doTry()
                    .process(validator).to("mock:valid")
                .doCatch(ValidationException.class)
                    .to("mock:invalid");
        }
    };
}
项目:Camel    文件:DefaultExceptionPolicyStrategyTest.java   
public void testClosetMatch1() {
    setupPolicies();
    OnExceptionDefinition result = strategy.getExceptionPolicy(policies, null, new ValidationException(null, ""));
    assertEquals(type1, result);

    result = strategy.getExceptionPolicy(policies, null, new ExchangeTimedOutException(null, 0));
    assertEquals(type1, result);
}
项目:Camel    文件:ValidationWithHandlePipelineTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            from("direct:start")
                .doTry()
                    .process(validator).to("mock:valid")
                .doCatch(ValidationException.class)
                    .doTry()
                        .process(validator).to("mock:valid")
                    .doCatch(ValidationException.class)
                        .pipeline("log:a", "mock:invalid");
        }
    };
}
项目:Camel    文件:ValidationWithInFlowExceptionTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            errorHandler(deadLetterChannel("mock:error").redeliveryDelay(0).maximumRedeliveries(3));

            onException(ValidationException.class).to("mock:invalid");

            from("direct:start").
                process(validator).
                to("mock:valid");
        }
    };
}
项目:Camel    文件:ValidatingProcessorNotUseSharedSchemaTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            errorHandler(deadLetterChannel("mock:error").redeliveryDelay(0).maximumRedeliveries(3));

            onException(ValidationException.class).to("mock:invalid");

            from("direct:start").
                process(validating).
                to("mock:valid");
        }
    };
}
项目:Camel    文件:BeanWithExceptionTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            onException(ValidationException.class).to("mock:invalid");

            from("direct:start").bean("myBean").to("mock:valid");
        }
    };
}
项目:Camel    文件:BeanWithExceptionTest.java   
public void someMethod(String body, @Header("foo")
                       String header, @ExchangeProperty("cheese") String cheese) throws ValidationException {
    assertEquals("old", cheese);

    if ("bar".equals(header)) {
        LOG.info("someMethod() called with valid header and body: " + body);
    } else {
        throw new ValidationException(null, "Invalid header foo: " + header);
    }
}
项目:Camel    文件:ValidationWithExceptionTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            errorHandler(deadLetterChannel("mock:error"));

            onException(ValidationException.class).to("mock:invalid");

            from("direct:start").
                    process(validator).
                    to("mock:valid");
        }
    };
}
项目:Camel    文件:ValidationFinallyBlockTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            TryDefinition tryType = from("direct:start").doTry().
                    process(validator).
                    to("mock:valid");
            tryType.doCatch(ValidationException.class).to("mock:invalid");
            tryType.doFinally().to("mock:all");
        }
    };
}
项目:Camel    文件:BuilderWithScopesTest.java   
public void process(Exchange exchange) throws Exception {
    order.add("VALIDATE");
    Object value = exchange.getIn().getHeader("foo");
    if (value == null) {
        throw new IllegalArgumentException("The foo header is not present.");
    } else if (!value.equals("bar")) {
        throw new ValidationException(exchange, "The foo header does not equal bar! Was: " + value);
    }
}
项目:Camel    文件:BuilderWithScopesTest.java   
protected RouteBuilder createTryCatchNoEnd() {
    return new RouteBuilder() {
        public void configure() {
            from("direct:a")
                .doTry()
                    .process(validator)
                    .process(toProcessor)
                .doCatch(ValidationException.class)
                    .process(orderProcessor)
                    .process(orderProcessor3)
                .end();
        }
    };
}
项目:Camel    文件:BuilderWithScopesTest.java   
protected RouteBuilder createTryCatchEnd() {
    return new RouteBuilder() {
        public void configure() {
            from("direct:a").doTry().process(validator).process(toProcessor)
                .doCatch(ValidationException.class).process(orderProcessor).end().process(orderProcessor3);
        }
    };
}
项目:Camel    文件:BuilderWithScopesTest.java   
protected RouteBuilder createTryCatchFinallyNoEnd() {
    return new RouteBuilder() {
        public void configure() {
            from("direct:a").doTry().process(validator).process(toProcessor)
                .doCatch(ValidationException.class).process(orderProcessor).doFinally()
                .process(orderProcessor2).process(orderProcessor3); // continuation of the finallyBlock clause
        }
    };
}
项目:Camel    文件:BuilderWithScopesTest.java   
protected RouteBuilder createTryCatchFinallyEnd() {
    return new RouteBuilder() {
        public void configure() {
            from("direct:a").doTry().process(validator).process(toProcessor)
                .doCatch(ValidationException.class).process(orderProcessor).doFinally()
                .process(orderProcessor2).end().process(orderProcessor3);
        }
    };
}
项目:Camel    文件:ValidatorRouteTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
                .doTry()
                    .to("validator:org/apache/camel/component/validator/schema.xsd")
                    .to("mock:valid")
                .doCatch(ValidationException.class)
                    .to("mock:invalid")
                .doFinally()
                    .to("mock:finally")
                .end();

            from("direct:startHeaders")
                .doTry()
                    .to("validator:org/apache/camel/component/validator/schema.xsd?headerName=headerToValidate")
                    .to("mock:valid")
                .doCatch(ValidationException.class)
                    .to("mock:invalid")
                .doFinally()
                    .to("mock:finally")
                .end();

            from("direct:startNoHeaderException")
                    .to("validator:org/apache/camel/component/validator/schema.xsd?headerName=headerToValidate")
                    .to("mock:valid");

            from("direct:startNullHeaderNoFail")
                    .to("validator:org/apache/camel/component/validator/schema.xsd?headerName=headerToValidate&failOnNullHeader=false")
                    .to("mock:valid");

            from("direct:useNotASharedSchema")
                .to("validator:org/apache/camel/component/validator/schema.xsd?useSharedSchema=false")
                .to("mock:valid");
        }
    };
}
项目:Camel    文件:FileConsumerFailureHandledTest.java   
public void process(Exchange exchange) throws Exception {
    String body = exchange.getIn().getBody(String.class);
    if ("London".equals(body)) {
        throw new ValidationException(exchange, "Forced exception by unit test");
    } else if ("Madrid".equals(body)) {
        throw new RuntimeCamelException("Madrid is not a supported city");
    } else if ("Dublin".equals(body)) {
        throw new ValidationException(exchange, "Dublin have good beer");
    }
    exchange.getOut().setBody("Hello " + body);
}
项目:camel-c24io    文件:ValidationTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            from("direct:start").
                    doTry().
                        process(new C24IOValidator()).
                        to("mock:valid").
                    doCatch(ValidationException.class).
                        to("mock:invalid");
        }
    };
}
项目:cleverbus    文件:AbstractBasicRoute.java   
/**
 * Handles specified exception.
 *
 * @param ex the thrown exception
 * @param asynch {@code true} if it's asynchronous message processing otherwise synchronous processing
 * @return next route URI
 */
@Handler
public String exceptionHandling(Exception ex, @Header(AsynchConstants.ASYNCH_MSG_HEADER) Boolean asynch) {
    Assert.notNull(ex, "the ex must not be null");
    Assert.isTrue(BooleanUtils.isTrue(asynch), "it must be asynchronous message");

    String nextUri;

    if (ExceptionUtils.indexOfThrowable(ex, ValidationException.class) >= 0
            || ExceptionUtils.indexOfThrowable(ex, ValidationIntegrationException.class) >= 0) {
        Log.warn("Validation error, no further processing - " + ex.getMessage());
        nextUri = AsynchConstants.URI_ERROR_FATAL;

    } else if (ExceptionUtils.indexOfThrowable(ex, BusinessException.class) >= 0) {
        Log.warn("Business exception, no further processing.");
        nextUri = AsynchConstants.URI_ERROR_FATAL;

    } else if (ExceptionUtils.indexOfThrowable(ex, NoDataFoundException.class) >= 0) {
        Log.warn("No data found, no further processing.");
        nextUri = AsynchConstants.URI_ERROR_FATAL;

    } else if (ExceptionUtils.indexOfThrowable(ex, MultipleDataFoundException.class) >= 0) {
        Log.warn("Multiple data found, no further processing.");
        nextUri = AsynchConstants.URI_ERROR_FATAL;

    } else if (ExceptionUtils.indexOfThrowable(ex, LockFailureException.class) >= 0) {
        Log.warn("Locking exception.");
        nextUri = AsynchConstants.URI_ERROR_HANDLING;

    } else {
        Log.error("Unspecified exception - " + ex.getClass().getSimpleName() + " (" + ex.getMessage() + ")");
        nextUri = AsynchConstants.URI_ERROR_HANDLING;
    }

    return nextUri;
}
项目:wildfly-camel    文件:MsvIntegrationTest.java   
@Test
public void testMsvSchemaValidationSuccess() throws Exception {
    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
            .doTry()
                .to("msv:/schema.rng")
                .to("mock:valid")
            .doCatch(ValidationException.class)
                .to("mock:invalid");
        }
    });

    MockEndpoint mockEndpointValid = camelctx.getEndpoint("mock:valid", MockEndpoint.class);
    mockEndpointValid.expectedMessageCount(1);

    MockEndpoint mockEndpointInvalid = camelctx.getEndpoint("mock:invalid", MockEndpoint.class);
    mockEndpointInvalid.expectedMessageCount(0);

    camelctx.start();
    try {
        ProducerTemplate template = camelctx.createProducerTemplate();
        template.sendBody("direct:start", ORDER_XML_VALID);

        mockEndpointValid.assertIsSatisfied();
        mockEndpointInvalid.assertIsSatisfied();
    } finally {
        camelctx.stop();
    }
}