Package org.exoplatform.frameworks.ftpclient.commands

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


      client.connect();

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

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

      boolean connected = false;

      for (int i = 0; i < 15; i++)
      {
View Full Code Here


      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_250, client.executeCommand(new CmdCwd("production")));
      assertEquals(FtpConst.Replyes.REPLY_227, client.executeCommand(new CmdPasv()));
      assertEquals(FtpConst.Replyes.REPLY_226, client.executeCommand(new CmdList()));

      client.close();

      log.info("Complete.");
View Full Code Here

      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_250, client.executeCommand(new CmdCwd("production")));
      assertEquals(FtpConst.Replyes.REPLY_227, client.executeCommand(new CmdPasv()));
      assertEquals(FtpConst.Replyes.REPLY_226, client.executeCommand(new CmdNlst()));

      client.close();

      log.info("Complete.");
View Full Code Here

      client.connect();

      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()));

      CmdStor cmdStor = new CmdStor("/production/test_file.txt");

      byte[] data = new byte[FILE_CONTENT.length()];
      char[] chars = FILE_CONTENT.toCharArray();
View Full Code Here

      client.connect();

      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();
View Full Code Here

      client.connect();

      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()));

      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));
View Full Code Here

      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()));

      String fileName = "/production/resr_test_file.txt";
      assertEquals(FtpConst.Replyes.REPLY_227, client.executeCommand(new CmdPasv()));

      byte[] data = getBytes("DATABYTES");

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

      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";
View Full Code Here

                  int expectReply = 3;
                  while (expectReply > 0)
                  {

                     int pasvReply = client.executeCommand(new CmdPasv(), FtpConst.Replyes.REPLY_227, 3);
                     if (pasvReply == FtpConst.Replyes.REPLY_227)
                     {
                        // byte []data = ("TEST FILE CONTENT " + i2).getBytes();
                        byte[] data = new byte[20 * 1024];

                        CmdStor cmdStor = new CmdStor(tf2Name);
                        cmdStor.setFileContent(data);
                        int storReply = client.executeCommand(cmdStor);
                        if (storReply == FtpConst.Replyes.REPLY_226)
                        {
                           break;
                        }
                        Thread.sleep(SLEEP);
                     }

                     Thread.sleep(SLEEP);
                     expectReply--;
                  }

                  if (expectReply == 0)
                  {
                     fail();
                  }
               }

               assertEquals(FtpConst.Replyes.REPLY_250, client.executeCommand(new CmdCwd("..")));
               Thread.sleep(SLEEP);
            }

            for (int i1 = 0; i1 < itemsCount; i1++)
            {

               String tf1Name = "test_folder_" + i1;

               assertEquals(FtpConst.Replyes.REPLY_250, client.executeCommand(new CmdCwd(tf1Name)));
               Thread.sleep(SLEEP);

               for (int i2 = 0; i2 < itemsCount; i2++)
               {
                  String tf2Name = "test_file_" + i2;

                  int expectReply = 3;
                  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)
View Full Code Here

            assertEquals(FtpConst.Replyes.REPLY_230, client.executeCommand(new CmdPass(FtpTestConfig.USER_PASS)));

            assertEquals(FtpConst.Replyes.REPLY_215, client.executeCommand(new CmdSyst()));
            assertEquals(FtpConst.Replyes.REPLY_200, client.executeCommand(new CmdType("A")));

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

            log.info("Verify folder exists...");

            if (client.executeCommand(new CmdList(rootTestFolder)) == FtpConst.Replyes.REPLY_226)
            {
               log.info("Test folder exist. try delete it...");
               assertEquals(FtpConst.Replyes.REPLY_250, client.executeCommand(new CmdRmd(rootTestFolder)));
               log.info("Deleted.");
            }

            for (int i1 = 1; i1 <= ITEMS_COUNT; i1++)
            {
               String folder1 = rootTestFolder + "/folder_" + i1;
               assertEquals(FtpConst.Replyes.REPLY_257, client.executeCommand(new CmdMkd(folder1)));
               for (int i2 = 1; i2 <= ITEMS_COUNT; i2++)
               {
                  String folder2 = folder1.substring(0);
                  folder2 += "/subfolder_" + i2;
                  assertEquals(FtpConst.Replyes.REPLY_257, client.executeCommand(new CmdMkd(folder2)));

                  for (int i3 = 0; i3 < ITEMS_COUNT; i3++)
                  {

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

                     String file3 = folder2.substring(0);
                     file3 += "/test_file_" + i3 + ".txt";

                     CmdStor cmdStor = new CmdStor(file3);
View Full Code Here

                     String file3 = folder2.substring(0);
                     file3 += "/test_file_" + i3 + ".txt";

                     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

TOP

Related Classes of org.exoplatform.frameworks.ftpclient.commands.CmdPasv

Copyright © 2018 www.massapicom. 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.