Package org.apache.camel

Examples of org.apache.camel.ValidationException


        public void someMethod(String body, @Header("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


        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

        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

        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

                exchange.setProperty("cheese", "old");
            }
        });
       
        assertNotNull(exchange.getException());
        ValidationException exception = assertIsInstanceOf(ValidationException.class, exchange.getException());
        assertEquals("Invalid header foo: notMatchedHeaderValue", exception.getMessage());

        assertMockEndpointsSatisfied();
    }
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

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.