tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blrun...@apache.org
Subject tajo git commit: TAJO-1980: Printout the usage of TajoShellCommand.
Date Sat, 21 Nov 2015 15:13:06 GMT
Repository: tajo
Updated Branches:
  refs/heads/branch-0.11.1 8209e4c86 -> 14393a8b2


TAJO-1980: Printout the usage of TajoShellCommand.

Signed-off-by: JaeHwa Jung <blrunner@apache.org>


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

Branch: refs/heads/branch-0.11.1
Commit: 14393a8b21f5ebe23c2f037322417e4e45652233
Parents: 8209e4c
Author: Dongkyu Hwangbo <hwangbodk@gmail.com>
Authored: Sun Nov 22 00:12:21 2015 +0900
Committer: JaeHwa Jung <blrunner@apache.org>
Committed: Sun Nov 22 00:12:21 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |  3 +++
 .../cli/tsql/commands/TajoShellCommand.java     |  1 +
 .../org/apache/tajo/cli/tsql/TestTajoCli.java   | 21 ++++++++++++++++++++
 3 files changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/14393a8b/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 0ebb96c..ebfe37b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -14,6 +14,9 @@ Release 0.11.1 - unreleased
 
   BUG FIXES
 
+    TAJO-1980: Printout the usage of TajoShellCommand.
+    (Contributed by Dongkyu Hwangbo, committed by jaehwa)
+
     TAJO-1981: Invalid nulls sort order in VectorizedSorter. (jihoon)
 
     TAJO-1935: Some Tasks don't work after they become TA_ASSIGNED. (jinho)

http://git-wip-us.apache.org/repos/asf/tajo/blob/14393a8b/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/commands/TajoShellCommand.java
----------------------------------------------------------------------
diff --git a/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/commands/TajoShellCommand.java
b/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/commands/TajoShellCommand.java
index 22fa829..bc48c8a 100644
--- a/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/commands/TajoShellCommand.java
+++ b/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/commands/TajoShellCommand.java
@@ -35,6 +35,7 @@ public abstract class TajoShellCommand {
 
   public void printHelp() {
     context.getOutput().print(getCommand());
+    context.getOutput().print(" " + getUsage());
     context.getOutput().print(" - ");
     context.getOutput().println(getDescription());
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/14393a8b/tajo-core-tests/src/test/java/org/apache/tajo/cli/tsql/TestTajoCli.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/cli/tsql/TestTajoCli.java b/tajo-core-tests/src/test/java/org/apache/tajo/cli/tsql/TestTajoCli.java
index 2988fd3..68c2441 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/cli/tsql/TestTajoCli.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/cli/tsql/TestTajoCli.java
@@ -30,6 +30,7 @@ import org.apache.tajo.TajoTestingCluster;
 import org.apache.tajo.TpchTestBase;
 import org.apache.tajo.catalog.CatalogUtil;
 import org.apache.tajo.catalog.TableDesc;
+import org.apache.tajo.cli.tsql.commands.TajoShellCommand;
 import org.apache.tajo.client.ClientParameters;
 import org.apache.tajo.client.QueryStatus;
 import org.apache.tajo.client.TajoClient;
@@ -46,6 +47,7 @@ import org.junit.rules.TestName;
 
 import java.io.*;
 import java.net.URL;
+import java.util.Map;
 import java.util.Properties;
 
 import static org.junit.Assert.*;
@@ -561,4 +563,23 @@ public class TestTajoCli {
       //nothing to do
     }
   }
+
+  @Test
+  public void testDefaultPrintHelp() throws IOException, NoSuchMethodException {
+    for (Map.Entry<String, TajoShellCommand> entry : tajoCli.getContext().getCommands().entrySet())
{
+      TajoShellCommand shellCommand = entry.getValue();
+
+      if (!shellCommand.getClass().getMethod("printHelp").getDeclaringClass().equals(shellCommand.getClass()))
{
+        tajoCli.executeMetaCommand("\\help " + entry.getKey().replace("\\", ""));
+        String result = new String(out.toByteArray());
+        out.reset();
+
+        String expected = shellCommand.getCommand()
+                + " " + shellCommand.getUsage()
+                + " - " + shellCommand.getDescription() + "\n";
+
+        assertEquals(result, expected);
+      }
+    }
+  }
 }


Mime
View raw message