mirror of https://github.com/grpc/grpc.git
parent
da9af3331c
commit
29ca79be89
13 changed files with 1332 additions and 184 deletions
@ -0,0 +1,369 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2016, Google Inc. |
||||
* All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are |
||||
* met: |
||||
* |
||||
* * Redistributions of source code must retain the above copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* * Redistributions in binary form must reproduce the above |
||||
* copyright notice, this list of conditions and the following disclaimer |
||||
* in the documentation and/or other materials provided with the |
||||
* distribution. |
||||
* * Neither the name of Google Inc. nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
*/ |
||||
|
||||
#include "grpc_tool.h" |
||||
|
||||
#include <unistd.h> |
||||
#include <fstream> |
||||
#include <iostream> |
||||
#include <memory> |
||||
#include <sstream> |
||||
#include <string> |
||||
|
||||
#include <gflags/gflags.h> |
||||
#include <grpc++/channel.h> |
||||
#include <grpc++/create_channel.h> |
||||
#include <grpc++/grpc++.h> |
||||
#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" |
||||
#include "test/cpp/util/proto_reflection_descriptor_database.h" |
||||
#include "test/cpp/util/string_ref_helper.h" |
||||
#include "test/cpp/util/test_config.h" |
||||
|
||||
DEFINE_bool(enable_ssl, false, "Whether to use ssl/tls."); |
||||
DEFINE_bool(use_auth, false, "Whether to create default google credentials."); |
||||
DEFINE_string(input_binary_file, "", |
||||
"Path to input file containing serialized request."); |
||||
DEFINE_string(output_binary_file, "", |
||||
"Path to output file to write serialized response."); |
||||
DEFINE_string(metadata, "", |
||||
"Metadata to send to server, in the form of key1:val1:key2:val2"); |
||||
DEFINE_string(proto_path, ".", "Path to look for the proto file."); |
||||
// TODO(zyc): support a list of input proto files
|
||||
DEFINE_string(protofiles, "", "Name of the proto file."); |
||||
|
||||
namespace grpc { |
||||
namespace testing { |
||||
namespace { |
||||
|
||||
class GrpcTool { |
||||
public: |
||||
explicit GrpcTool(); |
||||
virtual ~GrpcTool() {} |
||||
bool Help(int argc, const char** argv, OutputCallback callback); |
||||
bool CallMethod(int argc, const char** argv, OutputCallback callback); |
||||
void SetPrintCommandMode(int exit_status) { |
||||
print_command_usage_ = true; |
||||
usage_exit_status_ = exit_status; |
||||
} |
||||
|
||||
private: |
||||
void CommandUsage(const grpc::string& usage) const; |
||||
bool print_command_usage_; |
||||
int usage_exit_status_; |
||||
}; |
||||
|
||||
template <typename T> |
||||
std::function<bool(GrpcTool*, int, const char**, OutputCallback)> BindWith4Args( |
||||
T&& func) { |
||||
return std::bind(std::forward<T>(func), std::placeholders::_1, |
||||
std::placeholders::_2, std::placeholders::_3, |
||||
std::placeholders::_4); |
||||
} |
||||
|
||||
template <typename T> |
||||
size_t ArraySize(T& a) { |
||||
return ((sizeof(a) / sizeof(*(a))) / |
||||
static_cast<size_t>(!(sizeof(a) % sizeof(*(a))))); |
||||
} |
||||
|
||||
void ParseMetadataFlag( |
||||
std::multimap<grpc::string, grpc::string>* client_metadata) { |
||||
if (FLAGS_metadata.empty()) { |
||||
return; |
||||
} |
||||
std::vector<grpc::string> fields; |
||||
const char* delim = ":"; |
||||
size_t cur, next = -1; |
||||
do { |
||||
cur = next + 1; |
||||
next = FLAGS_metadata.find_first_of(delim, cur); |
||||
fields.push_back(FLAGS_metadata.substr(cur, next - cur)); |
||||
} while (next != grpc::string::npos); |
||||
if (fields.size() % 2) { |
||||
fprintf(stderr, "Failed to parse metadata flag.\n"); |
||||
exit(1); |
||||
} |
||||
for (size_t i = 0; i < fields.size(); i += 2) { |
||||
client_metadata->insert( |
||||
std::pair<grpc::string, grpc::string>(fields[i], fields[i + 1])); |
||||
} |
||||
} |
||||
|
||||
template <typename T> |
||||
void PrintMetadata(const T& m, const grpc::string& message) { |
||||
if (m.empty()) { |
||||
return; |
||||
} |
||||
fprintf(stderr, "%s\n", message.c_str()); |
||||
grpc::string pair; |
||||
for (typename T::const_iterator iter = m.begin(); iter != m.end(); ++iter) { |
||||
pair.clear(); |
||||
pair.append(iter->first.data(), iter->first.size()); |
||||
pair.append(" : "); |
||||
pair.append(iter->second.data(), iter->second.size()); |
||||
fprintf(stderr, "%s\n", pair.c_str()); |
||||
} |
||||
} |
||||
|
||||
struct Command { |
||||
const char* command; |
||||
std::function<bool(GrpcTool*, int, const char**, OutputCallback)> function; |
||||
int min_args; |
||||
int max_args; |
||||
}; |
||||
|
||||
const Command ops[] = { |
||||
{"help", BindWith4Args(&GrpcTool::Help), 0, INT_MAX}, |
||||
// {"ls", BindWith4Args(&GrpcTool::ListServices), 1, 3},
|
||||
// {"list", BindWith4Args(&GrpcTool::ListServices), 1, 3},
|
||||
{"call", BindWith4Args(&GrpcTool::CallMethod), 2, 3}, |
||||
// {"type", BindWith4Args(&GrpcTool::PrintType), 2, 2},
|
||||
// {"parse", BindWith4Args(&GrpcTool::ParseMessage), 2, 3},
|
||||
// {"totext", BindWith4Args(&GrpcTool::ToText), 2, 3},
|
||||
// {"tobinary", BindWith4Args(&GrpcTool::ToBinary), 2, 3},
|
||||
}; |
||||
|
||||
void Usage(const grpc::string& msg) { |
||||
fprintf( |
||||
stderr, |
||||
"%s\n" |
||||
// " grpc_cli ls ... ; List services\n"
|
||||
" grpc_cli call ... ; Call method\n" |
||||
// " grpc_cli type ... ; Print type\n"
|
||||
// " grpc_cli parse ... ; Parse message\n"
|
||||
// " grpc_cli totext ... ; Convert binary message to text\n"
|
||||
// " grpc_cli tobinary ... ; Convert text message to binary\n"
|
||||
" grpc_cli help ... ; Print this message, or per-command usage\n" |
||||
"\n", |
||||
msg.c_str()); |
||||
|
||||
exit(1); |
||||
} |
||||
|
||||
const Command* FindCommand(const grpc::string& name) { |
||||
for (int i = 0; i < (int)ArraySize(ops); i++) { |
||||
if (name == ops[i].command) { |
||||
return &ops[i]; |
||||
} |
||||
} |
||||
return NULL; |
||||
} |
||||
} // namespace
|
||||
|
||||
int GrpcToolMainLib(int argc, const char** argv, OutputCallback callback) { |
||||
if (argc < 2) { |
||||
Usage("No command specified"); |
||||
} |
||||
|
||||
grpc::string command = argv[1]; |
||||
argc -= 2; |
||||
argv += 2; |
||||
|
||||
const Command* cmd = FindCommand(command); |
||||
if (cmd != NULL) { |
||||
GrpcTool grpc_tool; |
||||
if (argc < cmd->min_args || argc > cmd->max_args) { |
||||
// Force the command to print its usage message
|
||||
fprintf(stderr, "\nWrong number of arguments for %s\n", command.c_str()); |
||||
grpc_tool.SetPrintCommandMode(1); |
||||
return cmd->function(&grpc_tool, -1, NULL, callback); |
||||
} |
||||
const bool ok = cmd->function(&grpc_tool, argc, argv, callback); |
||||
return ok ? 0 : 1; |
||||
} else { |
||||
Usage("Invalid command '" + grpc::string(command.c_str()) + "'"); |
||||
} |
||||
return 1; |
||||
} |
||||
|
||||
GrpcTool::GrpcTool() : print_command_usage_(false), usage_exit_status_(0) {} |
||||
|
||||
void GrpcTool::CommandUsage(const grpc::string& usage) const { |
||||
if (print_command_usage_) { |
||||
fprintf(stderr, "\n%s%s\n", usage.c_str(), |
||||
(usage.empty() || usage[usage.size() - 1] != '\n') ? "\n" : ""); |
||||
exit(usage_exit_status_); |
||||
} |
||||
} |
||||
|
||||
bool GrpcTool::Help(int argc, const char** argv, OutputCallback callback) { |
||||
CommandUsage( |
||||
"Print help\n" |
||||
" grpc_cli help [subcommand]\n"); |
||||
|
||||
if (argc == 0) { |
||||
Usage(""); |
||||
} else { |
||||
const Command* cmd = FindCommand(argv[0]); |
||||
if (cmd == NULL) { |
||||
Usage("Unknown command '" + grpc::string(argv[0]) + "'"); |
||||
} |
||||
SetPrintCommandMode(0); |
||||
cmd->function(this, -1, NULL, callback); |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
bool GrpcTool::CallMethod(int argc, const char** argv, |
||||
OutputCallback callback) { |
||||
CommandUsage( |
||||
"Call method\n" |
||||
" grpc_cli call <address> <service>[.<method>] <request>\n" |
||||
" <address> ; host:port\n" |
||||
" <service> ; Exported service name\n" |
||||
" <method> ; Method name\n" |
||||
" <request> ; Text protobuffer (overrides infile)\n" |
||||
" --protofiles ; Comma separated proto files used as a" |
||||
" fallback when parsing request/response\n" |
||||
" --proto_path ; The search path of proto files, valid" |
||||
" only when --protofiles is given\n" |
||||
" --metadata ; The metadata to be sent to the server\n" |
||||
" --enable_ssl ; Set whether to use tls\n" |
||||
" --use_auth ; Set whether to create default google" |
||||
" credentials\n" |
||||
" --outfile ; Output filename (defaults to stdout)\n" |
||||
" --input_binary_file ; Path to input file in binary format\n" |
||||
" --binary_output ; Path to output file in binary format\n"); |
||||
|
||||
std::stringstream output_ss; |
||||
grpc::string request_text; |
||||
grpc::string server_address(argv[0]); |
||||
grpc::string method_name(argv[1]); |
||||
std::unique_ptr<grpc::testing::ProtoFileParser> parser; |
||||
grpc::string serialized_request_proto; |
||||
|
||||
if (argc == 3) { |
||||
request_text = argv[2]; |
||||
} |
||||
|
||||
std::shared_ptr<grpc::ChannelCredentials> creds; |
||||
if (!FLAGS_enable_ssl) { |
||||
creds = grpc::InsecureChannelCredentials(); |
||||
} else { |
||||
if (FLAGS_use_auth) { |
||||
creds = grpc::GoogleDefaultCredentials(); |
||||
} else { |
||||
creds = grpc::SslCredentials(grpc::SslCredentialsOptions()); |
||||
} |
||||
} |
||||
std::shared_ptr<grpc::Channel> channel = |
||||
grpc::CreateChannel(server_address, creds); |
||||
|
||||
if (request_text.empty() && FLAGS_input_binary_file.empty()) { |
||||
if (isatty(STDIN_FILENO)) { |
||||
std::cout << "reading request message from stdin..." << std::endl; |
||||
} |
||||
std::stringstream input_stream; |
||||
input_stream << std::cin.rdbuf(); |
||||
request_text = input_stream.str(); |
||||
} |
||||
|
||||
if (!request_text.empty()) { |
||||
if (!FLAGS_protofiles.empty()) { |
||||
parser.reset(new grpc::testing::ProtoFileParser( |
||||
FLAGS_proto_path, FLAGS_protofiles, method_name)); |
||||
} else { |
||||
parser.reset(new grpc::testing::ProtoFileParser(channel, method_name)); |
||||
} |
||||
method_name = parser->GetFullMethodName(); |
||||
if (parser->HasError()) { |
||||
return 1; |
||||
} |
||||
|
||||
if (!FLAGS_input_binary_file.empty()) { |
||||
std::cout |
||||
<< "warning: request given in argv, ignoring --input_binary_file" |
||||
<< std::endl; |
||||
} |
||||
} |
||||
|
||||
if (parser) { |
||||
serialized_request_proto = |
||||
parser->GetSerializedProto(request_text, true /* is_request */); |
||||
if (parser->HasError()) { |
||||
return 1; |
||||
} |
||||
} else if (!FLAGS_input_binary_file.empty()) { |
||||
std::ifstream input_file(FLAGS_input_binary_file, |
||||
std::ios::in | std::ios::binary); |
||||
std::stringstream input_stream; |
||||
input_stream << input_file.rdbuf(); |
||||
serialized_request_proto = input_stream.str(); |
||||
} |
||||
std::cout << "connecting to " << server_address << std::endl; |
||||
|
||||
grpc::string serialized_response_proto; |
||||
std::multimap<grpc::string, grpc::string> client_metadata; |
||||
std::multimap<grpc::string_ref, grpc::string_ref> server_initial_metadata, |
||||
server_trailing_metadata; |
||||
ParseMetadataFlag(&client_metadata); |
||||
PrintMetadata(client_metadata, "Sending client initial metadata:"); |
||||
grpc::Status s = grpc::testing::CliCall::Call( |
||||
channel, method_name, serialized_request_proto, |
||||
&serialized_response_proto, client_metadata, &server_initial_metadata, |
||||
&server_trailing_metadata); |
||||
PrintMetadata(server_initial_metadata, |
||||
"Received initial metadata from server:"); |
||||
PrintMetadata(server_trailing_metadata, |
||||
"Received trailing metadata from server:"); |
||||
if (s.ok()) { |
||||
std::cout << "Rpc succeeded with OK status" << std::endl; |
||||
if (parser) { |
||||
grpc::string response_text = parser->GetTextFormat( |
||||
serialized_response_proto, false /* is_request */); |
||||
if (parser->HasError()) { |
||||
return false; |
||||
} |
||||
output_ss << "Response: \n " << response_text << std::endl; |
||||
} |
||||
if (!FLAGS_output_binary_file.empty()) { |
||||
std::ofstream output_file(FLAGS_output_binary_file, |
||||
std::ios::trunc | std::ios::binary); |
||||
output_file << serialized_response_proto; |
||||
} |
||||
} else { |
||||
std::cout << "Rpc failed with status code " << s.error_code() |
||||
<< ", error message: " << s.error_message() << std::endl; |
||||
} |
||||
|
||||
return callback(output_ss.str()); |
||||
} |
||||
|
||||
} // namespace testing
|
||||
} // namespace grpc
|
@ -0,0 +1,47 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2016, Google Inc. |
||||
* All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are |
||||
* met: |
||||
* |
||||
* * Redistributions of source code must retain the above copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* * Redistributions in binary form must reproduce the above |
||||
* copyright notice, this list of conditions and the following disclaimer |
||||
* in the documentation and/or other materials provided with the |
||||
* distribution. |
||||
* * Neither the name of Google Inc. nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
*/ |
||||
|
||||
#include <functional> |
||||
#include <string> |
||||
|
||||
#include <gflags/gflags.h> |
||||
|
||||
namespace grpc { |
||||
namespace testing { |
||||
|
||||
typedef std::function<bool(const std::string &)> OutputCallback; |
||||
|
||||
int GrpcToolMainLib(int argc, const char **argv, OutputCallback callback); |
||||
|
||||
} // namespace testing
|
||||
} // namespace grpc
|
@ -0,0 +1,219 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2015, Google Inc. |
||||
* All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are |
||||
* met: |
||||
* |
||||
* * Redistributions of source code must retain the above copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* * Redistributions in binary form must reproduce the above |
||||
* copyright notice, this list of conditions and the following disclaimer |
||||
* in the documentation and/or other materials provided with the |
||||
* distribution. |
||||
* * Neither the name of Google Inc. nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
* |
||||
*/ |
||||
|
||||
#include "test/cpp/util/grpc_tool.h" |
||||
|
||||
#include <sstream> |
||||
|
||||
#include <grpc++/channel.h> |
||||
#include <grpc++/client_context.h> |
||||
#include <grpc++/create_channel.h> |
||||
#include <grpc++/ext/proto_server_reflection_plugin.h> |
||||
#include <grpc++/server.h> |
||||
#include <grpc++/server_builder.h> |
||||
#include <grpc++/server_context.h> |
||||
#include <grpc/grpc.h> |
||||
#include <gtest/gtest.h> |
||||
|
||||
#include "src/proto/grpc/testing/echo.grpc.pb.h" |
||||
#include "src/proto/grpc/testing/echo.pb.h" |
||||
#include "test/core/util/port.h" |
||||
#include "test/core/util/test_config.h" |
||||
#include "test/cpp/util/string_ref_helper.h" |
||||
|
||||
using grpc::testing::EchoRequest; |
||||
using grpc::testing::EchoResponse; |
||||
|
||||
namespace grpc { |
||||
namespace testing { |
||||
|
||||
class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { |
||||
public: |
||||
Status Echo(ServerContext* context, const EchoRequest* request, |
||||
EchoResponse* response) GRPC_OVERRIDE { |
||||
if (!context->client_metadata().empty()) { |
||||
for (std::multimap<grpc::string_ref, grpc::string_ref>::const_iterator |
||||
iter = context->client_metadata().begin(); |
||||
iter != context->client_metadata().end(); ++iter) { |
||||
context->AddInitialMetadata(ToString(iter->first), |
||||
ToString(iter->second)); |
||||
} |
||||
} |
||||
context->AddTrailingMetadata("trailing_key", "trailing_value"); |
||||
response->set_message(request->message()); |
||||
return Status::OK; |
||||
} |
||||
}; |
||||
|
||||
class GrpcToolTest : public ::testing::Test { |
||||
protected: |
||||
GrpcToolTest() {} |
||||
|
||||
void SetUp() GRPC_OVERRIDE { |
||||
int port = grpc_pick_unused_port_or_die(); |
||||
server_address_ << "localhost:" << port; |
||||
// Setup server
|
||||
ServerBuilder builder; |
||||
builder.AddListeningPort(server_address_.str(), |
||||
InsecureServerCredentials()); |
||||
builder.RegisterService(&service_); |
||||
server_ = builder.BuildAndStart(); |
||||
} |
||||
|
||||
void TearDown() GRPC_OVERRIDE { server_->Shutdown(); } |
||||
|
||||
void ResetStub() { |
||||
channel_ = |
||||
CreateChannel(server_address_.str(), InsecureChannelCredentials()); |
||||
stub_ = grpc::testing::EchoTestService::NewStub(channel_); |
||||
} |
||||
|
||||
std::shared_ptr<Channel> channel_; |
||||
std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_; |
||||
std::unique_ptr<Server> server_; |
||||
std::ostringstream server_address_; |
||||
TestServiceImpl service_; |
||||
reflection::ProtoServerReflectionPlugin plugin_; |
||||
}; |
||||
|
||||
static bool PrintStream(std::stringstream* ss, const grpc::string& output) { |
||||
(*ss) << output << std::endl; |
||||
return true; |
||||
} |
||||
|
||||
template <typename T> |
||||
static size_t ArraySize(T& a) { |
||||
return ((sizeof(a) / sizeof(*(a))) / |
||||
static_cast<size_t>(!(sizeof(a) % sizeof(*(a))))); |
||||
} |
||||
|
||||
#define USAGE_REGEX "( grpc_cli .+\n){2,10}" |
||||
|
||||
TEST_F(GrpcToolTest, NoCommand) { |
||||
// Test input "grpc_cli"
|
||||
std::stringstream output_stream; |
||||
const char* argv[] = {"grpc_cli"}; |
||||
// Exit with 1, print usage instruction in stderr
|
||||
EXPECT_EXIT( |
||||
GrpcToolMainLib( |
||||
ArraySize(argv), argv, |
||||
std::bind(PrintStream, &output_stream, std::placeholders::_1)), |
||||
::testing::ExitedWithCode(1), "No command specified\n" USAGE_REGEX); |
||||
// No output
|
||||
EXPECT_TRUE(0 == output_stream.tellp()); |
||||
} |
||||
|
||||
TEST_F(GrpcToolTest, InvalidCommand) { |
||||
// Test input "grpc_cli"
|
||||
std::stringstream output_stream; |
||||
const char* argv[] = {"grpc_cli", "abc"}; |
||||
// Exit with 1, print usage instruction in stderr
|
||||
EXPECT_EXIT( |
||||
GrpcToolMainLib( |
||||
ArraySize(argv), argv, |
||||
std::bind(PrintStream, &output_stream, std::placeholders::_1)), |
||||
::testing::ExitedWithCode(1), "Invalid command 'abc'\n" USAGE_REGEX); |
||||
// No output
|
||||
EXPECT_TRUE(0 == output_stream.tellp()); |
||||
} |
||||
|
||||
TEST_F(GrpcToolTest, HelpCommand) { |
||||
// Test input "grpc_cli help"
|
||||
std::stringstream output_stream; |
||||
const char* argv[] = {"grpc_cli", "help"}; |
||||
// Exit with 1, print usage instruction in stderr
|
||||
EXPECT_EXIT(GrpcToolMainLib(ArraySize(argv), argv, |
||||
std::bind(PrintStream, &output_stream, |
||||
std::placeholders::_1)), |
||||
::testing::ExitedWithCode(1), USAGE_REGEX); |
||||
// No output
|
||||
EXPECT_TRUE(0 == output_stream.tellp()); |
||||
} |
||||
|
||||
TEST_F(GrpcToolTest, CallCommand) { |
||||
// Test input "grpc_cli call Echo"
|
||||
std::stringstream output_stream; |
||||
grpc::string server_address = server_address_.str(); |
||||
const char* argv[] = {"grpc_cli", "call", server_address.c_str(), "Echo", |
||||
"message: 'Hello'"}; |
||||
|
||||
EXPECT_TRUE(0 == GrpcToolMainLib(ArraySize(argv), argv, |
||||
std::bind(PrintStream, &output_stream, |
||||
std::placeholders::_1))); |
||||
// Expected output: "message: \"Hello\""
|
||||
EXPECT_TRUE(NULL != |
||||
strstr(output_stream.str().c_str(), "message: \"Hello\"")); |
||||
} |
||||
|
||||
TEST_F(GrpcToolTest, TooFewArguments) { |
||||
// Test input "grpc_cli call localhost:<port> Echo "message: 'Hello'"
|
||||
std::stringstream output_stream; |
||||
grpc::string server_address = server_address_.str(); |
||||
const char* argv[] = {"grpc_cli", "call", "Echo"}; |
||||
|
||||
// Exit with 1
|
||||
EXPECT_EXIT( |
||||
GrpcToolMainLib( |
||||
ArraySize(argv), argv, |
||||
std::bind(PrintStream, &output_stream, std::placeholders::_1)), |
||||
::testing::ExitedWithCode(1), ".*Wrong number of arguments for call.*"); |
||||
// No output
|
||||
EXPECT_TRUE(0 == output_stream.tellp()); |
||||
} |
||||
|
||||
TEST_F(GrpcToolTest, TooManyArguments) { |
||||
// Test input "grpc_cli call localhost:<port> Echo Echo "message: 'Hello'"
|
||||
std::stringstream output_stream; |
||||
grpc::string server_address = server_address_.str(); |
||||
const char* argv[] = {"grpc_cli", "call", server_address.c_str(), |
||||
"Echo", "Echo", "message: 'Hello'"}; |
||||
|
||||
// Exit with 1
|
||||
EXPECT_EXIT( |
||||
GrpcToolMainLib( |
||||
ArraySize(argv), argv, |
||||
std::bind(PrintStream, &output_stream, std::placeholders::_1)), |
||||
::testing::ExitedWithCode(1), ".*Wrong number of arguments for call.*"); |
||||
// No output
|
||||
EXPECT_TRUE(0 == output_stream.tellp()); |
||||
} |
||||
|
||||
} // namespace testing
|
||||
} // namespace grpc
|
||||
|
||||
int main(int argc, char** argv) { |
||||
grpc_test_init(argc, argv); |
||||
::testing::InitGoogleTest(&argc, argv); |
||||
::testing::FLAGS_gtest_death_test_style = "threadsafe"; |
||||
return RUN_ALL_TESTS(); |
||||
} |
@ -0,0 +1,286 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\1.0.204.1.props')" /> |
||||
<ItemGroup Label="ProjectConfigurations"> |
||||
<ProjectConfiguration Include="Debug|Win32"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Debug|x64"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|Win32"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|x64"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
</ItemGroup> |
||||
<PropertyGroup Label="Globals"> |
||||
<ProjectGuid>{F00D82D4-E988-6D2F-F0B9-9E82BCC2A2B2}</ProjectGuid> |
||||
<IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected> |
||||
<IntDir>$(SolutionDir)IntDir\$(MSBuildProjectName)\</IntDir> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0'" Label="Configuration"> |
||||
<PlatformToolset>v100</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '11.0'" Label="Configuration"> |
||||
<PlatformToolset>v110</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '12.0'" Label="Configuration"> |
||||
<PlatformToolset>v120</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '14.0'" Label="Configuration"> |
||||
<PlatformToolset>v140</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
<WholeProgramOptimization>true</WholeProgramOptimization> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||
<ImportGroup Label="ExtensionSettings"> |
||||
</ImportGroup> |
||||
<ImportGroup Label="PropertySheets"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\cpptest.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\global.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\openssl.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\protobuf.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\winsock.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\zlib.props" /> |
||||
</ImportGroup> |
||||
<PropertyGroup Label="UserMacros" /> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'"> |
||||
<TargetName>grpc_tool_test</TargetName> |
||||
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> |
||||
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib> |
||||
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> |
||||
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'"> |
||||
<TargetName>grpc_tool_test</TargetName> |
||||
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> |
||||
<Configuration-grpc_dependencies_zlib>Release</Configuration-grpc_dependencies_zlib> |
||||
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> |
||||
<Configuration-grpc_dependencies_openssl>Release</Configuration-grpc_dependencies_openssl> |
||||
</PropertyGroup> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>Disabled</Optimization> |
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>Disabled</Optimization> |
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>MaxSpeed</Optimization> |
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>MaxSpeed</Optimization> |
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemGroup> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\proto_utils.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\async_stream.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\async_unary_call.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\call.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\call_hook.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\channel_interface.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\client_context.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\client_unary_call.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\completion_queue.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\completion_queue_tag.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\config.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\core_codegen_interface.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\create_auth_context.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\grpc_library.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\method_handler_impl.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\rpc_method.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\rpc_service_method.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\security\auth_context.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\serialization_traits.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\server_context.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\server_interface.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\service_type.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\status.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\status_code_enum.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\string_ref.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\stub_options.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\sync.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\sync_cxx11.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\sync_no_cxx11.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\sync_stream.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\time.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\byte_buffer.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\byte_buffer_reader.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\compression_types.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\connectivity_state.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\grpc_types.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\propagation_bits.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\status.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\alloc.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\atm.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\atm_gcc_atomic.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\atm_gcc_sync.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\atm_windows.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\log.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\port_platform.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\slice.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\slice_buffer.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\sync.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\sync_generic.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\sync_posix.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\sync_windows.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\time.h" /> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\config_protobuf.h" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ClInclude Include="$(SolutionDir)\..\test\cpp\util\string_ref_helper.h" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ClCompile Include="$(SolutionDir)\..\src\proto\grpc\testing\echo.pb.cc"> |
||||
</ClCompile> |
||||
<ClInclude Include="$(SolutionDir)\..\src\proto\grpc\testing\echo.pb.h"> |
||||
</ClInclude> |
||||
<ClCompile Include="$(SolutionDir)\..\src\proto\grpc\testing\echo.grpc.pb.cc"> |
||||
</ClCompile> |
||||
<ClInclude Include="$(SolutionDir)\..\src\proto\grpc\testing\echo.grpc.pb.h"> |
||||
</ClInclude> |
||||
<ClCompile Include="$(SolutionDir)\..\src\proto\grpc\testing\echo_messages.pb.cc"> |
||||
</ClCompile> |
||||
<ClInclude Include="$(SolutionDir)\..\src\proto\grpc\testing\echo_messages.pb.h"> |
||||
</ClInclude> |
||||
<ClCompile Include="$(SolutionDir)\..\src\proto\grpc\testing\echo_messages.grpc.pb.cc"> |
||||
</ClCompile> |
||||
<ClInclude Include="$(SolutionDir)\..\src\proto\grpc\testing\echo_messages.grpc.pb.h"> |
||||
</ClInclude> |
||||
<ClCompile Include="$(SolutionDir)\..\test\cpp\util\grpc_tool_test.cc"> |
||||
</ClCompile> |
||||
<ClCompile Include="$(SolutionDir)\..\test\cpp\util\string_ref_helper.cc"> |
||||
</ClCompile> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc_cli_libs\grpc_cli_libs.vcxproj"> |
||||
<Project>{86E35862-43E8-F59E-F906-AFE0348AD3D2}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++_reflection\grpc++_reflection.vcxproj"> |
||||
<Project>{5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc_test_util\grpc_test_util.vcxproj"> |
||||
<Project>{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++\grpc++.vcxproj"> |
||||
<Project>{C187A093-A0FE-489D-A40A-6E33DE0F9FEB}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc\grpc.vcxproj"> |
||||
<Project>{29D16885-7228-4C31-81ED-5F9187C7F2A9}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr_test_util\gpr_test_util.vcxproj"> |
||||
<Project>{EAB0A629-17A9-44DB-B5FF-E91A721FE037}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr\gpr.vcxproj"> |
||||
<Project>{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}</Project> |
||||
</ProjectReference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<None Include="packages.config" /> |
||||
</ItemGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||
<ImportGroup Label="ExtensionTargets"> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" /> |
||||
</ImportGroup> |
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
||||
<PropertyGroup> |
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> |
||||
</PropertyGroup> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" /> |
||||
</Target> |
||||
</Project> |
||||
|
@ -0,0 +1,232 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ItemGroup> |
||||
<ClCompile Include="$(SolutionDir)\..\src\proto\grpc\testing\echo.proto"> |
||||
<Filter>src\proto\grpc\testing</Filter> |
||||
</ClCompile> |
||||
<ClCompile Include="$(SolutionDir)\..\src\proto\grpc\testing\echo_messages.proto"> |
||||
<Filter>src\proto\grpc\testing</Filter> |
||||
</ClCompile> |
||||
<ClCompile Include="$(SolutionDir)\..\test\cpp\util\grpc_tool_test.cc"> |
||||
<Filter>test\cpp\util</Filter> |
||||
</ClCompile> |
||||
<ClCompile Include="$(SolutionDir)\..\test\cpp\util\string_ref_helper.cc"> |
||||
<Filter>test\cpp\util</Filter> |
||||
</ClCompile> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\proto_utils.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\async_stream.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\async_unary_call.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\call.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\call_hook.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\channel_interface.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\client_context.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\client_unary_call.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\completion_queue.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\completion_queue_tag.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\config.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\core_codegen_interface.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\create_auth_context.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\grpc_library.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\method_handler_impl.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\rpc_method.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\rpc_service_method.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\security\auth_context.h"> |
||||
<Filter>include\grpc++\impl\codegen\security</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\serialization_traits.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\server_context.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\server_interface.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\service_type.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\status.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\status_code_enum.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\string_ref.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\stub_options.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\sync.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\sync_cxx11.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\sync_no_cxx11.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\sync_stream.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\time.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\byte_buffer.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\byte_buffer_reader.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\compression_types.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\connectivity_state.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\grpc_types.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\propagation_bits.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\status.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\alloc.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\atm.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\atm_gcc_atomic.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\atm_gcc_sync.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\atm_windows.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\log.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\port_platform.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\slice.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\slice_buffer.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\sync.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\sync_generic.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\sync_posix.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\sync_windows.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\time.h"> |
||||
<Filter>include\grpc\impl\codegen</Filter> |
||||
</ClInclude> |
||||
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\config_protobuf.h"> |
||||
<Filter>include\grpc++\impl\codegen</Filter> |
||||
</ClInclude> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ClInclude Include="$(SolutionDir)\..\test\cpp\util\string_ref_helper.h"> |
||||
<Filter>test\cpp\util</Filter> |
||||
</ClInclude> |
||||
</ItemGroup> |
||||
|
||||
<ItemGroup> |
||||
<Filter Include="include"> |
||||
<UniqueIdentifier>{89fed779-17c5-23da-c8a2-9e868ff34480}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="include\grpc"> |
||||
<UniqueIdentifier>{96e4a1a8-0b91-1a6d-ae4d-ddf33abb93c0}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="include\grpc++"> |
||||
<UniqueIdentifier>{1d9dcc6f-7c1b-cdc3-4c35-73d5968dfd92}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="include\grpc++\impl"> |
||||
<UniqueIdentifier>{5eca7690-973a-c8ed-84d6-5325f8de43ac}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="include\grpc++\impl\codegen"> |
||||
<UniqueIdentifier>{5789073e-5b84-0ec9-af06-47866647874d}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="include\grpc++\impl\codegen\security"> |
||||
<UniqueIdentifier>{d3f3293f-204f-7771-fcdf-de673f6b06b6}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="include\grpc\impl"> |
||||
<UniqueIdentifier>{7e90f37b-f9cc-0725-b2c1-12aa7d4809ba}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="include\grpc\impl\codegen"> |
||||
<UniqueIdentifier>{7e4b71ef-8125-6446-bfc1-9bc90beed59c}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="src"> |
||||
<UniqueIdentifier>{169774bd-5c6c-6827-66a4-326b4aef44d6}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="src\proto"> |
||||
<UniqueIdentifier>{1b609b37-ef2a-e5eb-e1ba-ad9e79c77438}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="src\proto\grpc"> |
||||
<UniqueIdentifier>{cd1e35d8-8a61-62fe-6ce1-c8936872d1ef}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="src\proto\grpc\testing"> |
||||
<UniqueIdentifier>{f7ee4df5-1f47-1e7f-c91e-350382c1b729}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="test"> |
||||
<UniqueIdentifier>{f2166b83-6b0b-d53b-b58b-627bd9efcad2}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="test\cpp"> |
||||
<UniqueIdentifier>{bbe36cbc-7fbe-2817-0bd0-d03726f323e6}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="test\cpp\util"> |
||||
<UniqueIdentifier>{e106cd7b-cfa0-0645-f1a9-2acedc23afe7}</UniqueIdentifier> |
||||
</Filter> |
||||
</ItemGroup> |
||||
</Project> |
||||
|
Loading…
Reference in new issue