Home > Java, SOA Suite > Unit testing file transfers

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.

About these ads
Categories: Java, SOA Suite

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: