You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2016/07/21 20:57:39 UTC

[1/8] accumulo git commit: ACCUMULO-4374: Changes to Shell to fix ChangeSecret tool

Repository: accumulo
Updated Branches:
  refs/heads/1.7 9b7f60e5d -> 612ede696
  refs/heads/1.8 1aceaa014 -> 7a47b187e
  refs/heads/master 10d29ad1f -> 29e0ffd39


ACCUMULO-4374: Changes to Shell to fix ChangeSecret tool

Signed-off-by: Josh Elser <el...@apache.org>


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

Branch: refs/heads/1.7
Commit: 612ede6960503a8ffef0d30bd73503015c52274d
Parents: 9b7f60e
Author: milleruntime <mi...@gmail.com>
Authored: Fri Jul 15 15:42:00 2016 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Thu Jul 21 16:32:58 2016 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/accumulo/shell/Shell.java  | 16 ++++++++++------
 .../org/apache/accumulo/shell/mock/MockShell.java   |  2 +-
 .../org/apache/accumulo/shell/ShellConfigTest.java  | 11 ++++++-----
 3 files changed, 17 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/612ede69/shell/src/main/java/org/apache/accumulo/shell/Shell.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/Shell.java b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
index 0005c36..393fe26 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
@@ -230,10 +230,8 @@ public class Shell extends ShellOptions implements KeywordExecutable {
   private PrintWriter writer = null;
   private boolean masking = false;
 
-  public Shell() throws IOException {
-    this(new ConsoleReader(), new PrintWriter(new OutputStreamWriter(System.out, Charset.forName(System.getProperty("jline.WindowsTerminal.output.encoding",
-        System.getProperty("file.encoding"))))));
-  }
+  // no arg constructor should do minimal work since its used in Main ServiceLoader
+  public Shell() {}
 
   public Shell(ConsoleReader reader, PrintWriter writer) {
     super();
@@ -246,7 +244,12 @@ public class Shell extends ShellOptions implements KeywordExecutable {
    *
    * @return true if the shell was successfully configured, false otherwise.
    */
-  public boolean config(String... args) {
+  public boolean config(String... args) throws IOException {
+    if (this.reader == null)
+      this.reader = new ConsoleReader();
+    if (this.writer == null)
+      this.writer = new PrintWriter(new OutputStreamWriter(System.out, Charset.forName(System.getProperty("jline.WindowsTerminal.output.encoding",
+          System.getProperty("file.encoding")))));
     ShellOptionsJC options = new ShellOptionsJC();
     JCommander jc = new JCommander();
 
@@ -583,7 +586,8 @@ public class Shell extends ShellOptions implements KeywordExecutable {
   }
 
   public static void main(String args[]) throws IOException {
-    new Shell().execute(args);
+    new Shell(new ConsoleReader(), new PrintWriter(new OutputStreamWriter(System.out, Charset.forName(System.getProperty(
+        "jline.WindowsTerminal.output.encoding", System.getProperty("file.encoding")))))).execute(args);
   }
 
   public int start() throws IOException {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/612ede69/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java b/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
index 609f23f..8e63eb8 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
@@ -50,7 +50,7 @@ public class MockShell extends Shell {
   }
 
   @Override
-  public boolean config(String... args) {
+  public boolean config(String... args) throws IOException {
     // If configuring the shell failed, fail quickly
     if (!super.config(args)) {
       return false;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/612ede69/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java b/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
index 64bad82..49f22a6 100644
--- a/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
+++ b/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertTrue;
 import java.io.File;
 import java.io.FileDescriptor;
 import java.io.FileInputStream;
+import java.io.IOException;
 import java.io.PrintStream;
 import java.io.PrintWriter;
 import java.nio.file.Files;
@@ -91,30 +92,30 @@ public class ShellConfigTest {
   }
 
   @Test
-  public void testHelp() {
+  public void testHelp() throws IOException {
     assertFalse(shell.config(args("--help")));
     assertTrue("Did not print usage", output.get().startsWith("Usage"));
   }
 
   @Test
-  public void testBadArg() {
+  public void testBadArg() throws IOException {
     assertFalse(shell.config(args("--bogus")));
     assertTrue("Did not print usage", output.get().startsWith("Usage"));
   }
 
   @Test
-  public void testTokenWithoutOptions() {
+  public void testTokenWithoutOptions() throws IOException {
     assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName())));
     assertFalse(output.get().contains(ParameterException.class.getName()));
   }
 
   @Test
-  public void testTokenAndOption() {
+  public void testTokenAndOption() throws IOException {
     assertTrue(shell.config(args("--fake", "-tc", PasswordToken.class.getName(), "-u", "foo", "-l", "password=foo")));
   }
 
   @Test
-  public void testTokenAndOptionAndPassword() {
+  public void testTokenAndOptionAndPassword() throws IOException {
     assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName(), "-l", "password=foo", "-p", "bar")));
     assertTrue(output.get().contains(ParameterException.class.getName()));
   }


[7/8] accumulo git commit: ACCUMULO-4374: Changes to Shell to fix ChangeSecret tool

Posted by el...@apache.org.
ACCUMULO-4374: Changes to Shell to fix ChangeSecret tool

Closes apache/accumulo#126, apache/accumulo#129

Signed-off-by: Josh Elser <el...@apache.org>


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

Branch: refs/heads/1.8
Commit: 7a47b187e0958f07425867f97012f7b2dc66a6f9
Parents: fa8177b
Author: milleruntime <mi...@gmail.com>
Authored: Fri Jul 15 15:42:00 2016 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Thu Jul 21 16:33:49 2016 -0400

----------------------------------------------------------------------
 .../src/main/java/org/apache/accumulo/shell/Shell.java | 13 ++++++++-----
 .../java/org/apache/accumulo/shell/mock/MockShell.java |  2 +-
 .../org/apache/accumulo/shell/ShellConfigTest.java     | 11 ++++++-----
 3 files changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/7a47b187/shell/src/main/java/org/apache/accumulo/shell/Shell.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/Shell.java b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
index 053e998..7678ead 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
@@ -245,9 +245,8 @@ public class Shell extends ShellOptions implements KeywordExecutable {
     }
   }
 
-  public Shell() throws IOException {
-    this(new ConsoleReader());
-  }
+  // no arg constructor should do minimal work since its used in Main ServiceLoader
+  public Shell() {}
 
   public Shell(ConsoleReader reader) {
     super();
@@ -258,8 +257,12 @@ public class Shell extends ShellOptions implements KeywordExecutable {
    * Configures the shell using the provided options. Not for client use.
    *
    * @return true if the shell was successfully configured, false otherwise.
+   * @throws IOException
+   *           if problems occur creating the ConsoleReader
    */
-  public boolean config(String... args) {
+  public boolean config(String... args) throws IOException {
+    if (this.reader == null)
+      this.reader = new ConsoleReader();
     ShellOptionsJC options = new ShellOptionsJC();
     JCommander jc = new JCommander();
 
@@ -596,7 +599,7 @@ public class Shell extends ShellOptions implements KeywordExecutable {
   }
 
   public static void main(String args[]) throws IOException {
-    new Shell().execute(args);
+    new Shell(new ConsoleReader()).execute(args);
   }
 
   public int start() throws IOException {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7a47b187/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java b/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
index f2bd075..ebc92f7 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
@@ -52,7 +52,7 @@ public class MockShell extends Shell {
   }
 
   @Override
-  public boolean config(String... args) {
+  public boolean config(String... args) throws IOException {
     // If configuring the shell failed, fail quickly
     if (!super.config(args)) {
       return false;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7a47b187/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java b/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
index 9bfe992..8bef14d 100644
--- a/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
+++ b/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertTrue;
 import java.io.File;
 import java.io.FileDescriptor;
 import java.io.FileInputStream;
+import java.io.IOException;
 import java.io.PrintStream;
 import java.nio.file.Files;
 import java.util.HashMap;
@@ -90,30 +91,30 @@ public class ShellConfigTest {
   }
 
   @Test
-  public void testHelp() {
+  public void testHelp() throws IOException {
     assertFalse(shell.config(args("--help")));
     assertTrue("Did not print usage", output.get().startsWith("Usage"));
   }
 
   @Test
-  public void testBadArg() {
+  public void testBadArg() throws IOException {
     assertFalse(shell.config(args("--bogus")));
     assertTrue("Did not print usage", output.get().startsWith("Usage"));
   }
 
   @Test
-  public void testTokenWithoutOptions() {
+  public void testTokenWithoutOptions() throws IOException {
     assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName())));
     assertFalse(output.get().contains(ParameterException.class.getName()));
   }
 
   @Test
-  public void testTokenAndOption() {
+  public void testTokenAndOption() throws IOException {
     assertTrue(shell.config(args("--fake", "-tc", PasswordToken.class.getName(), "-u", "foo", "-l", "password=foo")));
   }
 
   @Test
-  public void testTokenAndOptionAndPassword() {
+  public void testTokenAndOptionAndPassword() throws IOException {
     assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName(), "-l", "password=foo", "-p", "bar")));
     assertTrue(output.get().contains(ParameterException.class.getName()));
   }


[3/8] accumulo git commit: ACCUMULO-4374: Changes to Shell to fix ChangeSecret tool

Posted by el...@apache.org.
ACCUMULO-4374: Changes to Shell to fix ChangeSecret tool

Signed-off-by: Josh Elser <el...@apache.org>


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

Branch: refs/heads/master
Commit: 612ede6960503a8ffef0d30bd73503015c52274d
Parents: 9b7f60e
Author: milleruntime <mi...@gmail.com>
Authored: Fri Jul 15 15:42:00 2016 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Thu Jul 21 16:32:58 2016 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/accumulo/shell/Shell.java  | 16 ++++++++++------
 .../org/apache/accumulo/shell/mock/MockShell.java   |  2 +-
 .../org/apache/accumulo/shell/ShellConfigTest.java  | 11 ++++++-----
 3 files changed, 17 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/612ede69/shell/src/main/java/org/apache/accumulo/shell/Shell.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/Shell.java b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
index 0005c36..393fe26 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
@@ -230,10 +230,8 @@ public class Shell extends ShellOptions implements KeywordExecutable {
   private PrintWriter writer = null;
   private boolean masking = false;
 
-  public Shell() throws IOException {
-    this(new ConsoleReader(), new PrintWriter(new OutputStreamWriter(System.out, Charset.forName(System.getProperty("jline.WindowsTerminal.output.encoding",
-        System.getProperty("file.encoding"))))));
-  }
+  // no arg constructor should do minimal work since its used in Main ServiceLoader
+  public Shell() {}
 
   public Shell(ConsoleReader reader, PrintWriter writer) {
     super();
@@ -246,7 +244,12 @@ public class Shell extends ShellOptions implements KeywordExecutable {
    *
    * @return true if the shell was successfully configured, false otherwise.
    */
-  public boolean config(String... args) {
+  public boolean config(String... args) throws IOException {
+    if (this.reader == null)
+      this.reader = new ConsoleReader();
+    if (this.writer == null)
+      this.writer = new PrintWriter(new OutputStreamWriter(System.out, Charset.forName(System.getProperty("jline.WindowsTerminal.output.encoding",
+          System.getProperty("file.encoding")))));
     ShellOptionsJC options = new ShellOptionsJC();
     JCommander jc = new JCommander();
 
@@ -583,7 +586,8 @@ public class Shell extends ShellOptions implements KeywordExecutable {
   }
 
   public static void main(String args[]) throws IOException {
-    new Shell().execute(args);
+    new Shell(new ConsoleReader(), new PrintWriter(new OutputStreamWriter(System.out, Charset.forName(System.getProperty(
+        "jline.WindowsTerminal.output.encoding", System.getProperty("file.encoding")))))).execute(args);
   }
 
   public int start() throws IOException {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/612ede69/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java b/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
index 609f23f..8e63eb8 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
@@ -50,7 +50,7 @@ public class MockShell extends Shell {
   }
 
   @Override
-  public boolean config(String... args) {
+  public boolean config(String... args) throws IOException {
     // If configuring the shell failed, fail quickly
     if (!super.config(args)) {
       return false;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/612ede69/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java b/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
index 64bad82..49f22a6 100644
--- a/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
+++ b/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertTrue;
 import java.io.File;
 import java.io.FileDescriptor;
 import java.io.FileInputStream;
+import java.io.IOException;
 import java.io.PrintStream;
 import java.io.PrintWriter;
 import java.nio.file.Files;
@@ -91,30 +92,30 @@ public class ShellConfigTest {
   }
 
   @Test
-  public void testHelp() {
+  public void testHelp() throws IOException {
     assertFalse(shell.config(args("--help")));
     assertTrue("Did not print usage", output.get().startsWith("Usage"));
   }
 
   @Test
-  public void testBadArg() {
+  public void testBadArg() throws IOException {
     assertFalse(shell.config(args("--bogus")));
     assertTrue("Did not print usage", output.get().startsWith("Usage"));
   }
 
   @Test
-  public void testTokenWithoutOptions() {
+  public void testTokenWithoutOptions() throws IOException {
     assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName())));
     assertFalse(output.get().contains(ParameterException.class.getName()));
   }
 
   @Test
-  public void testTokenAndOption() {
+  public void testTokenAndOption() throws IOException {
     assertTrue(shell.config(args("--fake", "-tc", PasswordToken.class.getName(), "-u", "foo", "-l", "password=foo")));
   }
 
   @Test
-  public void testTokenAndOptionAndPassword() {
+  public void testTokenAndOptionAndPassword() throws IOException {
     assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName(), "-l", "password=foo", "-p", "bar")));
     assertTrue(output.get().contains(ParameterException.class.getName()));
   }


[8/8] accumulo git commit: Merge branch '1.8'

Posted by el...@apache.org.
Merge branch '1.8'


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

Branch: refs/heads/master
Commit: 29e0ffd390364e5f36f13736b35b7af71ad90d10
Parents: 10d29ad 7a47b18
Author: Josh Elser <el...@apache.org>
Authored: Thu Jul 21 16:55:54 2016 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Thu Jul 21 16:55:54 2016 -0400

----------------------------------------------------------------------
 .../src/main/java/org/apache/accumulo/shell/Shell.java | 13 ++++++++-----
 .../org/apache/accumulo/shell/ShellConfigTest.java     | 10 +++++-----
 2 files changed, 13 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/29e0ffd3/shell/src/main/java/org/apache/accumulo/shell/Shell.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/accumulo/blob/29e0ffd3/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
----------------------------------------------------------------------
diff --cc shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
index 1e0a240,8bef14d..5e8736c
--- a/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
+++ b/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
@@@ -121,22 -102,19 +121,22 @@@ public class ShellConfigTest 
      assertTrue("Did not print usage", output.get().startsWith("Usage"));
    }
  
 +  @Ignore
    @Test
-   public void testTokenWithoutOptions() {
+   public void testTokenWithoutOptions() throws IOException {
      assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName())));
      assertFalse(output.get().contains(ParameterException.class.getName()));
    }
  
 +  @Ignore
    @Test
-   public void testTokenAndOption() {
+   public void testTokenAndOption() throws IOException {
      assertTrue(shell.config(args("--fake", "-tc", PasswordToken.class.getName(), "-u", "foo", "-l", "password=foo")));
    }
  
 +  @Ignore
    @Test
-   public void testTokenAndOptionAndPassword() {
+   public void testTokenAndOptionAndPassword() throws IOException {
      assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName(), "-l", "password=foo", "-p", "bar")));
      assertTrue(output.get().contains(ParameterException.class.getName()));
    }


[4/8] accumulo git commit: Merge branch '1.7' into 1.8-up

Posted by el...@apache.org.
Merge branch '1.7' into 1.8-up


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

Branch: refs/heads/1.8
Commit: fa8177bab29f2dfcee3e515b0253b0fb9839dfe2
Parents: 1aceaa0 612ede6
Author: Josh Elser <el...@apache.org>
Authored: Thu Jul 21 16:33:14 2016 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Thu Jul 21 16:33:14 2016 -0400

----------------------------------------------------------------------

----------------------------------------------------------------------



[6/8] accumulo git commit: ACCUMULO-4374: Changes to Shell to fix ChangeSecret tool

Posted by el...@apache.org.
ACCUMULO-4374: Changes to Shell to fix ChangeSecret tool

Closes apache/accumulo#126, apache/accumulo#129

Signed-off-by: Josh Elser <el...@apache.org>


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

Branch: refs/heads/master
Commit: 7a47b187e0958f07425867f97012f7b2dc66a6f9
Parents: fa8177b
Author: milleruntime <mi...@gmail.com>
Authored: Fri Jul 15 15:42:00 2016 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Thu Jul 21 16:33:49 2016 -0400

----------------------------------------------------------------------
 .../src/main/java/org/apache/accumulo/shell/Shell.java | 13 ++++++++-----
 .../java/org/apache/accumulo/shell/mock/MockShell.java |  2 +-
 .../org/apache/accumulo/shell/ShellConfigTest.java     | 11 ++++++-----
 3 files changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/7a47b187/shell/src/main/java/org/apache/accumulo/shell/Shell.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/Shell.java b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
index 053e998..7678ead 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
@@ -245,9 +245,8 @@ public class Shell extends ShellOptions implements KeywordExecutable {
     }
   }
 
-  public Shell() throws IOException {
-    this(new ConsoleReader());
-  }
+  // no arg constructor should do minimal work since its used in Main ServiceLoader
+  public Shell() {}
 
   public Shell(ConsoleReader reader) {
     super();
@@ -258,8 +257,12 @@ public class Shell extends ShellOptions implements KeywordExecutable {
    * Configures the shell using the provided options. Not for client use.
    *
    * @return true if the shell was successfully configured, false otherwise.
+   * @throws IOException
+   *           if problems occur creating the ConsoleReader
    */
-  public boolean config(String... args) {
+  public boolean config(String... args) throws IOException {
+    if (this.reader == null)
+      this.reader = new ConsoleReader();
     ShellOptionsJC options = new ShellOptionsJC();
     JCommander jc = new JCommander();
 
@@ -596,7 +599,7 @@ public class Shell extends ShellOptions implements KeywordExecutable {
   }
 
   public static void main(String args[]) throws IOException {
-    new Shell().execute(args);
+    new Shell(new ConsoleReader()).execute(args);
   }
 
   public int start() throws IOException {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7a47b187/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java b/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
index f2bd075..ebc92f7 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
@@ -52,7 +52,7 @@ public class MockShell extends Shell {
   }
 
   @Override
-  public boolean config(String... args) {
+  public boolean config(String... args) throws IOException {
     // If configuring the shell failed, fail quickly
     if (!super.config(args)) {
       return false;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7a47b187/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java b/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
index 9bfe992..8bef14d 100644
--- a/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
+++ b/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertTrue;
 import java.io.File;
 import java.io.FileDescriptor;
 import java.io.FileInputStream;
+import java.io.IOException;
 import java.io.PrintStream;
 import java.nio.file.Files;
 import java.util.HashMap;
@@ -90,30 +91,30 @@ public class ShellConfigTest {
   }
 
   @Test
-  public void testHelp() {
+  public void testHelp() throws IOException {
     assertFalse(shell.config(args("--help")));
     assertTrue("Did not print usage", output.get().startsWith("Usage"));
   }
 
   @Test
-  public void testBadArg() {
+  public void testBadArg() throws IOException {
     assertFalse(shell.config(args("--bogus")));
     assertTrue("Did not print usage", output.get().startsWith("Usage"));
   }
 
   @Test
-  public void testTokenWithoutOptions() {
+  public void testTokenWithoutOptions() throws IOException {
     assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName())));
     assertFalse(output.get().contains(ParameterException.class.getName()));
   }
 
   @Test
-  public void testTokenAndOption() {
+  public void testTokenAndOption() throws IOException {
     assertTrue(shell.config(args("--fake", "-tc", PasswordToken.class.getName(), "-u", "foo", "-l", "password=foo")));
   }
 
   @Test
-  public void testTokenAndOptionAndPassword() {
+  public void testTokenAndOptionAndPassword() throws IOException {
     assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName(), "-l", "password=foo", "-p", "bar")));
     assertTrue(output.get().contains(ParameterException.class.getName()));
   }


[5/8] accumulo git commit: Merge branch '1.7' into 1.8-up

Posted by el...@apache.org.
Merge branch '1.7' into 1.8-up


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

Branch: refs/heads/master
Commit: fa8177bab29f2dfcee3e515b0253b0fb9839dfe2
Parents: 1aceaa0 612ede6
Author: Josh Elser <el...@apache.org>
Authored: Thu Jul 21 16:33:14 2016 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Thu Jul 21 16:33:14 2016 -0400

----------------------------------------------------------------------

----------------------------------------------------------------------



[2/8] accumulo git commit: ACCUMULO-4374: Changes to Shell to fix ChangeSecret tool

Posted by el...@apache.org.
ACCUMULO-4374: Changes to Shell to fix ChangeSecret tool

Signed-off-by: Josh Elser <el...@apache.org>


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

Branch: refs/heads/1.8
Commit: 612ede6960503a8ffef0d30bd73503015c52274d
Parents: 9b7f60e
Author: milleruntime <mi...@gmail.com>
Authored: Fri Jul 15 15:42:00 2016 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Thu Jul 21 16:32:58 2016 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/accumulo/shell/Shell.java  | 16 ++++++++++------
 .../org/apache/accumulo/shell/mock/MockShell.java   |  2 +-
 .../org/apache/accumulo/shell/ShellConfigTest.java  | 11 ++++++-----
 3 files changed, 17 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/612ede69/shell/src/main/java/org/apache/accumulo/shell/Shell.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/Shell.java b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
index 0005c36..393fe26 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
@@ -230,10 +230,8 @@ public class Shell extends ShellOptions implements KeywordExecutable {
   private PrintWriter writer = null;
   private boolean masking = false;
 
-  public Shell() throws IOException {
-    this(new ConsoleReader(), new PrintWriter(new OutputStreamWriter(System.out, Charset.forName(System.getProperty("jline.WindowsTerminal.output.encoding",
-        System.getProperty("file.encoding"))))));
-  }
+  // no arg constructor should do minimal work since its used in Main ServiceLoader
+  public Shell() {}
 
   public Shell(ConsoleReader reader, PrintWriter writer) {
     super();
@@ -246,7 +244,12 @@ public class Shell extends ShellOptions implements KeywordExecutable {
    *
    * @return true if the shell was successfully configured, false otherwise.
    */
-  public boolean config(String... args) {
+  public boolean config(String... args) throws IOException {
+    if (this.reader == null)
+      this.reader = new ConsoleReader();
+    if (this.writer == null)
+      this.writer = new PrintWriter(new OutputStreamWriter(System.out, Charset.forName(System.getProperty("jline.WindowsTerminal.output.encoding",
+          System.getProperty("file.encoding")))));
     ShellOptionsJC options = new ShellOptionsJC();
     JCommander jc = new JCommander();
 
@@ -583,7 +586,8 @@ public class Shell extends ShellOptions implements KeywordExecutable {
   }
 
   public static void main(String args[]) throws IOException {
-    new Shell().execute(args);
+    new Shell(new ConsoleReader(), new PrintWriter(new OutputStreamWriter(System.out, Charset.forName(System.getProperty(
+        "jline.WindowsTerminal.output.encoding", System.getProperty("file.encoding")))))).execute(args);
   }
 
   public int start() throws IOException {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/612ede69/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java b/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
index 609f23f..8e63eb8 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java
@@ -50,7 +50,7 @@ public class MockShell extends Shell {
   }
 
   @Override
-  public boolean config(String... args) {
+  public boolean config(String... args) throws IOException {
     // If configuring the shell failed, fail quickly
     if (!super.config(args)) {
       return false;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/612ede69/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java b/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
index 64bad82..49f22a6 100644
--- a/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
+++ b/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertTrue;
 import java.io.File;
 import java.io.FileDescriptor;
 import java.io.FileInputStream;
+import java.io.IOException;
 import java.io.PrintStream;
 import java.io.PrintWriter;
 import java.nio.file.Files;
@@ -91,30 +92,30 @@ public class ShellConfigTest {
   }
 
   @Test
-  public void testHelp() {
+  public void testHelp() throws IOException {
     assertFalse(shell.config(args("--help")));
     assertTrue("Did not print usage", output.get().startsWith("Usage"));
   }
 
   @Test
-  public void testBadArg() {
+  public void testBadArg() throws IOException {
     assertFalse(shell.config(args("--bogus")));
     assertTrue("Did not print usage", output.get().startsWith("Usage"));
   }
 
   @Test
-  public void testTokenWithoutOptions() {
+  public void testTokenWithoutOptions() throws IOException {
     assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName())));
     assertFalse(output.get().contains(ParameterException.class.getName()));
   }
 
   @Test
-  public void testTokenAndOption() {
+  public void testTokenAndOption() throws IOException {
     assertTrue(shell.config(args("--fake", "-tc", PasswordToken.class.getName(), "-u", "foo", "-l", "password=foo")));
   }
 
   @Test
-  public void testTokenAndOptionAndPassword() {
+  public void testTokenAndOptionAndPassword() throws IOException {
     assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName(), "-l", "password=foo", "-p", "bar")));
     assertTrue(output.get().contains(ParameterException.class.getName()));
   }