我已经开始为我的 Mule 项目编写测试用例。
我为我的主要流程编写了功能测试用例,如下所示。
public void testMainFlow_1() throws Exception{
MuleClient client = muleContext.getClient();
MuleMessage result = client.send(helloServiceAddress, fileAsString("SamplePayloads/input_Request.xml"), properties);
assertNotNull("Null Result", result);
assertEquals(result.getPayloadAsString(), fileAsString("SampleResponses/sampleResponse.xml"));
}
但是我怎样才能测试我的子流程。他们没有任何终点。那么如何将有效负载传递给他们并对其进行测试。
下面给出的是我的流程配置。
<flow name="main_flow" >
....
....
<flow-ref name="subflow_1" />
....
....
<flow-ref name="subflow_2" />
....
....
</flow>
<sub-flow name="subflow_1">
....
<some-transformer ... />
<out-bound call to web-service />
<some-transformer ... />
....
</sub-flow>
<sub-flow name="subflow_2">
....
<some-transformer ... />
<out-bound call to web-service />
<some-transformer ... />
....
</sub-flow>