assertEquals(FtpConst.Replyes.REPLY_425, client.executeCommand(new CmdRetr(null)));
}
// desired reply - 500 RETR: command requires a parameter
{
assertEquals(FtpConst.Replyes.REPLY_227, client.executeCommand(new CmdPasv()));
assertEquals(FtpConst.Replyes.REPLY_500, client.executeCommand(new CmdRetr(null)));
}
String fileName = "test_file_" + System.currentTimeMillis() + ".txt";
byte[] fileContent = "THIS FILE CONTENT".getBytes();
// desired reply - 550 $: Permission denied
{
assertEquals(FtpConst.Replyes.REPLY_227, client.executeCommand(new CmdPasv()));
assertEquals(FtpConst.Replyes.REPLY_550, client.executeCommand(new CmdRetr(fileName)));
}
{
assertEquals(FtpConst.Replyes.REPLY_250, client.executeCommand(new CmdCwd("production")));
assertEquals(FtpConst.Replyes.REPLY_227, client.executeCommand(new CmdPasv()));
CmdStor cmdStor = new CmdStor(fileName);
cmdStor.setFileContent(fileContent);
assertEquals(FtpConst.Replyes.REPLY_226, client.executeCommand(cmdStor));
}
// desired reply - 125 Data connection already open; Transfer starting
// 226 Transfer complete
{
assertEquals(FtpConst.Replyes.REPLY_227, client.executeCommand(new CmdPasv()));
CmdRetr cmdRetr = new CmdRetr(fileName);
assertEquals(FtpConst.Replyes.REPLY_226, client.executeCommand(cmdRetr));
}
// desired reply - 550 Restore value invalid
{
assertEquals(FtpConst.Replyes.REPLY_227, client.executeCommand(new CmdPasv()));
assertEquals(FtpConst.Replyes.REPLY_350, client.executeCommand(new CmdRest(100000)));
CmdRetr cmdRetr = new CmdRetr(fileName);
assertEquals(FtpConst.Replyes.REPLY_550, client.executeCommand(cmdRetr));
}