I need to do end to end (Functional Testing)testing via Munit. For that, I need to attach actual payload which is Image. How can I attach the image in Inbound message processor( Munit - Set Message, there is no option for attachment) or any other way we can achieve this.
<flow name="TestImage">
<file:inbound-endpoint path="tmp\imageUpload" responseTimeout="10000" doc:name="ImageFlow" connector-ref="fileConn" fileAge="100" pollingFrequency="500"></file:inbound-endpoint>
............. many processor..... Logic involved...
<file:outbound-endpoint path="tmp\Upload" responseTimeout="10000" doc:name="Flow" connector-ref="fileConn" fileAge="100" pollingFrequency="500"></file:outbound-endpoint>
Mule Studio Version: 5.3.1
The file inbound endpoint will by default return a input stream as payload with the content of the file you want to read.
Now MUnit disable inbound endpoints by default so to test this flow you'll have to do a flow-ref to your flow "TestImage". In this case you can use the set message processor and load the test file you want to use in the following way:
<munit:set payload="#[getResource('test_image.jpeg').asStream()]" doc:name="Set Message"/>
This'll create a message with a payload that's an input stream for your image.
HTH.