Get ClientContext included with ChannelInterface, and slight more cleanup

pull/17034/head
Yash Tibrewal 6 years ago
parent 01313976e1
commit 85ddf5c713
  1. 1
      include/grpcpp/impl/codegen/channel_interface.h
  2. 1
      include/grpcpp/impl/codegen/client_interceptor.h
  3. 2
      include/grpcpp/impl/codegen/interceptor.h
  4. 1
      include/grpcpp/impl/codegen/server_interceptor.h
  5. 12
      test/cpp/end2end/client_interceptors_end2end_test.cc
  6. 4
      test/cpp/end2end/server_interceptors_end2end_test.cc

@ -21,6 +21,7 @@
#include <grpc/impl/codegen/connectivity_state.h> #include <grpc/impl/codegen/connectivity_state.h>
#include <grpcpp/impl/codegen/call.h> #include <grpcpp/impl/codegen/call.h>
#include <grpcpp/impl/codegen/client_context.h>
#include <grpcpp/impl/codegen/status.h> #include <grpcpp/impl/codegen/status.h>
#include <grpcpp/impl/codegen/time.h> #include <grpcpp/impl/codegen/time.h>

@ -21,7 +21,6 @@
#include <vector> #include <vector>
#include <grpc/impl/codegen/log.h>
#include <grpcpp/impl/codegen/interceptor.h> #include <grpcpp/impl/codegen/interceptor.h>
#include <grpcpp/impl/codegen/string_ref.h> #include <grpcpp/impl/codegen/string_ref.h>

@ -21,13 +21,13 @@
#include <grpc/impl/codegen/grpc_types.h> #include <grpc/impl/codegen/grpc_types.h>
#include <grpcpp/impl/codegen/byte_buffer.h> #include <grpcpp/impl/codegen/byte_buffer.h>
#include <grpcpp/impl/codegen/channel_interface.h>
#include <grpcpp/impl/codegen/config.h> #include <grpcpp/impl/codegen/config.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h> #include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/impl/codegen/metadata_map.h> #include <grpcpp/impl/codegen/metadata_map.h>
namespace grpc { namespace grpc {
class ChannelInterface;
class Status; class Status;
namespace experimental { namespace experimental {

@ -22,7 +22,6 @@
#include <atomic> #include <atomic>
#include <vector> #include <vector>
#include <grpc/impl/codegen/log.h>
#include <grpcpp/impl/codegen/interceptor.h> #include <grpcpp/impl/codegen/interceptor.h>
#include <grpcpp/impl/codegen/string_ref.h> #include <grpcpp/impl/codegen/string_ref.h>

@ -152,7 +152,9 @@ class HijackingInterceptor : public experimental::Interceptor {
EchoRequest req; EchoRequest req;
auto* buffer = methods->GetSendMessage(); auto* buffer = methods->GetSendMessage();
auto copied_buffer = *buffer; auto copied_buffer = *buffer;
SerializationTraits<EchoRequest>::Deserialize(&copied_buffer, &req); EXPECT_TRUE(
SerializationTraits<EchoRequest>::Deserialize(&copied_buffer, &req)
.ok());
EXPECT_EQ(req.message(), "Hello"); EXPECT_EQ(req.message(), "Hello");
} }
if (methods->QueryInterceptionHookPoint( if (methods->QueryInterceptionHookPoint(
@ -255,7 +257,9 @@ class HijackingInterceptorMakesAnotherCall : public experimental::Interceptor {
EchoRequest req; EchoRequest req;
auto* buffer = methods->GetSendMessage(); auto* buffer = methods->GetSendMessage();
auto copied_buffer = *buffer; auto copied_buffer = *buffer;
SerializationTraits<EchoRequest>::Deserialize(&copied_buffer, &req); EXPECT_TRUE(
SerializationTraits<EchoRequest>::Deserialize(&copied_buffer, &req)
.ok());
EXPECT_EQ(req.message(), "Hello"); EXPECT_EQ(req.message(), "Hello");
req_ = req; req_ = req;
stub_ = grpc::testing::EchoTestService::NewStub( stub_ = grpc::testing::EchoTestService::NewStub(
@ -367,7 +371,9 @@ class LoggingInterceptor : public experimental::Interceptor {
EchoRequest req; EchoRequest req;
auto* buffer = methods->GetSendMessage(); auto* buffer = methods->GetSendMessage();
auto copied_buffer = *buffer; auto copied_buffer = *buffer;
SerializationTraits<EchoRequest>::Deserialize(&copied_buffer, &req); EXPECT_TRUE(
SerializationTraits<EchoRequest>::Deserialize(&copied_buffer, &req)
.ok());
EXPECT_TRUE(req.message().find("Hello") == 0); EXPECT_TRUE(req.message().find("Hello") == 0);
} }
if (methods->QueryInterceptionHookPoint( if (methods->QueryInterceptionHookPoint(

@ -103,7 +103,9 @@ class LoggingInterceptor : public experimental::Interceptor {
EchoRequest req; EchoRequest req;
auto* buffer = methods->GetSendMessage(); auto* buffer = methods->GetSendMessage();
auto copied_buffer = *buffer; auto copied_buffer = *buffer;
SerializationTraits<EchoRequest>::Deserialize(&copied_buffer, &req); EXPECT_TRUE(
SerializationTraits<EchoRequest>::Deserialize(&copied_buffer, &req)
.ok());
EXPECT_TRUE(req.message().find("Hello") == 0); EXPECT_TRUE(req.message().find("Hello") == 0);
} }
if (methods->QueryInterceptionHookPoint( if (methods->QueryInterceptionHookPoint(

Loading…
Cancel
Save