|
|
|
@ -354,40 +354,41 @@ class HybridEnd2endTest : public ::testing::Test { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
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< |
|
|
|
|
typedef EchoTestService::WithAsyncMethod_RequestStream< |
|
|
|
|
EchoTestService::WithAsyncMethod_Echo<TestServiceImpl>> |
|
|
|
|
service; |
|
|
|
|
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< |
|
|
|
|
typedef EchoTestService::WithAsyncMethod_RequestStream< |
|
|
|
|
EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl>> |
|
|
|
|
service; |
|
|
|
|
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< |
|
|
|
|
typedef EchoTestService::WithAsyncMethod_RequestStream< |
|
|
|
|
EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl>> |
|
|
|
|
service; |
|
|
|
|
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< |
|
|
|
|
typedef EchoTestService::WithAsyncMethod_RequestStream< |
|
|
|
|
EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl>> |
|
|
|
|
service; |
|
|
|
|
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< |
|
|
|
|
typedef EchoTestService::WithAsyncMethod_RequestStream< |
|
|
|
|
EchoTestService::WithGenericMethod_Echo<TestServiceImpl>> |
|
|
|
|
service; |
|
|
|
|
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< |
|
|
|
|
typedef EchoTestService::WithAsyncMethod_RequestStream< |
|
|
|
|
EchoTestService::WithGenericMethod_Echo<TestServiceImpl>> |
|
|
|
|
service; |
|
|
|
|
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< |
|
|
|
|
typedef EchoTestService::WithAsyncMethod_RequestStream< |
|
|
|
|
EchoTestService::WithGenericMethod_Echo<TestServiceImpl>> |
|
|
|
|
service; |
|
|
|
|
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; |
|
|
|
|
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; |
|
|
|
|
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(); |
|
|
|
|