Examples of CmdRetr


Examples of org.exoplatform.frameworks.ftpclient.commands.CmdRetr

      assertEquals(FtpConst.Replyes.REPLY_331, client.executeCommand(new CmdUser("admin")));
      assertEquals(FtpConst.Replyes.REPLY_230, client.executeCommand(new CmdPass("admin")));
      assertEquals(FtpConst.Replyes.REPLY_215, client.executeCommand(new CmdSyst()));
      assertEquals(FtpConst.Replyes.REPLY_227, client.executeCommand(new CmdPasv()));

      CmdRetr cmdRetr = new CmdRetr("/production/test_file.txt");
      assertEquals(FtpConst.Replyes.REPLY_226, client.executeCommand(cmdRetr));

      byte[] fileContent = cmdRetr.getFileContent();
      assertEquals(fileContent.length, FILE_CONTENT.length());

      for (int i = 0; i < fileContent.length; i++)
      {
         if (fileContent[i] != FILE_CONTENT.charAt(i))
View Full Code Here

Examples of org.exoplatform.frameworks.ftpclient.commands.CmdRetr

      assertEquals(FtpConst.Replyes.REPLY_215, client.executeCommand(new CmdSyst()));
      assertEquals(FtpConst.Replyes.REPLY_227, client.executeCommand(new CmdPasv()));

      assertEquals(FtpConst.Replyes.REPLY_350, client.executeCommand(new CmdRest(9)));

      CmdRetr cmdRetr = new CmdRetr("/production/test_file.txt");
      assertEquals(FtpConst.Replyes.REPLY_226, client.executeCommand(cmdRetr));

      byte[] fileContent = cmdRetr.getFileContent();
      assertEquals(fileContent.length, FILE_CONTENT.length() - 9);

      for (int i = 0; i < fileContent.length; i++)
      {
         if (fileContent[i] != FILE_CONTENT.charAt(i + 9))
View Full Code Here

Examples of org.exoplatform.frameworks.ftpclient.commands.CmdRetr

      assertEquals(FtpConst.Replyes.REPLY_226, client.executeCommand(cmdStor));

      assertEquals(FtpConst.Replyes.REPLY_227, client.executeCommand(new CmdPasv()));

      CmdRetr cmdRetr = new CmdRetr(fileName);
      assertEquals(FtpConst.Replyes.REPLY_226, client.executeCommand(cmdRetr));

      byte[] dataAfter = cmdRetr.getFileContent();
      for (int i = 0; i < dataAfter.length; i++)
      {
         if (dataAfter[i] != data[i])
         {
            fail();
         }
      }

      assertEquals(FtpConst.Replyes.REPLY_227, client.executeCommand(new CmdPasv()));

      assertEquals(FtpConst.Replyes.REPLY_350, client.executeCommand(new CmdRest(data.length)));

      byte[] secondData = getBytes("_APPENDED");

      cmdStor = new CmdStor(fileName);
      cmdStor.setFileContent(secondData);

      assertEquals(FtpConst.Replyes.REPLY_226, client.executeCommand(cmdStor));

      assertEquals(FtpConst.Replyes.REPLY_227, client.executeCommand(new CmdPasv()));

      cmdRetr = new CmdRetr(fileName);
      assertEquals(FtpConst.Replyes.REPLY_226, client.executeCommand(cmdRetr));

      String secondString = "DATABYTES_APPENDED";

      byte[] secondDataAfter = cmdRetr.getFileContent();
      for (int i = 0; i < secondDataAfter.length; i++)
      {
         if (secondDataAfter[i] != (byte)secondString.charAt(i))
         {
            fail();
         }
      }

      assertEquals(FtpConst.Replyes.REPLY_227, client.executeCommand(new CmdPasv()));

      assertEquals(FtpConst.Replyes.REPLY_350, client.executeCommand(new CmdRest(4)));

      byte[] replasedData = getBytes("INT");

      cmdStor = new CmdStor(fileName);
      cmdStor.setFileContent(replasedData);

      assertEquals(FtpConst.Replyes.REPLY_226, client.executeCommand(cmdStor));

      assertEquals(FtpConst.Replyes.REPLY_227, client.executeCommand(new CmdPasv()));

      cmdRetr = new CmdRetr(fileName);
      assertEquals(FtpConst.Replyes.REPLY_226, client.executeCommand(cmdRetr));

      String readyString = "DATAINTES_APPENDED";

      byte[] readyBytes = cmdRetr.getFileContent();
      for (int i = 0; i < readyBytes.length; i++)
      {
         if (readyBytes[i] != (byte)readyString.charAt(i))
         {
            fail();
View Full Code Here

Examples of org.exoplatform.frameworks.ftpclient.commands.CmdRetr

                  while (expectReply > 0)
                  {
                     int pasvReply = client.executeCommand(new CmdPasv(), FtpConst.Replyes.REPLY_227, 3);
                     if (pasvReply == FtpConst.Replyes.REPLY_227)
                     {
                        CmdRetr cmdRetr = new CmdRetr(tf2Name);
                        int retrReply = client.executeCommand(cmdRetr);
                        if (retrReply == FtpConst.Replyes.REPLY_226)
                        {
                           break;
                        }
View Full Code Here

Examples of org.exoplatform.frameworks.ftpclient.commands.CmdRetr

                     log.info("CurFileName - [" + file3 + "]");

                     assertEquals(FtpConst.Replyes.REPLY_227, client.executeCommand(new CmdPasv()));

                     CmdRetr cmdRetr = new CmdRetr(file3);
                     int reply = client.executeCommand(cmdRetr);

                     log.info("RETR REPLY - " + reply);

                  }
View Full Code Here

Examples of org.exoplatform.frameworks.ftpclient.commands.CmdRetr

      FtpClientSession client = FtpTestConfig.getTestFtpClient();
      client.connect();

      // desired reply - 530 Please login with USER and PASS
      {
         assertEquals(FtpConst.Replyes.REPLY_530, client.executeCommand(new CmdRetr(null)));
      }

      // login
      {
         assertEquals(FtpConst.Replyes.REPLY_331, client.executeCommand(new CmdUser(FtpTestConfig.USER_ID)));
         assertEquals(FtpConst.Replyes.REPLY_230, client.executeCommand(new CmdPass(FtpTestConfig.USER_PASS)));
      }

      // desired reply - 425 Unable to build data connection
      {
         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));
      }

      {
         assertEquals(FtpConst.Replyes.REPLY_250, client.executeCommand(new CmdDele(fileName)));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.