Repository: tajo
Updated Branches:
refs/heads/master 090ce1710 -> ef682ccc9
TAJO-1980: Printout the usage of TajoShellCommand.
Closes #863
Signed-off-by: JaeHwa Jung <bl...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/ef682ccc
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/ef682ccc
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/ef682ccc
Branch: refs/heads/master
Commit: ef682ccc9e3b187ccc52810eac184ad2b149c4ba
Parents: 090ce17
Author: Dongkyu Hwangbo <hw...@gmail.com>
Authored: Sun Nov 22 00:07:01 2015 +0900
Committer: JaeHwa Jung <bl...@apache.org>
Committed: Sun Nov 22 00:07:01 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/ef682ccc/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index b1e65a7..e681e37 100644
--- a/CHANGES
+++ b/CHANGES
@@ -35,6 +35,9 @@ Release 0.12.0 - 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/ef682ccc/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/ef682ccc/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);
+ }
+ }
+ }
}