public void testXmlEncryptionDecryption() throws Exception {
final Namespaces namespaces = new Namespaces("c", "http://camelcookbook.org/schema/booksignings");
final String cityExistsXPath = "exists(/c:booksignings/c:store/c:address/c:city)";
context.getRouteDefinition("encrypt")
.adviceWith(context, new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
interceptSendToEndpoint("direct:decrypt")
.when(namespaces.xpath(cityExistsXPath))
.to("mock:incorrectlyEncrypted");
}
});
context.getRouteDefinition("decrypt")
.adviceWith(context, new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
interceptSendToEndpoint("mock:out")
.when(namespaces.xpath(cityExistsXPath))
.to("mock:correctlyDecrypted");