use of org.apache.camel.processor.validation.SchemaValidationException in project camel by apache.
the class ValidatingProcessorTest method testInvalidMessage.
public void testInvalidMessage() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:invalid");
mock.expectedMessageCount(1);
String xml = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>" + "<user xmlns=\"http://foo.com/bar\">" + " <username>someone</username>" + "</user>";
try {
template.sendBody("direct:start", xml);
fail("Should have thrown a RuntimeCamelException");
} catch (RuntimeCamelException e) {
assertTrue(e.getCause() instanceof SchemaValidationException);
// expected
}
assertMockEndpointsSatisfied();
}
use of org.apache.camel.processor.validation.SchemaValidationException in project camel by apache.
the class ValidatingProcessorTest method testNonWellFormedXml.
public void testNonWellFormedXml() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:invalid");
mock.expectedMessageCount(1);
String xml = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>" + "user xmlns=\"http://foo.com/bar\">" + " <id>1</id>" + " <username>davsclaus</username>";
try {
template.sendBody("direct:start", xml);
fail("Should have thrown a RuntimeCamelException");
} catch (RuntimeCamelException e) {
assertTrue(e.getCause() instanceof SchemaValidationException);
// expected
}
assertMockEndpointsSatisfied();
}
use of org.apache.camel.processor.validation.SchemaValidationException in project camel by apache.
the class ValidatingProcessorNotUseSharedSchemaTest method testInvalidMessage.
public void testInvalidMessage() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:invalid");
mock.expectedMessageCount(1);
String xml = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>" + "<user xmlns=\"http://foo.com/bar\">" + " <username>someone</username>" + "</user>";
try {
template.sendBody("direct:start", xml);
fail("Should have thrown a RuntimeCamelException");
} catch (RuntimeCamelException e) {
assertTrue(e.getCause() instanceof SchemaValidationException);
// expected
}
assertMockEndpointsSatisfied();
}
Aggregations