blob: 66d6fa63d98b4db47445433b1c47cd396190262c [file] [log] [blame]
chrismair00dc7bd2014-05-11 21:21:28 +00001 --------------------------------------------------
2 FakeFtpServer versus StubFtpServer
3 --------------------------------------------------
4
5FakeFtpServer or StubFtpServer?
6~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7
8 The <<MockFtpServer>> project includes two separate <mock> implementations of an FTP Server. Which one you
9 use is dependent on what kind of FTP scenario(s) you wish to simulate, and what level of control you need
10 over exact server replies.
11
12* FakeFtpServer
13~~~~~~~~~~~~~~~
14
15 <<FakeFtpServer>> provides a high-level abstraction for an FTP Server and is suitable for most testing
16 and simulation scenarios. You define a filesystem (internal, in-memory) containing an arbitrary set of
17 files and directories. These files and directories can (optionally) have associated access permissions.
18 You also configure a set of one or more user accounts that control which users can login to the FTP server,
19 and their home (default) directories. The user account is also used when assigning file and directory
20 ownership for new files.
21
22 <<FakeFtpServer>> processes FTP client requests and responds with reply codes and reply messages
23 consistent with its configuration and the contents of its internal filesystem, including file and
24 directory permissions, if they have been configured.
25
26 <<FakeFtpServer>> can be fully configured programmatically or within a
27 {{{http://www.springframework.org/}Spring Framework}} or other dependency-injection container.
28
29 See the {{{./fakeftpserver-features.html}FakeFtpServer Features and Limitations}} page for more information on
30 which features and scenarios are supported.
31
32* StubFtpServer
33~~~~~~~~~~~~~~~
34
35 <<StubFtpServer>> is a "stub" implementation of an FTP server. It supports the main FTP commands by
36 implementing command handlers for each of the corresponding low-level FTP server commands (e.g. RETR,
37 DELE, LIST). These <CommandHandler>s can be individually configured to return custom data or reply codes,
38 allowing simulation of a complete range of both success and failure scenarios. The <CommandHandler>s can
39 also be interrogated to verify command invocation data such as command parameters and timestamps.
40
41 <<StubFtpServer>> works out of the box with reasonable defaults, but can be fully configured programmatically
42 or within a {{{http://www.springframework.org/}Spring Framework}} or other dependency-injection container.
43
44 See the {{{./stubftpserver-features.html}StubFtpServer Features and Limitations}} page for more information on
45 which features and scenarios are supported.
46
47* So, Which One Should I Use?
48~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49
50 In general, if your testing and simulation needs are pretty straightforward, then using <<FakeFtpServer>> is
51 probably the best choice. See the {{{./fakeftpserver-features.html}FakeFtpServer Features and Limitations}} page
52 for more information on which features and scenarios are supported.
53
54 Some reasons to use <<StubFtpServer>> include:
55
56 * If you need to simulate an FTP server scenario not supported by <<FakeFtpServer>>.
57
58 * You want to test a very specific and/or limited FTP scenario. In this case, the setup of the
59 <<StubFtpServer>> might be simpler -- you don't have to setup fake files and directories and user accounts.
60
61 * You are more comfortable with configuring and using the lower-level FTP server command reply codes and behavior.