The simplest approach is probably the standard FileSystemViews configured
to use a temporary directory.

Your tests can populate and check the contents of that directory directly.

Slightly more sophisticated - you could create an in-memory filesystem.
Have a look at this as an example:
https://github.com/stefanbirkner/fake-sftp-server-rule/blob/master/src/main/java/com/github/stefanbirkner/fakesftpserver/rule/FakeSftpServerRule.java

The example uses Apache SSHServer, but a very similar approach ought to
work in Mina SFTPd.

If you do decide to implement your own virtual FileSystemView, you'll find
there's a lot of methods to implement, but they're all pretty easy to do.
Maybe give yourself a couple of hours research spike to create a
FileSystemView that presents one directory containing one file with a fixed
content; after which you'll know exactly what's going on.



On Tue, Oct 17, 2017 at 4:00 PM Oliver Zemann <oliver.zem...@gmail.com>
wrote:

> Hi,
>
> i would like to integrate Apache Mina FTP Server into my project for
> integration tests. I need to add some files to it, which should be
> downloaded and then processed. The files i want to use in the
> integration tests are located in the resources. Is it correct that i
> have to implement FileSystemView and set that on the
> ServerFactory.setFileSystem ?
>
> I used another library which was able to do something like that:
> ftpServer.addFile(inputStreamFromResourcesFile,
> "/path/where/to/put/the/file")
>
> Something like a virtual file system. Does apache mina ftp have
> something like that? Unfortunately, the documentation is very limited
> when it comes to embedding the ftp server and file handling and it feels
> a bit overkill to implement FileSystemView.
>
> Thanks!
>
> Oli
>
>

Reply via email to