2007/11/15, Arjan Moraal <[EMAIL PROTECTED]>:
>
> Any idea the test is failing?
>
> It seems to have been caused by this change
> http://svn.apache.org/viewvc?view=rev&revision=593539
>
> For now I've reverted back to the old version since it breaks about half our
> routes :(
I'm responsible for this patch so I can guess where the problem is.
previously (before this patch) in pipeline basic behavior was to
propagate out message to the next step of pipeline only if there was
out message that had not-null body.
In other case it was propagating in message to the next step.
I changed this condition into 'propagate out message if there is out
message - don't care about content of this message'. Consult test case
that was created for this issue - I believe it explains why I've done
it.
so the problem is probably that at the very beginning of your pipeline
you receive some exchange that already contains out message. By
default first exchange that goes to the pipeline is not generated, but
is used as is. So if it contains some null-body out message it will be
copied as in message to the next step of your flow.
Probably someone calls getOut() - not getOut(false) - it creates the
out message that later will be propagated.
>
> Thanks,
> Arjan
>
>
> Arjan Moraal wrote:
> >
> > Hi,
> >
> > I've just updated my sources from Oct 16 to the latest version from svn,
> > and now the following simple test is failing. The test is working with the
> > Oct 16 sources. Any idea why?
> >
> > == TEST CASE ==
> >
> > package com.bbc.newsi.feeds.sport.renderservice.camel;
> >
> > import static org.apache.camel.language.juel.JuelExpression.el;
> > import junit.framework.TestCase;
> >
> > import org.apache.camel.CamelContext;
> > import org.apache.camel.CamelTemplate;
> > import org.apache.camel.Exchange;
> > import org.apache.camel.Message;
> > import org.apache.camel.Processor;
> > import org.apache.camel.builder.RouteBuilder;
> > import org.apache.camel.component.mock.MockEndpoint;
> > import org.apache.camel.impl.DefaultCamelContext;
> >
> > /**
> > *
> > * @author Albert Moraal
> > * @version $Revision$ $Date$ $Author$
> > */
> > public class NullBodyTest extends TestCase {
> > private CamelContext context;
> > private CamelTemplate<Exchange> template;
> >
> > @Override
> > protected void setUp() throws Exception {
> > super.setUp();
> > context = new DefaultCamelContext();
> > context.start();
> > template = new CamelTemplate<Exchange>(context);
> > }
> >
> > @Override
> > protected void tearDown() throws Exception {
> > context.stop();
> > super.tearDown();
> > }
> >
> > public void testNullBody() throws Exception {
> > context.addRoutes(
> > new RouteBuilder() {
> > @Override
> > public void configure() {
> > from("seda:nullbodytest")
> > .to("mock:Before")
> > .setBody(el("xx${in.body}xx"))
> > .to("mock:After");
> > }
> > }
> > );
> >
> > MockEndpoint resultEndpoint = context.getEndpoint("mock:After",
> > MockEndpoint.class);
> > resultEndpoint.expectedBodiesReceived("xxtestbodyxx");
> >
> > template.send("seda:nullbodytest", new Processor() {
> > public void process(Exchange exchange) {
> > Message in = exchange.getIn();
> > in.setBody("testbody");
> > }
> > });
> >
> > resultEndpoint.assertIsSatisfied();
> > }
> >
> > }
> >
> > == RESULT ==
> >
> > java.lang.AssertionError: mock:After Body of message: 0. Expected:
> > <xxtestbodyxx> but was: <null>
> > 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.sport.renderservice.camel.NullBodyTest.testNullBody(NullBodyTest.java:61)
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/setBody%28el%28-%29%29-creates-null-body-tf4805396s22882.html#a13768004
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>