5 Replies Latest reply on Feb 24, 2010 11:13 AM by Claus Ibsen

    testing routes when endpoints need to return a value

    Lyfe Musique Novice

      I have a handle on testing a route like below:

       

      from("jbi:endpoint:http://my.entry/http/listener")

      .to("direct:content-based-routing");

       

      from("direct:content-based-routing")

      .choice()

      .when().method("myBean","isTrue")

      .to("direct:positive-input")

      .otherwise()

      .to("direct:negative-input")

      .end();

       

      There are two distinct from().to().  However, how could I test a scenario where an endpoint, in the middle of the routing, takes input and provides output.  Eg, mimicing a service. 

       

      An example like below:

       

      from("jbi:endpoint:http://my.entry/http/listener")

      .to("direct:content-based-routing");

       

      from("direct:content-based-routing")

      .to("jbi:endpoint:http://my.exit/PositiveService/Pos1?mep=in-out");

      .process(new Process())

      to("jbi:endpoint:http://my.exit/PositiveService/Pos2?mep=in-out");

       

      I would like to test what comes into the first jbi endpoint and pass out a value.  Then, I would like to check what comes into the second endpoint.

       

      For my test, I rewrote the logic as such:

       

      from("jbi:endpoint:http://my.entry/http/listener")

      .to("direct:content-based-routing");

       

      from("direct:content-based-routing")

      .to("direct:pos1");

      .process(new Process())

      to("direct:pos2");

       

      In my test, I can test what comes into direct:pos1 (but can't pass back a value).  So, any testing on direct:pos2 will be invalid.