aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2019-01-03 12:21:19 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2019-01-03 12:21:19 -0800
commit50c60f03ba84b4e1b1d31819a295ef4e1076907b (patch)
tree80d4450cd80610f8c0ef95a52b34c190ae9d756a
parentc6261f4b918a88f5b1fc5cd60e1e2b44e8f83a76 (diff)
Rename GetSendMessage to GetSerializedSendMessage and GetOriginalSendMessage to GetSendMessage
-rw-r--r--include/grpcpp/impl/codegen/interceptor.h4
-rw-r--r--include/grpcpp/impl/codegen/interceptor_common.h8
-rw-r--r--test/cpp/end2end/client_interceptors_end2end_test.cc15
-rw-r--r--test/cpp/end2end/server_interceptors_end2end_test.cc25
4 files changed, 25 insertions, 27 deletions
diff --git a/include/grpcpp/impl/codegen/interceptor.h b/include/grpcpp/impl/codegen/interceptor.h
index a83d285d13..5a9a3a44e6 100644
--- a/include/grpcpp/impl/codegen/interceptor.h
+++ b/include/grpcpp/impl/codegen/interceptor.h
@@ -109,13 +109,13 @@ class InterceptorBatchMethods {
/// Returns a modifable ByteBuffer holding the serialized form of the message
/// that is going to be sent. Valid for PRE_SEND_MESSAGE interceptions.
/// A return value of nullptr indicates that this ByteBuffer is not valid.
- virtual ByteBuffer* GetSendMessage() = 0;
+ virtual ByteBuffer* GetSerializedSendMessage() = 0;
/// Returns a non-modifiable pointer to the original non-serialized form of
/// the message. Valid for PRE_SEND_MESSAGE interceptions. A return value of
/// nullptr indicates that this field is not valid. Also note that this is
/// only supported for sync and callback APIs at the present moment.
- virtual const void* GetOriginalSendMessage() = 0;
+ virtual const void* GetSendMessage() = 0;
/// Returns a modifiable multimap of the initial metadata to be sent. Valid
/// for PRE_SEND_INITIAL_METADATA interceptions. A value of nullptr indicates
diff --git a/include/grpcpp/impl/codegen/interceptor_common.h b/include/grpcpp/impl/codegen/interceptor_common.h
index bf936368d4..4b7eaefee1 100644
--- a/include/grpcpp/impl/codegen/interceptor_common.h
+++ b/include/grpcpp/impl/codegen/interceptor_common.h
@@ -79,9 +79,9 @@ class InterceptorBatchMethodsImpl
hooks_[static_cast<size_t>(type)] = true;
}
- ByteBuffer* GetSendMessage() override { return send_message_; }
+ ByteBuffer* GetSerializedSendMessage() override { return send_message_; }
- const void* GetOriginalSendMessage() override { return orig_send_message_; }
+ const void* GetSendMessage() override { return orig_send_message_; }
std::multimap<grpc::string, grpc::string>* GetSendInitialMetadata() override {
return send_initial_metadata_;
@@ -385,14 +385,14 @@ class CancelInterceptorBatchMethods
"Cancel notification");
}
- ByteBuffer* GetSendMessage() override {
+ ByteBuffer* GetSerializedSendMessage() override {
GPR_CODEGEN_ASSERT(false &&
"It is illegal to call GetSendMessage on a method which "
"has a Cancel notification");
return nullptr;
}
- const void* GetOriginalSendMessage() override {
+ const void* GetSendMessage() override {
GPR_CODEGEN_ASSERT(
false &&
"It is illegal to call GetOriginalSendMessage on a method which "
diff --git a/test/cpp/end2end/client_interceptors_end2end_test.cc b/test/cpp/end2end/client_interceptors_end2end_test.cc
index 1ed1fb686d..3db709e956 100644
--- a/test/cpp/end2end/client_interceptors_end2end_test.cc
+++ b/test/cpp/end2end/client_interceptors_end2end_test.cc
@@ -68,7 +68,7 @@ class HijackingInterceptor : public experimental::Interceptor {
if (methods->QueryInterceptionHookPoint(
experimental::InterceptionHookPoints::PRE_SEND_MESSAGE)) {
EchoRequest req;
- auto* buffer = methods->GetSendMessage();
+ auto* buffer = methods->GetSerializedSendMessage();
auto copied_buffer = *buffer;
EXPECT_TRUE(
SerializationTraits<EchoRequest>::Deserialize(&copied_buffer, &req)
@@ -173,7 +173,7 @@ class HijackingInterceptorMakesAnotherCall : public experimental::Interceptor {
if (methods->QueryInterceptionHookPoint(
experimental::InterceptionHookPoints::PRE_SEND_MESSAGE)) {
EchoRequest req;
- auto* buffer = methods->GetSendMessage();
+ auto* buffer = methods->GetSerializedSendMessage();
auto copied_buffer = *buffer;
EXPECT_TRUE(
SerializationTraits<EchoRequest>::Deserialize(&copied_buffer, &req)
@@ -287,17 +287,16 @@ class LoggingInterceptor : public experimental::Interceptor {
if (methods->QueryInterceptionHookPoint(
experimental::InterceptionHookPoints::PRE_SEND_MESSAGE)) {
EchoRequest req;
- auto* buffer = methods->GetSendMessage();
+ auto* buffer = methods->GetSerializedSendMessage();
auto copied_buffer = *buffer;
EXPECT_TRUE(
SerializationTraits<EchoRequest>::Deserialize(&copied_buffer, &req)
.ok());
EXPECT_TRUE(req.message().find("Hello") == 0u);
- EXPECT_EQ(
- static_cast<const EchoRequest*>(methods->GetOriginalSendMessage())
- ->message()
- .find("Hello"),
- 0u);
+ EXPECT_EQ(static_cast<const EchoRequest*>(methods->GetSendMessage())
+ ->message()
+ .find("Hello"),
+ 0u);
}
if (methods->QueryInterceptionHookPoint(
experimental::InterceptionHookPoints::PRE_SEND_CLOSE)) {
diff --git a/test/cpp/end2end/server_interceptors_end2end_test.cc b/test/cpp/end2end/server_interceptors_end2end_test.cc
index 28f51bb2fc..09e855b0d0 100644
--- a/test/cpp/end2end/server_interceptors_end2end_test.cc
+++ b/test/cpp/end2end/server_interceptors_end2end_test.cc
@@ -83,7 +83,7 @@ class LoggingInterceptor : public experimental::Interceptor {
if (methods->QueryInterceptionHookPoint(
experimental::InterceptionHookPoints::PRE_SEND_MESSAGE)) {
EchoRequest req;
- auto* buffer = methods->GetSendMessage();
+ auto* buffer = methods->GetSerializedSendMessage();
auto copied_buffer = *buffer;
EXPECT_TRUE(
SerializationTraits<EchoRequest>::Deserialize(&copied_buffer, &req)
@@ -142,30 +142,29 @@ class LoggingInterceptorFactory
}
};
-// Test if GetOriginalSendMessage works as expected
-class GetOriginalSendMessageTester : public experimental::Interceptor {
+// Test if GetSendMessage works as expected
+class GetSendMessageTester : public experimental::Interceptor {
public:
- GetOriginalSendMessageTester(experimental::ServerRpcInfo* info) {}
+ GetSendMessageTester(experimental::ServerRpcInfo* info) {}
void Intercept(experimental::InterceptorBatchMethods* methods) override {
if (methods->QueryInterceptionHookPoint(
experimental::InterceptionHookPoints::PRE_SEND_MESSAGE)) {
- EXPECT_EQ(
- static_cast<const EchoRequest*>(methods->GetOriginalSendMessage())
- ->message()
- .find("Hello"),
- 0u);
+ EXPECT_EQ(static_cast<const EchoRequest*>(methods->GetSendMessage())
+ ->message()
+ .find("Hello"),
+ 0u);
}
methods->Proceed();
}
};
-class GetOriginalSendMessageTesterFactory
+class GetSendMessageTesterFactory
: public experimental::ServerInterceptorFactoryInterface {
public:
virtual experimental::Interceptor* CreateServerInterceptor(
experimental::ServerRpcInfo* info) override {
- return new GetOriginalSendMessageTester(info);
+ return new GetSendMessageTester(info);
}
};
@@ -205,7 +204,7 @@ class ServerInterceptorsEnd2endSyncUnaryTest : public ::testing::Test {
new LoggingInterceptorFactory()));
creators.push_back(
std::unique_ptr<experimental::ServerInterceptorFactoryInterface>(
- new GetOriginalSendMessageTesterFactory()));
+ new GetSendMessageTesterFactory()));
// Add 20 dummy interceptor factories and null interceptor factories
for (auto i = 0; i < 20; i++) {
creators.push_back(std::unique_ptr<DummyInterceptorFactory>(
@@ -248,7 +247,7 @@ class ServerInterceptorsEnd2endSyncStreamingTest : public ::testing::Test {
new LoggingInterceptorFactory()));
creators.push_back(
std::unique_ptr<experimental::ServerInterceptorFactoryInterface>(
- new GetOriginalSendMessageTesterFactory()));
+ new GetSendMessageTesterFactory()));
for (auto i = 0; i < 20; i++) {
creators.push_back(std::unique_ptr<DummyInterceptorFactory>(
new DummyInterceptorFactory()));