The MockFtpServer project provides a mock/dummy FTP server implementations that can be very useful for testing of FTP client code or standing in for an unavailable "real" FTP server during development. Version 2.1 includes support for IPv6 (EPRT and EPSV commands), as well as a few bug fixes.
The project provides both a low-level "stub" server implementation (StubFtpServer) and a higher-level "fake" server (FakeFtpServer).
FakeFtpServer processes FTP client requests and responds with reply codes and reply messages consistent with its configured file system and user accounts, including file and directory permissions, if they have been configured.
Here is an example showing configuration and starting of an FakeFtpServer with a single user account and a (simulated) Windows file system, defining a directory containing two files. If you wish, you can define a Unix file system, instead.
// Create the server and add a user account
FakeFtpServer fakeFtpServer = new FakeFtpServer();
fakeFtpServer.addUserAccount(new UserAccount("user", "password", "c:
data"));
// Set up the Windows filesystem
FileSystem fileSystem = new WindowsFakeFileSystem();
fileSystem.add(new DirectoryEntry("c:
data"));
fileSystem.add(new FileEntry("c:\\data
file1.txt", "abcdef 1234567890"));
fileSystem.add(new FileEntry("c:\\data
run.exe"));
fakeFtpServer.setFileSystem(fileSystem);
fakeFtpServer.start();
-
MockFtpServer 2.1 released (2 messages)
- Posted by: Chris Mair
- Posted on: June 22 2009 10:22 EDT
Threaded Messages (2)
- Re: MockFtpServer 2.1 released by Nathan Lee on June 22 2009 21:53 EDT
- Additional functionality by Ion Surucianu on June 23 2009 10:22 EDT
-
Re: MockFtpServer 2.1 released[ Go to top ]
- Posted by: Nathan Lee
- Posted on: June 22 2009 21:53 EDT
- in response to Chris Mair
Would have been a useful thing to have on several integration projects (the old "end result = dump of files somewhere" scenario) I've had. Pity the current project doesn't have much of that going on. Nathan Lee -
Additional functionality[ Go to top ]
- Posted by: Ion Surucianu
- Posted on: June 23 2009 10:22 EDT
- in response to Chris Mair
It would be awesome if this fantastic library had SFTP support as well.