Examples of CmdType


Examples of org.apache.james.cli.type.CmdType

        ServerCmd sCmd = new ServerCmd();

        // Execute the requested command.
        String[] arguments = cmd.getArgs();
        String cmdName = arguments[0];
        CmdType cmdType = null;
        try {

            cmdType = CmdType.lookup(cmdName);

            if (CmdType.ADDUSER.equals(cmdType)) {
                if (cmdType.hasCorrectArguments(arguments.length)) {
                    probe.addUser(arguments[1], arguments[2]);
                } else {
                    printUsage();
                    System.exit(1);
                }
            } else if (CmdType.REMOVEUSER.equals(cmdType)) {
                if (cmdType.hasCorrectArguments(arguments.length)) {
                    probe.removeUser(arguments[1]);
                } else {
                    printUsage();
                    System.exit(1);
                }
            } else if (CmdType.LISTUSERS.equals(cmdType)) {
                if (cmdType.hasCorrectArguments(arguments.length)) {
                    sCmd.print(probe.listUsers(), System.out);
                } else {
                    printUsage();
                    System.exit(1);
                }
            } else if (CmdType.ADDDOMAIN.equals(cmdType)) {
                if (cmdType.hasCorrectArguments(arguments.length)) {
                    probe.addDomain(arguments[1]);
                } else {
                    printUsage();
                    System.exit(1);
                }
            } else if (CmdType.REMOVEDOMAIN.equals(cmdType)) {
                if (cmdType.hasCorrectArguments(arguments.length)) {
                    probe.removeDomain(arguments[1]);
                } else {
                    printUsage();
                    System.exit(1);
                }
            } else if (CmdType.CONTAINSDOMAIN.equals(cmdType)) {
                if (cmdType.hasCorrectArguments(arguments.length)) {
                    probe.containsDomain(arguments[1]);
                } else {
                    printUsage();
                    System.exit(1);
                }
            } else if (CmdType.LISTDOMAINS.equals(cmdType)) {
                if (cmdType.hasCorrectArguments(arguments.length)) {
                    sCmd.print(probe.listDomains(), System.out);
                } else {
                    printUsage();
                    System.exit(1);
                }
            } else if (CmdType.LISTMAPPINGS.equals(cmdType)) {
                if (cmdType.hasCorrectArguments(arguments.length)) {
                    sCmd.print(probe.listMappings(), System.out);
                } else {
                    printUsage();
                    System.exit(1);
                }
            } else if (CmdType.LISTUSERDOMAINMAPPINGS.equals(cmdType)) {
                if (cmdType.hasCorrectArguments(arguments.length)) {
                    Collection<String> userDomainMappings = probe.listUserDomainMappings(arguments[1], arguments[2]);
                    sCmd.print(userDomainMappings.toArray(new String[userDomainMappings.size()]), System.out);
                } else {
                    printUsage();
                    System.exit(1);
                }
            } else if (CmdType.ADDADDRESSMAPPING.equals(cmdType)) {
                if (cmdType.hasCorrectArguments(arguments.length)) {
                    probe.addAddressMapping(arguments[1], arguments[2], arguments[3]);
                } else {
                    printUsage();
                    System.exit(1);
                }
            } else if (CmdType.REMOVEADDRESSMAPPING.equals(cmdType)) {
                if (cmdType.hasCorrectArguments(arguments.length)) {
                    probe.removeAddressMapping(arguments[1], arguments[2], arguments[3]);
                } else {
                    printUsage();
                    System.exit(1);
                }
            } else if (CmdType.ADDREGEXMAPPING.equals(cmdType)) {
                if (cmdType.hasCorrectArguments(arguments.length)) {
                    probe.addRegexMapping(arguments[1], arguments[2], arguments[3]);
                } else {
                    printUsage();
                    System.exit(1);
                }
            } else if (CmdType.REMOVEREGEXMAPPING.equals(cmdType)) {
                if (cmdType.hasCorrectArguments(arguments.length)) {
                    probe.removeRegexMapping(arguments[1], arguments[2], arguments[3]);
                } else {
                    printUsage();
                    System.exit(1);
                }
            } else if (CmdType.SETPASSWORD.equals(cmdType)) {
                if (cmdType.hasCorrectArguments(arguments.length)) {
                    probe.setPassword(arguments[1], arguments[2]);
                } else {
                    printUsage();
                    System.exit(1);
                }
            } else if (CmdType.COPYMAILBOX.equals(cmdType)) {
                if (cmdType.hasCorrectArguments(arguments.length)) {
                    probe.copyMailbox(arguments[1], arguments[2]);
                } else {
                    printUsage();
                    System.exit(1);
                }
            } else {
                System.err.println("Unrecognized command: " + cmdName + ".");
                printUsage();
                System.exit(1);
            }
        } catch (Exception e) {
            sCmd.onException(e, System.err);
            System.exit(1);
        }

        sCmd.print(new String[]{cmdType.getCommand() + " command executed sucessfully in "
                + (Calendar.getInstance().getTimeInMillis() - start) + " ms."}, System.out);
        System.exit(0);
    }
View Full Code Here

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

      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_200, client.executeCommand(new CmdType("A")));
      assertEquals(FtpConst.Replyes.REPLY_200, client.executeCommand(new CmdType("I")));
      assertEquals(FtpConst.Replyes.REPLY_500, client.executeCommand(new CmdType("SOMETYPE")));

      client.close();

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

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

            assertEquals(FtpConst.Replyes.REPLY_331, client.executeCommand(new CmdUser(FtpTestConfig.USER_ID)));
            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...");
View Full Code Here

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

            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_200, client.executeCommand(new CmdType("A")));

            for (int i1 = 1; i1 <= ITEMS_COUNT; i1++)
            {
               String folder1 = rootTestFolder + "/folder_" + i1;
               for (int i2 = 1; i2 <= ITEMS_COUNT; i2++)
View Full Code Here

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

            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_200, client.executeCommand(new CmdType("A")));

            for (int i1 = 1; i1 <= ITEMS_COUNT; i1++)
            {
               String folder1 = rootTestFolder + "/folder_" + i1;
               for (int i2 = 1; i2 <= ITEMS_COUNT; i2++)
View Full Code Here

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

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

      {
         CmdType cmdType = new CmdType("");
         assertEquals(FtpConst.Replyes.REPLY_530, client.executeCommand(cmdType));
      }

      {
         CmdUser cmdUser = new CmdUser(FtpTestConfig.USER_ID);
         assertEquals(FtpConst.Replyes.REPLY_331, client.executeCommand(cmdUser));
      }

      {
         CmdPass cmdPass = new CmdPass(FtpTestConfig.USER_PASS);
         assertEquals(FtpConst.Replyes.REPLY_230, client.executeCommand(cmdPass));
      }

      {
         CmdType cmdType = new CmdType("a");
         assertEquals(FtpConst.Replyes.REPLY_200, client.executeCommand(cmdType));
      }

      {
         CmdType cmdType = new CmdType("i");
         assertEquals(FtpConst.Replyes.REPLY_200, client.executeCommand(cmdType));
      }

      {
         CmdType cmdType = new CmdType("any");
         assertEquals(FtpConst.Replyes.REPLY_500, client.executeCommand(cmdType));
      }

      {
         CmdType cmdType = new CmdType("");
         assertEquals(FtpConst.Replyes.REPLY_500, client.executeCommand(cmdType));
      }

      client.close();
      log.info("Complete.\r\n");
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.