diff options
author | yangg <yangg@google.com> | 2014-12-17 15:53:12 -0800 |
---|---|---|
committer | Michael Lumish <mlumish@google.com> | 2014-12-19 13:02:04 -0800 |
commit | a4b6f5df94d6293455f2fed86b56491b7f6dd39e (patch) | |
tree | d0770d772e589ebe01e7f9193010c899d4359296 /test | |
parent | 081e2b0e63869397a50d247571278503d7a61d11 (diff) |
Add ServerContext. It is currently empty and deadline and metadata will come to
it in subsequent cl's.
Change on 2014/12/17 by yangg <yangg@google.com>
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=82372934
Diffstat (limited to 'test')
-rw-r--r-- | test/cpp/end2end/end2end_test.cc | 12 | ||||
-rw-r--r-- | test/cpp/qps/server.cc | 5 |
2 files changed, 12 insertions, 5 deletions
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index ea21099fc7..b8f9fcf228 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -40,6 +40,7 @@ #include <grpc++/create_channel.h> #include <grpc++/server.h> #include <grpc++/server_builder.h> +#include <grpc++/server_context.h> #include <grpc++/status.h> #include <grpc++/stream.h> #include <gtest/gtest.h> @@ -55,14 +56,16 @@ namespace grpc { class TestServiceImpl : public TestService::Service { public: - Status Echo(const EchoRequest* request, EchoResponse* response) { + Status Echo(ServerContext* context, const EchoRequest* request, + EchoResponse* response) { response->set_message(request->message()); return Status::OK; } // Unimplemented is left unimplemented to test the returned error. - Status RequestStream(ServerReader<EchoRequest>* reader, + Status RequestStream(ServerContext* context, + ServerReader<EchoRequest>* reader, EchoResponse* response) { EchoRequest request; response->set_message(""); @@ -74,7 +77,7 @@ class TestServiceImpl : public TestService::Service { // Return 3 messages. // TODO(yangg) make it generic by adding a parameter into EchoRequest - Status ResponseStream(const EchoRequest* request, + Status ResponseStream(ServerContext* context, const EchoRequest* request, ServerWriter<EchoResponse>* writer) { EchoResponse response; response.set_message(request->message() + "0"); @@ -87,7 +90,8 @@ class TestServiceImpl : public TestService::Service { return Status::OK; } - Status BidiStream(ServerReaderWriter<EchoResponse, EchoRequest>* stream) { + Status BidiStream(ServerContext* context, + ServerReaderWriter<EchoResponse, EchoRequest>* stream) { EchoRequest request; EchoResponse response; while (stream->Read(&request)) { diff --git a/test/cpp/qps/server.cc b/test/cpp/qps/server.cc index 7e6c01e24e..5e426127f0 100644 --- a/test/cpp/qps/server.cc +++ b/test/cpp/qps/server.cc @@ -39,6 +39,7 @@ #include <grpc++/config.h> #include <grpc++/server.h> #include <grpc++/server_builder.h> +#include <grpc++/server_context.h> #include <grpc++/status.h> #include "test/cpp/interop/test.pb.h" @@ -50,6 +51,7 @@ DEFINE_int32(port, 0, "Server port."); using grpc::Server; using grpc::ServerBuilder; +using grpc::ServerContext; using grpc::testing::Payload; using grpc::testing::PayloadType; using grpc::testing::SimpleRequest; @@ -71,7 +73,8 @@ bool SetPayload(PayloadType type, int size, Payload* payload) { class TestServiceImpl : public TestService::Service { public: - Status UnaryCall(const SimpleRequest* request, SimpleResponse* response) { + Status UnaryCall(ServerContext* context, const SimpleRequest* request, + SimpleResponse* response) { if (request->has_response_size() && request->response_size() > 0) { if (!SetPayload(request->response_type(), request->response_size(), response->mutable_payload())) { |