From d417f01e2eebeedfaae76b40667372bd0fb21fea Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 18 Jan 2015 14:29:08 +0100 Subject: Use jobs in queries, sync works again. --- tests/dummyresourcetest.cpp | 53 +++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 21 deletions(-) (limited to 'tests') diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index c469796..a80d22f 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp @@ -82,27 +82,38 @@ private Q_SLOTS: QCOMPARE(revisionSpy.count(), 2); } - // void testResourceSync() - // { - // Akonadi2::Pipeline pipeline("org.kde.dummy"); - // DummyResource resource; - // auto job = resource.synchronizeWithSource(&pipeline); - // auto future = job.exec(); - // QTRY_VERIFY(future.isFinished()); - // } - - // void testSyncAndFacade() - // { - // Akonadi2::Query query; - // query.resources << "org.kde.dummy"; - - // async::SyncListResult result(Akonadi2::Store::load(query)); - // result.exec(); - // QVERIFY(!result.isEmpty()); - // auto value = result.first(); - // QVERIFY(!value->getProperty("summary").toString().isEmpty()); - // qDebug() << value->getProperty("summary").toString(); - // } + void testWriteToFacade() + { + Akonadi2::Query query; + Akonadi2::Domain::Event event; + event.setProperty("summary", "summaryValue"); + Akonadi2::Store::create(event, "org.kde.dummy"); + + QTest::qWait(1000); + //TODO wait for success response + } + + void testResourceSync() + { + Akonadi2::Pipeline pipeline("org.kde.dummy"); + DummyResource resource; + auto job = resource.synchronizeWithSource(&pipeline); + auto future = job.exec(); + QTRY_VERIFY(future.isFinished()); + } + + void testSyncAndFacade() + { + Akonadi2::Query query; + query.resources << "org.kde.dummy"; + + async::SyncListResult result(Akonadi2::Store::load(query)); + result.exec(); + QVERIFY(!result.isEmpty()); + auto value = result.first(); + QVERIFY(!value->getProperty("summary").toString().isEmpty()); + qDebug() << value->getProperty("summary").toString(); + } }; -- cgit v1.2.3