diff --git a/examples/tips/client.cc b/examples/tips/client.cc index bfbd59c9d56d2f152e74077aa19992884cf981ba..a902a21c3c689582710743e742c6f469afa63d20 100644 --- a/examples/tips/client.cc +++ b/examples/tips/client.cc @@ -35,7 +35,6 @@ #include "examples/tips/client.h" -using grpc::ChannelInterface; using grpc::ClientContext; using tech::pubsub::Topic; using tech::pubsub::PublisherService; @@ -44,7 +43,7 @@ namespace grpc { namespace examples { namespace tips { -Client::Client(std::shared_ptr<ChannelInterface> channel) +Client::Client(std::shared_ptr<grpc::ChannelInterface> channel) : stub_(PublisherService::NewStub(channel)) { } @@ -52,11 +51,11 @@ Status Client::CreateTopic(grpc::string topic) { Topic request; Topic response; request.set_name(topic); - ClientContext context; + grpc::ClientContext context; return stub_->CreateTopic(&context, request, &response); } -} // namesapce tips +} // namespace tips } // namespace examples } // namespace grpc diff --git a/examples/tips/client.h b/examples/tips/client.h index 83e79118235d10fe3e9f64306dcf9d6966a1634f..152a2a396ddffc914391ec19bb49209948f5590e 100644 --- a/examples/tips/client.h +++ b/examples/tips/client.h @@ -48,6 +48,6 @@ class Client { std::unique_ptr<tech::pubsub::PublisherService::Stub> stub_; }; -} // namesapce tips +} // namespace tips } // namespace examples } // namespace grpc diff --git a/examples/tips/client_main.cc b/examples/tips/client_main.cc index 0324b4b8b08edfb7b91a999231a0cd1daca50828..17567b6f17a5f4f3e0db822ac4e8a690ad1860b9 100644 --- a/examples/tips/client_main.cc +++ b/examples/tips/client_main.cc @@ -31,40 +31,26 @@ * */ -#include <chrono> -#include <memory> -#include <string> -#include <thread> - #include <grpc/grpc.h> #include <grpc/support/log.h> #include <google/gflags.h> -#include <grpc++/channel_arguments.h> #include <grpc++/channel_interface.h> -#include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/status.h> -#include <grpc++/stream.h> + +#include "examples/tips/client.h" #include "test/cpp/util/create_test_channel.h" -DEFINE_bool(enable_ssl, false, "Whether to use ssl/tls."); -DEFINE_bool(use_prod_roots, false, "True to use SSL roots for production GFE"); +DEFINE_bool(enable_ssl, true, "Whether to use ssl/tls."); +DEFINE_bool(use_prod_roots, true, "True to use SSL roots for production GFE"); DEFINE_int32(server_port, 0, "Server port."); DEFINE_string(server_host, "127.0.0.1", "Server host to connect to"); DEFINE_string(server_host_override, "foo.test.google.com", "Override the server host which is sent in HTTP header"); -using grpc::ChannelInterface; -using grpc::ClientContext; -using grpc::CreateTestChannel; - -void CreateTopic(std::shared_ptr<ChannelInterface> channel, grpc::string topic); - int main(int argc, char** argv) { grpc_init(); - google::ParseCommandLineFlags(&argc, &argv, true); - gpr_log(GPR_INFO, "Start TIPS client"); GPR_ASSERT(FLAGS_server_port); @@ -73,11 +59,13 @@ int main(int argc, char** argv) { snprintf(host_port, host_port_buf_size, "%s:%d", FLAGS_server_host.c_str(), FLAGS_server_port); - std::shared_ptr<ChannelInterface> channel( - CreateTestChannel(host_port, FLAGS_server_host_override, FLAGS_enable_ssl, - FLAGS_use_prod_roots)); + std::shared_ptr<grpc::ChannelInterface> channel( + grpc::CreateTestChannel(host_port, FLAGS_server_host_override, + FLAGS_enable_ssl, FLAGS_use_prod_roots)); - CreateTopic(channel, "test"); + grpc::examples::tips::Client client(channel); + grpc::Status s = client.CreateTopic("test"); + GPR_ASSERT(s.IsOk()); channel.reset(); grpc_shutdown(); diff --git a/examples/tips/client_test.cc b/examples/tips/client_test.cc index d40f0c0d8b4dc3e65e4f8a2053697ee7643b220c..69238f2c6fcc060eadb098f136899ebdd9deb95a 100644 --- a/examples/tips/client_test.cc +++ b/examples/tips/client_test.cc @@ -47,10 +47,6 @@ using grpc::ChannelInterface; -namespace { - -} // - namespace grpc { namespace testing { namespace { diff --git a/examples/tips/empty.proto b/examples/tips/empty.proto index a698ab6f8a9e665aaee2df1bb62ce31e5eaa24ea..adf66b5e614dc51bf180205a4374a79271ad0235 100644 --- a/examples/tips/empty.proto +++ b/examples/tips/empty.proto @@ -10,10 +10,4 @@ package proto2; // rpc Bar (proto2.Empty) returns (proto2.Empty) { }; // }; // -// BEGIN GOOGLE-INTERNAL -// The difference between this one and net/rpc/empty-message.proto is that -// 1) The generated message here is in proto2 C++ API. -// 2) The proto2.Empty has minimum dependencies -// (no message_set or net/rpc dependencies) -// END GOOGLE-INTERNAL message Empty {} diff --git a/examples/tips/label.proto b/examples/tips/label.proto index e79e1db77c215ce1918430478ff2b4d4b5d74854..e93ac9dea3006c76644dedfb4f71c0857ac6b14e 100644 --- a/examples/tips/label.proto +++ b/examples/tips/label.proto @@ -1,7 +1,6 @@ // Labels provide a way to associate user-defined metadata with various // objects. Labels may be used to organize objects into non-hierarchical -// groups; think metadata tags attached to mp3s. For more details, see -// http://go/exosphere:labels +// groups; think metadata tags attached to mp3s. syntax = "proto2";