I wrote this camel route:
@Component
public class FirstRoute extends RouteBuilder {
private static final String DIRECT_ENDPOINT = "direct:test_direct";
private static final String HTTP_ENDPOINT = "http:test_http";
@Autowired
private URIProcessor uriProcessor;
@Override
public void configure() throws Exception {
restConfiguration().component("servlet").bindingMode(RestBindingMode.json);
rest("/doTest/").post("/{comp}").to(DIRECT_ENDPOINT);
test();
}
public void test() {
from(DIRECT_ENDPOINT).routeId("route_rest")
.marshal().json(JsonLibrary.Jackson)
.process(uriProcessor)
.to(HTTP_ENDPOINT).unmarshal().json(JsonLibrary.Jackson, TestDto.class);
}
}
It works fine.
I want to write a test class for this route, so in test class i wrote:
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new FirstRoute();
But when I run the test occurs an error.
This is the log of error:
org.apache.camel.FailedToCreateRouteException: Failed to create route route_rest at: >>> process[Processor@0x0] <<< in route: Route(route_rest)[[From[direct:testEsenzioneReddito]] -> [Ma... because of ref must be specified on: process[Processor@0x0]
...
Caused by: java.lang.IllegalArgumentException: ref must be specified on: process[Processor@0x0]
... 42 more
I have no idea what it could be, someone have does anyone have any suggestions? Thank you