java - How to set the Exchange of a bean to ProducerTemplate -
i m running test cameltestsupport,
public class testintegrationbeanctrlcontrat extends cameltestsupport { @endpointinject(uri = "mock:result") protected mockendpoint resultendpoint; @produce(uri = "direct:start") protected producertemplate template; @override protected routebuilder createroutebuilder() { return new routebuilder() { @override public void configure() { this.from("direct:start") .bean(myclassa.class, "methodofmyclassa").to("mock:result"); } }; } @test public void test_controlebean_integration() { this.template.sendbody(....); }
i m trying put body of bean producer template , exemple :
template.sendbody( bean(myclassb.class, "methodofmyclassb") )
is possible ?
in general how can setup input in producetemplace.
i’m not sure understand needs if want inject result of bean in route process should use camel mock inject bean process (myclassb.methodofmyclassb() in example):
@endpointinject(uri = "mock:result") protected mockendpoint resultendpoint; @produce(uri = "direct:start") protected producertemplate template; @override protected routebuilder createroutebuilder() throws exception { return new routebuilder() { @override public void configure() throws exception { from("direct:start").bean("beana", "methoda").to("mock:beanb").to("mock:result"); } }; } @test public void test() throws exception { mockendpoint mock = getmockendpoint("mock:beanb"); mock.whenanyexchangereceived(new processor() { public void process(exchange exchange) throws exception { // call method of class here exchange.getin().setbody(myclassb.methodofmyclassb()); } }); template.sendbody("your message body..."); // check results mock.assertissatisfied(); }
Comments
Post a Comment