FunctionalTestCase Mule 3.6.0

FunctionalTestCase Mule 3.6.0

我正在将我的 FunctionalTestCase 从 Mule 3.5.0 迁移到 Mule 3.6.0,当我尝试 post json 时,例如:

Map properties = new HashMap(); 
properties.put("Content-Type", "application/json"); 
properties.put("http.method", "POST"); 
muleMessage.addProperties(properties, PropertyScope.OUTBOUND); 
AbstractMuleContextTestCase.muleContext.getClient().send(url, muleMessage); 

我总是在我正在测试的流程中得到 NullPayload,这是如何在新版本的 Mule 3.6.0

中执行 post 的正确方法

MuleClient 现在有一个新方法来指定请求选项,包括要使用的方法。这是:send(String url, MuleMessage message, OperationOptions operationOptions)。可以通过多种方式创建 operationOptions,其中之一是:newOptions().method("POST").build() 发出 POST 请求。

可以在 testHttpRedeliveryExhaustedRollbackUsingMuleClient 中找到 here 的示例。