diff options
author | Vijay Pai <vpai@google.com> | 2016-08-29 16:42:04 -0700 |
---|---|---|
committer | Vijay Pai <vpai@google.com> | 2016-08-29 16:42:04 -0700 |
commit | a9c0d7f88b213d9a5e41808fd5d1eceaff1a034f (patch) | |
tree | c98aa839fbdac5d0cee7358660e376143c9d0bcd /test | |
parent | 266494cadb6b6d213d8f01da0630d80d2b9f6c1f (diff) |
Change names to StreamedUnary, ServerUnaryStreamer, etc. Use a templated method handler since most code shared between the new StreamedUnary and the existing BidiStreaming. Eliminate the separate enum case for streamed unary. Return a status failure if a StreamedUnary method handler doesn't actually do a write (since that is
violating the appearance of unary-ness)
Diffstat (limited to 'test')
-rw-r--r-- | test/cpp/end2end/hybrid_end2end_test.cc | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/test/cpp/end2end/hybrid_end2end_test.cc b/test/cpp/end2end/hybrid_end2end_test.cc index 1512e99a3c..eb7125cb04 100644 --- a/test/cpp/end2end/hybrid_end2end_test.cc +++ b/test/cpp/end2end/hybrid_end2end_test.cc @@ -421,31 +421,33 @@ TEST_F(HybridEnd2endTest, AsyncRequestStreamResponseStream_SyncDupService) { request_stream_handler_thread.join(); } -// Add a second service with one sync FCUnary method. -class FCUnaryDupPkg : public duplicate::EchoTestService::WithFCUnaryMethod_Echo< +// Add a second service with one sync streamed unary method. +class StreamedUnaryDupPkg : public + duplicate::EchoTestService::WithStreamedUnaryMethod_Echo< TestServiceImplDupPkg> { public: - Status FCEcho(ServerContext* context, - FCUnary<EchoRequest, EchoResponse>* fc_unary) GRPC_OVERRIDE { + Status StreamedEcho(ServerContext* context, + ServerUnaryStreamer<EchoRequest, EchoResponse>* stream) + GRPC_OVERRIDE { EchoRequest req; EchoResponse resp; uint32_t next_msg_sz; - fc_unary->NextMessageSize(&next_msg_sz); - gpr_log(GPR_INFO, "FC Unary Next Message Size is %u", next_msg_sz); - GPR_ASSERT(fc_unary->Read(&req)); + stream->NextMessageSize(&next_msg_sz); + gpr_log(GPR_INFO, "Streamed Unary Next Message Size is %u", next_msg_sz); + GPR_ASSERT(stream->Read(&req)); resp.set_message(req.message() + "_dup"); - GPR_ASSERT(fc_unary->Write(resp)); + GPR_ASSERT(stream->Write(resp)); return Status::OK; } }; TEST_F(HybridEnd2endTest, - AsyncRequestStreamResponseStream_SyncFCUnaryDupService) { + AsyncRequestStreamResponseStream_SyncStreamedUnaryDupService) { typedef EchoTestService::WithAsyncMethod_RequestStream< EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl>> SType; SType service; - FCUnaryDupPkg dup_service; + StreamedUnaryDupPkg dup_service; SetUpServer(&service, &dup_service, nullptr, 8192); ResetStub(); std::thread response_stream_handler_thread(HandleServerStreaming<SType>, @@ -458,30 +460,31 @@ TEST_F(HybridEnd2endTest, request_stream_handler_thread.join(); } -// Add a second service that is fully FCUnary -class FullyFCUnaryDupPkg : public duplicate::EchoTestService::FCUnaryService { +// Add a second service that is fully Streamed Unary +class FullyStreamedUnaryDupPkg : public duplicate::EchoTestService::StreamedUnaryService { public: - Status FCEcho(ServerContext* context, - FCUnary<EchoRequest, EchoResponse>* fc_unary) GRPC_OVERRIDE { + Status StreamedEcho(ServerContext* context, + ServerUnaryStreamer<EchoRequest, EchoResponse>* stream) + GRPC_OVERRIDE { EchoRequest req; EchoResponse resp; uint32_t next_msg_sz; - fc_unary->NextMessageSize(&next_msg_sz); - gpr_log(GPR_INFO, "FC Unary Next Message Size is %u", next_msg_sz); - GPR_ASSERT(fc_unary->Read(&req)); + stream->NextMessageSize(&next_msg_sz); + gpr_log(GPR_INFO, "Streamed Unary Next Message Size is %u", next_msg_sz); + GPR_ASSERT(stream->Read(&req)); resp.set_message(req.message() + "_dup"); - GPR_ASSERT(fc_unary->Write(resp)); + GPR_ASSERT(stream->Write(resp)); return Status::OK; } }; TEST_F(HybridEnd2endTest, - AsyncRequestStreamResponseStream_SyncFullyFCUnaryDupService) { + AsyncRequestStreamResponseStream_SyncFullyStreamedUnaryDupService) { typedef EchoTestService::WithAsyncMethod_RequestStream< EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl>> SType; SType service; - FullyFCUnaryDupPkg dup_service; + FullyStreamedUnaryDupPkg dup_service; SetUpServer(&service, &dup_service, nullptr, 8192); ResetStub(); std::thread response_stream_handler_thread(HandleServerStreaming<SType>, |