From 78284e0963d93e3e0f85e2165013412580a3b8c1 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 14 Jan 2016 18:52:04 +0100 Subject: Got rid of all uses of Query::syncOnDemand and Query::processAll --- tests/dummyresourcebenchmark.cpp | 6 +---- tests/dummyresourcetest.cpp | 28 +++++++----------------- tests/maildirresourcetest.cpp | 47 +++++++++++++++------------------------- tests/modelinteractivitytest.cpp | 4 +--- tests/querytest.cpp | 31 +++++--------------------- 5 files changed, 34 insertions(+), 82 deletions(-) (limited to 'tests') diff --git a/tests/dummyresourcebenchmark.cpp b/tests/dummyresourcebenchmark.cpp index aad86c0..c52eee3 100644 --- a/tests/dummyresourcebenchmark.cpp +++ b/tests/dummyresourcebenchmark.cpp @@ -92,9 +92,7 @@ private Q_SLOTS: { Akonadi2::Query query; query.resources << "org.kde.dummy.instance1"; - query.syncOnDemand = false; - query.processAll = true; - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); } auto allProcessedTime = time.elapsed(); @@ -123,8 +121,6 @@ private Q_SLOTS: time.start(); Akonadi2::Query query; query.resources << "org.kde.dummy.instance1"; - query.syncOnDemand = false; - query.processAll = false; query.propertyFilter.insert("uid", "testuid"); auto model = Akonadi2::Store::loadModel(query); diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index 0e1f382..72a24b6 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp @@ -62,11 +62,9 @@ private Q_SLOTS: Akonadi2::Query query; query.resources << "org.kde.dummy.instance1"; - query.syncOnDemand = false; - query.processAll = true; //Ensure all local data is processed - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); query.propertyFilter.insert("uid", "testuid"); auto model = Akonadi2::Store::loadModel(query); @@ -88,11 +86,9 @@ private Q_SLOTS: Akonadi2::Query query; query.resources << "org.kde.dummy.instance1"; - query.syncOnDemand = false; - query.processAll = true; //Ensure all local data is processed - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); query.propertyFilter.insert("uid", "testuid"); @@ -118,11 +114,9 @@ private Q_SLOTS: Akonadi2::Query query; query.resources << "org.kde.dummy.instance1"; - query.syncOnDemand = false; - query.processAll = true; //Ensure all local data is processed - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); query.propertyFilter.insert("summary", "summaryValue2"); @@ -153,11 +147,10 @@ private Q_SLOTS: { Akonadi2::Query query; query.resources << "org.kde.dummy.instance1"; - query.syncOnDemand = true; - query.processAll = true; //Ensure all local data is processed Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); auto model = Akonadi2::Store::loadModel(query); QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); @@ -171,11 +164,10 @@ private Q_SLOTS: { Akonadi2::Query query; query.resources << "org.kde.dummy.instance1"; - query.syncOnDemand = true; - query.processAll = true; //Ensure all local data is processed Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); auto model = Akonadi2::Store::loadModel(query); QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); @@ -195,12 +187,10 @@ private Q_SLOTS: Akonadi2::Query query; query.resources << "org.kde.dummy.instance1"; - query.syncOnDemand = false; - query.processAll = true; query.propertyFilter.insert("uid", "testuid"); //Ensure all local data is processed - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); //Test create Akonadi2::ApplicationDomain::Event event2; @@ -219,7 +209,7 @@ private Q_SLOTS: Akonadi2::Store::modify(event2).exec().waitForFinished(); //Ensure all local data is processed - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); //Test modify { @@ -234,7 +224,7 @@ private Q_SLOTS: Akonadi2::Store::remove(event2).exec().waitForFinished(); //Ensure all local data is processed - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); //Test remove { @@ -249,8 +239,6 @@ private Q_SLOTS: Akonadi2::Query query; query.resources << "org.kde.dummy.instance1"; - query.syncOnDemand = false; - query.processAll = true; query.liveQuery = true; query.propertyFilter.insert("uid", "testuid"); diff --git a/tests/maildirresourcetest.cpp b/tests/maildirresourcetest.cpp index b61190d..3e07d93 100644 --- a/tests/maildirresourcetest.cpp +++ b/tests/maildirresourcetest.cpp @@ -87,11 +87,10 @@ private Q_SLOTS: { Akonadi2::Query query; query.resources << "org.kde.maildir.instance1"; - query.syncOnDemand = true; - query.processAll = true; //Ensure all local data is processed Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); auto model = Akonadi2::Store::loadModel(query); QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); @@ -102,12 +101,11 @@ private Q_SLOTS: { Akonadi2::Query query; query.resources << "org.kde.maildir.instance1"; - query.syncOnDemand = true; - query.processAll = true; query.parentProperty = "parent"; //Ensure all local data is processed Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); auto model = Akonadi2::Store::loadModel(query); QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); @@ -124,10 +122,8 @@ private Q_SLOTS: using namespace Akonadi2::ApplicationDomain; //Ensure all local data is processed auto query = Query::ResourceFilter("org.kde.maildir.instance1"); - query.processAll = true; - query.syncOnDemand = true; Store::synchronize(query).exec().waitForFinished(); - // Store::flushMessageQueues(Query::ResourceFilter("org.kde.maildir.instance1")).exec().waitForFinished(); + Store::flushMessageQueue(query.resources).exec().waitForFinished(); auto result = Store::fetchOne( Query::ResourceFilter("org.kde.maildir.instance1") + Query::RequestedProperties(QByteArrayList() << "name") ) @@ -150,11 +146,10 @@ private Q_SLOTS: Akonadi2::Query query; query.resources << "org.kde.maildir.instance1"; query.requestedProperties << "folder" << "subject" << "mimeMessage" << "date"; - query.syncOnDemand = true; - query.processAll = true; //Ensure all local data is processed Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); auto mailModel = Akonadi2::Store::loadModel(query); QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); @@ -170,12 +165,11 @@ private Q_SLOTS: { Akonadi2::Query query; query.resources << "org.kde.maildir.instance1"; - query.syncOnDemand = true; - query.processAll = true; query.requestedProperties << "name"; //Ensure all local data is processed Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); auto targetPath = tempDir.path() + "/maildir1/"; QDir dir(targetPath); @@ -183,6 +177,7 @@ private Q_SLOTS: //Ensure all local data is processed Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); auto model = Akonadi2::Store::loadModel(query); QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); @@ -194,15 +189,15 @@ private Q_SLOTS: { Akonadi2::Query query; query.resources << "org.kde.maildir.instance1"; - query.syncOnDemand = true; - query.processAll = true; query.requestedProperties << "folder" << "subject"; //Ensure all local data is processed Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); //Ensure all local data is processed Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); auto mailModel = Akonadi2::Store::loadModel(query); QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); @@ -213,12 +208,11 @@ private Q_SLOTS: { Akonadi2::Query query; query.resources << "org.kde.maildir.instance1"; - query.syncOnDemand = true; - query.processAll = true; query.requestedProperties << "folder" << "subject"; //Ensure all local data is processed Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); auto targetPath = tempDir.path() + "/maildir1/cur/1365777830.R28.localhost.localdomain:2,S"; QFile file(targetPath); @@ -226,6 +220,7 @@ private Q_SLOTS: //Ensure all local data is processed Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); auto mailModel = Akonadi2::Store::loadModel(query); QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); @@ -236,11 +231,9 @@ private Q_SLOTS: { Akonadi2::Query query; query.resources << "org.kde.maildir.instance1"; - query.syncOnDemand = false; - query.processAll = true; //Ensure all local data is processed - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); Akonadi2::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); folder.setProperty("name", "testCreateFolder"); @@ -248,7 +241,7 @@ private Q_SLOTS: Akonadi2::Store::create(folder).exec().waitForFinished(); //Ensure all local data is processed - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; QFileInfo file(targetPath); @@ -260,15 +253,13 @@ private Q_SLOTS: { Akonadi2::Query query; query.resources << "org.kde.maildir.instance1"; - query.syncOnDemand = false; - query.processAll = true; auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; Akonadi2::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); folder.setProperty("name", "testCreateFolder"); Akonadi2::Store::create(folder).exec().waitForFinished(); - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); QTRY_VERIFY(QFileInfo(targetPath).exists()); Akonadi2::Query folderQuery; @@ -280,7 +271,7 @@ private Q_SLOTS: auto createdFolder = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value(); Akonadi2::Store::remove(*createdFolder).exec().waitForFinished(); - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); QTRY_VERIFY(!QFileInfo(targetPath).exists()); } @@ -288,11 +279,9 @@ private Q_SLOTS: { Akonadi2::Query query; query.resources << "org.kde.maildir.instance1"; - query.syncOnDemand = false; - query.processAll = true; //Ensure all local data is processed - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); Akonadi2::ApplicationDomain::Mail mail("org.kde.maildir.instance1"); mail.setProperty("name", "testCreateMail"); @@ -300,7 +289,7 @@ private Q_SLOTS: Akonadi2::Store::create(mail).exec().waitForFinished(); //Ensure all local data is processed - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); auto targetPath = tempDir.path() + "/maildir1/new"; QDir dir(targetPath); @@ -312,9 +301,8 @@ private Q_SLOTS: { Akonadi2::Query query; query.resources << "org.kde.maildir.instance1"; - query.syncOnDemand = true; - query.processAll = true; Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); Akonadi2::Query folderQuery; folderQuery.resources << "org.kde.maildir.instance1"; @@ -334,6 +322,7 @@ private Q_SLOTS: Akonadi2::Store::remove(*mail).exec().waitForFinished(); Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); QTRY_COMPARE(QDir(tempDir.path() + "/maildir1/cur", QString(), QDir::NoSort, QDir::Files).count(), static_cast(0)); } diff --git a/tests/modelinteractivitytest.cpp b/tests/modelinteractivitytest.cpp index 52db932..59c2c6f 100644 --- a/tests/modelinteractivitytest.cpp +++ b/tests/modelinteractivitytest.cpp @@ -73,11 +73,9 @@ private Q_SLOTS: Akonadi2::Query query; query.resources << "org.kde.dummy.instance1"; - query.syncOnDemand = false; - query.processAll = true; query.liveQuery = true; - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); //Test QTime time; diff --git a/tests/querytest.cpp b/tests/querytest.cpp index e09f7a4..f9344cd 100644 --- a/tests/querytest.cpp +++ b/tests/querytest.cpp @@ -48,8 +48,6 @@ private Q_SLOTS: //Test Akonadi2::Query query; query.resources << "foobar"; - query.syncOnDemand = false; - query.processAll = false; query.liveQuery = true; //We fetch before the data is available and rely on the live query mechanism to deliver the actual data @@ -70,8 +68,6 @@ private Q_SLOTS: //Test Akonadi2::Query query; query.resources << "org.kde.dummy.instance1"; - query.syncOnDemand = false; - query.processAll = false; query.liveQuery = true; //We fetch before the data is available and rely on the live query mechanism to deliver the actual data @@ -91,12 +87,10 @@ private Q_SLOTS: //Test Akonadi2::Query query; query.resources << "org.kde.dummy.instance1"; - query.syncOnDemand = false; - query.processAll = true; query.liveQuery = false; //Ensure all local data is processed - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data auto model = Akonadi2::Store::loadModel(query); @@ -150,8 +144,6 @@ private Q_SLOTS: //Test Akonadi2::Query query; query.resources << "org.kde.dummy.instance1"; - query.syncOnDemand = false; - query.processAll = false; query.liveQuery = true; //We fetch before the data is available and rely on the live query mechanism to deliver the actual data @@ -171,11 +163,9 @@ private Q_SLOTS: Akonadi2::Query query; query.resources << "org.kde.dummy.instance1"; - query.syncOnDemand = false; - query.processAll = true; //Ensure all local data is processed - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); auto model = Akonadi2::Store::loadModel(query); QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); @@ -192,12 +182,10 @@ private Q_SLOTS: //Test Akonadi2::Query query; query.resources << "org.kde.dummy.instance1"; - query.syncOnDemand = false; - query.processAll = true; query.parentProperty = "parent"; //Ensure all local data is processed - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data auto model = Akonadi2::Store::loadModel(query); @@ -222,13 +210,11 @@ private Q_SLOTS: //Test Akonadi2::Query query; query.resources << "org.kde.dummy.instance1"; - query.syncOnDemand = false; - query.processAll = true; query.liveQuery = false; query.propertyFilter.insert("uid", "test1"); //Ensure all local data is processed - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); //We fetch before the data is available and rely on the live query mechanism to deliver the actual data auto model = Akonadi2::Store::loadModel(query); @@ -246,11 +232,9 @@ private Q_SLOTS: Akonadi2::Query query; query.resources << "org.kde.dummy.instance1"; - query.syncOnDemand = false; - query.processAll = true; //Ensure all local data is processed - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); auto model = Akonadi2::Store::loadModel(query); QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); @@ -268,13 +252,10 @@ private Q_SLOTS: //Test Akonadi2::Query query; query.resources << "org.kde.dummy.instance1"; - query.syncOnDemand = false; - query.processAll = true; - query.liveQuery = false; query.propertyFilter.insert("folder", folderEntity->identifier()); //Ensure all local data is processed - Akonadi2::Store::synchronize(query).exec().waitForFinished(); + Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); //We fetch before the data is available and rely on the live query mechanism to deliver the actual data auto model = Akonadi2::Store::loadModel(query); -- cgit v1.2.3