accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [2/3] accumulo git commit: ACCUMULO-3424 Remove requirement for properties on provided token.
Date Tue, 16 Dec 2014 20:35:46 GMT
ACCUMULO-3424 Remove requirement for properties on provided token.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/27d4ee21
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/27d4ee21
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/27d4ee21

Branch: refs/heads/master
Commit: 27d4ee212984015acc53c4514bb053d3482240de
Parents: 86f7c1b
Author: Josh Elser <elserj@apache.org>
Authored: Tue Dec 16 15:26:59 2014 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Tue Dec 16 15:28:06 2014 -0500

----------------------------------------------------------------------
 .../java/org/apache/accumulo/core/util/shell/Shell.java | 12 +++++-------
 .../accumulo/core/util/shell/ShellConfigTest.java       |  4 ++--
 2 files changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/27d4ee21/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java b/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
index b187a76..a7ab8db 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
@@ -286,8 +286,7 @@ public class Shell extends ShellOptions {
 
     // process default parameters if unspecified
     try {
-      boolean hasToken = (token != null);
-      boolean hasTokenOptions = !loginOptions.isEmpty();
+      final boolean hasToken = (token != null);
 
       if (hasToken && password != null) {
         throw new ParameterException("Can not supply '--pass' option with '--tokenClass'
option");
@@ -300,16 +299,15 @@ public class Shell extends ShellOptions {
         }
       });
 
-      // Need either both a token and options, or neither, but not just one.
-      if (hasToken != hasTokenOptions) {
-        throw new ParameterException("Must supply either both or neither of '--tokenClass'
and '--tokenProperty'");
-      } else if (hasToken) { // implied hasTokenOptions
+      if (hasToken) { // implied hasTokenOptions
         // Fully qualified name so we don't shadow java.util.Properties
         org.apache.accumulo.core.client.security.tokens.AuthenticationToken.Properties props;
         // and line wrap it because the package name is so long
         props = new org.apache.accumulo.core.client.security.tokens.AuthenticationToken.Properties();
 
-        props.putAllStrings(loginOptions);
+        if (!loginOptions.isEmpty()) {
+          props.putAllStrings(loginOptions);
+        }
         token.init(props);
       } else {
         // Read password if the user explicitly asked for it, or didn't specify anything
at all

http://git-wip-us.apache.org/repos/asf/accumulo/blob/27d4ee21/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java b/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java
index 43d2e12..6b9ff14 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java
@@ -72,9 +72,9 @@ public class ShellConfigTest {
   }
   
   @Test
-  public void testToken() {
+  public void testTokenWithoutOptions() {
     assertTrue(shell.config("--fake", "-tc", PasswordToken.class.getCanonicalName()));
-    assertTrue(output.get().contains(ParameterException.class.getCanonicalName()));
+    assertFalse(output.get().contains(ParameterException.class.getCanonicalName()));
   }
   
   @Test


Mime
View raw message