役立ちます
<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>
希望:以下のサンプルを参照してください。以下のコードを参照してください
<munit:before-suite name="twitter_munit_testBefore_Suite" description="MUnit Test">
<scripting:component doc:name="Script">
<scripting:script name="groovyScriptPayloadGenerator" engine="Groovy"><![CDATA[
import groovy.json.JsonSlurper
def jsonSlurper = new JsonSlurper()
def object = jsonSlurper.parseText '''
{ "positive": 15,
"negative": 5,
"neutral": 0
}''']]></scripting:script>
</scripting:component>
</munit:before-suite>
<munit:test name="new-test-suite-tetsFlowTest" description="Test">
<munit:set payload="#[resultOfScript('groovyScriptPayloadGenerator')]" doc:name="Set Message">
<munit:inbound-properties>
<munit:inbound-property key="http.query.params" value="#[['query':'value']]"/>
</munit:inbound-properties>
</munit:set>
<flow-ref name="tetsFlow" doc:name="Flow-ref to tetsFlow"/>
</munit:test>
詳細については、thisもチェックしてください。 同じように、モックを設定することもできます。 これは役に立ちます。
ありがとう、これは私がやったことです。 – CamJohnson26