From 730055d9628ca6d27e46d7c6716148a8d93bf95d Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 27 Aug 2015 12:29:45 -0700 Subject: implementation fix --- include/grpc++/credentials.h | 2 +- src/cpp/client/create_channel.cc | 2 +- test/cpp/end2end/async_end2end_test.cc | 8 ++++---- test/cpp/end2end/client_crash_test.cc | 2 +- test/cpp/end2end/end2end_test.cc | 9 ++++----- test/cpp/end2end/generic_end2end_test.cc | 4 ++-- test/cpp/end2end/mock_test.cc | 4 ++-- test/cpp/end2end/server_crash_test_client.cc | 4 ++-- test/cpp/end2end/shutdown_test.cc | 2 +- test/cpp/end2end/thread_stress_test.cc | 4 ++-- test/cpp/end2end/zookeeper_test.cc | 2 +- test/cpp/qps/driver.cc | 8 ++++---- test/cpp/qps/report.h | 4 ++-- test/cpp/util/cli_call_test.cc | 3 +-- test/cpp/util/create_test_channel.cc | 4 ++-- test/cpp/util/grpc_cli.cc | 2 +- 16 files changed, 31 insertions(+), 33 deletions(-) diff --git a/include/grpc++/credentials.h b/include/grpc++/credentials.h index 71e1f00f15..d623bcef60 100644 --- a/include/grpc++/credentials.h +++ b/include/grpc++/credentials.h @@ -57,7 +57,7 @@ class Credentials : public GrpcLibrary { virtual SecureCredentials* AsSecureCredentials() = 0; private: - friend std::shared_ptr CreateChannel( + friend std::shared_ptr CreateCustomChannel( const grpc::string& target, const std::shared_ptr& creds, const ChannelArguments& args); diff --git a/src/cpp/client/create_channel.cc b/src/cpp/client/create_channel.cc index 8d2f1bf37a..1dac960017 100644 --- a/src/cpp/client/create_channel.cc +++ b/src/cpp/client/create_channel.cc @@ -43,7 +43,7 @@ namespace grpc { class ChannelArguments; -std::shared_ptr CreateCustomChannel( +std::shared_ptr CreateChannel( const grpc::string& target, const std::shared_ptr& creds) { return CreateCustomChannel(target, creds, ChannelArguments()); } diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 41b91e459b..bbcac9ba34 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -200,8 +200,8 @@ class AsyncEnd2endTest : public ::testing::TestWithParam { } void ResetStub() { - std::shared_ptr channel = CreateChannel( - server_address_.str(), InsecureCredentials(), ChannelArguments()); + std::shared_ptr channel = + CreateChannel(server_address_.str(), InsecureCredentials()); stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel)); } @@ -750,8 +750,8 @@ TEST_P(AsyncEnd2endTest, ServerCheckDone) { } TEST_P(AsyncEnd2endTest, UnimplementedRpc) { - std::shared_ptr channel = CreateChannel( - server_address_.str(), InsecureCredentials(), ChannelArguments()); + std::shared_ptr channel = + CreateChannel(server_address_.str(), InsecureCredentials()); std::unique_ptr stub; stub = std::move(grpc::cpp::test::util::UnimplementedService::NewStub(channel)); diff --git a/test/cpp/end2end/client_crash_test.cc b/test/cpp/end2end/client_crash_test.cc index 3359080cec..3a6e55216a 100644 --- a/test/cpp/end2end/client_crash_test.cc +++ b/test/cpp/end2end/client_crash_test.cc @@ -76,7 +76,7 @@ class CrashTest : public ::testing::Test { })); GPR_ASSERT(server_); return grpc::cpp::test::util::TestService::NewStub( - CreateChannel(addr, InsecureCredentials(), ChannelArguments())); + CreateChannel(addr, InsecureCredentials())); } void KillServer() { server_.reset(); } diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 9826837c60..37a6e693e6 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -291,8 +291,8 @@ class End2endTest : public ::testing::TestWithParam { ChannelArguments args; args.SetSslTargetNameOverride("foo.test.google.fr"); args.SetString(GRPC_ARG_SECONDARY_USER_AGENT_STRING, "end2end_test"); - channel_ = - CreateChannel(server_address_.str(), SslCredentials(ssl_opts), args); + channel_ = CreateCustomChannel(server_address_.str(), + SslCredentials(ssl_opts), args); } void ResetStub(bool use_proxy) { @@ -307,8 +307,7 @@ class End2endTest : public ::testing::TestWithParam { builder.RegisterService(proxy_service_.get()); proxy_server_ = builder.BuildAndStart(); - channel_ = CreateChannel(proxyaddr.str(), InsecureCredentials(), - ChannelArguments()); + channel_ = CreateChannel(proxyaddr.str(), InsecureCredentials()); } stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel_)); @@ -566,7 +565,7 @@ TEST_F(End2endTest, BadCredentials) { std::shared_ptr bad_creds = ServiceAccountCredentials("", "", 1); EXPECT_EQ(static_cast(nullptr), bad_creds.get()); std::shared_ptr channel = - CreateChannel(server_address_.str(), bad_creds, ChannelArguments()); + CreateChannel(server_address_.str(), bad_creds); std::unique_ptr stub( grpc::cpp::test::util::TestService::NewStub(channel)); EchoRequest request; diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index 809eef058c..7acbc711fb 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -121,8 +121,8 @@ class GenericEnd2endTest : public ::testing::Test { } void ResetStub() { - std::shared_ptr channel = CreateChannel( - server_address_.str(), InsecureCredentials(), ChannelArguments()); + std::shared_ptr channel = + CreateChannel(server_address_.str(), InsecureCredentials()); generic_stub_.reset(new GenericStub(channel)); } diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc index b2c6dc39a8..077d21aa72 100644 --- a/test/cpp/end2end/mock_test.cc +++ b/test/cpp/end2end/mock_test.cc @@ -245,8 +245,8 @@ class MockTest : public ::testing::Test { void TearDown() GRPC_OVERRIDE { server_->Shutdown(); } void ResetStub() { - std::shared_ptr channel = CreateChannel( - server_address_.str(), InsecureCredentials(), ChannelArguments()); + std::shared_ptr channel = + CreateChannel(server_address_.str(), InsecureCredentials()); stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel)); } diff --git a/test/cpp/end2end/server_crash_test_client.cc b/test/cpp/end2end/server_crash_test_client.cc index 7ca43a0c5b..6ff42fcb30 100644 --- a/test/cpp/end2end/server_crash_test_client.cc +++ b/test/cpp/end2end/server_crash_test_client.cc @@ -58,8 +58,8 @@ using namespace gflags; int main(int argc, char** argv) { ParseCommandLineFlags(&argc, &argv, true); - auto stub = grpc::cpp::test::util::TestService::NewStub(grpc::CreateChannel( - FLAGS_address, grpc::InsecureCredentials(), grpc::ChannelArguments())); + auto stub = grpc::cpp::test::util::TestService::NewStub( + grpc::CreateChannel(FLAGS_address, grpc::InsecureCredentials())); EchoRequest request; EchoResponse response; diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc index e83f86f7ec..59fec6ad40 100644 --- a/test/cpp/end2end/shutdown_test.cc +++ b/test/cpp/end2end/shutdown_test.cc @@ -95,7 +95,7 @@ class ShutdownTest : public ::testing::Test { void ResetStub() { string target = "dns:localhost:" + to_string(port_); - channel_ = CreateChannel(target, InsecureCredentials(), ChannelArguments()); + channel_ = CreateChannel(target, InsecureCredentials()); stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel_)); } diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc index 8304f04d56..2a16481972 100644 --- a/test/cpp/end2end/thread_stress_test.cc +++ b/test/cpp/end2end/thread_stress_test.cc @@ -191,8 +191,8 @@ class End2endTest : public ::testing::Test { void TearDown() GRPC_OVERRIDE { server_->Shutdown(); } void ResetStub() { - std::shared_ptr channel = CreateChannel( - server_address_.str(), InsecureCredentials(), ChannelArguments()); + std::shared_ptr channel = + CreateChannel(server_address_.str(), InsecureCredentials()); stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel)); } diff --git a/test/cpp/end2end/zookeeper_test.cc b/test/cpp/end2end/zookeeper_test.cc index e7d95b1c46..931541ca34 100644 --- a/test/cpp/end2end/zookeeper_test.cc +++ b/test/cpp/end2end/zookeeper_test.cc @@ -159,7 +159,7 @@ class ZookeeperTest : public ::testing::Test { void ResetStub() { string target = "zookeeper://" + zookeeper_address_ + "/test"; - channel_ = CreateChannel(target, InsecureCredentials(), ChannelArguments()); + channel_ = CreateChannel(target, InsecureCredentials()); stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel_)); } diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index 3bd61ea4e8..0e771d6b81 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -154,8 +154,8 @@ std::unique_ptr RunScenario( // where class contained in std::vector must have a copy constructor auto* servers = new ServerData[num_servers]; for (size_t i = 0; i < num_servers; i++) { - servers[i].stub = std::move(Worker::NewStub( - CreateChannel(workers[i], InsecureCredentials(), ChannelArguments()))); + servers[i].stub = std::move( + Worker::NewStub(CreateChannel(workers[i], InsecureCredentials()))); ServerArgs args; result_server_config = server_config; result_server_config.set_host(workers[i]); @@ -182,8 +182,8 @@ std::unique_ptr RunScenario( // where class contained in std::vector must have a copy constructor auto* clients = new ClientData[num_clients]; for (size_t i = 0; i < num_clients; i++) { - clients[i].stub = std::move(Worker::NewStub(CreateChannel( - workers[i + num_servers], InsecureCredentials(), ChannelArguments()))); + clients[i].stub = std::move(Worker::NewStub( + CreateChannel(workers[i + num_servers], InsecureCredentials()))); ClientArgs args; result_client_config = client_config; result_client_config.set_host(workers[i + num_servers]); diff --git a/test/cpp/qps/report.h b/test/cpp/qps/report.h index 620abade39..5914fc4e30 100644 --- a/test/cpp/qps/report.h +++ b/test/cpp/qps/report.h @@ -116,8 +116,8 @@ class PerfDbReporter : public Reporter { test_name_(test_name), sys_info_(sys_info), tag_(tag) { - perf_db_client_.init(grpc::CreateChannel( - server_address, grpc::InsecureCredentials(), ChannelArguments())); + perf_db_client_.init( + grpc::CreateChannel(server_address, grpc::InsecureCredentials())); } ~PerfDbReporter() GRPC_OVERRIDE { SendData(); }; diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc index 111a0e9f76..0efa201622 100644 --- a/test/cpp/util/cli_call_test.cc +++ b/test/cpp/util/cli_call_test.cc @@ -91,8 +91,7 @@ class CliCallTest : public ::testing::Test { void TearDown() GRPC_OVERRIDE { server_->Shutdown(); } void ResetStub() { - channel_ = CreateChannel(server_address_.str(), InsecureCredentials(), - ChannelArguments()); + channel_ = CreateChannel(server_address_.str(), InsecureCredentials()); stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel_)); } diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc index 161b4bdc1d..e993d14e71 100644 --- a/test/cpp/util/create_test_channel.cc +++ b/test/cpp/util/create_test_channel.cc @@ -74,9 +74,9 @@ std::shared_ptr CreateTestChannel( if (creds.get()) { channel_creds = CompositeCredentials(creds, channel_creds); } - return CreateChannel(connect_to, channel_creds, channel_args); + return CreateCustomChannel(connect_to, channel_creds, channel_args); } else { - return CreateChannel(server, InsecureCredentials(), channel_args); + return CreateChannel(server, InsecureCredentials()); } } diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc index a4888efebe..22cac21f77 100644 --- a/test/cpp/util/grpc_cli.cc +++ b/test/cpp/util/grpc_cli.cc @@ -159,7 +159,7 @@ int main(int argc, char** argv) { } } std::shared_ptr channel = - grpc::CreateChannel(server_address, creds, grpc::ChannelArguments()); + grpc::CreateChannel(server_address, creds); grpc::string response; std::multimap client_metadata; -- cgit v1.2.3