Cam*_*n26 2 mule mule-studio munit anypoint-studio
我正在尝试在MUnit中测试APIKit.最初我在MUnit中使用http请求来调用我的流,然后APIKit将请求路由到我的逻辑所在的正确子流.现在我想模拟子流的一个元素,所以我试图用APIKit流的引用替换http请求.这有效,但APIKit路由器抛出错误:
Cannot resolve request base path
Run Code Online (Sandbox Code Playgroud)
因为没有设置入站属性.这是我的问题,我如何模仿我发送到流参考的入站属性,以便请求看起来像来自HTTP请求?或者,有没有其他方法可以构造代码,以便我可以模拟我的逻辑元素?
谢谢
小智 8
您可以在模拟http响应中添加属性.见下面的示例:
<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>
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助