|
@@ -106,7 +106,7 @@ TEST_F(ClientTest, CheckMethodsGeneration)
|
|
QPointer<SimpleStringMessage> result(new SimpleStringMessage);
|
|
QPointer<SimpleStringMessage> result(new SimpleStringMessage);
|
|
testClient.testMethod(request, result);
|
|
testClient.testMethod(request, result);
|
|
testClient.testMethod(request);
|
|
testClient.testMethod(request);
|
|
- testClient.testMethod(request, &testClient, [](QGrpcAsyncReplyShared) {});
|
|
|
|
|
|
+ testClient.testMethod(request, &testClient, [](QGrpcCallReplyShared) {});
|
|
delete result;
|
|
delete result;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -130,8 +130,8 @@ TEST_P(ClientTest, StringEchoAsyncTest)
|
|
request.setTestFieldString("Hello beach!");
|
|
request.setTestFieldString("Hello beach!");
|
|
QEventLoop waiter;
|
|
QEventLoop waiter;
|
|
|
|
|
|
- QGrpcAsyncReplyShared reply = testClient->testMethod(request);
|
|
|
|
- QObject::connect(reply.get(), &QGrpcAsyncReply::finished, &m_app, [reply, &result, &waiter]() {
|
|
|
|
|
|
+ QGrpcCallReplyShared reply = testClient->testMethod(request);
|
|
|
|
+ QObject::connect(reply.get(), &QGrpcCallReply::finished, &m_app, [reply, &result, &waiter]() {
|
|
result = reply->read<SimpleStringMessage>();
|
|
result = reply->read<SimpleStringMessage>();
|
|
reply->deleteLater();
|
|
reply->deleteLater();
|
|
waiter.quit();
|
|
waiter.quit();
|
|
@@ -149,7 +149,7 @@ TEST_P(ClientTest, StringEchoAsync2Test)
|
|
SimpleStringMessage request;
|
|
SimpleStringMessage request;
|
|
request.setTestFieldString("Hello beach!");
|
|
request.setTestFieldString("Hello beach!");
|
|
QEventLoop waiter;
|
|
QEventLoop waiter;
|
|
- testClient->testMethod(request, &m_app, [&result, &waiter](QGrpcAsyncReplyShared reply) {
|
|
|
|
|
|
+ testClient->testMethod(request, &m_app, [&result, &waiter](QGrpcCallReplyShared reply) {
|
|
result = reply->read<SimpleStringMessage>();
|
|
result = reply->read<SimpleStringMessage>();
|
|
waiter.quit();
|
|
waiter.quit();
|
|
});
|
|
});
|
|
@@ -167,17 +167,17 @@ TEST_P(ClientTest, StringEchoImmediateAsyncAbortTest)
|
|
SimpleStringMessage request;
|
|
SimpleStringMessage request;
|
|
request.setTestFieldString("sleep");
|
|
request.setTestFieldString("sleep");
|
|
QEventLoop waiter;
|
|
QEventLoop waiter;
|
|
- QGrpcAsyncReplyShared reply = testClient->testMethod(request);
|
|
|
|
|
|
+ QGrpcCallReplyShared reply = testClient->testMethod(request);
|
|
|
|
|
|
result.setTestFieldString("Result not changed by echo");
|
|
result.setTestFieldString("Result not changed by echo");
|
|
- QObject::connect(reply.get(), &QGrpcAsyncReply::finished, &m_app, [&waiter, &result, reply]() {
|
|
|
|
|
|
+ QObject::connect(reply.get(), &QGrpcCallReply::finished, &m_app, [&waiter, &result, reply]() {
|
|
result = reply->read<SimpleStringMessage>();
|
|
result = reply->read<SimpleStringMessage>();
|
|
reply->deleteLater();
|
|
reply->deleteLater();
|
|
waiter.quit();
|
|
waiter.quit();
|
|
});
|
|
});
|
|
|
|
|
|
QGrpcStatus::StatusCode asyncStatus = QGrpcStatus::StatusCode::Ok;
|
|
QGrpcStatus::StatusCode asyncStatus = QGrpcStatus::StatusCode::Ok;
|
|
- QObject::connect(reply.get(), &QGrpcAsyncReply::error, [&asyncStatus](const QGrpcStatus &status) {
|
|
|
|
|
|
+ QObject::connect(reply.get(), &QGrpcCallReply::error, [&asyncStatus](const QGrpcStatus &status) {
|
|
asyncStatus = status.code();
|
|
asyncStatus = status.code();
|
|
});
|
|
});
|
|
|
|
|
|
@@ -204,20 +204,20 @@ TEST_P(ClientTest, StringEchoDeferredAsyncAbortTest)
|
|
SimpleStringMessage request;
|
|
SimpleStringMessage request;
|
|
request.setTestFieldString("sleep");
|
|
request.setTestFieldString("sleep");
|
|
QEventLoop waiter;
|
|
QEventLoop waiter;
|
|
- QGrpcAsyncReplyShared reply = testClient->testMethod(request);
|
|
|
|
|
|
+ QGrpcCallReplyShared reply = testClient->testMethod(request);
|
|
|
|
|
|
result.setTestFieldString("Result not changed by echo");
|
|
result.setTestFieldString("Result not changed by echo");
|
|
bool errorCalled = false;
|
|
bool errorCalled = false;
|
|
reply = testClient->testMethod(request);
|
|
reply = testClient->testMethod(request);
|
|
- QObject::connect(reply.get(), &QGrpcAsyncReply::finished, &m_app, [reply, &result, &waiter]() {
|
|
|
|
|
|
+ QObject::connect(reply.get(), &QGrpcCallReply::finished, &m_app, [reply, &result, &waiter]() {
|
|
result = reply->read<SimpleStringMessage>();
|
|
result = reply->read<SimpleStringMessage>();
|
|
waiter.quit();
|
|
waiter.quit();
|
|
});
|
|
});
|
|
- QObject::connect(reply.get(), &QGrpcAsyncReply::error, [&errorCalled]() {
|
|
|
|
|
|
+ QObject::connect(reply.get(), &QGrpcCallReply::error, [&errorCalled]() {
|
|
errorCalled = true;
|
|
errorCalled = true;
|
|
});
|
|
});
|
|
|
|
|
|
- QTimer::singleShot(500, reply.get(), &QGrpcAsyncReply::abort);
|
|
|
|
|
|
+ QTimer::singleShot(500, reply.get(), &QGrpcCallReply::abort);
|
|
QTimer::singleShot(5000, &waiter, &QEventLoop::quit);
|
|
QTimer::singleShot(5000, &waiter, &QEventLoop::quit);
|
|
|
|
|
|
waiter.exec();
|
|
waiter.exec();
|
|
@@ -397,8 +397,8 @@ TEST_P(ClientTest, StatusMessageAsyncTest)
|
|
QEventLoop waiter;
|
|
QEventLoop waiter;
|
|
QString statusMessage;
|
|
QString statusMessage;
|
|
|
|
|
|
- QGrpcAsyncReplyShared reply = testClient->testMethodStatusMessage(request);
|
|
|
|
- QObject::connect(reply.get(), &QGrpcAsyncReply::error, [&asyncStatus, &waiter, &statusMessage](const QGrpcStatus &status) {
|
|
|
|
|
|
+ QGrpcCallReplyShared reply = testClient->testMethodStatusMessage(request);
|
|
|
|
+ QObject::connect(reply.get(), &QGrpcCallReply::error, [&asyncStatus, &waiter, &statusMessage](const QGrpcStatus &status) {
|
|
asyncStatus = status.code();
|
|
asyncStatus = status.code();
|
|
statusMessage = status.message();
|
|
statusMessage = status.message();
|
|
waiter.quit();
|
|
waiter.quit();
|
|
@@ -523,7 +523,7 @@ TEST_P(ClientTest, AsyncReplyStreamTest)
|
|
callTimeout.setInterval(5000);
|
|
callTimeout.setInterval(5000);
|
|
auto reply = testClient->testMethodStatusMessage(request);
|
|
auto reply = testClient->testMethodStatusMessage(request);
|
|
|
|
|
|
- reply->stream(&m_app, []() {
|
|
|
|
|
|
+ reply->subscribe(&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, AsyncReplyStreamTest)
|
|
request.setTestFieldString("Hello beach!");
|
|
request.setTestFieldString("Hello beach!");
|
|
|
|
|
|
reply = testClient->testMethod(request);
|
|
reply = testClient->testMethod(request);
|
|
- reply->stream(&m_app, [reply, &result, &waiter]() {
|
|
|
|
|
|
+ reply->subscribe(&m_app, [reply, &result, &waiter]() {
|
|
result = reply->read<SimpleStringMessage>();
|
|
result = reply->read<SimpleStringMessage>();
|
|
waiter.quit();
|
|
waiter.quit();
|
|
});
|
|
});
|
|
@@ -556,7 +556,7 @@ TEST_P(ClientTest, AsyncReplyStreamTest)
|
|
request.setTestFieldString("Hello beach1!");
|
|
request.setTestFieldString("Hello beach1!");
|
|
|
|
|
|
reply = testClient->testMethod(request);
|
|
reply = testClient->testMethod(request);
|
|
- reply->stream(&m_app, [reply, &result, &waiter]() {
|
|
|
|
|
|
+ reply->subscribe(&m_app, [reply, &result, &waiter]() {
|
|
result = reply->read<SimpleStringMessage>();
|
|
result = reply->read<SimpleStringMessage>();
|
|
waiter.quit();
|
|
waiter.quit();
|
|
}, []() {
|
|
}, []() {
|
|
@@ -710,9 +710,9 @@ TEST_P(ClientTest, StringEchoAsyncThreadTest)
|
|
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();
|
|
- QGrpcAsyncReplyShared reply = testClient->testMethod(request);
|
|
|
|
|
|
+ QGrpcCallReplyShared reply = testClient->testMethod(request);
|
|
QObject::connect(reply.get(), &QObject::destroyed, [&replyDestroyed]{replyDestroyed = true;});
|
|
QObject::connect(reply.get(), &QObject::destroyed, [&replyDestroyed]{replyDestroyed = true;});
|
|
- QObject::connect(reply.get(), &QGrpcAsyncReply::finished, &waiter, [reply, &result, &waiter, &threadsOk, validThread]() {
|
|
|
|
|
|
+ QObject::connect(reply.get(), &QGrpcCallReply::finished, &waiter, [reply, &result, &waiter, &threadsOk, validThread]() {
|
|
threadsOk &= reply->thread() != QThread::currentThread();
|
|
threadsOk &= reply->thread() != QThread::currentThread();
|
|
threadsOk &= validThread == QThread::currentThread();
|
|
threadsOk &= validThread == QThread::currentThread();
|
|
result = reply->read<SimpleStringMessage>();
|
|
result = reply->read<SimpleStringMessage>();
|