Package org.apache.camel

Examples of org.apache.camel.ValidationException


*/
public class MyValidator implements Processor {
    public void process(Exchange exchange) throws Exception {
        Object value = exchange.getIn().getHeader("foo");
        if (value == null || !value.equals("bar")) {
            throw new ValidationException(exchange, "The foo header does not equal bar! Was: " + value);
        }
    }
View Full Code Here


        assertEquals(type2, result);
    }

    public void testClosetMatch1() {
        setupPolicies();
        ExceptionType result = strategy.getExceptionPolicy(policies, null, new ValidationException(null, ""));
        assertEquals(type1, result);

        result = strategy.getExceptionPolicy(policies, null, new ExchangeTimedOutException(null, 0));
        assertEquals(type1, result);
    }
View Full Code Here

        public void someMethod(String body, @Header(name = "foo")
                               String header) throws ValidationException {
            if ("bar".equals(header)) {
                LOG.info("someMethod() called with valid header and body: " + body);
            } else {
                throw new ValidationException(null, "Invalid header foo: " + header);
            }
        }
View Full Code Here

    private class MyValidatorProcessor implements Processor {
        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");
            }
            exchange.getOut().setBody("Hello " + body);
        }
View Full Code Here

    private class MyValidatorProcessor implements Processor {
        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);
        }
View Full Code Here

    private class MyValidatorProcessor implements Processor {
        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);
        }
View Full Code Here

    private class MyValidatorProcessor implements Processor {
        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);
        }
View Full Code Here

            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);
            }
        }
View Full Code Here

*/
public class MyValidator implements Processor {
    public void process(Exchange exchange) throws Exception {
        Object value = exchange.getIn().getHeader("foo");
        if (value == null || !value.equals("bar")) {
            throw new ValidationException(exchange, "The foo header does not equal bar! Was: " + value);
        }
    }
View Full Code Here

    private class MyValidatorProcessor implements Processor {
        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);
        }
View Full Code Here

TOP

Related Classes of org.apache.camel.ValidationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.