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