diff options
author | Julien Boeuf <jboeuf@google.com> | 2015-08-24 23:55:43 -0700 |
---|---|---|
committer | Julien Boeuf <jboeuf@google.com> | 2015-08-24 23:55:43 -0700 |
commit | 0382bfae38ca7594e55e941087f8095eb7493a4e (patch) | |
tree | 925bd59036b7e27fb4ea4a7aa8d59862f413fc2b /test/cpp/util | |
parent | 8fd915ab8dfaf2a451fc46ecf225ea4d4400c64b (diff) | |
parent | e289e52436505e73440854ee6f8e5ddda5750929 (diff) |
Merge branch 'master' of github.com:grpc/grpc into cpp_string_ref
Diffstat (limited to 'test/cpp/util')
-rw-r--r-- | test/cpp/util/benchmark_config.cc | 14 | ||||
-rw-r--r-- | test/cpp/util/byte_buffer_test.cc | 7 | ||||
-rw-r--r-- | test/cpp/util/cli_call.cc | 15 | ||||
-rw-r--r-- | test/cpp/util/cli_call.h | 7 | ||||
-rw-r--r-- | test/cpp/util/cli_call_test.cc | 20 | ||||
-rw-r--r-- | test/cpp/util/create_test_channel.cc | 12 | ||||
-rw-r--r-- | test/cpp/util/create_test_channel.h | 11 | ||||
-rw-r--r-- | test/cpp/util/grpc_cli.cc | 11 | ||||
-rw-r--r-- | test/cpp/util/slice_test.cc | 2 | ||||
-rw-r--r-- | test/cpp/util/status_test.cc | 3 | ||||
-rw-r--r-- | test/cpp/util/string_ref_test.cc | 2 | ||||
-rw-r--r-- | test/cpp/util/time_test.cc | 2 |
12 files changed, 49 insertions, 57 deletions
diff --git a/test/cpp/util/benchmark_config.cc b/test/cpp/util/benchmark_config.cc index 91fbbf9677..3c38221b4c 100644 --- a/test/cpp/util/benchmark_config.cc +++ b/test/cpp/util/benchmark_config.cc @@ -37,7 +37,8 @@ DEFINE_bool(enable_log_reporter, true, "Enable reporting of benchmark results through GprLog"); -DEFINE_bool(report_metrics_db, false, "True if metrics to be reported to performance database"); +DEFINE_bool(report_metrics_db, false, + "True if metrics to be reported to performance database"); DEFINE_string(hashed_id, "", "Hash of the user id"); @@ -45,7 +46,8 @@ DEFINE_string(test_name, "", "Name of the test being executed"); DEFINE_string(sys_info, "", "System information"); -DEFINE_string(server_address, "localhost:50052", "Address of the performance database server"); +DEFINE_string(server_address, "localhost:50052", + "Address of the performance database server"); DEFINE_string(tag, "", "Optional tag for the test"); @@ -69,10 +71,10 @@ static std::shared_ptr<Reporter> InitBenchmarkReporters() { composite_reporter->add( std::unique_ptr<Reporter>(new GprLogReporter("LogReporter"))); } - if(FLAGS_report_metrics_db) { - composite_reporter->add( - std::unique_ptr<Reporter>(new PerfDbReporter("PerfDbReporter", FLAGS_hashed_id, FLAGS_test_name, - FLAGS_sys_info, FLAGS_server_address, FLAGS_tag))); + if (FLAGS_report_metrics_db) { + composite_reporter->add(std::unique_ptr<Reporter>( + new PerfDbReporter("PerfDbReporter", FLAGS_hashed_id, FLAGS_test_name, + FLAGS_sys_info, FLAGS_server_address, FLAGS_tag))); } return std::shared_ptr<Reporter>(composite_reporter); diff --git a/test/cpp/util/byte_buffer_test.cc b/test/cpp/util/byte_buffer_test.cc index 13eb49730a..f36c32cac5 100644 --- a/test/cpp/util/byte_buffer_test.cc +++ b/test/cpp/util/byte_buffer_test.cc @@ -31,13 +31,13 @@ * */ -#include <grpc++/byte_buffer.h> +#include <grpc++/support/byte_buffer.h> #include <cstring> #include <vector> #include <grpc/support/slice.h> -#include <grpc++/slice.h> +#include <grpc++/support/slice.h> #include <gtest/gtest.h> namespace grpc { @@ -46,8 +46,7 @@ namespace { const char* kContent1 = "hello xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const char* kContent2 = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy world"; -class ByteBufferTest : public ::testing::Test { -}; +class ByteBufferTest : public ::testing::Test {}; TEST_F(ByteBufferTest, CreateFromSingleSlice) { gpr_slice hello = gpr_slice_from_copied_string(kContent1); diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc index 83a7a1744a..d60cee9c02 100644 --- a/test/cpp/util/cli_call.cc +++ b/test/cpp/util/cli_call.cc @@ -35,24 +35,21 @@ #include <iostream> -#include <grpc++/byte_buffer.h> -#include <grpc++/channel_interface.h> -#include <grpc++/client_context.h> -#include <grpc++/generic_stub.h> -#include <grpc++/status.h> -#include <grpc++/stream.h> - #include <grpc/grpc.h> #include <grpc/support/log.h> #include <grpc/support/slice.h> +#include <grpc++/support/byte_buffer.h> +#include <grpc++/channel.h> +#include <grpc++/client_context.h> +#include <grpc++/generic/generic_stub.h> namespace grpc { namespace testing { namespace { -void* tag(int i) { return (void*)(gpr_intptr) i; } +void* tag(int i) { return (void*)(gpr_intptr)i; } } // namespace -Status CliCall::Call(std::shared_ptr<grpc::ChannelInterface> channel, +Status CliCall::Call(std::shared_ptr<grpc::Channel> channel, const grpc::string& method, const grpc::string& request, grpc::string* response, const MetadataContainer& metadata, MetadataContainer* server_initial_metadata, diff --git a/test/cpp/util/cli_call.h b/test/cpp/util/cli_call.h index 8d114c9cb5..7a3dcf2e9f 100644 --- a/test/cpp/util/cli_call.h +++ b/test/cpp/util/cli_call.h @@ -36,9 +36,8 @@ #include <map> -#include <grpc++/channel_interface.h> -#include <grpc++/config.h> -#include <grpc++/status.h> +#include <grpc++/channel.h> +#include <grpc++/support/status.h> namespace grpc { namespace testing { @@ -46,7 +45,7 @@ namespace testing { class CliCall GRPC_FINAL { public: typedef std::multimap<grpc::string, grpc::string> MetadataContainer; - static Status Call(std::shared_ptr<grpc::ChannelInterface> channel, + static Status Call(std::shared_ptr<grpc::Channel> channel, const grpc::string& method, const grpc::string& request, grpc::string* response, const MetadataContainer& metadata, MetadataContainer* server_initial_metadata, diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc index 848a3aee57..35bfad202f 100644 --- a/test/cpp/util/cli_call_test.cc +++ b/test/cpp/util/cli_call_test.cc @@ -31,24 +31,22 @@ * */ -#include "test/core/util/test_config.h" #include "test/cpp/util/cli_call.h" -#include "test/cpp/util/echo.grpc.pb.h" -#include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> + +#include <grpc/grpc.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> -#include <grpc++/dynamic_thread_pool.h> #include <grpc++/server.h> #include <grpc++/server_builder.h> #include <grpc++/server_context.h> #include <grpc++/server_credentials.h> -#include <grpc++/status.h> -#include "test/core/util/port.h" #include <gtest/gtest.h> -#include <grpc/grpc.h> +#include "test/core/util/port.h" +#include "test/core/util/test_config.h" +#include "test/cpp/util/echo.grpc.pb.h" using grpc::cpp::test::util::EchoRequest; using grpc::cpp::test::util::EchoResponse; @@ -75,7 +73,7 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { class CliCallTest : public ::testing::Test { protected: - CliCallTest() : thread_pool_(2) {} + CliCallTest() {} void SetUp() GRPC_OVERRIDE { int port = grpc_pick_unused_port_or_die(); @@ -85,7 +83,6 @@ class CliCallTest : public ::testing::Test { builder.AddListeningPort(server_address_.str(), InsecureServerCredentials()); builder.RegisterService(&service_); - builder.SetThreadPool(&thread_pool_); server_ = builder.BuildAndStart(); } @@ -97,12 +94,11 @@ class CliCallTest : public ::testing::Test { stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel_)); } - std::shared_ptr<ChannelInterface> channel_; + std::shared_ptr<Channel> channel_; std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_; std::unique_ptr<Server> server_; std::ostringstream server_address_; TestServiceImpl service_; - DynamicThreadPool thread_pool_; }; // Send a rpc with a normal stub and then a CliCall. Verify they match. diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc index dc48fa2d87..161b4bdc1d 100644 --- a/test/cpp/util/create_test_channel.cc +++ b/test/cpp/util/create_test_channel.cc @@ -33,11 +33,11 @@ #include "test/cpp/util/create_test_channel.h" -#include "test/core/end2end/data/ssl_test_data.h" -#include <grpc++/channel_arguments.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> +#include "test/core/end2end/data/ssl_test_data.h" + namespace grpc { // When ssl is enabled, if server is empty, override_hostname is used to @@ -55,7 +55,7 @@ namespace grpc { // CreateTestChannel("test.google.com:443", "", true, true, creds); // same as above // CreateTestChannel("", "test.google.com:443", true, true, creds); -std::shared_ptr<ChannelInterface> CreateTestChannel( +std::shared_ptr<Channel> CreateTestChannel( const grpc::string& server, const grpc::string& override_hostname, bool enable_ssl, bool use_prod_roots, const std::shared_ptr<Credentials>& creds) { @@ -80,7 +80,7 @@ std::shared_ptr<ChannelInterface> CreateTestChannel( } } -std::shared_ptr<ChannelInterface> CreateTestChannel( +std::shared_ptr<Channel> CreateTestChannel( const grpc::string& server, const grpc::string& override_hostname, bool enable_ssl, bool use_prod_roots) { return CreateTestChannel(server, override_hostname, enable_ssl, @@ -88,8 +88,8 @@ std::shared_ptr<ChannelInterface> CreateTestChannel( } // Shortcut for end2end and interop tests. -std::shared_ptr<ChannelInterface> CreateTestChannel(const grpc::string& server, - bool enable_ssl) { +std::shared_ptr<Channel> CreateTestChannel(const grpc::string& server, + bool enable_ssl) { return CreateTestChannel(server, "foo.test.google.fr", enable_ssl, false); } diff --git a/test/cpp/util/create_test_channel.h b/test/cpp/util/create_test_channel.h index 5f2609ddd8..1263d4ed68 100644 --- a/test/cpp/util/create_test_channel.h +++ b/test/cpp/util/create_test_channel.h @@ -36,20 +36,19 @@ #include <memory> -#include <grpc++/config.h> #include <grpc++/credentials.h> namespace grpc { -class ChannelInterface; +class Channel; -std::shared_ptr<ChannelInterface> CreateTestChannel(const grpc::string& server, - bool enable_ssl); +std::shared_ptr<Channel> CreateTestChannel(const grpc::string& server, + bool enable_ssl); -std::shared_ptr<ChannelInterface> CreateTestChannel( +std::shared_ptr<Channel> CreateTestChannel( const grpc::string& server, const grpc::string& override_hostname, bool enable_ssl, bool use_prod_roots); -std::shared_ptr<ChannelInterface> CreateTestChannel( +std::shared_ptr<Channel> CreateTestChannel( const grpc::string& server, const grpc::string& override_hostname, bool enable_ssl, bool use_prod_roots, const std::shared_ptr<Credentials>& creds); diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc index 3c3baeb769..746d67deeb 100644 --- a/test/cpp/util/grpc_cli.cc +++ b/test/cpp/util/grpc_cli.cc @@ -64,14 +64,13 @@ #include <sstream> #include <gflags/gflags.h> -#include "test/cpp/util/cli_call.h" -#include "test/cpp/util/test_config.h" -#include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> +#include <grpc/grpc.h> +#include <grpc++/channel.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> -#include <grpc/grpc.h> +#include "test/cpp/util/cli_call.h" +#include "test/cpp/util/test_config.h" DEFINE_bool(enable_ssl, true, "Whether to use ssl/tls."); DEFINE_bool(use_auth, false, "Whether to create default google credentials."); @@ -154,7 +153,7 @@ int main(int argc, char** argv) { creds = grpc::SslCredentials(grpc::SslCredentialsOptions()); } } - std::shared_ptr<grpc::ChannelInterface> channel = + std::shared_ptr<grpc::Channel> channel = grpc::CreateChannel(server_address, creds, grpc::ChannelArguments()); grpc::string response; diff --git a/test/cpp/util/slice_test.cc b/test/cpp/util/slice_test.cc index eb328490e1..de7ff031ab 100644 --- a/test/cpp/util/slice_test.cc +++ b/test/cpp/util/slice_test.cc @@ -31,7 +31,7 @@ * */ -#include <grpc++/slice.h> +#include <grpc++/support/slice.h> #include <grpc/support/slice.h> #include <gtest/gtest.h> diff --git a/test/cpp/util/status_test.cc b/test/cpp/util/status_test.cc index 17b92ab06a..837a6bab02 100644 --- a/test/cpp/util/status_test.cc +++ b/test/cpp/util/status_test.cc @@ -31,7 +31,8 @@ * */ -#include <grpc++/status.h> +#include <grpc++/support/status.h> + #include <grpc/status.h> #include <grpc/support/log.h> diff --git a/test/cpp/util/string_ref_test.cc b/test/cpp/util/string_ref_test.cc index 8a16b339f9..b6ec9f3eec 100644 --- a/test/cpp/util/string_ref_test.cc +++ b/test/cpp/util/string_ref_test.cc @@ -31,7 +31,7 @@ * */ -#include <grpc++/string_ref.h> +#include <grpc++/support/string_ref.h> #include <string.h> diff --git a/test/cpp/util/time_test.cc b/test/cpp/util/time_test.cc index 4cb6ec4b4e..1e501dfd28 100644 --- a/test/cpp/util/time_test.cc +++ b/test/cpp/util/time_test.cc @@ -32,7 +32,7 @@ */ #include <grpc/support/time.h> -#include <grpc++/time.h> +#include <grpc++/support/time.h> #include <gtest/gtest.h> using std::chrono::duration_cast; |