Reputation: 41
I am working with the task in which, I have set header in one of the processor.
exchange.getIn().setHeader("ResourceSpec", equipmentSpec.getSpec());
While writing the test cases, it was expecting for value.because of that test cases getting failed.
Mock-RouteTest:
void advice(@Observes CamelContextStartingEvent event, CamelContext context) throws Exception {
context.getRouteDefinition(test.update)
.adviceWith(context, new AdviceWithRouteBuilder() {
@Override
public void configure() {
weaveByToString(".*lineInquiryBy.*")
.replace()
.to("mock:lineInquiry");
}
});
Need help to set header in mock. So that while executing, processor can get the value.
Using camel-test and camel-test-cdi.
Thanks
Upvotes: 0
Views: 1695
Reputation: 7005
Not sure if I understand your question. What I understood:
ResourceSpec
adviceWith
from the routeResourceSpec
is not setIf I understood your question correct, you can simply "insert" the setHeader
where you remove the processor
weaveByToString(".*lineInquiryBy.*")
.replace()
.to("mock:lineInquiry")
.setHeader("ResourceSpec", constant("static value"));
If you need a dynamic value (for example from a message header), you can use the Camel Simple expression language:
.setHeader("ResourceSpec", simple("${header.myHeader}"));
Upvotes: 0