未验证 提交 d2da0365 编写于 作者: C CritasWang 提交者: GitHub

Change display nums of client to fixed 1000

上级 c9315c75
...@@ -103,8 +103,6 @@ public class StartClientScriptIT extends AbstractScript { ...@@ -103,8 +103,6 @@ public class StartClientScriptIT extends AbstractScript {
ip, ip,
"-p", "-p",
port, port,
"-maxPRC",
"0",
"-e", "-e",
"\"flush\"", "\"flush\"",
"&", "&",
...@@ -112,22 +110,6 @@ public class StartClientScriptIT extends AbstractScript { ...@@ -112,22 +110,6 @@ public class StartClientScriptIT extends AbstractScript {
"%^errorlevel%"); "%^errorlevel%");
builder2.environment().put("CLASSPATH", libPath); builder2.environment().put("CLASSPATH", libPath);
testOutput(builder2, output2, 0); testOutput(builder2, output2, 0);
final String[] output3 = {
"Error: error format of max print row count, it should be an integer number"
};
ProcessBuilder builder3 =
new ProcessBuilder(
"cmd.exe",
"/c",
sbinPath + File.separator + "start-cli.bat",
"-maxPRC",
"-1111111111111111111111111111",
"&",
"exit",
"%^errorlevel%");
builder3.environment().put("CLASSPATH", libPath);
testOutput(builder3, output3, 1);
} }
@Override @Override
...@@ -159,23 +141,9 @@ public class StartClientScriptIT extends AbstractScript { ...@@ -159,23 +141,9 @@ public class StartClientScriptIT extends AbstractScript {
ip, ip,
"-p", "-p",
port, port,
"-maxPRC",
"0",
"-e", "-e",
"\"flush\""); "\"flush\"");
builder2.environment().put("CLASSPATH", libPath); builder2.environment().put("CLASSPATH", libPath);
testOutput(builder2, output2, 0); testOutput(builder2, output2, 0);
final String[] output3 = {
"Error: error format of max print row count, it should be an integer number"
};
ProcessBuilder builder3 =
new ProcessBuilder(
"sh",
sbinPath + File.separator + "start-cli.sh",
"-maxPRC",
"-1111111111111111111111111111");
builder3.environment().put("CLASSPATH", libPath);
testOutput(builder3, output3, 1);
} }
} }
...@@ -78,7 +78,7 @@ while true; do ...@@ -78,7 +78,7 @@ while true; do
shift 2 shift 2
;; ;;
--help) --help)
echo "Usage: $0 [-h <ip>] [-p <port>] [-u <username>] [-pw <password>] [-D <name=value>] [-c] [-e sql] [-maxPRC <PRC size>]" echo "Usage: $0 [-h <ip>] [-p <port>] [-u <username>] [-pw <password>] [-D <name=value>] [-c] [-e sql]"
exit 0 exit 0
;; ;;
"") "")
......
...@@ -78,13 +78,10 @@ public abstract class AbstractCli { ...@@ -78,13 +78,10 @@ public abstract class AbstractCli {
static final String ISO8601_ARGS = "disableISO8601"; static final String ISO8601_ARGS = "disableISO8601";
static final List<String> AGGREGRATE_TIME_LIST = new ArrayList<>(); static final List<String> AGGREGRATE_TIME_LIST = new ArrayList<>();
static final String MAX_PRINT_ROW_COUNT_ARGS = "maxPRC";
private static final String MAX_PRINT_ROW_COUNT_NAME = "maxPrintRowCount";
static final String RPC_COMPRESS_ARGS = "c"; static final String RPC_COMPRESS_ARGS = "c";
private static final String RPC_COMPRESS_NAME = "rpcCompressed"; private static final String RPC_COMPRESS_NAME = "rpcCompressed";
static final String TIMEOUT_ARGS = "timeout"; static final String TIMEOUT_ARGS = "timeout";
private static final String TIMEOUT_NAME = "queryTimeout"; private static final String TIMEOUT_NAME = "queryTimeout";
static final String SET_MAX_DISPLAY_NUM = "set max_display_num";
static final String SET_TIMESTAMP_DISPLAY = "set time_display_type"; static final String SET_TIMESTAMP_DISPLAY = "set time_display_type";
static final String SHOW_TIMESTAMP_DISPLAY = "show time_display_type"; static final String SHOW_TIMESTAMP_DISPLAY = "show time_display_type";
static final String SET_TIME_ZONE = "set time_zone"; static final String SET_TIME_ZONE = "set time_zone";
...@@ -135,7 +132,6 @@ public abstract class AbstractCli { ...@@ -135,7 +132,6 @@ public abstract class AbstractCli {
keywordSet.add("-" + USERNAME_ARGS); keywordSet.add("-" + USERNAME_ARGS);
keywordSet.add("-" + EXECUTE_ARGS); keywordSet.add("-" + EXECUTE_ARGS);
keywordSet.add("-" + ISO8601_ARGS); keywordSet.add("-" + ISO8601_ARGS);
keywordSet.add("-" + MAX_PRINT_ROW_COUNT_ARGS);
keywordSet.add("-" + RPC_COMPRESS_ARGS); keywordSet.add("-" + RPC_COMPRESS_ARGS);
} }
...@@ -186,14 +182,6 @@ public abstract class AbstractCli { ...@@ -186,14 +182,6 @@ public abstract class AbstractCli {
.build(); .build();
options.addOption(execute); options.addOption(execute);
Option maxPrintCount =
Option.builder(MAX_PRINT_ROW_COUNT_ARGS)
.argName(MAX_PRINT_ROW_COUNT_NAME)
.hasArg()
.desc("Maximum number of rows displayed (optional)")
.build();
options.addOption(maxPrintCount);
Option isRpcCompressed = Option isRpcCompressed =
Option.builder(RPC_COMPRESS_ARGS) Option.builder(RPC_COMPRESS_ARGS)
.argName(RPC_COMPRESS_NAME) .argName(RPC_COMPRESS_NAME)
...@@ -261,17 +249,6 @@ public abstract class AbstractCli { ...@@ -261,17 +249,6 @@ public abstract class AbstractCli {
return CODE_OK; return CODE_OK;
} }
static void setMaxDisplayNumber(String maxDisplayNum) {
long tmp = Long.parseLong(maxDisplayNum.trim());
if (tmp > Integer.MAX_VALUE) {
throw new NumberFormatException();
} else if (tmp <= 0) {
continuePrint = true;
} else {
maxPrintRowCount = Integer.parseInt(maxDisplayNum.trim());
}
}
static void setQueryTimeout(String timeoutString) { static void setQueryTimeout(String timeoutString) {
long timeout = Long.parseLong(timeoutString.trim()); long timeout = Long.parseLong(timeoutString.trim());
if (timeout > Integer.MAX_VALUE || timeout < 0) { if (timeout > Integer.MAX_VALUE || timeout < 0) {
...@@ -389,11 +366,6 @@ public abstract class AbstractCli { ...@@ -389,11 +366,6 @@ public abstract class AbstractCli {
return OperationResult.CONTINUE_OPER; return OperationResult.CONTINUE_OPER;
} }
if (specialCmd.startsWith(SET_MAX_DISPLAY_NUM)) {
lastProcessStatus = setMaxDisplayNum(specialCmd, cmd);
return OperationResult.CONTINUE_OPER;
}
if (specialCmd.startsWith(SHOW_TIMEZONE)) { if (specialCmd.startsWith(SHOW_TIMEZONE)) {
lastProcessStatus = showTimeZone(connection); lastProcessStatus = showTimeZone(connection);
return OperationResult.CONTINUE_OPER; return OperationResult.CONTINUE_OPER;
...@@ -431,10 +403,6 @@ public abstract class AbstractCli { ...@@ -431,10 +403,6 @@ public abstract class AbstractCli {
String.format( String.format(
" %s=xxx\t\t set fetch size when querying data from server.", SET_FETCH_SIZE)); " %s=xxx\t\t set fetch size when querying data from server.", SET_FETCH_SIZE));
println(String.format(" %s\t\t show fetch size", SHOW_FETCH_SIZE)); println(String.format(" %s\t\t show fetch size", SHOW_FETCH_SIZE));
println(
String.format(
" %s=xxx\t eg. set max lines for cli to ouput, -1 equals to unlimited.",
SET_MAX_DISPLAY_NUM));
} }
private static int setTimestampDisplay(String specialCmd, String cmd) { private static int setTimestampDisplay(String specialCmd, String cmd) {
...@@ -480,25 +448,6 @@ public abstract class AbstractCli { ...@@ -480,25 +448,6 @@ public abstract class AbstractCli {
return CODE_OK; return CODE_OK;
} }
private static int setMaxDisplayNum(String specialCmd, String cmd) {
String[] values = specialCmd.split("=");
if (values.length != 2) {
println(
String.format(
"Max display number format error, please input like %s = 10000",
SET_MAX_DISPLAY_NUM));
return CODE_ERROR;
}
try {
setMaxDisplayNumber(cmd.split("=")[1]);
} catch (Exception e) {
println(String.format("Max display number format error, %s", e.getMessage()));
return CODE_ERROR;
}
println("Max display number has set to " + values[1].trim());
return CODE_OK;
}
private static int showTimeZone(IoTDBConnection connection) { private static int showTimeZone(IoTDBConnection connection) {
try { try {
println("Current time zone: " + connection.getTimeZone()); println("Current time zone: " + connection.getTimeZone());
...@@ -558,10 +507,7 @@ public abstract class AbstractCli { ...@@ -558,10 +507,7 @@ public abstract class AbstractCli {
output(lists, maxSizeList); output(lists, maxSizeList);
continue; continue;
} }
println( println("This display 1000 rows. Press ENTER to show more, input 'q' to quit.");
String.format(
"Reach the max_display_num = %s. Press ENTER to show more, input 'q' to quit.",
maxPrintRowCount));
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try { try {
if ("".equals(br.readLine())) { if ("".equals(br.readLine())) {
......
...@@ -108,9 +108,6 @@ public class Cli extends AbstractCli { ...@@ -108,9 +108,6 @@ public class Cli extends AbstractCli {
if (commandLine.hasOption(ISO8601_ARGS)) { if (commandLine.hasOption(ISO8601_ARGS)) {
timeFormat = RpcUtils.setTimeFormat("long"); timeFormat = RpcUtils.setTimeFormat("long");
} }
if (commandLine.hasOption(MAX_PRINT_ROW_COUNT_ARGS)) {
setMaxDisplayNumber(commandLine.getOptionValue(MAX_PRINT_ROW_COUNT_ARGS));
}
if (commandLine.hasOption(TIMEOUT_ARGS)) { if (commandLine.hasOption(TIMEOUT_ARGS)) {
setQueryTimeout(commandLine.getOptionValue(TIMEOUT_ARGS)); setQueryTimeout(commandLine.getOptionValue(TIMEOUT_ARGS));
} }
......
...@@ -67,7 +67,6 @@ public class AbstractCliIT { ...@@ -67,7 +67,6 @@ public class AbstractCliIT {
AbstractCli.PW_ARGS, AbstractCli.PW_ARGS,
AbstractCli.USERNAME_ARGS, AbstractCli.USERNAME_ARGS,
AbstractCli.ISO8601_ARGS, AbstractCli.ISO8601_ARGS,
AbstractCli.MAX_PRINT_ROW_COUNT_ARGS,
}; };
for (String keyword : keywords) { for (String keyword : keywords) {
if (!AbstractCli.keywordSet.contains("-" + keyword)) { if (!AbstractCli.keywordSet.contains("-" + keyword)) {
...@@ -168,20 +167,6 @@ public class AbstractCliIT { ...@@ -168,20 +167,6 @@ public class AbstractCliIT {
AbstractCli.handleInputCmd( AbstractCli.handleInputCmd(
String.format("%s=default", AbstractCli.SET_TIMESTAMP_DISPLAY), connection)); String.format("%s=default", AbstractCli.SET_TIMESTAMP_DISPLAY), connection));
assertEquals(
OperationResult.CONTINUE_OPER,
AbstractCli.handleInputCmd(
String.format("%s=", AbstractCli.SET_MAX_DISPLAY_NUM), connection));
assertEquals(
OperationResult.CONTINUE_OPER,
AbstractCli.handleInputCmd(
String.format("%s=xxx", AbstractCli.SET_MAX_DISPLAY_NUM), connection));
assertEquals(
OperationResult.CONTINUE_OPER,
AbstractCli.handleInputCmd(
String.format("%s=1", AbstractCli.SET_MAX_DISPLAY_NUM), connection));
testSetMaxDisplayNumber();
assertEquals( assertEquals(
OperationResult.CONTINUE_OPER, OperationResult.CONTINUE_OPER,
AbstractCli.handleInputCmd(AbstractCli.SHOW_TIMEZONE, connection)); AbstractCli.handleInputCmd(AbstractCli.SHOW_TIMEZONE, connection));
...@@ -209,28 +194,4 @@ public class AbstractCliIT { ...@@ -209,28 +194,4 @@ public class AbstractCliIT {
AbstractCli.handleInputCmd( AbstractCli.handleInputCmd(
String.format("%s=111", AbstractCli.SET_FETCH_SIZE), connection)); String.format("%s=111", AbstractCli.SET_FETCH_SIZE), connection));
} }
private void testSetMaxDisplayNumber() {
try {
AbstractCli.setMaxDisplayNumber("10");
} catch (NumberFormatException e) {
fail();
}
try {
AbstractCli.setMaxDisplayNumber("111111111111111");
fail();
} catch (NumberFormatException ignored) {
}
try {
AbstractCli.setMaxDisplayNumber("-10");
} catch (NumberFormatException ignored) {
}
try {
AbstractCli.setMaxDisplayNumber("0");
} catch (NumberFormatException ignored) {
}
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册