Kalyan
Kalyan

Reputation: 99

How to mock a message processor in a Mule flow

I have created a mule flow using MS Dynamics CRM connector.

<flow name="Dynamics_crmFlow4" doc:name="Dynamics_crmFlow4">
    <vm:inbound-endpoint exchange-pattern="one-way" path="CreateRecord" doc:name="VM"/>
    <dynamicscrm:create config-ref="MS_Dynamics_CRM" logicalName="account" doc:name="CreateAccount">
        <dynamicscrm:entity>
            <dynamicscrm:entity key="address1_city">#[message.payload['city']]</dynamicscrm:entity>
            <dynamicscrm:entity key="name">#[message.payload['name']]</dynamicscrm:entity>
        </dynamicscrm:entity>
    </dynamicscrm:create>
    <logger message="Account created guid : #[payload]" level="INFO" doc:name="Logger"/>
</flow>

I am trying to write unit test for the above flow. In this process I would like mock "dynamicscrm:create" message processor in the above flow. Can any one suggest a best way to mock a message processor in a flow. Thanks in Advance.

Upvotes: 1

Views: 1148

Answers (2)

Ryan Hoegg
Ryan Hoegg

Reputation: 2475

An example of mocking a message processor using munit can be found here: https://github.com/mulesoft/munit/blob/munit-3.4.x/munit-examples/munit-jira-mock-example/src/test/munit/jira-mock-example-test.xml

Upvotes: 0

Seba
Seba

Reputation: 2319

Check the Munit module: https://github.com/mulesoft/munit/wiki

Munit is a Mule testing framework, it allows mule developers to automate mule app testing in an easy manner.

Upvotes: 1

Related Questions