summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt2
-rw-r--r--tests/clientapitest.cpp30
-rw-r--r--tests/dummyresourcebenchmark.cpp6
-rw-r--r--tests/dummyresourcetest.cpp28
-rw-r--r--tests/inspectiontest.cpp65
-rw-r--r--tests/maildirresourcetest.cpp178
-rw-r--r--tests/modelinteractivitytest.cpp4
-rw-r--r--tests/querytest.cpp31
-rw-r--r--tests/resourcecommunicationtest.cpp4
9 files changed, 216 insertions, 132 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 1e0f6b5..38e5512 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -51,12 +51,14 @@ auto_tests (
51 databasepopulationandfacadequerybenchmark 51 databasepopulationandfacadequerybenchmark
52 dummyresourcewritebenchmark 52 dummyresourcewritebenchmark
53 modelinteractivitytest 53 modelinteractivitytest
54 inspectiontest
54) 55)
55target_link_libraries(dummyresourcetest akonadi2_resource_dummy) 56target_link_libraries(dummyresourcetest akonadi2_resource_dummy)
56target_link_libraries(dummyresourcebenchmark akonadi2_resource_dummy) 57target_link_libraries(dummyresourcebenchmark akonadi2_resource_dummy)
57target_link_libraries(dummyresourcewritebenchmark akonadi2_resource_dummy) 58target_link_libraries(dummyresourcewritebenchmark akonadi2_resource_dummy)
58target_link_libraries(querytest akonadi2_resource_dummy) 59target_link_libraries(querytest akonadi2_resource_dummy)
59target_link_libraries(modelinteractivitytest akonadi2_resource_dummy) 60target_link_libraries(modelinteractivitytest akonadi2_resource_dummy)
61target_link_libraries(inspectiontest akonadi2_resource_dummy)
60 62
61if (BUILD_MAILDIR) 63if (BUILD_MAILDIR)
62 auto_tests ( 64 auto_tests (
diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp
index 78e1d1e..86150ee 100644
--- a/tests/clientapitest.cpp
+++ b/tests/clientapitest.cpp
@@ -33,6 +33,7 @@ public:
33 KAsync::Job<void> create(const T &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); }; 33 KAsync::Job<void> create(const T &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); };
34 KAsync::Job<void> modify(const T &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); }; 34 KAsync::Job<void> modify(const T &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); };
35 KAsync::Job<void> remove(const T &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); }; 35 KAsync::Job<void> remove(const T &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); };
36 KAsync::Job<void> inspect(const Akonadi2::Inspection &) Q_DECL_OVERRIDE { return KAsync::null<void>(); };
36 QPair<KAsync::Job<void>, typename Akonadi2::ResultEmitter<typename T::Ptr>::Ptr > load(const Akonadi2::Query &query) Q_DECL_OVERRIDE 37 QPair<KAsync::Job<void>, typename Akonadi2::ResultEmitter<typename T::Ptr>::Ptr > load(const Akonadi2::Query &query) Q_DECL_OVERRIDE
37 { 38 {
38 auto resultProvider = new Akonadi2::ResultProvider<typename T::Ptr>(); 39 auto resultProvider = new Akonadi2::ResultProvider<typename T::Ptr>();
@@ -265,9 +266,38 @@ private Q_SLOTS:
265 Akonadi2::Query query; 266 Akonadi2::Query query;
266 query.liveQuery = false; 267 query.liveQuery = false;
267 268
269 int childrenFetchedCount = 0;
268 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); 270 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query);
271 QObject::connect(model.data(), &QAbstractItemModel::dataChanged, [&childrenFetchedCount](const QModelIndex &, const QModelIndex &, const QVector<int> &roles) {
272 if (roles.contains(Akonadi2::Store::ChildrenFetchedRole)) {
273 childrenFetchedCount++;
274 }
275 });
269 QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); 276 QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool());
270 QCOMPARE(model->rowCount(QModelIndex()), 2); 277 QCOMPARE(model->rowCount(QModelIndex()), 2);
278 //Ensure children fetched is only emitted once (when all resources are done)
279 QTest::qWait(50);
280 QCOMPARE(childrenFetchedCount, 1);
281 }
282
283 void testImperativeLoad()
284 {
285 auto facade = DummyResourceFacade<Akonadi2::ApplicationDomain::Event>::registerFacade();
286 facade->results << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create());
287 ResourceConfig::addResource("dummyresource.instance1", "dummyresource");
288
289 Akonadi2::Query query;
290 query.resources << "dummyresource.instance1";
291 query.liveQuery = false;
292
293 bool gotValue = false;
294 auto result = Akonadi2::Store::fetchOne<Akonadi2::ApplicationDomain::Event>(query)
295 .then<void, Akonadi2::ApplicationDomain::Event>([&gotValue](const Akonadi2::ApplicationDomain::Event &event) {
296 gotValue = true;
297 }).exec();
298 result.waitForFinished();
299 QVERIFY(!result.errorCode());
300 QVERIFY(gotValue);
271 } 301 }
272 302
273 303
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:
92 { 92 {
93 Akonadi2::Query query; 93 Akonadi2::Query query;
94 query.resources << "org.kde.dummy.instance1"; 94 query.resources << "org.kde.dummy.instance1";
95 query.syncOnDemand = false; 95 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
96 query.processAll = true;
97 Akonadi2::Store::synchronize(query).exec().waitForFinished();
98 } 96 }
99 auto allProcessedTime = time.elapsed(); 97 auto allProcessedTime = time.elapsed();
100 98
@@ -123,8 +121,6 @@ private Q_SLOTS:
123 time.start(); 121 time.start();
124 Akonadi2::Query query; 122 Akonadi2::Query query;
125 query.resources << "org.kde.dummy.instance1"; 123 query.resources << "org.kde.dummy.instance1";
126 query.syncOnDemand = false;
127 query.processAll = false;
128 124
129 query.propertyFilter.insert("uid", "testuid"); 125 query.propertyFilter.insert("uid", "testuid");
130 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); 126 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(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:
62 62
63 Akonadi2::Query query; 63 Akonadi2::Query query;
64 query.resources << "org.kde.dummy.instance1"; 64 query.resources << "org.kde.dummy.instance1";
65 query.syncOnDemand = false;
66 query.processAll = true;
67 65
68 //Ensure all local data is processed 66 //Ensure all local data is processed
69 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 67 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
70 68
71 query.propertyFilter.insert("uid", "testuid"); 69 query.propertyFilter.insert("uid", "testuid");
72 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); 70 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query);
@@ -88,11 +86,9 @@ private Q_SLOTS:
88 86
89 Akonadi2::Query query; 87 Akonadi2::Query query;
90 query.resources << "org.kde.dummy.instance1"; 88 query.resources << "org.kde.dummy.instance1";
91 query.syncOnDemand = false;
92 query.processAll = true;
93 89
94 //Ensure all local data is processed 90 //Ensure all local data is processed
95 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 91 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
96 92
97 query.propertyFilter.insert("uid", "testuid"); 93 query.propertyFilter.insert("uid", "testuid");
98 94
@@ -118,11 +114,9 @@ private Q_SLOTS:
118 114
119 Akonadi2::Query query; 115 Akonadi2::Query query;
120 query.resources << "org.kde.dummy.instance1"; 116 query.resources << "org.kde.dummy.instance1";
121 query.syncOnDemand = false;
122 query.processAll = true;
123 117
124 //Ensure all local data is processed 118 //Ensure all local data is processed
125 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 119 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
126 120
127 query.propertyFilter.insert("summary", "summaryValue2"); 121 query.propertyFilter.insert("summary", "summaryValue2");
128 122
@@ -153,11 +147,10 @@ private Q_SLOTS:
153 { 147 {
154 Akonadi2::Query query; 148 Akonadi2::Query query;
155 query.resources << "org.kde.dummy.instance1"; 149 query.resources << "org.kde.dummy.instance1";
156 query.syncOnDemand = true;
157 query.processAll = true;
158 150
159 //Ensure all local data is processed 151 //Ensure all local data is processed
160 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 152 Akonadi2::Store::synchronize(query).exec().waitForFinished();
153 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
161 154
162 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); 155 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query);
163 QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); 156 QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1);
@@ -171,11 +164,10 @@ private Q_SLOTS:
171 { 164 {
172 Akonadi2::Query query; 165 Akonadi2::Query query;
173 query.resources << "org.kde.dummy.instance1"; 166 query.resources << "org.kde.dummy.instance1";
174 query.syncOnDemand = true;
175 query.processAll = true;
176 167
177 //Ensure all local data is processed 168 //Ensure all local data is processed
178 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 169 Akonadi2::Store::synchronize(query).exec().waitForFinished();
170 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
179 171
180 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); 172 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query);
181 QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); 173 QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1);
@@ -195,12 +187,10 @@ private Q_SLOTS:
195 187
196 Akonadi2::Query query; 188 Akonadi2::Query query;
197 query.resources << "org.kde.dummy.instance1"; 189 query.resources << "org.kde.dummy.instance1";
198 query.syncOnDemand = false;
199 query.processAll = true;
200 query.propertyFilter.insert("uid", "testuid"); 190 query.propertyFilter.insert("uid", "testuid");
201 191
202 //Ensure all local data is processed 192 //Ensure all local data is processed
203 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 193 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
204 194
205 //Test create 195 //Test create
206 Akonadi2::ApplicationDomain::Event event2; 196 Akonadi2::ApplicationDomain::Event event2;
@@ -219,7 +209,7 @@ private Q_SLOTS:
219 Akonadi2::Store::modify<Akonadi2::ApplicationDomain::Event>(event2).exec().waitForFinished(); 209 Akonadi2::Store::modify<Akonadi2::ApplicationDomain::Event>(event2).exec().waitForFinished();
220 210
221 //Ensure all local data is processed 211 //Ensure all local data is processed
222 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 212 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
223 213
224 //Test modify 214 //Test modify
225 { 215 {
@@ -234,7 +224,7 @@ private Q_SLOTS:
234 Akonadi2::Store::remove<Akonadi2::ApplicationDomain::Event>(event2).exec().waitForFinished(); 224 Akonadi2::Store::remove<Akonadi2::ApplicationDomain::Event>(event2).exec().waitForFinished();
235 225
236 //Ensure all local data is processed 226 //Ensure all local data is processed
237 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 227 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
238 228
239 //Test remove 229 //Test remove
240 { 230 {
@@ -249,8 +239,6 @@ private Q_SLOTS:
249 239
250 Akonadi2::Query query; 240 Akonadi2::Query query;
251 query.resources << "org.kde.dummy.instance1"; 241 query.resources << "org.kde.dummy.instance1";
252 query.syncOnDemand = false;
253 query.processAll = true;
254 query.liveQuery = true; 242 query.liveQuery = true;
255 query.propertyFilter.insert("uid", "testuid"); 243 query.propertyFilter.insert("uid", "testuid");
256 244
diff --git a/tests/inspectiontest.cpp b/tests/inspectiontest.cpp
new file mode 100644
index 0000000..29cce6c
--- /dev/null
+++ b/tests/inspectiontest.cpp
@@ -0,0 +1,65 @@
1#include <QtTest>
2
3#include <QString>
4
5#include "dummyresource/resourcefactory.h"
6#include "clientapi.h"
7#include "resourceconfig.h"
8#include "log.h"
9
10/**
11 * Test of inspection system using the dummy resource.
12 *
13 * This test requires the dummy resource installed.
14 */
15class InspectionTest : public QObject
16{
17 Q_OBJECT
18private Q_SLOTS:
19 void initTestCase()
20 {
21 Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Trace);
22 auto factory = Akonadi2::ResourceFactory::load("org.kde.dummy");
23 QVERIFY(factory);
24 DummyResource::removeFromDisk("org.kde.dummy.instance1");
25 ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy");
26 }
27
28 void cleanup()
29 {
30 Akonadi2::Store::shutdown(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished();
31 DummyResource::removeFromDisk("org.kde.dummy.instance1");
32 auto factory = Akonadi2::ResourceFactory::load("org.kde.dummy");
33 QVERIFY(factory);
34 Akonadi2::Store::start(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished();
35 }
36
37 void testInspection_data()
38 {
39 QTest::addColumn<bool>("success");
40 QTest::newRow("success") << true;
41 QTest::newRow("fail") << false;
42 }
43
44 void testInspection()
45 {
46 QFETCH(bool, success);
47 using namespace Akonadi2;
48 using namespace Akonadi2::ApplicationDomain;
49
50 Mail mail(QByteArray("org.kde.dummy.instance1"), QByteArray("identifier"), 0, QSharedPointer<MemoryBufferAdaptor::MemoryBufferAdaptor>::create());
51
52 //testInspection is a magic property that the dummyresource supports
53 auto inspectionCommand = Resources::Inspection::PropertyInspection(mail, "testInspection", success);
54 auto result = Resources::inspect<Mail>(inspectionCommand).exec();
55 result.waitForFinished();
56 if (success) {
57 QVERIFY(!result.errorCode());
58 } else {
59 QVERIFY(result.errorCode());
60 }
61 }
62};
63
64QTEST_MAIN(InspectionTest)
65#include "inspectiontest.moc"
diff --git a/tests/maildirresourcetest.cpp b/tests/maildirresourcetest.cpp
index 6e7818a..ec4f6a4 100644
--- a/tests/maildirresourcetest.cpp
+++ b/tests/maildirresourcetest.cpp
@@ -87,11 +87,10 @@ private Q_SLOTS:
87 { 87 {
88 Akonadi2::Query query; 88 Akonadi2::Query query;
89 query.resources << "org.kde.maildir.instance1"; 89 query.resources << "org.kde.maildir.instance1";
90 query.syncOnDemand = true;
91 query.processAll = true;
92 90
93 //Ensure all local data is processed 91 //Ensure all local data is processed
94 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 92 Akonadi2::Store::synchronize(query).exec().waitForFinished();
93 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
95 94
96 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); 95 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query);
97 QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); 96 QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool());
@@ -102,12 +101,11 @@ private Q_SLOTS:
102 { 101 {
103 Akonadi2::Query query; 102 Akonadi2::Query query;
104 query.resources << "org.kde.maildir.instance1"; 103 query.resources << "org.kde.maildir.instance1";
105 query.syncOnDemand = true;
106 query.processAll = true;
107 query.parentProperty = "parent"; 104 query.parentProperty = "parent";
108 105
109 //Ensure all local data is processed 106 //Ensure all local data is processed
110 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 107 Akonadi2::Store::synchronize(query).exec().waitForFinished();
108 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
111 109
112 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); 110 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query);
113 QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); 111 QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool());
@@ -120,34 +118,27 @@ private Q_SLOTS:
120 118
121 void testListMailsOfFolder() 119 void testListMailsOfFolder()
122 { 120 {
123 { 121 using namespace Akonadi2;
124 Akonadi2::Query query; 122 using namespace Akonadi2::ApplicationDomain;
125 query.resources << "org.kde.maildir.instance1"; 123 //Ensure all local data is processed
126 query.syncOnDemand = true; 124 auto query = Query::ResourceFilter("org.kde.maildir.instance1");
127 query.processAll = true; 125 Store::synchronize(query).exec().waitForFinished();
128 126 Store::flushMessageQueue(query.resources).exec().waitForFinished();
129 //Ensure all local data is processed 127 auto result = Store::fetchOne<Folder>(
130 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 128 Query::ResourceFilter("org.kde.maildir.instance1") + Query::RequestedProperties(QByteArrayList() << "name")
131 } 129 )
132 QByteArray folderIdentifier; 130 .then<QList<Mail::Ptr>, Folder>([](const Folder &folder) {
133 { 131 Trace() << "Found a folder" << folder.identifier();
134 Akonadi2::Query query; 132 return Store::fetchAll<Mail>(
135 query.resources << "org.kde.maildir.instance1"; 133 Query::PropertyFilter("folder", folder) + Query::RequestedProperties(QByteArrayList() << "folder" << "subject")
136 query.requestedProperties << "folder" << "name"; 134 );
137 135 })
138 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); 136 .then<void, QList<Mail::Ptr> >([](const QList<Mail::Ptr> &mails) {
139 QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); 137 QVERIFY(mails.size() >= 1);
140 QVERIFY(model->rowCount(QModelIndex()) > 1); 138 })
141 folderIdentifier = model->index(1, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Folder::Ptr>()->identifier(); 139 .exec();
142 } 140 result.waitForFinished();
143 141 QVERIFY(!result.errorCode());
144 Akonadi2::Query query;
145 query.resources << "org.kde.maildir.instance1";
146 query.requestedProperties << "folder" << "subject";
147 query.propertyFilter.insert("folder", folderIdentifier);
148 auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query);
149 QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool());
150 QVERIFY(mailModel->rowCount(QModelIndex()) >= 1);
151 } 142 }
152 143
153 void testMailContent() 144 void testMailContent()
@@ -155,11 +146,10 @@ private Q_SLOTS:
155 Akonadi2::Query query; 146 Akonadi2::Query query;
156 query.resources << "org.kde.maildir.instance1"; 147 query.resources << "org.kde.maildir.instance1";
157 query.requestedProperties << "folder" << "subject" << "mimeMessage" << "date"; 148 query.requestedProperties << "folder" << "subject" << "mimeMessage" << "date";
158 query.syncOnDemand = true;
159 query.processAll = true;
160 149
161 //Ensure all local data is processed 150 //Ensure all local data is processed
162 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 151 Akonadi2::Store::synchronize(query).exec().waitForFinished();
152 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
163 153
164 auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); 154 auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query);
165 QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); 155 QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool());
@@ -175,12 +165,11 @@ private Q_SLOTS:
175 { 165 {
176 Akonadi2::Query query; 166 Akonadi2::Query query;
177 query.resources << "org.kde.maildir.instance1"; 167 query.resources << "org.kde.maildir.instance1";
178 query.syncOnDemand = true;
179 query.processAll = true;
180 query.requestedProperties << "name"; 168 query.requestedProperties << "name";
181 169
182 //Ensure all local data is processed 170 //Ensure all local data is processed
183 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 171 Akonadi2::Store::synchronize(query).exec().waitForFinished();
172 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
184 173
185 auto targetPath = tempDir.path() + "/maildir1/"; 174 auto targetPath = tempDir.path() + "/maildir1/";
186 QDir dir(targetPath); 175 QDir dir(targetPath);
@@ -188,6 +177,7 @@ private Q_SLOTS:
188 177
189 //Ensure all local data is processed 178 //Ensure all local data is processed
190 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 179 Akonadi2::Store::synchronize(query).exec().waitForFinished();
180 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
191 181
192 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); 182 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query);
193 QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); 183 QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool());
@@ -199,15 +189,15 @@ private Q_SLOTS:
199 { 189 {
200 Akonadi2::Query query; 190 Akonadi2::Query query;
201 query.resources << "org.kde.maildir.instance1"; 191 query.resources << "org.kde.maildir.instance1";
202 query.syncOnDemand = true;
203 query.processAll = true;
204 query.requestedProperties << "folder" << "subject"; 192 query.requestedProperties << "folder" << "subject";
205 193
206 //Ensure all local data is processed 194 //Ensure all local data is processed
207 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 195 Akonadi2::Store::synchronize(query).exec().waitForFinished();
196 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
208 197
209 //Ensure all local data is processed 198 //Ensure all local data is processed
210 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 199 Akonadi2::Store::synchronize(query).exec().waitForFinished();
200 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
211 201
212 auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); 202 auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query);
213 QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); 203 QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool());
@@ -218,12 +208,11 @@ private Q_SLOTS:
218 { 208 {
219 Akonadi2::Query query; 209 Akonadi2::Query query;
220 query.resources << "org.kde.maildir.instance1"; 210 query.resources << "org.kde.maildir.instance1";
221 query.syncOnDemand = true;
222 query.processAll = true;
223 query.requestedProperties << "folder" << "subject"; 211 query.requestedProperties << "folder" << "subject";
224 212
225 //Ensure all local data is processed 213 //Ensure all local data is processed
226 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 214 Akonadi2::Store::synchronize(query).exec().waitForFinished();
215 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
227 216
228 auto targetPath = tempDir.path() + "/maildir1/cur/1365777830.R28.localhost.localdomain:2,S"; 217 auto targetPath = tempDir.path() + "/maildir1/cur/1365777830.R28.localhost.localdomain:2,S";
229 QFile file(targetPath); 218 QFile file(targetPath);
@@ -231,6 +220,7 @@ private Q_SLOTS:
231 220
232 //Ensure all local data is processed 221 //Ensure all local data is processed
233 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 222 Akonadi2::Store::synchronize(query).exec().waitForFinished();
223 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
234 224
235 auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); 225 auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query);
236 QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); 226 QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool());
@@ -241,11 +231,9 @@ private Q_SLOTS:
241 { 231 {
242 Akonadi2::Query query; 232 Akonadi2::Query query;
243 query.resources << "org.kde.maildir.instance1"; 233 query.resources << "org.kde.maildir.instance1";
244 query.syncOnDemand = false;
245 query.processAll = true;
246 234
247 //Ensure all local data is processed 235 //Ensure all local data is processed
248 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 236 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
249 237
250 Akonadi2::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); 238 Akonadi2::ApplicationDomain::Folder folder("org.kde.maildir.instance1");
251 folder.setProperty("name", "testCreateFolder"); 239 folder.setProperty("name", "testCreateFolder");
@@ -253,7 +241,7 @@ private Q_SLOTS:
253 Akonadi2::Store::create(folder).exec().waitForFinished(); 241 Akonadi2::Store::create(folder).exec().waitForFinished();
254 242
255 //Ensure all local data is processed 243 //Ensure all local data is processed
256 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 244 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
257 245
258 auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; 246 auto targetPath = tempDir.path() + "/maildir1/testCreateFolder";
259 QFileInfo file(targetPath); 247 QFileInfo file(targetPath);
@@ -265,15 +253,13 @@ private Q_SLOTS:
265 { 253 {
266 Akonadi2::Query query; 254 Akonadi2::Query query;
267 query.resources << "org.kde.maildir.instance1"; 255 query.resources << "org.kde.maildir.instance1";
268 query.syncOnDemand = false;
269 query.processAll = true;
270 256
271 auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; 257 auto targetPath = tempDir.path() + "/maildir1/testCreateFolder";
272 258
273 Akonadi2::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); 259 Akonadi2::ApplicationDomain::Folder folder("org.kde.maildir.instance1");
274 folder.setProperty("name", "testCreateFolder"); 260 folder.setProperty("name", "testCreateFolder");
275 Akonadi2::Store::create(folder).exec().waitForFinished(); 261 Akonadi2::Store::create(folder).exec().waitForFinished();
276 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 262 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
277 QTRY_VERIFY(QFileInfo(targetPath).exists()); 263 QTRY_VERIFY(QFileInfo(targetPath).exists());
278 264
279 Akonadi2::Query folderQuery; 265 Akonadi2::Query folderQuery;
@@ -285,7 +271,7 @@ private Q_SLOTS:
285 auto createdFolder = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Folder::Ptr>(); 271 auto createdFolder = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Folder::Ptr>();
286 272
287 Akonadi2::Store::remove(*createdFolder).exec().waitForFinished(); 273 Akonadi2::Store::remove(*createdFolder).exec().waitForFinished();
288 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 274 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
289 QTRY_VERIFY(!QFileInfo(targetPath).exists()); 275 QTRY_VERIFY(!QFileInfo(targetPath).exists());
290 } 276 }
291 277
@@ -293,11 +279,9 @@ private Q_SLOTS:
293 { 279 {
294 Akonadi2::Query query; 280 Akonadi2::Query query;
295 query.resources << "org.kde.maildir.instance1"; 281 query.resources << "org.kde.maildir.instance1";
296 query.syncOnDemand = false;
297 query.processAll = true;
298 282
299 //Ensure all local data is processed 283 //Ensure all local data is processed
300 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 284 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
301 285
302 Akonadi2::ApplicationDomain::Mail mail("org.kde.maildir.instance1"); 286 Akonadi2::ApplicationDomain::Mail mail("org.kde.maildir.instance1");
303 mail.setProperty("name", "testCreateMail"); 287 mail.setProperty("name", "testCreateMail");
@@ -305,7 +289,7 @@ private Q_SLOTS:
305 Akonadi2::Store::create(mail).exec().waitForFinished(); 289 Akonadi2::Store::create(mail).exec().waitForFinished();
306 290
307 //Ensure all local data is processed 291 //Ensure all local data is processed
308 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 292 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
309 293
310 auto targetPath = tempDir.path() + "/maildir1/new"; 294 auto targetPath = tempDir.path() + "/maildir1/new";
311 QDir dir(targetPath); 295 QDir dir(targetPath);
@@ -315,32 +299,72 @@ private Q_SLOTS:
315 299
316 void testRemoveMail() 300 void testRemoveMail()
317 { 301 {
318 Akonadi2::Query query; 302 using namespace Akonadi2;
319 query.resources << "org.kde.maildir.instance1"; 303 using namespace Akonadi2::ApplicationDomain;
320 query.syncOnDemand = true; 304
321 query.processAll = true; 305 auto query = Query::ResourceFilter("org.kde.maildir.instance1");
322 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 306 Store::synchronize(query).exec().waitForFinished();
323 307 Store::flushMessageQueue(query.resources).exec().waitForFinished();
324 Akonadi2::Query folderQuery; 308
325 folderQuery.resources << "org.kde.maildir.instance1"; 309 auto result = Store::fetchOne<Folder>(
326 folderQuery.propertyFilter.insert("name", "maildir1"); 310 Query::ResourceFilter("org.kde.maildir.instance1") + Query::PropertyFilter("name", "maildir1") + Query::RequestedProperties(QByteArrayList() << "name")
327 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(folderQuery); 311 )
328 QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); 312 .then<void, KAsync::Job<void>, Folder>([query](const Folder &folder) {
329 QCOMPARE(model->rowCount(QModelIndex()), 1); 313 return Store::fetchAll<Mail>(
330 auto folder = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Folder::Ptr>(); 314 Query::PropertyFilter("folder", folder) + Query::RequestedProperties(QByteArrayList() << "folder" << "subject")
331 315 )
332 Akonadi2::Query mailQuery; 316 .then<void, KAsync::Job<void>, QList<Mail::Ptr> >([query](const QList<Mail::Ptr> &mails) {
333 mailQuery.resources << "org.kde.maildir.instance1"; 317 //Can't use QCOMPARE because it tries to return FIXME Implement ASYNCCOMPARE
334 mailQuery.propertyFilter.insert("folder", folder->identifier()); 318 if (mails.size() != 1) {
335 auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(mailQuery); 319 return KAsync::error<void>(1, "Wrong number of mails.");
336 QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); 320 }
337 QCOMPARE(mailModel->rowCount(QModelIndex()), 1); 321 auto mail = mails.first();
338 auto mail = mailModel->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Mail::Ptr>(); 322
339 323 return Store::remove(*mail)
340 Akonadi2::Store::remove(*mail).exec().waitForFinished(); 324 .then(Store::flushReplayQueue(query.resources)) //The change needs to be replayed already
341 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 325 .then(Resources::inspect<Mail>(Resources::Inspection::ExistenceInspection(*mail, false)));
326 })
327 .then<void>([](){});
328 })
329 .exec();
330 result.waitForFinished();
331 QVERIFY(!result.errorCode());
332 }
342 333
343 QTRY_COMPARE(QDir(tempDir.path() + "/maildir1/cur", QString(), QDir::NoSort, QDir::Files).count(), static_cast<unsigned int>(0)); 334 void testMarkMailAsRead()
335 {
336 using namespace Akonadi2;
337 using namespace Akonadi2::ApplicationDomain;
338
339 auto query = Query::ResourceFilter("org.kde.maildir.instance1");
340 Store::synchronize(query).exec().waitForFinished();
341 Store::flushMessageQueue(query.resources).exec().waitForFinished();
342
343 auto result = Store::fetchOne<Folder>(
344 Query::ResourceFilter("org.kde.maildir.instance1") + Query::PropertyFilter("name", "maildir1") + Query::RequestedProperties(QByteArrayList() << "name")
345 )
346 .then<void, KAsync::Job<void>, Folder>([query](const Folder &folder) {
347 Trace() << "Found a folder" << folder.identifier();
348 return Store::fetchAll<Mail>(
349 Query::PropertyFilter("folder", folder) + Query::RequestedProperties(QByteArrayList() << "folder" << "subject")
350 )
351 .then<void, KAsync::Job<void>, QList<Mail::Ptr> >([query](const QList<Mail::Ptr> &mails) {
352 //Can't use QCOMPARE because it tries to return FIXME Implement ASYNCCOMPARE
353 if (mails.size() != 1) {
354 return KAsync::error<void>(1, "Wrong number of mails.");
355 }
356 auto mail = mails.first();
357 mail->setProperty("unread", true);
358 auto inspectionCommand = Resources::Inspection::PropertyInspection(*mail, "unread", true);
359 return Store::modify(*mail)
360 .then<void>(Store::flushReplayQueue(query.resources)) //The change needs to be replayed already
361 .then(Resources::inspect<Mail>(inspectionCommand));
362 })
363 .then<void>([](){});
364 })
365 .exec();
366 result.waitForFinished();
367 QVERIFY(!result.errorCode());
344 } 368 }
345 369
346}; 370};
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:
73 73
74 Akonadi2::Query query; 74 Akonadi2::Query query;
75 query.resources << "org.kde.dummy.instance1"; 75 query.resources << "org.kde.dummy.instance1";
76 query.syncOnDemand = false;
77 query.processAll = true;
78 query.liveQuery = true; 76 query.liveQuery = true;
79 77
80 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 78 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
81 79
82 //Test 80 //Test
83 QTime time; 81 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:
48 //Test 48 //Test
49 Akonadi2::Query query; 49 Akonadi2::Query query;
50 query.resources << "foobar"; 50 query.resources << "foobar";
51 query.syncOnDemand = false;
52 query.processAll = false;
53 query.liveQuery = true; 51 query.liveQuery = true;
54 52
55 //We fetch before the data is available and rely on the live query mechanism to deliver the actual data 53 //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:
70 //Test 68 //Test
71 Akonadi2::Query query; 69 Akonadi2::Query query;
72 query.resources << "org.kde.dummy.instance1"; 70 query.resources << "org.kde.dummy.instance1";
73 query.syncOnDemand = false;
74 query.processAll = false;
75 query.liveQuery = true; 71 query.liveQuery = true;
76 72
77 //We fetch before the data is available and rely on the live query mechanism to deliver the actual data 73 //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:
91 //Test 87 //Test
92 Akonadi2::Query query; 88 Akonadi2::Query query;
93 query.resources << "org.kde.dummy.instance1"; 89 query.resources << "org.kde.dummy.instance1";
94 query.syncOnDemand = false;
95 query.processAll = true;
96 query.liveQuery = false; 90 query.liveQuery = false;
97 91
98 //Ensure all local data is processed 92 //Ensure all local data is processed
99 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 93 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
100 94
101 //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data 95 //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data
102 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); 96 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query);
@@ -150,8 +144,6 @@ private Q_SLOTS:
150 //Test 144 //Test
151 Akonadi2::Query query; 145 Akonadi2::Query query;
152 query.resources << "org.kde.dummy.instance1"; 146 query.resources << "org.kde.dummy.instance1";
153 query.syncOnDemand = false;
154 query.processAll = false;
155 query.liveQuery = true; 147 query.liveQuery = true;
156 148
157 //We fetch before the data is available and rely on the live query mechanism to deliver the actual data 149 //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:
171 163
172 Akonadi2::Query query; 164 Akonadi2::Query query;
173 query.resources << "org.kde.dummy.instance1"; 165 query.resources << "org.kde.dummy.instance1";
174 query.syncOnDemand = false;
175 query.processAll = true;
176 166
177 //Ensure all local data is processed 167 //Ensure all local data is processed
178 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 168 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
179 169
180 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); 170 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query);
181 QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); 171 QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool());
@@ -192,12 +182,10 @@ private Q_SLOTS:
192 //Test 182 //Test
193 Akonadi2::Query query; 183 Akonadi2::Query query;
194 query.resources << "org.kde.dummy.instance1"; 184 query.resources << "org.kde.dummy.instance1";
195 query.syncOnDemand = false;
196 query.processAll = true;
197 query.parentProperty = "parent"; 185 query.parentProperty = "parent";
198 186
199 //Ensure all local data is processed 187 //Ensure all local data is processed
200 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 188 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
201 189
202 //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data 190 //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data
203 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); 191 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query);
@@ -222,13 +210,11 @@ private Q_SLOTS:
222 //Test 210 //Test
223 Akonadi2::Query query; 211 Akonadi2::Query query;
224 query.resources << "org.kde.dummy.instance1"; 212 query.resources << "org.kde.dummy.instance1";
225 query.syncOnDemand = false;
226 query.processAll = true;
227 query.liveQuery = false; 213 query.liveQuery = false;
228 query.propertyFilter.insert("uid", "test1"); 214 query.propertyFilter.insert("uid", "test1");
229 215
230 //Ensure all local data is processed 216 //Ensure all local data is processed
231 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 217 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
232 218
233 //We fetch before the data is available and rely on the live query mechanism to deliver the actual data 219 //We fetch before the data is available and rely on the live query mechanism to deliver the actual data
234 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); 220 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query);
@@ -246,11 +232,9 @@ private Q_SLOTS:
246 232
247 Akonadi2::Query query; 233 Akonadi2::Query query;
248 query.resources << "org.kde.dummy.instance1"; 234 query.resources << "org.kde.dummy.instance1";
249 query.syncOnDemand = false;
250 query.processAll = true;
251 235
252 //Ensure all local data is processed 236 //Ensure all local data is processed
253 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 237 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
254 238
255 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); 239 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query);
256 QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); 240 QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool());
@@ -268,13 +252,10 @@ private Q_SLOTS:
268 //Test 252 //Test
269 Akonadi2::Query query; 253 Akonadi2::Query query;
270 query.resources << "org.kde.dummy.instance1"; 254 query.resources << "org.kde.dummy.instance1";
271 query.syncOnDemand = false;
272 query.processAll = true;
273 query.liveQuery = false;
274 query.propertyFilter.insert("folder", folderEntity->identifier()); 255 query.propertyFilter.insert("folder", folderEntity->identifier());
275 256
276 //Ensure all local data is processed 257 //Ensure all local data is processed
277 Akonadi2::Store::synchronize(query).exec().waitForFinished(); 258 Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished();
278 259
279 //We fetch before the data is available and rely on the live query mechanism to deliver the actual data 260 //We fetch before the data is available and rely on the live query mechanism to deliver the actual data
280 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); 261 auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query);
diff --git a/tests/resourcecommunicationtest.cpp b/tests/resourcecommunicationtest.cpp
index 18e9223..1b09c5f 100644
--- a/tests/resourcecommunicationtest.cpp
+++ b/tests/resourcecommunicationtest.cpp
@@ -32,8 +32,8 @@ private Q_SLOTS:
32 32
33 flatbuffers::FlatBufferBuilder fbb; 33 flatbuffers::FlatBufferBuilder fbb;
34 auto name = fbb.CreateString("test"); 34 auto name = fbb.CreateString("test");
35 auto command = Akonadi2::CreateHandshake(fbb, name); 35 auto command = Akonadi2::Commands::CreateHandshake(fbb, name);
36 Akonadi2::FinishHandshakeBuffer(fbb, command); 36 Akonadi2::Commands::FinishHandshakeBuffer(fbb, command);
37 auto result = resourceAccess.sendCommand(Akonadi2::Commands::HandshakeCommand, fbb).exec(); 37 auto result = resourceAccess.sendCommand(Akonadi2::Commands::HandshakeCommand, fbb).exec();
38 result.waitForFinished(); 38 result.waitForFinished();
39 QVERIFY(!result.errorCode()); 39 QVERIFY(!result.errorCode());