With this simple example the test is passing indeed. But when I feed a
slightly more complicated xml it is failing. Maybe it's just something
simple I'm overlooking...
public void testXPathWithRUFixtures() throws Exception {
log.debug("testXPathWithRUFixtures()");
context.addRoutes(
new RouteBuilder() {
@Override
public void configure() {
from("direct:xpathrufix").splitter(xpath("/rugbyFixtures/rugbyFixture")).to("mock:result");
}
}
);
final String fixture1 =
"<rugbyFixture id=\"2909509\" venue=\"Parc des Princes\" "+
"date=\"2007-10-19\" time=\"20:00:00\">"+
"<homeTeam id=\"33176\" name=\"France\" />"+
"<awayTeam id=\"33085\" name=\"Argentina\" />"+
"<competition id=\"700\" name=\"World Cup\" />"+
"</rugbyFixture>";
final String fixture2 =
"<rugbyFixture id=\"2866397\" venue=\"Kingston Park\" "+
"date=\"2007-10-21\" time=\"14:00:00\">"+
"<homeTeam id=\"34698\" name=\"Newcastle\" />"+
"<awayTeam id=\"33094\" name=\"Bath\" />"+
"<competition id=\"100\" name=\"Guinness Premiership\" />"+
"</rugbyFixture>";
resultEndpoint.expectedBodiesReceived(fixture1, fixture2);
template.send("direct:xpathrufix", new Processor() {
public void process(Exchange exchange) {
Message in = exchange.getIn();
in.setBody(//"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+
"<rugbyFixtures>"+fixture1+fixture2+"</rugbyFixtures>");
}
});
resultEndpoint.assertIsSatisfied();
}
The error is:
java.lang.AssertionError: mock:result Body of message: 0. Expected:
<<rugbyFixture id="2909509" venue="Parc des Princes" date="2007-10-19"
time="20:00:00"><homeTeam id="33176" name="France" /><awayTeam id="33085"
name="Argentina" /><competition id="700" name="World Cup" /></rugbyFixture>>
but was: <<rugbyFixture date="2007-10-19" id="2909509" time="20:00:00"
venue="Parc des Princes"><homeTeam id="33176" name="France"/><awayTeam
id="33085" name="Argentina"/><competition id="700" name="World
Cup"/></rugbyFixture>>
at
org.apache.camel.component.mock.MockEndpoint.fail(MockEndpoint.java:531)
at
org.apache.camel.component.mock.MockEndpoint.assertEquals(MockEndpoint.java:513)
at
org.apache.camel.component.mock.MockEndpoint$2.run(MockEndpoint.java:252)
at
org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:179)
at
org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:144)
at
com.bbc.newsi.feeds.common.dslroutes.CamelTest.testXPathWithRUFixtures(CamelTest.java:101)
--
View this message in context:
http://www.nabble.com/Problem-with-XPath-splitters-tf4357605s22882.html#a13401827
Sent from the Camel - Users mailing list archive at Nabble.com.