Camel JaxbDataFormat marshaling issue
Issue
- We have this given simple route:
new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:objectToXML")
.marshal(jaxb);
}
};
with this input:
DomainObject input = new DomainObject("stuff");
Exchange exchange = template.request("direct:objectToXML", new RouteInputProcessor(input));
- Then a test such as this will fail:
Object actual = exchange.getIn().getBody();
Assert.assertTrue(actual instanceof byte[]);
Because the class of actual is still DomainObject
. However, modifying the route to this:
new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:objectToXMLWithLog")
.marshal(jaxb)
.to("log:marshaled");
}
};
will work.
- Same for this route:
new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:objectToXMLWithEmptyProcessor")
.marshal(jaxb)
.process(new EmptyProcessor());
}
};
With EmptyProcessor
having this method:
@Override
public void process(Exchange exchange) throws Exception {
}
So... is the exchange a box and the message body scroedingers cat? Is this the expected behavior?
- We assume that, during further processing of these routes, these problems would not actually occur. This might just be a problem with the way CamelTestSupport operates. However, we are trying to create a couple of tests to document/demonstrate how camel works in various scenarios and came across this.
Environment
- Red Hat JBoss Fuse
- 6.x
- Apache Camel
- camel-jaxb
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.