Remove unnecessary dependencies
diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc
index 28c8795..897ac5c 100644
--- a/test/cpp/util/grpc_cli.cc
+++ b/test/cpp/util/grpc_cli.cc
@@ -33,19 +33,24 @@
/*
A command line tool to talk to a grpc server.
+ Run `grpc_cli help` command to see its usage information.
+
Example of talking to grpc interop server:
- grpc_cli call localhost:50051 UnaryCall src/proto/grpc/testing/test.proto \
- "response_size:10" --enable_ssl=false
+ grpc_cli call localhost:50051 UnaryCall "response_size:10" \
+ --protofiles=src/proto/grpc/testing/test.proto --enable_ssl=false
Options:
- 1. --proto_path, if your proto file is not under current working directory,
+ 1. --protofiles, use this flag to provide a proto file if the server does
+ does not have the reflection service.
+ 2. --proto_path, if your proto file is not under current working directory,
use this flag to provide a search root. It should work similar to the
- counterpart in protoc.
- 2. --metadata specifies metadata to be sent to the server, such as:
+ counterpart in protoc. This option is valid only when protofiles is
+ provided.
+ 3. --metadata specifies metadata to be sent to the server, such as:
--metadata="MyHeaderKey1:Value1:MyHeaderKey2:Value2"
- 3. --enable_ssl, whether to use tls.
- 4. --use_auth, if set to true, attach a GoogleDefaultCredentials to the call
- 3. --input_binary_file, a file containing the serialized request. The file
+ 4. --enable_ssl, whether to use tls.
+ 5. --use_auth, if set to true, attach a GoogleDefaultCredentials to the call
+ 6. --input_binary_file, a file containing the serialized request. The file
can be generated by calling something like:
protoc --proto_path=src/proto/grpc/testing/ \
--encode=grpc.testing.SimpleRequest \
@@ -53,7 +58,7 @@
< input.txt > input.bin
If this is used and no proto file is provided in the argument list, the
method string has to be exact in the form of /package.service/method.
- 4. --output_binary_file, a file to write binary format response into, it can
+ 7. --output_binary_file, a file to write binary format response into, it can
be later decoded using protoc:
protoc --proto_path=src/proto/grpc/testing/ \
--decode=grpc.testing.SimpleResponse \
diff --git a/test/cpp/util/grpc_tool.cc b/test/cpp/util/grpc_tool.cc
index 38ac9e5..5b3f565 100644
--- a/test/cpp/util/grpc_tool.cc
+++ b/test/cpp/util/grpc_tool.cc
@@ -31,7 +31,7 @@
*
*/
-#include "grpc_tool.h"
+#include "test/cpp/util/grpc_tool.h"
#include <unistd.h>
#include <fstream>
@@ -47,7 +47,6 @@
#include <grpc++/security/credentials.h>
#include <grpc++/support/string_ref.h>
#include <grpc/grpc.h>
-#include <grpc/support/log.h>
#include "test/cpp/util/cli_call.h"
#include "test/cpp/util/proto_file_parser.h"
@@ -75,8 +74,8 @@
public:
explicit GrpcTool();
virtual ~GrpcTool() {}
- bool Help(int argc, const char** argv, OutputCallback callback);
- bool CallMethod(int argc, const char** argv, OutputCallback callback);
+ bool Help(int argc, const char** argv, GrpcToolOutputCallback callback);
+ bool CallMethod(int argc, const char** argv, GrpcToolOutputCallback callback);
void SetPrintCommandMode(int exit_status) {
print_command_usage_ = true;
usage_exit_status_ = exit_status;
@@ -89,8 +88,8 @@
};
template <typename T>
-std::function<bool(GrpcTool*, int, const char**, OutputCallback)> BindWith4Args(
- T&& func) {
+std::function<bool(GrpcTool*, int, const char**, GrpcToolOutputCallback)>
+BindWith4Args(T&& func) {
return std::bind(std::forward<T>(func), std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3,
std::placeholders::_4);
@@ -143,7 +142,8 @@
struct Command {
const char* command;
- std::function<bool(GrpcTool*, int, const char**, OutputCallback)> function;
+ std::function<bool(GrpcTool*, int, const char**, GrpcToolOutputCallback)>
+ function;
int min_args;
int max_args;
};
@@ -186,7 +186,8 @@
}
} // namespace
-int GrpcToolMainLib(int argc, const char** argv, OutputCallback callback) {
+int GrpcToolMainLib(int argc, const char** argv,
+ GrpcToolOutputCallback callback) {
if (argc < 2) {
Usage("No command specified");
}
@@ -222,7 +223,8 @@
}
}
-bool GrpcTool::Help(int argc, const char** argv, OutputCallback callback) {
+bool GrpcTool::Help(int argc, const char** argv,
+ GrpcToolOutputCallback callback) {
CommandUsage(
"Print help\n"
" grpc_cli help [subcommand]\n");
@@ -241,7 +243,7 @@
}
bool GrpcTool::CallMethod(int argc, const char** argv,
- OutputCallback callback) {
+ GrpcToolOutputCallback callback) {
CommandUsage(
"Call method\n"
" grpc_cli call <address> <service>[.<method>] <request>\n"
diff --git a/test/cpp/util/grpc_tool.h b/test/cpp/util/grpc_tool.h
index d779737..9e61abf 100644
--- a/test/cpp/util/grpc_tool.h
+++ b/test/cpp/util/grpc_tool.h
@@ -31,17 +31,16 @@
*
*/
+#include <grpc++/support/config.h>
#include <functional>
-#include <string>
-
-#include <gflags/gflags.h>
namespace grpc {
namespace testing {
-typedef std::function<bool(const std::string &)> OutputCallback;
+typedef std::function<bool(const grpc::string &)> GrpcToolOutputCallback;
-int GrpcToolMainLib(int argc, const char **argv, OutputCallback callback);
+int GrpcToolMainLib(int argc, const char **argv,
+ GrpcToolOutputCallback callback);
} // namespace testing
} // namespace grpc