accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [3/6] git commit: ACCUMULO-2235 Make the du shell command successful when not in a table context.
Date Thu, 23 Jan 2014 04:34:05 GMT
ACCUMULO-2235 Make the du shell command successful when not in a table context.


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

Branch: refs/heads/master
Commit: 707e74e057bc449aced48147544153d0571801d0
Parents: 7bef404
Author: Josh Elser <elserj@apache.org>
Authored: Wed Jan 22 23:18:17 2014 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Wed Jan 22 23:18:17 2014 -0500

----------------------------------------------------------------------
 .../apache/accumulo/core/util/shell/commands/DUCommand.java  | 8 ++++++--
 .../test/java/org/apache/accumulo/test/ShellServerTest.java  | 6 +++++-
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/707e74e0/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java
b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java
index bdc4d33..b03f516 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java
@@ -44,16 +44,20 @@ public class DUCommand extends Command {
 
     boolean prettyPrint = cl.hasOption(optHumanReadble.getOpt()) ? true : false;
 
+    // Add any patterns
     if (cl.hasOption(optTablePattern.getOpt())) {
       for (String table : shellState.getConnector().tableOperations().list()) {
         if (table.matches(cl.getOptionValue(optTablePattern.getOpt()))) {
           tablesToFlush.add(table);
         }
       }
-    } else {
-      shellState.checkTableState();
+    }
+    
+    // If we didn't get any tables, and we have a table selected, add the current table
+    if (tablesToFlush.isEmpty() && !shellState.getTableName().isEmpty()) {
       tablesToFlush.add(shellState.getTableName());
     }
+    
     try {
       final AccumuloConfiguration acuConf = new ConfigurationCopy(shellState.getConnector().instanceOperations().getSystemConfiguration());
       TableDiskUsage.printDiskUsage(acuConf, tablesToFlush, FileSystem.get(new Configuration()),
shellState.getConnector(), new Printer() {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/707e74e0/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java b/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
index 014342c..bc73c9f 100644
--- a/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
+++ b/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
@@ -245,7 +245,11 @@ public class ShellServerTest {
   
   @Test(timeout = 30000)
   public void du() throws Exception {
-    // du
+    // Calling du not in a table context shouldn't throw an error
+    output.clear();
+    exec("du", true, "", true);
+    
+    output.clear();
     exec("createtable t");
     make10();
     exec("flush -t t -w");


Mime
View raw message