0

Is there a way to test a choice router for the following scenario which is based on the http.status? I am seeking a way to test the first condition of the router

<flow>  
 <choice>
  <when expression="#[message.inboundProperties['http.status'] !=201">  
   ......
   <otherwise>
    .....
   </otherwise>
  </choice>
</flow>

I want to verify that a javax.ws.rs.core.Response with can be correctly handled by the HTTP endpoint.

David Dossot
  • 33,403
  • 4
  • 38
  • 72
BreenDeen
  • 623
  • 1
  • 13
  • 42
  • The flow doesn't have an inbound endpoint: does it mean you invoke it via a `flow-ref`? – David Dossot Nov 07 '13 at 05:22
  • 1
    You have asked couple of same other questions on SO without accepting the answers or comments if it didn't help you. Like [here](http://stackoverflow.com/questions/19781993/mule-esb-process-jersey-response-based-on-status-code-using-choice-router) and [here](http://stackoverflow.com/questions/19758138/mule-esb-mule-filter-based-on-http-status) – Charu Khurana Nov 07 '13 at 10:27
  • Yes, it is called from another flow which has an http:outbound-endpoint. The outbound-endpoint invokes a remote rest service which returns a status of 201 if every went well or another status if things didn;t work well. – BreenDeen Nov 07 '13 at 14:49

1 Answers1

1

The flow doesn't have an inbound endpoint (thus it's a private flow) so to test it

  • create a test flow in a test XML config file that you will load side by side with your other Mule configuration XML files,
  • add an inbound VM endpoint to this test flow and make it call the private flow you want to test,
  • in your functional test case, use the Mule Client to dispatch a test message over the VM endpoint, setting properties on this test message that will end-up as inbound properties in the private flow.
David Dossot
  • 33,403
  • 4
  • 38
  • 72