james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1148019 - in /james/server/trunk/cli/src: main/java/org/apache/james/cli/ServerCmd.java main/java/org/apache/james/cli/type/CmdType.java test/java/org/apache/james/cli/type/CmdTypeTest.java
Date Mon, 18 Jul 2011 19:47:19 GMT
Author: norman
Date: Mon Jul 18 19:47:18 2011
New Revision: 1148019

URL: http://svn.apache.org/viewvc?rev=1148019&view=rev
Log:
Allow to set password via the cli. See JAMES-1292. Thanks to Patrick Pyette for the patch

Modified:
    james/server/trunk/cli/src/main/java/org/apache/james/cli/ServerCmd.java
    james/server/trunk/cli/src/main/java/org/apache/james/cli/type/CmdType.java
    james/server/trunk/cli/src/test/java/org/apache/james/cli/type/CmdTypeTest.java

Modified: james/server/trunk/cli/src/main/java/org/apache/james/cli/ServerCmd.java
URL: http://svn.apache.org/viewvc/james/server/trunk/cli/src/main/java/org/apache/james/cli/ServerCmd.java?rev=1148019&r1=1148018&r2=1148019&view=diff
==============================================================================
--- james/server/trunk/cli/src/main/java/org/apache/james/cli/ServerCmd.java (original)
+++ james/server/trunk/cli/src/main/java/org/apache/james/cli/ServerCmd.java Mon Jul 18 19:47:18
2011
@@ -202,6 +202,13 @@ public class ServerCmd {
                     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 {
                 System.err.println("Unrecognized command: " + cmdName + ".");
                 printUsage();
@@ -259,6 +266,7 @@ public class ServerCmd {
         HelpFormatter hf = new HelpFormatter();
         String header = String.format("%nAvailable commands:%n" 
                 + "adduser <username> <password>%n"
+                + "setpassword <username> <password>%n"
                 + "removeuser <username>%n" 
                 + "listusers%n" 
                 + "adddomain <domainname>%n"

Modified: james/server/trunk/cli/src/main/java/org/apache/james/cli/type/CmdType.java
URL: http://svn.apache.org/viewvc/james/server/trunk/cli/src/main/java/org/apache/james/cli/type/CmdType.java?rev=1148019&r1=1148018&r2=1148019&view=diff
==============================================================================
--- james/server/trunk/cli/src/main/java/org/apache/james/cli/type/CmdType.java (original)
+++ james/server/trunk/cli/src/main/java/org/apache/james/cli/type/CmdType.java Mon Jul 18
19:47:18 2011
@@ -33,7 +33,8 @@ public enum CmdType {
     ADDADDRESSMAPPING("addaddressmapping", 4),
     REMOVEADDRESSMAPPING("removeaddressmapping", 4),
     ADDREGEXMAPPING("addregexmapping", 4),
-    REMOVEREGEXMAPPING("removeregexmapping", 4);
+    REMOVEREGEXMAPPING("removeregexmapping", 4),
+    SETPASSWORD("setpassword", 3);
     private String command;
     private int arguments;
 

Modified: james/server/trunk/cli/src/test/java/org/apache/james/cli/type/CmdTypeTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/cli/src/test/java/org/apache/james/cli/type/CmdTypeTest.java?rev=1148019&r1=1148018&r2=1148019&view=diff
==============================================================================
--- james/server/trunk/cli/src/test/java/org/apache/james/cli/type/CmdTypeTest.java (original)
+++ james/server/trunk/cli/src/test/java/org/apache/james/cli/type/CmdTypeTest.java Mon Jul
18 19:47:18 2011
@@ -71,6 +71,9 @@ public class CmdTypeTest extends TestCas
 
         result = CmdType.lookup(CmdType.LISTDOMAINS.getCommand());
         assertEquals(CmdType.LISTDOMAINS, result);
+        
+        result = CmdType.lookup(CmdType.SETPASSWORD.getCommand());
+        assertEquals(CmdType.SETPASSWORD, result);
 
         // Test known bad value
         result = CmdType.lookup("");



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message