Unit testing file transfers
I recently wrote an application for managed file transfers with FTP, FTPS and SFTP. Naturally I wanted good unit tests and I found an excellent solution that made it possible to run real transfers in a controlled way: MockFtpServer and Apache SSHD. This way I could fire up an FTP server and an SSH server from jUnit, run a test and be in full control over both the client (my application) and the servers.
The same approach can be used to test file-based integrations in general driven from jUnit, possibly with a continuous integration engine such as Jenkins running the tests.
To use the libraries with Maven, include:
<dependency>
<groupId>org.mockftpserver</groupId>
<artifactId>MockFtpServer</artifactId>
<version>2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-core</artifactId>
<version>0.6.0</version>
<scope>test</scope>
</dependency>
You may need additional dependencies as well, for example SLF4J and BouncyCastle.
-
2012-12-11 at 11:00 | #1Spring Integration FakeFtpServer example | GoSmarter Tech Blog
-
2013-02-11 at 18:37 | #2Spring Integration FakeFtpServer example | Krishna's Blog