aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp
diff options
context:
space:
mode:
authorGravatar vjpai <vpai@google.com>2016-06-15 22:15:00 -0700
committerGravatar vjpai <vpai@google.com>2016-06-15 22:15:00 -0700
commite44d53757a57c86c1a3e2019688093c66221f44f (patch)
treee72f8b8efdace297074178a94f2a5395748f9fc5 /test/cpp
parent679c75f0a67d65f115bb44521f49da3db14c2ad2 (diff)
De-lambda-ify
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/end2end/hybrid_end2end_test.cc169
1 files changed, 84 insertions, 85 deletions
diff --git a/test/cpp/end2end/hybrid_end2end_test.cc b/test/cpp/end2end/hybrid_end2end_test.cc
index 2c05db345b..cdc770d93a 100644
--- a/test/cpp/end2end/hybrid_end2end_test.cc
+++ b/test/cpp/end2end/hybrid_end2end_test.cc
@@ -347,47 +347,48 @@ class HybridEnd2endTest : public ::testing::Test {
}
grpc::testing::UnimplementedService::Service unimplemented_service_;
- std::vector<std::unique_ptr<ServerCompletionQueue> > cqs_;
+ std::vector<std::unique_ptr<ServerCompletionQueue>> cqs_;
std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<Server> server_;
std::ostringstream server_address_;
};
TEST_F(HybridEnd2endTest, AsyncEcho) {
- EchoTestService::WithAsyncMethod_Echo<TestServiceImpl> service;
+ typedef EchoTestService::WithAsyncMethod_Echo<TestServiceImpl> SType;
+ SType service;
SetUpServer(&service, nullptr, nullptr);
ResetStub();
- std::thread echo_handler_thread(
- [this, &service] { HandleEcho(&service, cqs_[0].get(), false); });
+ std::thread echo_handler_thread(HandleEcho<SType>, &service,
+ cqs_[0].get(), false);
TestAllMethods();
echo_handler_thread.join();
}
TEST_F(HybridEnd2endTest, AsyncEchoRequestStream) {
- EchoTestService::WithAsyncMethod_RequestStream<
- EchoTestService::WithAsyncMethod_Echo<TestServiceImpl> >
- service;
+ typedef EchoTestService::WithAsyncMethod_RequestStream<
+ EchoTestService::WithAsyncMethod_Echo<TestServiceImpl>>
+ SType;
+ SType service;
SetUpServer(&service, nullptr, nullptr);
ResetStub();
- std::thread echo_handler_thread(
- [this, &service] { HandleEcho(&service, cqs_[0].get(), false); });
- std::thread request_stream_handler_thread(
- [this, &service] { HandleClientStreaming(&service, cqs_[1].get()); });
+ std::thread echo_handler_thread(HandleEcho<SType>, &service, cqs_[0].get(), false);
+ std::thread request_stream_handler_thread(HandleClientStreaming<SType>, &service, cqs_[1].get());
TestAllMethods();
echo_handler_thread.join();
request_stream_handler_thread.join();
}
TEST_F(HybridEnd2endTest, AsyncRequestStreamResponseStream) {
- EchoTestService::WithAsyncMethod_RequestStream<
- EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl> >
- service;
+ typedef EchoTestService::WithAsyncMethod_RequestStream<
+ EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl>>
+ SType;
+ SType service;
SetUpServer(&service, nullptr, nullptr);
ResetStub();
- std::thread response_stream_handler_thread(
- [this, &service] { HandleServerStreaming(&service, cqs_[0].get()); });
- std::thread request_stream_handler_thread(
- [this, &service] { HandleClientStreaming(&service, cqs_[1].get()); });
+ std::thread response_stream_handler_thread(HandleServerStreaming<SType>,
+ &service, cqs_[0].get());
+ std::thread request_stream_handler_thread(HandleClientStreaming<SType>,
+ &service, cqs_[1].get());
TestAllMethods();
response_stream_handler_thread.join();
request_stream_handler_thread.join();
@@ -395,16 +396,17 @@ TEST_F(HybridEnd2endTest, AsyncRequestStreamResponseStream) {
// Add a second service with one sync method.
TEST_F(HybridEnd2endTest, AsyncRequestStreamResponseStream_SyncDupService) {
- EchoTestService::WithAsyncMethod_RequestStream<
- EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl> >
- service;
+ typedef EchoTestService::WithAsyncMethod_RequestStream<
+ EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl>>
+ SType;
+ SType service;
TestServiceImplDupPkg dup_service;
SetUpServer(&service, &dup_service, nullptr);
ResetStub();
- std::thread response_stream_handler_thread(
- [this, &service] { HandleServerStreaming(&service, cqs_[0].get()); });
- std::thread request_stream_handler_thread(
- [this, &service] { HandleClientStreaming(&service, cqs_[1].get()); });
+ std::thread response_stream_handler_thread(HandleServerStreaming<SType>,
+ &service, cqs_[0].get());
+ std::thread request_stream_handler_thread(HandleClientStreaming<SType>,
+ &service, cqs_[1].get());
TestAllMethods();
SendEchoToDupService();
response_stream_handler_thread.join();
@@ -413,18 +415,18 @@ TEST_F(HybridEnd2endTest, AsyncRequestStreamResponseStream_SyncDupService) {
// Add a second service with one async method.
TEST_F(HybridEnd2endTest, AsyncRequestStreamResponseStream_AsyncDupService) {
- EchoTestService::WithAsyncMethod_RequestStream<
- EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl> >
- service;
+ typedef EchoTestService::WithAsyncMethod_RequestStream<
+ EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl>>
+ SType;
+ SType service;
duplicate::EchoTestService::AsyncService dup_service;
SetUpServer(&service, &dup_service, nullptr);
ResetStub();
- std::thread response_stream_handler_thread(
- [this, &service] { HandleServerStreaming(&service, cqs_[0].get()); });
- std::thread request_stream_handler_thread(
- [this, &service] { HandleClientStreaming(&service, cqs_[1].get()); });
- std::thread echo_handler_thread(
- [this, &dup_service] { HandleEcho(&dup_service, cqs_[2].get(), true); });
+ std::thread response_stream_handler_thread(HandleServerStreaming<SType>,
+ &service, cqs_[0].get());
+ std::thread request_stream_handler_thread(HandleClientStreaming<SType>,
+ &service, cqs_[1].get());
+ std::thread echo_handler_thread(HandleEcho<duplicate::EchoTestService::AsyncService>, &dup_service, cqs_[2].get(), true);
TestAllMethods();
SendEchoToDupService();
response_stream_handler_thread.join();
@@ -437,25 +439,24 @@ TEST_F(HybridEnd2endTest, GenericEcho) {
AsyncGenericService generic_service;
SetUpServer(&service, nullptr, &generic_service);
ResetStub();
- std::thread generic_handler_thread([this, &generic_service] {
- HandleGenericCall(&generic_service, cqs_[0].get());
- });
+ std::thread generic_handler_thread(HandleGenericCall, &generic_service,
+ cqs_[0].get());
TestAllMethods();
generic_handler_thread.join();
}
TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream) {
- EchoTestService::WithAsyncMethod_RequestStream<
- EchoTestService::WithGenericMethod_Echo<TestServiceImpl> >
- service;
+ typedef EchoTestService::WithAsyncMethod_RequestStream<
+ EchoTestService::WithGenericMethod_Echo<TestServiceImpl>>
+ SType;
+ SType service;
AsyncGenericService generic_service;
SetUpServer(&service, nullptr, &generic_service);
ResetStub();
- std::thread generic_handler_thread([this, &generic_service] {
- HandleGenericCall(&generic_service, cqs_[0].get());
- });
- std::thread request_stream_handler_thread(
- [this, &service] { HandleClientStreaming(&service, cqs_[1].get()); });
+ std::thread generic_handler_thread(HandleGenericCall, &generic_service,
+ cqs_[0].get());
+ std::thread request_stream_handler_thread(HandleClientStreaming<SType>,
+ &service, cqs_[1].get());
TestAllMethods();
generic_handler_thread.join();
request_stream_handler_thread.join();
@@ -463,18 +464,18 @@ TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream) {
// Add a second service with one sync method.
TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream_SyncDupService) {
- EchoTestService::WithAsyncMethod_RequestStream<
- EchoTestService::WithGenericMethod_Echo<TestServiceImpl> >
- service;
+ typedef EchoTestService::WithAsyncMethod_RequestStream<
+ EchoTestService::WithGenericMethod_Echo<TestServiceImpl>>
+ SType;
+ SType service;
AsyncGenericService generic_service;
TestServiceImplDupPkg dup_service;
SetUpServer(&service, &dup_service, &generic_service);
ResetStub();
- std::thread generic_handler_thread([this, &generic_service] {
- HandleGenericCall(&generic_service, cqs_[0].get());
- });
- std::thread request_stream_handler_thread(
- [this, &service] { HandleClientStreaming(&service, cqs_[1].get()); });
+ std::thread generic_handler_thread(HandleGenericCall, &generic_service,
+ cqs_[0].get());
+ std::thread request_stream_handler_thread(HandleClientStreaming<SType>,
+ &service, cqs_[1].get());
TestAllMethods();
SendEchoToDupService();
generic_handler_thread.join();
@@ -483,20 +484,19 @@ TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream_SyncDupService) {
// Add a second service with one async method.
TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream_AsyncDupService) {
- EchoTestService::WithAsyncMethod_RequestStream<
- EchoTestService::WithGenericMethod_Echo<TestServiceImpl> >
- service;
+ typedef EchoTestService::WithAsyncMethod_RequestStream<
+ EchoTestService::WithGenericMethod_Echo<TestServiceImpl>>
+ SType;
+ SType service;
AsyncGenericService generic_service;
duplicate::EchoTestService::AsyncService dup_service;
SetUpServer(&service, &dup_service, &generic_service);
ResetStub();
- std::thread generic_handler_thread([this, &generic_service] {
- HandleGenericCall(&generic_service, cqs_[0].get());
- });
- std::thread request_stream_handler_thread(
- [this, &service] { HandleClientStreaming(&service, cqs_[1].get()); });
- std::thread echo_handler_thread(
- [this, &dup_service] { HandleEcho(&dup_service, cqs_[2].get(), true); });
+ std::thread generic_handler_thread(HandleGenericCall, &generic_service,
+ cqs_[0].get());
+ std::thread request_stream_handler_thread(HandleClientStreaming<SType>,
+ &service, cqs_[1].get());
+ std::thread echo_handler_thread(HandleEcho<duplicate::EchoTestService::AsyncService>, &dup_service, cqs_[2].get(), true);
TestAllMethods();
SendEchoToDupService();
generic_handler_thread.join();
@@ -505,20 +505,20 @@ TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream_AsyncDupService) {
}
TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStreamResponseStream) {
- EchoTestService::WithAsyncMethod_RequestStream<
+ typedef EchoTestService::WithAsyncMethod_RequestStream<
EchoTestService::WithGenericMethod_Echo<
- EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl> > >
- service;
+ EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl>>>
+ SType;
+ SType service;
AsyncGenericService generic_service;
SetUpServer(&service, nullptr, &generic_service);
ResetStub();
- std::thread generic_handler_thread([this, &generic_service] {
- HandleGenericCall(&generic_service, cqs_[0].get());
- });
- std::thread request_stream_handler_thread(
- [this, &service] { HandleClientStreaming(&service, cqs_[1].get()); });
- std::thread response_stream_handler_thread(
- [this, &service] { HandleServerStreaming(&service, cqs_[2].get()); });
+ std::thread generic_handler_thread(HandleGenericCall, &generic_service,
+ cqs_[0].get());
+ std::thread request_stream_handler_thread(HandleClientStreaming<SType>,
+ &service, cqs_[1].get());
+ std::thread response_stream_handler_thread(HandleServerStreaming<SType>,
+ &service, cqs_[2].get());
TestAllMethods();
generic_handler_thread.join();
request_stream_handler_thread.join();
@@ -526,21 +526,20 @@ TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStreamResponseStream) {
}
TEST_F(HybridEnd2endTest, GenericEchoRequestStreamAsyncResponseStream) {
- EchoTestService::WithGenericMethod_RequestStream<
+ typedef EchoTestService::WithGenericMethod_RequestStream<
EchoTestService::WithGenericMethod_Echo<
- EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl> > >
- service;
+ EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl>>>
+ SType;
+ SType service;
AsyncGenericService generic_service;
SetUpServer(&service, nullptr, &generic_service);
ResetStub();
- std::thread generic_handler_thread([this, &generic_service] {
- HandleGenericCall(&generic_service, cqs_[0].get());
- });
- std::thread generic_handler_thread2([this, &generic_service] {
- HandleGenericCall(&generic_service, cqs_[1].get());
- });
- std::thread response_stream_handler_thread(
- [this, &service] { HandleServerStreaming(&service, cqs_[2].get()); });
+ std::thread generic_handler_thread(HandleGenericCall, &generic_service,
+ cqs_[0].get());
+ std::thread generic_handler_thread2(HandleGenericCall, &generic_service,
+ cqs_[1].get());
+ std::thread response_stream_handler_thread(HandleServerStreaming<SType>,
+ &service, cqs_[2].get());
TestAllMethods();
generic_handler_thread.join();
generic_handler_thread2.join();
@@ -552,7 +551,7 @@ TEST_F(HybridEnd2endTest, GenericEchoRequestStreamAsyncResponseStream) {
TEST_F(HybridEnd2endTest, GenericMethodWithoutGenericService) {
EchoTestService::WithGenericMethod_RequestStream<
EchoTestService::WithGenericMethod_Echo<
- EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl> > >
+ EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl>>>
service;
SetUpServer(&service, nullptr, nullptr);
EXPECT_EQ(nullptr, server_.get());