You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by "Michael Blow (Code Review)" <do...@asterixdb.incubator.apache.org> on 2016/08/31 19:39:53 UTC
Change in asterixdb[master]: Extensibility, Cleanup For Client Helper
Michael Blow has uploaded a new change for review.
https://asterix-gerrit.ics.uci.edu/1133
Change subject: Extensibility, Cleanup For Client Helper
......................................................................
Extensibility, Cleanup For Client Helper
Change-Id: Ifa24e952c1b49d7d3a5b971906915ae1560086c8
---
M asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java
M asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ClientCommand.java
M asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java
3 files changed, 17 insertions(+), 8 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/33/1133/1
diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java
index 82e8386..419e660 100644
--- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java
+++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java
@@ -33,6 +33,7 @@
public class AsterixHelperExecution {
public static final String ASTERIX_HELPER = "asterixhelper";
+ public static final int COMMAND_USAGE_ALIGNMENT = 20;
protected AsterixHelperExecution() {
}
@@ -41,7 +42,7 @@
"squid:S106", // use of System.err
"squid:S1166" // rethrow or log exception
})
- protected int execute(String [] argArray) throws IOException {
+ public int execute(String [] argArray) throws IOException {
Args args = createArgs();
CmdLineParser parser = createParser(args);
try {
@@ -59,7 +60,7 @@
System.err.println("ERROR: " + e.getMessage() + "\n\n"
+ "Usage: " + getHelperCommandName() + " [options] <command>\n\n"
+ "Commands:");
- printCommandUsage(System.err);
+ printCommandsUsage(System.err);
System.err.println("Options:");
parser.printUsage(System.err);
System.err.flush();
@@ -71,12 +72,20 @@
return ASTERIX_HELPER;
}
- protected void printCommandUsage(PrintStream out) {
+ protected void printCommandsUsage(PrintStream out) {
for (Command command : Command.values()) {
- out.println(" " + command.name().toLowerCase() + " " + command.usage());
+ printCommandUsage(out, command.name(), command.usage());
}
}
+ protected void printCommandUsage(PrintStream out, String name, String usage) {
+ StringBuilder padding = new StringBuilder();
+ for (int i = name.length(); i < COMMAND_USAGE_ALIGNMENT; i++) {
+ padding.append(' ');
+ }
+ out.println(" " + name.toLowerCase() + padding.toString() + " : " + usage);
+ }
+
protected CmdLineParser createParser(Args args) {
return new CmdLineParser(args, ParserProperties.defaults().withUsageWidth(120));
}
diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ClientCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ClientCommand.java
index 734d87b..8f0cac0 100644
--- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ClientCommand.java
+++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ClientCommand.java
@@ -28,9 +28,9 @@
public abstract class ClientCommand {
public enum Command {
- GET_CLUSTER_STATE("- Get state of cluster (errorcode 0 = UP, non-zero = DOWN)"),
- WAIT_FOR_CLUSTER(" - Wait for cluster to be ready (errorcode 0 = UP, non-zero = UNKNOWN)\")"),
- SHUTDOWN_CLUSTER(" - Instructs the cluster to shut down"),;
+ GET_CLUSTER_STATE("Get state of cluster (errorcode 0 = UP, non-zero = DOWN)"),
+ WAIT_FOR_CLUSTER("Wait for cluster to be ready (errorcode 0 = UP, non-zero = UNKNOWN)"),
+ SHUTDOWN_CLUSTER("Instructs the cluster to shut down"),;
private final String usage;
private static final Map<String, Command> nameMap = new HashMap<>();
diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java
index 1440b70..77ccbb4 100644
--- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java
+++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java
@@ -26,7 +26,7 @@
import org.apache.asterix.clienthelper.Args;
public abstract class RemoteCommand extends ClientCommand {
- enum Method {
+ protected enum Method {
GET,
POST
}
--
To view, visit https://asterix-gerrit.ics.uci.edu/1133
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa24e952c1b49d7d3a5b971906915ae1560086c8
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <mb...@apache.org>
Change in asterixdb[master]: Extensibility, Cleanup For Client Helper
Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.
Change subject: Extensibility, Cleanup For Client Helper
......................................................................
Patch Set 1:
Integration Tests Successful
https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/527/ : SUCCESS
--
To view, visit https://asterix-gerrit.ics.uci.edu/1133
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifa24e952c1b49d7d3a5b971906915ae1560086c8
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <mb...@apache.org>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Michael Blow <mb...@apache.org>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-HasComments: No
Change in asterixdb[master]: Extensibility, Cleanup For Client Helper
Posted by "Till Westmann (Code Review)" <do...@asterixdb.incubator.apache.org>.
Till Westmann has posted comments on this change.
Change subject: Extensibility, Cleanup For Client Helper
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://asterix-gerrit.ics.uci.edu/1133
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifa24e952c1b49d7d3a5b971906915ae1560086c8
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <mb...@apache.org>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-HasComments: No
Change in asterixdb[master]: Extensibility, Cleanup For Client Helper
Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.
Change subject: Extensibility, Cleanup For Client Helper
......................................................................
Patch Set 1:
Build Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-notopic/2478/
--
To view, visit https://asterix-gerrit.ics.uci.edu/1133
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifa24e952c1b49d7d3a5b971906915ae1560086c8
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <mb...@apache.org>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No
Change in asterixdb[master]: Extensibility, Cleanup For Client Helper
Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.
Change subject: Extensibility, Cleanup For Client Helper
......................................................................
Patch Set 1:
Integration Tests Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/527/
--
To view, visit https://asterix-gerrit.ics.uci.edu/1133
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifa24e952c1b49d7d3a5b971906915ae1560086c8
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <mb...@apache.org>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No
Change in asterixdb[master]: Extensibility, Cleanup For Client Helper
Posted by "Michael Blow (Code Review)" <do...@asterixdb.incubator.apache.org>.
Michael Blow has submitted this change and it was merged.
Change subject: Extensibility, Cleanup For Client Helper
......................................................................
Extensibility, Cleanup For Client Helper
Change-Id: Ifa24e952c1b49d7d3a5b971906915ae1560086c8
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1133
Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <ti...@apache.org>
---
M asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java
M asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ClientCommand.java
M asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java
3 files changed, 17 insertions(+), 8 deletions(-)
Approvals:
Till Westmann: Looks good to me, approved
Jenkins: Verified; No violations found
diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java
index 82e8386..419e660 100644
--- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java
+++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java
@@ -33,6 +33,7 @@
public class AsterixHelperExecution {
public static final String ASTERIX_HELPER = "asterixhelper";
+ public static final int COMMAND_USAGE_ALIGNMENT = 20;
protected AsterixHelperExecution() {
}
@@ -41,7 +42,7 @@
"squid:S106", // use of System.err
"squid:S1166" // rethrow or log exception
})
- protected int execute(String [] argArray) throws IOException {
+ public int execute(String [] argArray) throws IOException {
Args args = createArgs();
CmdLineParser parser = createParser(args);
try {
@@ -59,7 +60,7 @@
System.err.println("ERROR: " + e.getMessage() + "\n\n"
+ "Usage: " + getHelperCommandName() + " [options] <command>\n\n"
+ "Commands:");
- printCommandUsage(System.err);
+ printCommandsUsage(System.err);
System.err.println("Options:");
parser.printUsage(System.err);
System.err.flush();
@@ -71,12 +72,20 @@
return ASTERIX_HELPER;
}
- protected void printCommandUsage(PrintStream out) {
+ protected void printCommandsUsage(PrintStream out) {
for (Command command : Command.values()) {
- out.println(" " + command.name().toLowerCase() + " " + command.usage());
+ printCommandUsage(out, command.name(), command.usage());
}
}
+ protected void printCommandUsage(PrintStream out, String name, String usage) {
+ StringBuilder padding = new StringBuilder();
+ for (int i = name.length(); i < COMMAND_USAGE_ALIGNMENT; i++) {
+ padding.append(' ');
+ }
+ out.println(" " + name.toLowerCase() + padding.toString() + " : " + usage);
+ }
+
protected CmdLineParser createParser(Args args) {
return new CmdLineParser(args, ParserProperties.defaults().withUsageWidth(120));
}
diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ClientCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ClientCommand.java
index 734d87b..8f0cac0 100644
--- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ClientCommand.java
+++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ClientCommand.java
@@ -28,9 +28,9 @@
public abstract class ClientCommand {
public enum Command {
- GET_CLUSTER_STATE("- Get state of cluster (errorcode 0 = UP, non-zero = DOWN)"),
- WAIT_FOR_CLUSTER(" - Wait for cluster to be ready (errorcode 0 = UP, non-zero = UNKNOWN)\")"),
- SHUTDOWN_CLUSTER(" - Instructs the cluster to shut down"),;
+ GET_CLUSTER_STATE("Get state of cluster (errorcode 0 = UP, non-zero = DOWN)"),
+ WAIT_FOR_CLUSTER("Wait for cluster to be ready (errorcode 0 = UP, non-zero = UNKNOWN)"),
+ SHUTDOWN_CLUSTER("Instructs the cluster to shut down"),;
private final String usage;
private static final Map<String, Command> nameMap = new HashMap<>();
diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java
index 1440b70..77ccbb4 100644
--- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java
+++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java
@@ -26,7 +26,7 @@
import org.apache.asterix.clienthelper.Args;
public abstract class RemoteCommand extends ClientCommand {
- enum Method {
+ protected enum Method {
GET,
POST
}
--
To view, visit https://asterix-gerrit.ics.uci.edu/1133
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifa24e952c1b49d7d3a5b971906915ae1560086c8
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <mb...@apache.org>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Michael Blow <mb...@apache.org>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>