|
@@ -237,7 +237,7 @@ TEST_P(ClientTest, StringEchoStreamTest)
|
|
QEventLoop waiter;
|
|
QEventLoop waiter;
|
|
|
|
|
|
int i = 0;
|
|
int i = 0;
|
|
- auto stream = testClient->subscribeTestMethodServerStream(request);
|
|
|
|
|
|
+ auto stream = testClient->streamTestMethodServerStream(request);
|
|
QObject::connect(stream.get(), &QGrpcStream::messageReceived, &m_app, [&result, &i, &waiter, stream]() {
|
|
QObject::connect(stream.get(), &QGrpcStream::messageReceived, &m_app, [&result, &i, &waiter, stream]() {
|
|
SimpleStringMessage ret = stream->read<SimpleStringMessage>();
|
|
SimpleStringMessage ret = stream->read<SimpleStringMessage>();
|
|
|
|
|
|
@@ -269,7 +269,7 @@ TEST_P(ClientTest, StringEchoStreamAbortTest)
|
|
QEventLoop waiter;
|
|
QEventLoop waiter;
|
|
|
|
|
|
int i = 0;
|
|
int i = 0;
|
|
- auto stream = testClient->subscribeTestMethodServerStream(request);
|
|
|
|
|
|
+ auto stream = testClient->streamTestMethodServerStream(request);
|
|
QObject::connect(stream.get(), &QGrpcStream::messageReceived, &m_app, [&result, &i, &waiter, stream]() {
|
|
QObject::connect(stream.get(), &QGrpcStream::messageReceived, &m_app, [&result, &i, &waiter, stream]() {
|
|
SimpleStringMessage ret = stream->read<SimpleStringMessage>();
|
|
SimpleStringMessage ret = stream->read<SimpleStringMessage>();
|
|
++i;
|
|
++i;
|
|
@@ -301,7 +301,7 @@ TEST_P(ClientTest, StringEchoStreamAbortByTimerTest)
|
|
|
|
|
|
|
|
|
|
int i = 0;
|
|
int i = 0;
|
|
- auto stream = testClient->subscribeTestMethodServerStream(request);
|
|
|
|
|
|
+ auto stream = testClient->streamTestMethodServerStream(request);
|
|
QTimer::singleShot(3500, stream.get(), [stream]() {
|
|
QTimer::singleShot(3500, stream.get(), [stream]() {
|
|
stream->cancel();
|
|
stream->cancel();
|
|
});
|
|
});
|
|
@@ -343,7 +343,7 @@ TEST_P(ClientTest, StringEchoStreamTestRet)
|
|
|
|
|
|
QEventLoop waiter;
|
|
QEventLoop waiter;
|
|
|
|
|
|
- testClient->subscribeTestMethodServerStream(request, result);
|
|
|
|
|
|
+ testClient->streamTestMethodServerStream(request, result);
|
|
|
|
|
|
int i = 0;
|
|
int i = 0;
|
|
QObject::connect(result.data(), &SimpleStringMessage::testFieldStringChanged, &m_app, [&i]() {
|
|
QObject::connect(result.data(), &SimpleStringMessage::testFieldStringChanged, &m_app, [&i]() {
|
|
@@ -372,7 +372,7 @@ TEST_P(ClientTest, HugeBlobEchoStreamTest)
|
|
QByteArray dataHash = QCryptographicHash::hash(request.testBytes(), QCryptographicHash::Sha256);
|
|
QByteArray dataHash = QCryptographicHash::hash(request.testBytes(), QCryptographicHash::Sha256);
|
|
QEventLoop waiter;
|
|
QEventLoop waiter;
|
|
|
|
|
|
- auto stream = testClient->subscribeTestMethodBlobServerStream(request);
|
|
|
|
|
|
+ auto stream = testClient->streamTestMethodBlobServerStream(request);
|
|
|
|
|
|
QObject::connect(stream.get(), &QGrpcStream::messageReceived, &m_app, [&result, &waiter, stream]() {
|
|
QObject::connect(stream.get(), &QGrpcStream::messageReceived, &m_app, [&result, &waiter, stream]() {
|
|
BlobMessage ret = stream->read<BlobMessage>();
|
|
BlobMessage ret = stream->read<BlobMessage>();
|
|
@@ -510,7 +510,7 @@ TEST_F(ClientTest, ClientSyncTestUnattachedChannelSignal)
|
|
delete ret;
|
|
delete ret;
|
|
}
|
|
}
|
|
|
|
|
|
-TEST_P(ClientTest, AsyncReplySubscribeTest)
|
|
|
|
|
|
+TEST_P(ClientTest, AsyncReplyStreamTest)
|
|
{
|
|
{
|
|
auto testClient = (*GetParam())();
|
|
auto testClient = (*GetParam())();
|
|
QTimer callTimeout;
|
|
QTimer callTimeout;
|
|
@@ -523,7 +523,7 @@ TEST_P(ClientTest, AsyncReplySubscribeTest)
|
|
callTimeout.setInterval(5000);
|
|
callTimeout.setInterval(5000);
|
|
auto reply = testClient->testMethodStatusMessage(request);
|
|
auto reply = testClient->testMethodStatusMessage(request);
|
|
|
|
|
|
- reply->subscribe(&m_app, []() {
|
|
|
|
|
|
+ reply->stream(&m_app, []() {
|
|
ASSERT_TRUE(false);
|
|
ASSERT_TRUE(false);
|
|
},
|
|
},
|
|
[&asyncStatus, &waiter, &statusMessage](const QGrpcStatus &status) {
|
|
[&asyncStatus, &waiter, &statusMessage](const QGrpcStatus &status) {
|
|
@@ -542,7 +542,7 @@ TEST_P(ClientTest, AsyncReplySubscribeTest)
|
|
request.setTestFieldString("Hello beach!");
|
|
request.setTestFieldString("Hello beach!");
|
|
|
|
|
|
reply = testClient->testMethod(request);
|
|
reply = testClient->testMethod(request);
|
|
- reply->subscribe(&m_app, [reply, &result, &waiter]() {
|
|
|
|
|
|
+ reply->stream(&m_app, [reply, &result, &waiter]() {
|
|
result = reply->read<SimpleStringMessage>();
|
|
result = reply->read<SimpleStringMessage>();
|
|
waiter.quit();
|
|
waiter.quit();
|
|
});
|
|
});
|
|
@@ -556,7 +556,7 @@ TEST_P(ClientTest, AsyncReplySubscribeTest)
|
|
request.setTestFieldString("Hello beach1!");
|
|
request.setTestFieldString("Hello beach1!");
|
|
|
|
|
|
reply = testClient->testMethod(request);
|
|
reply = testClient->testMethod(request);
|
|
- reply->subscribe(&m_app, [reply, &result, &waiter]() {
|
|
|
|
|
|
+ reply->stream(&m_app, [reply, &result, &waiter]() {
|
|
result = reply->read<SimpleStringMessage>();
|
|
result = reply->read<SimpleStringMessage>();
|
|
waiter.quit();
|
|
waiter.quit();
|
|
}, []() {
|
|
}, []() {
|
|
@@ -578,8 +578,8 @@ TEST_P(ClientTest, MultipleStreamsTest)
|
|
QEventLoop waiter;
|
|
QEventLoop waiter;
|
|
request.setTestFieldString("Stream");
|
|
request.setTestFieldString("Stream");
|
|
|
|
|
|
- auto stream = testClient->subscribeTestMethodServerStream(request);
|
|
|
|
- auto streamNext = testClient->subscribeTestMethodServerStream(request);
|
|
|
|
|
|
+ auto stream = testClient->streamTestMethodServerStream(request);
|
|
|
|
+ auto streamNext = testClient->streamTestMethodServerStream(request);
|
|
|
|
|
|
ASSERT_EQ(stream, streamNext);
|
|
ASSERT_EQ(stream, streamNext);
|
|
|
|
|
|
@@ -606,8 +606,8 @@ TEST_P(ClientTest, MultipleStreamsCancelTest)
|
|
SimpleStringMessage request;
|
|
SimpleStringMessage request;
|
|
request.setTestFieldString("Stream");
|
|
request.setTestFieldString("Stream");
|
|
|
|
|
|
- auto stream = testClient->subscribeTestMethodServerStream(request);
|
|
|
|
- auto streamNext = testClient->subscribeTestMethodServerStream(request);
|
|
|
|
|
|
+ auto stream = testClient->streamTestMethodServerStream(request);
|
|
|
|
+ auto streamNext = testClient->streamTestMethodServerStream(request);
|
|
|
|
|
|
ASSERT_EQ(stream, streamNext);
|
|
ASSERT_EQ(stream, streamNext);
|
|
|
|
|
|
@@ -626,10 +626,10 @@ TEST_P(ClientTest, MultipleStreamsCancelTest)
|
|
ASSERT_TRUE(isFinished);
|
|
ASSERT_TRUE(isFinished);
|
|
ASSERT_TRUE(isFinishedNext);
|
|
ASSERT_TRUE(isFinishedNext);
|
|
|
|
|
|
- stream = testClient->subscribeTestMethodServerStream(request);
|
|
|
|
|
|
+ stream = testClient->streamTestMethodServerStream(request);
|
|
ASSERT_NE(stream, streamNext);
|
|
ASSERT_NE(stream, streamNext);
|
|
|
|
|
|
- streamNext = testClient->subscribeTestMethodServerStream(request);
|
|
|
|
|
|
+ streamNext = testClient->streamTestMethodServerStream(request);
|
|
|
|
|
|
ASSERT_EQ(stream, streamNext);
|
|
ASSERT_EQ(stream, streamNext);
|
|
|
|
|
|
@@ -744,7 +744,7 @@ TEST_P(ClientTest, StringEchoStreamThreadTest)
|
|
std::shared_ptr<QThread> thread(QThread::create([&](){
|
|
std::shared_ptr<QThread> thread(QThread::create([&](){
|
|
QEventLoop waiter;
|
|
QEventLoop waiter;
|
|
QThread *validThread = QThread::currentThread();
|
|
QThread *validThread = QThread::currentThread();
|
|
- auto stream = testClient->subscribeTestMethodServerStream(request);
|
|
|
|
|
|
+ auto stream = testClient->streamTestMethodServerStream(request);
|
|
QObject::connect(stream.get(), &QGrpcStream::messageReceived, &waiter, [&result, &i, &waiter, stream, &threadsOk, validThread]() {
|
|
QObject::connect(stream.get(), &QGrpcStream::messageReceived, &waiter, [&result, &i, &waiter, stream, &threadsOk, validThread]() {
|
|
SimpleStringMessage ret = stream->read<SimpleStringMessage>();
|
|
SimpleStringMessage ret = stream->read<SimpleStringMessage>();
|
|
result.setTestFieldString(result.testFieldString() + ret.testFieldString());
|
|
result.setTestFieldString(result.testFieldString() + ret.testFieldString());
|
|
@@ -796,7 +796,7 @@ TEST_P(ClientTest, StreamCancelWhileErrorTimeoutTest)
|
|
QEventLoop waiter;
|
|
QEventLoop waiter;
|
|
|
|
|
|
bool ok = false;
|
|
bool ok = false;
|
|
- auto stream = testClient->subscribeTestMethodServerStream(request);
|
|
|
|
|
|
+ auto stream = testClient->streamTestMethodServerStream(request);
|
|
QObject::connect(stream.get(), &QGrpcStream::finished, &m_app, [&ok, &waiter]() {
|
|
QObject::connect(stream.get(), &QGrpcStream::finished, &m_app, [&ok, &waiter]() {
|
|
ok = true;
|
|
ok = true;
|
|
waiter.quit();
|
|
waiter.quit();
|