finj - Unit testing
[ L A S T U P D A T E : 2022-03-03 ]
What the hell ?
I'd like finj to be as good as possible : in terms of features,
code quality and maintenance. Following the advice of several people, I decided to use
JUnit framework to set up code testing during
development phase.
Test classes
There are a couple of test suites available from the org.finj package :
org.finj.AllTest :
Run all the other ones, in cascade.
org.finj.BrowsingTest :
Tests FTP commands related to browsing through remote file system.
org.finj.ConnectionTest :
Tests FTP commands that set up the command and data connections.
org.finj.DataTest :
Tests data transfer FTP commands.
org.finj.InformationTest :
Tests FTP commands providing information on the remote system.
org.finj.MiscellaneousTest :
Tests several FTP commands that don't fit in the other groups.
org.finj.ObserverTest :
Tests org.finj.FTPClientObserver related methods.
Installing JUnit
Go download JUnit (ca. 400ko),
extract files, and put junit.jar in your classpath, or in Java2's
$JAVA_HOME/jre/lib/ext directory.
Running tests
Type at a shell prompt :
% java org.finj.*Test [ [-t] | -a | -s | -h ]
where "*Test " is one of the test classes defined above.
Use -h flag to get help on running testing classes.
Three user interfaces are available, depending on the flag you provide :
- -t : command-line interface (default),
- -a : AWT interface,
- -s : Swing interface,
Conclusion
Feel free to e-mail me
any comment, bug report, test proposition, ...
-- javier
org.finj.FTPClient methods
FTP functions are listed here, the way they are in the RFC959-4.1.
org.finj.BrowsingTest : |
|
description |
command |
method name |
test name |
change to parent directory |
CDUP |
setWorkingDirectoryUp() |
testWorkingDirectory() |
change working directory |
CWD |
setWorkingDirectory(String) |
testWorkingDirectory() |
make directory |
MKD |
makeDirectory(String) |
testMakeDirectory() |
print working directory |
PWD |
getWorkingDirectory() |
testWorkingDirectory() |
remove directory |
RMD |
removeDirectory(String) |
testRemoveDirectory() |
|
|
|
org.finj.ConnectionTest : |
|
description |
command |
method name |
test name |
account |
ACCT |
setAccount(String) |
test |
transfer mode |
MODE |
setDataTransferMode(int)
getDataTransferMode()
|
test |
noop |
NOOP |
checkConnection() |
test |
password |
PASS |
login(String, String) |
test |
passive |
PASV |
|
almost everywhere... |
data port |
PORT |
setDataPort(short) |
test |
logout |
QUIT |
close() |
test |
reinitialize |
REIN |
logout() |
test |
file structure |
STRU |
setDataStructure(int)
getDataStructure()
|
test |
representation type |
TYPE |
setDataType(int)
setDataType(int, int)
getDataType()
|
test |
user name |
USER |
login(String, String) |
test |
|
|
|
org.finj.DataTest : |
|
description |
command |
method name |
test name |
abort |
ABOR |
abortCommand() |
test |
allocate |
ALLO |
allocateSpace(int)
allocateSpace(int, int)
|
test |
append (with create) |
APPE |
appendToFile(InputStream, String)
appendToFile(InputStream, String, boolean)
|
testUploadAppendTransfer() |
delete |
DELE |
deleteFile(String)
deleteFile(String, boolean)
|
testDeleteFile() |
restart |
REST |
getFileFrom(String, int)
getFileFrom(String, int, boolean)
|
testDownloadTransfer() |
retrieve |
RETR |
getFile(OutputStream, String)
getFile(OutputStream, String, boolean)
|
testDownloadTransfer() |
rename from |
RNFR |
renameFile(String, String) |
testSpacedFileNames() |
rename to |
RNTO |
renameFile(String, String) |
testSpacedFileNames() |
store |
STOR |
putFile(InputStream, String)
putFile(InputStream, String, boolean)
|
testUploadCreateFile() |
store unique |
STOU |
putUniqueFile(InputStream)
putUniqueFile(InputStream, boolean)
|
testUploadUniqueFile() |
|
|
|
org.finj.InformationTest : |
|
description |
command |
method name |
test name |
help |
HELP |
[FIXME: WILL IT BE IMPLEMENTED ANYWAY ?] |
test |
list |
LIST |
getFileDescriptors()
getFileDescriptors(String)
|
testFileDescriptors() |
name list |
NLST |
getFileNames()
getFileNames(boolean)
getFileNames(String)
getFileNames(String, boolean)
|
testFileNames() |
status |
STAT |
getServerStatus()
getServerStatus(String)
|
testServerStatus() |
system |
SYST |
getServerSystemName() |
testSystemName() |
|
|
|
org.finj.MiscellaneousTest : |
|
description |
command |
method name |
test name |
site parameters |
SITE |
doSite(String) |
testDoSite() |
structure mount |
SMNT |
mountStructure(String) |
testMountStructure() |
|
|
|
org.finj.ObserverTest : |
|
description |
command |
method name |
test name |
broadcasting command |
|
broadcastCommand(String) |
testNotification() |
broadcasting reply |
|
broadcastReply(FTPReply) |
testNotification() |
connection status |
|
isConnected() |
testNotification() |
data received |
|
dataReceived(int) |
testNotification() |
data sent |
|
dataSent(int) |
testNotification() |
define observer |
|
setObserver(FTPClientObserver) |
testManipulation() |
determine observer |
|
hasObserver() |
testManipulation() |
observer |
|
getObserver() |
testManipulation() |
remove observer |
|
removeObserver() |
testManipulation() |
|
forged on |
|
written with |
|
tested using |
|
|
|
|
|
project admin
|