xref: /aosp_15_r20/external/mockftpserver/MockFtpServer/src/site/apt/index.apt (revision 876b9d758e92bb9ac60d09763a5f23a1c6322c5f)
1*876b9d75SXin Li		--------------------------------------------------
2*876b9d75SXin Li								Home
3*876b9d75SXin Li		--------------------------------------------------
4*876b9d75SXin Li
5*876b9d75SXin LiMockFtpServer - Providing a Fake/Stub FTP Server
6*876b9d75SXin Li~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7*876b9d75SXin Li
8*876b9d75SXin Li  The <<MockFtpServer>> project provides mock/dummy FTP server implementations that can be very
9*876b9d75SXin Li  useful for testing of FTP client code. Two FTP Server implementations are provided, each at a different
10*876b9d75SXin Li  level of abstraction.
11*876b9d75SXin Li
12*876b9d75SXin Li  <<FakeFtpServer>> provides a higher-level abstraction for an FTP server and is suitable for most testing
13*876b9d75SXin Li  and simulation scenarios. You define a filesystem (virtual, in-memory) containing an arbitrary set of
14*876b9d75SXin Li  files and directories. These files and directories can (optionally) have associated access permissions.
15*876b9d75SXin Li  You also configure a set of one or more user accounts that control which users can login to the FTP server,
16*876b9d75SXin Li  and their home (default) directories. The user account is also used when assigning file and directory
17*876b9d75SXin Li  ownership for new files. See {{{./fakeftpserver-features.html}FakeFtpServer Features and Limitations}}.
18*876b9d75SXin Li
19*876b9d75SXin Li  <<StubFtpServer>> is a "stub" implementation of an FTP server. It supports the main FTP commands by
20*876b9d75SXin Li  implementing command handlers for each of the corresponding low-level FTP server commands (e.g. RETR,
21*876b9d75SXin Li  DELE, LIST). These <CommandHandler>s can be individually configured to return custom data or reply codes,
22*876b9d75SXin Li  allowing simulation of a complete range of both success and failure scenarios. The <CommandHandler>s can
23*876b9d75SXin Li  also be interrogated to verify command invocation data such as command parameters and timestamps.
24*876b9d75SXin Li  See {{{./stubftpserver-features.html}StubFtpServer Features and Limitations}}.
25*876b9d75SXin Li
26*876b9d75SXin Li  See the {{{./fakeftpserver-versus-stubftpserver.html}FakeFtpServer or StubFtpServer?}} page for more
27*876b9d75SXin Li  information on deciding whether to use <<FakeFtpServer>> or <<StubFtpServer>>.
28*876b9d75SXin Li
29*876b9d75SXin Li  The <<MockFtpServer>> project is written in Java, and is ideally suited to testing Java code. But because
30*876b9d75SXin Li  communication with the FTP server is across the network using sockets, it can be used to test FTP client
31*876b9d75SXin Li  code written in any language.
32*876b9d75SXin Li
33*876b9d75SXin Li  NOTE: Starting with <<MockFtpServer>> 2.4, the <<Log4J>> dependency has been replaced with {{{http://www.slf4j.org/}SLF4J}}.
34*876b9d75SXin Li
35*876b9d75SXin Li
36*876b9d75SXin Li* Requirements
37*876b9d75SXin Li~~~~~~~~~~~~~~
38*876b9d75SXin Li
39*876b9d75SXin Li  The <<MockFtpServer>> project requires:
40*876b9d75SXin Li
41*876b9d75SXin Li  *  Java (JDK) version 1.4 or later
42*876b9d75SXin Li
43*876b9d75SXin Li  * The {{{http://www.slf4j.org/}SLF4J}} API jar, accessible on the CLASSPATH. An SLF4J binding (logging
44*876b9d75SXin Li    framework-specific jar) is optional.
45*876b9d75SXin Li
46*876b9d75SXin Li
47*876b9d75SXin Li* Maven Support
48*876b9d75SXin Li~~~~~~~~~~~~~~~
49*876b9d75SXin Li
50*876b9d75SXin Li  For projects built using {{{http://maven.apache.org/}Maven}}, <<MockFtpServer>> is now available
51*876b9d75SXin Li  from the <<Maven Central Repository>>. Add a dependency to your POM like this:
52*876b9d75SXin Li
53*876b9d75SXin Li--------------------
54*876b9d75SXin Li  <dependency>
55*876b9d75SXin Li    <groupId>org.mockftpserver</groupId>
56*876b9d75SXin Li    <artifactId>MockFtpServer</artifactId>
57*876b9d75SXin Li    <version>2.4</version>
58*876b9d75SXin Li    <scope>test</scope>
59*876b9d75SXin Li  </dependency>
60*876b9d75SXin Li--------------------