0
votes

Has anyone used MUnit with SFTP component, could yo please provide me any helpful information/example to start up? I went through the MUnit documentation but didnt get much help on the SFTP component with Munit.

2

2 Answers

1
votes

Use Munit FTP server. Enable secure attribute true to use SFTP . Please Refer this page https://docs.mulesoft.com/munit/v/1.2.0/munit-ftp-server.

Start the server before suites run, and stops the servers after. Example as below.

     <ftpserver:config name="FTP_Server" secure="true" doc:name="FTP Server"/>

<munit:before-suite name="suiteBefore" description="MUnit Test">
    <ftpserver:start-server config-ref="FTP_Server" doc:name="FTP Server"/>
</munit:before-suite>

<munit:test name="FlowTest" description="Test">
    --flow test goes here----
    <flow-ref name="test5Flow" doc:name="Flow-ref to test5Flow"/>
    <ftpserver:contains-files config-ref="FTP_Server" file="testFile.xml" path="/tmp" doc:name="FTP Server"/>
</munit:test>

<munit:after-suite name="After_Suite" description="After suite actions">
    <ftpserver:stop-server config-ref="FTP_Server" doc:name="FTP Server"/>
</munit:after-suite>
0
votes

From Anypoint Studio, go to Help and Install New Software…​. In the Work with: panel look for MUnit Update Site, and from the MUnit Tools for Mule section, select FTP server Module (Mule 3.4.0+) then you come to get munit component for ftp server .you can use this ftp server in before/after suite to handle data transformation for testing of the application and you can use this as a out bound to your application munit flow.