在Mulesoft for APIKit中为MUnit流参考设置入站属性 [英] Set Inbound Properties for MUnit Flow Reference in Mulesoft for APIKit
问题描述
我正在尝试在MUnit中测试APIKit.最初,我是在MUnit中使用http请求来调用流,然后APIKit会将请求路由到逻辑所在的适当子流.现在,我想模拟子流的元素之一,因此我试图用对APIKit流的引用替换http请求.可以,但是APIKit路由器会引发错误:
I'm trying to test APIKit in MUnit. Originally I was using an http request within MUnit to call my flow and then APIKit would route the request to the proper subflow where my logic lives. Now I want to mock one of the elements of the subflow, so I'm trying to replace the http request with a reference to the APIKit flow. This works, but the APIKit router throws an error:
Cannot resolve request base path
因为未设置任何入站属性.这就是我的问题,如何模仿发送到流引用的入站属性,以使请求看起来像来自HTTP请求?另外,还有另一种方法可以构造代码,以便模拟逻辑元素吗?
Because none of the inbound properties are set. And this is my problem, how do I mimic the inbound properties that I send to a flow reference so that the request looks like it came from an HTTP request? Alternatively, is there another way I can structure the code so that I can mock an element of my logic?
谢谢
推荐答案
您可以在模拟http响应上添加属性.参见下面的示例:
You can add properties on your mock http response. See sample below:
<mock:when messageProcessor=".*:.*" doc:name="Queue Message">
<mock:with-attributes>
<mock:with-attribute name="doc:name" whereValue="#['Queue Message']"/>
</mock:with-attributes>
<mock:then-return payload="#['Sample response']">
<mock:inbound-properties>
<mock:inbound-property key="prop1" value="val1"/>
<mock:inbound-property key="prop2" value="val2"/>
</mock:inbound-properties>
</mock:then-return>
</mock:when>
希望这会有所帮助
这篇关于在Mulesoft for APIKit中为MUnit流参考设置入站属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!