summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-02-09 15:47:09 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-02-09 15:47:09 +0100
commit573051b8df4a2961b4ba8a1b7e31f1437517f9c8 (patch)
treebac9c2680b6ceec49df48082335046338c940144
parent4d662fec99071ec8160c33b2fa17794e898bd3be (diff)
downloadsink-573051b8df4a2961b4ba8a1b7e31f1437517f9c8.tar.gz
sink-573051b8df4a2961b4ba8a1b7e31f1437517f9c8.zip
Moved some API
-rw-r--r--common/clientapi.cpp8
-rw-r--r--common/clientapi.h77
-rw-r--r--tests/dummyresourcebenchmark.cpp4
-rw-r--r--tests/dummyresourcetest.cpp16
-rw-r--r--tests/maildirresourcetest.cpp45
-rw-r--r--tests/modelinteractivitytest.cpp2
-rw-r--r--tests/querytest.cpp12
7 files changed, 84 insertions, 80 deletions
diff --git a/common/clientapi.cpp b/common/clientapi.cpp
index 73bc194..e6878a6 100644
--- a/common/clientapi.cpp
+++ b/common/clientapi.cpp
@@ -160,7 +160,7 @@ KAsync::Job<void> Store::remove(const DomainType &domainObject)
160 }); 160 });
161} 161}
162 162
163KAsync::Job<void> Store::shutdown(const QByteArray &identifier) 163KAsync::Job<void> Resources::shutdown(const QByteArray &identifier)
164{ 164{
165 Trace() << "shutdown " << identifier; 165 Trace() << "shutdown " << identifier;
166 auto time = QSharedPointer<QTime>::create(); 166 auto time = QSharedPointer<QTime>::create();
@@ -183,7 +183,7 @@ KAsync::Job<void> Store::shutdown(const QByteArray &identifier)
183 .template then<void>([](){}); 183 .template then<void>([](){});
184} 184}
185 185
186KAsync::Job<void> Store::start(const QByteArray &identifier) 186KAsync::Job<void> Resources::start(const QByteArray &identifier)
187{ 187{
188 Trace() << "start " << identifier; 188 Trace() << "start " << identifier;
189 auto time = QSharedPointer<QTime>::create(); 189 auto time = QSharedPointer<QTime>::create();
@@ -231,7 +231,7 @@ KAsync::Job<void> Store::synchronize(const Sink::Query &query)
231 .template then<void>([](){}); 231 .template then<void>([](){});
232} 232}
233 233
234KAsync::Job<void> Store::flushMessageQueue(const QByteArrayList &resourceIdentifier) 234KAsync::Job<void> Resources::flushMessageQueue(const QByteArrayList &resourceIdentifier)
235{ 235{
236 Trace() << "flushMessageQueue" << resourceIdentifier; 236 Trace() << "flushMessageQueue" << resourceIdentifier;
237 return KAsync::iterate(resourceIdentifier) 237 return KAsync::iterate(resourceIdentifier)
@@ -247,7 +247,7 @@ KAsync::Job<void> Store::flushMessageQueue(const QByteArrayList &resourceIdentif
247 .template then<void>([](){}); 247 .template then<void>([](){});
248} 248}
249 249
250KAsync::Job<void> Store::flushReplayQueue(const QByteArrayList &resourceIdentifier) 250KAsync::Job<void> Resources::flushReplayQueue(const QByteArrayList &resourceIdentifier)
251{ 251{
252 return flushMessageQueue(resourceIdentifier); 252 return flushMessageQueue(resourceIdentifier);
253} 253}
diff --git a/common/clientapi.h b/common/clientapi.h
index 19d42e0..36c923b 100644
--- a/common/clientapi.h
+++ b/common/clientapi.h
@@ -36,6 +36,19 @@ namespace Sink {
36class ResourceAccess; 36class ResourceAccess;
37class Notification; 37class Notification;
38 38
39class SINKCOMMON_EXPORT Notifier {
40public:
41 Notifier(const QSharedPointer<ResourceAccess> &resourceAccess);
42 Notifier(const QByteArray &resourceInstanceIdentifier);
43 // Notifier(const QByteArrayList &resource);
44 void registerHandler(std::function<void(const Notification &)>);
45
46private:
47 class Private;
48 QSharedPointer<Private> d;
49};
50
51
39/** 52/**
40 * Store interface used in the client API. 53 * Store interface used in the client API.
41 */ 54 */
@@ -82,30 +95,6 @@ public:
82 static KAsync::Job<void> synchronize(const Sink::Query &query); 95 static KAsync::Job<void> synchronize(const Sink::Query &query);
83 96
84 /** 97 /**
85 * Shutdown resource.
86 */
87 static KAsync::Job<void> shutdown(const QByteArray &resourceIdentifier);
88
89 /**
90 * Start resource.
91 *
92 * The resource is ready for operation once this command completes.
93 * This command is only necessary if a resource was shutdown previously,
94 * otherwise the resource process will automatically start as necessary.
95 */
96 static KAsync::Job<void> start(const QByteArray &resourceIdentifier);
97
98 /**
99 * Flushes any pending messages to disk
100 */
101 static KAsync::Job<void> flushMessageQueue(const QByteArrayList &resourceIdentifier);
102
103 /**
104 * Flushes any pending messages that haven't been replayed to the source.
105 */
106 static KAsync::Job<void> flushReplayQueue(const QByteArrayList &resourceIdentifier);
107
108 /**
109 * Removes a resource from disk. 98 * Removes a resource from disk.
110 */ 99 */
111 static void removeFromDisk(const QByteArray &resourceIdentifier); 100 static void removeFromDisk(const QByteArray &resourceIdentifier);
@@ -128,21 +117,35 @@ public:
128}; 117};
129 118
130namespace Resources { 119namespace Resources {
131 template <class DomainType>
132 KAsync::Job<void> SINKCOMMON_EXPORT inspect(const Inspection &inspectionCommand);
133}
134 120
135class SINKCOMMON_EXPORT Notifier { 121template <class DomainType>
136public: 122KAsync::Job<void> SINKCOMMON_EXPORT inspect(const Inspection &inspectionCommand);
137 Notifier(const QSharedPointer<ResourceAccess> &resourceAccess);
138 Notifier(const QByteArray &resourceInstanceIdentifier);
139 // Notifier(const QByteArrayList &resource);
140 void registerHandler(std::function<void(const Notification &)>);
141 123
142private: 124/**
143 class Private; 125 * Shutdown resource.
144 QSharedPointer<Private> d; 126 */
145}; 127KAsync::Job<void> SINKCOMMON_EXPORT shutdown(const QByteArray &resourceIdentifier);
128
129/**
130 * Start resource.
131 *
132 * The resource is ready for operation once this command completes.
133 * This command is only necessary if a resource was shutdown previously,
134 * otherwise the resource process will automatically start as necessary.
135 */
136KAsync::Job<void> SINKCOMMON_EXPORT start(const QByteArray &resourceIdentifier);
137
138/**
139 * Flushes any pending messages to disk
140 */
141KAsync::Job<void> SINKCOMMON_EXPORT flushMessageQueue(const QByteArrayList &resourceIdentifier);
142
143/**
144 * Flushes any pending messages that haven't been replayed to the source.
145 */
146KAsync::Job<void> SINKCOMMON_EXPORT flushReplayQueue(const QByteArrayList &resourceIdentifier);
147
148}
146 149
147} 150}
148 151
diff --git a/tests/dummyresourcebenchmark.cpp b/tests/dummyresourcebenchmark.cpp
index 089fc08..6170f49 100644
--- a/tests/dummyresourcebenchmark.cpp
+++ b/tests/dummyresourcebenchmark.cpp
@@ -102,7 +102,7 @@ private Q_SLOTS:
102 QTRY_VERIFY(gotNotification); 102 QTRY_VERIFY(gotNotification);
103 103
104 QVERIFY2(duration < 100, QString::fromLatin1("Processing a create command took more than 100ms: %1").arg(duration).toLatin1()); 104 QVERIFY2(duration < 100, QString::fromLatin1("Processing a create command took more than 100ms: %1").arg(duration).toLatin1());
105 Sink::Store::shutdown("org.kde.dummy.instance1").exec().waitForFinished(); 105 Sink::Resources::shutdown("org.kde.dummy.instance1").exec().waitForFinished();
106 qDebug() << "Single command took [ms]: " << duration; 106 qDebug() << "Single command took [ms]: " << duration;
107 } 107 }
108 108
@@ -127,7 +127,7 @@ private Q_SLOTS:
127 { 127 {
128 Sink::Query query; 128 Sink::Query query;
129 query.resources << "org.kde.dummy.instance1"; 129 query.resources << "org.kde.dummy.instance1";
130 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 130 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
131 } 131 }
132 auto allProcessedTime = time.elapsed(); 132 auto allProcessedTime = time.elapsed();
133 133
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp
index bfa4885..e74fe25 100644
--- a/tests/dummyresourcetest.cpp
+++ b/tests/dummyresourcetest.cpp
@@ -65,7 +65,7 @@ private Q_SLOTS:
65 query.resources << "org.kde.dummy.instance1"; 65 query.resources << "org.kde.dummy.instance1";
66 66
67 //Ensure all local data is processed 67 //Ensure all local data is processed
68 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 68 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
69 69
70 query.propertyFilter.insert("uid", "testuid"); 70 query.propertyFilter.insert("uid", "testuid");
71 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); 71 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query);
@@ -89,7 +89,7 @@ private Q_SLOTS:
89 query.resources << "org.kde.dummy.instance1"; 89 query.resources << "org.kde.dummy.instance1";
90 90
91 //Ensure all local data is processed 91 //Ensure all local data is processed
92 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 92 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
93 93
94 query.propertyFilter.insert("uid", "testuid"); 94 query.propertyFilter.insert("uid", "testuid");
95 95
@@ -117,7 +117,7 @@ private Q_SLOTS:
117 query.resources << "org.kde.dummy.instance1"; 117 query.resources << "org.kde.dummy.instance1";
118 118
119 //Ensure all local data is processed 119 //Ensure all local data is processed
120 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 120 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
121 121
122 query.propertyFilter.insert("summary", "summaryValue2"); 122 query.propertyFilter.insert("summary", "summaryValue2");
123 123
@@ -151,7 +151,7 @@ private Q_SLOTS:
151 151
152 //Ensure all local data is processed 152 //Ensure all local data is processed
153 Sink::Store::synchronize(query).exec().waitForFinished(); 153 Sink::Store::synchronize(query).exec().waitForFinished();
154 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 154 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
155 155
156 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); 156 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query);
157 QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); 157 QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1);
@@ -168,7 +168,7 @@ private Q_SLOTS:
168 168
169 //Ensure all local data is processed 169 //Ensure all local data is processed
170 Sink::Store::synchronize(query).exec().waitForFinished(); 170 Sink::Store::synchronize(query).exec().waitForFinished();
171 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 171 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
172 172
173 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); 173 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query);
174 QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); 174 QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1);
@@ -191,7 +191,7 @@ private Q_SLOTS:
191 query.propertyFilter.insert("uid", "testuid"); 191 query.propertyFilter.insert("uid", "testuid");
192 192
193 //Ensure all local data is processed 193 //Ensure all local data is processed
194 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 194 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
195 195
196 //Test create 196 //Test create
197 Sink::ApplicationDomain::Event event2; 197 Sink::ApplicationDomain::Event event2;
@@ -210,7 +210,7 @@ private Q_SLOTS:
210 Sink::Store::modify<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished(); 210 Sink::Store::modify<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished();
211 211
212 //Ensure all local data is processed 212 //Ensure all local data is processed
213 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 213 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
214 214
215 //Test modify 215 //Test modify
216 { 216 {
@@ -225,7 +225,7 @@ private Q_SLOTS:
225 Sink::Store::remove<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished(); 225 Sink::Store::remove<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished();
226 226
227 //Ensure all local data is processed 227 //Ensure all local data is processed
228 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 228 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
229 229
230 //Test remove 230 //Test remove
231 { 231 {
diff --git a/tests/maildirresourcetest.cpp b/tests/maildirresourcetest.cpp
index e502d10..c5c9348 100644
--- a/tests/maildirresourcetest.cpp
+++ b/tests/maildirresourcetest.cpp
@@ -68,7 +68,7 @@ private Q_SLOTS:
68 68
69 void cleanup() 69 void cleanup()
70 { 70 {
71 Sink::Store::shutdown(QByteArray("org.kde.maildir.instance1")).exec().waitForFinished(); 71 Sink::Resources::shutdown(QByteArray("org.kde.maildir.instance1")).exec().waitForFinished();
72 MaildirResource::removeFromDisk("org.kde.maildir.instance1"); 72 MaildirResource::removeFromDisk("org.kde.maildir.instance1");
73 QDir dir(targetPath); 73 QDir dir(targetPath);
74 dir.removeRecursively(); 74 dir.removeRecursively();
@@ -80,7 +80,7 @@ private Q_SLOTS:
80 qDebug() << "-----------------------------------------"; 80 qDebug() << "-----------------------------------------";
81 qDebug(); 81 qDebug();
82 copyRecursively(TESTDATAPATH "/maildir1", targetPath); 82 copyRecursively(TESTDATAPATH "/maildir1", targetPath);
83 Sink::Store::start(QByteArray("org.kde.maildir.instance1")).exec().waitForFinished(); 83 Sink::Resources::start(QByteArray("org.kde.maildir.instance1")).exec().waitForFinished();
84 } 84 }
85 85
86 void testListFolders() 86 void testListFolders()
@@ -90,7 +90,7 @@ private Q_SLOTS:
90 90
91 //Ensure all local data is processed 91 //Ensure all local data is processed
92 Sink::Store::synchronize(query).exec().waitForFinished(); 92 Sink::Store::synchronize(query).exec().waitForFinished();
93 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 93 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
94 94
95 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); 95 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query);
96 QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); 96 QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool());
@@ -105,7 +105,7 @@ private Q_SLOTS:
105 105
106 //Ensure all local data is processed 106 //Ensure all local data is processed
107 Sink::Store::synchronize(query).exec().waitForFinished(); 107 Sink::Store::synchronize(query).exec().waitForFinished();
108 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 108 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
109 109
110 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); 110 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query);
111 QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); 111 QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool());
@@ -123,7 +123,7 @@ private Q_SLOTS:
123 //Ensure all local data is processed 123 //Ensure all local data is processed
124 auto query = Query::ResourceFilter("org.kde.maildir.instance1"); 124 auto query = Query::ResourceFilter("org.kde.maildir.instance1");
125 Store::synchronize(query).exec().waitForFinished(); 125 Store::synchronize(query).exec().waitForFinished();
126 Store::flushMessageQueue(query.resources).exec().waitForFinished(); 126 Resources::flushMessageQueue(query.resources).exec().waitForFinished();
127 auto result = Store::fetchOne<Folder>( 127 auto result = Store::fetchOne<Folder>(
128 Query::ResourceFilter("org.kde.maildir.instance1") + Query::RequestedProperties(QByteArrayList() << "name") 128 Query::ResourceFilter("org.kde.maildir.instance1") + Query::RequestedProperties(QByteArrayList() << "name")
129 ) 129 )
@@ -149,7 +149,7 @@ private Q_SLOTS:
149 149
150 //Ensure all local data is processed 150 //Ensure all local data is processed
151 Sink::Store::synchronize(query).exec().waitForFinished(); 151 Sink::Store::synchronize(query).exec().waitForFinished();
152 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 152 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
153 153
154 auto mailModel = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); 154 auto mailModel = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query);
155 QTRY_VERIFY(mailModel->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); 155 QTRY_VERIFY(mailModel->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool());
@@ -172,7 +172,7 @@ private Q_SLOTS:
172 172
173 //Ensure all local data is processed 173 //Ensure all local data is processed
174 Sink::Store::synchronize(query).exec().waitForFinished(); 174 Sink::Store::synchronize(query).exec().waitForFinished();
175 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 175 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
176 176
177 auto targetPath = tempDir.path() + "/maildir1/"; 177 auto targetPath = tempDir.path() + "/maildir1/";
178 QDir dir(targetPath); 178 QDir dir(targetPath);
@@ -180,7 +180,7 @@ private Q_SLOTS:
180 180
181 //Ensure all local data is processed 181 //Ensure all local data is processed
182 Sink::Store::synchronize(query).exec().waitForFinished(); 182 Sink::Store::synchronize(query).exec().waitForFinished();
183 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 183 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
184 184
185 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); 185 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query);
186 QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); 186 QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool());
@@ -196,11 +196,11 @@ private Q_SLOTS:
196 196
197 //Ensure all local data is processed 197 //Ensure all local data is processed
198 Sink::Store::synchronize(query).exec().waitForFinished(); 198 Sink::Store::synchronize(query).exec().waitForFinished();
199 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 199 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
200 200
201 //Ensure all local data is processed 201 //Ensure all local data is processed
202 Sink::Store::synchronize(query).exec().waitForFinished(); 202 Sink::Store::synchronize(query).exec().waitForFinished();
203 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 203 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
204 204
205 auto mailModel = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); 205 auto mailModel = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query);
206 QTRY_VERIFY(mailModel->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); 206 QTRY_VERIFY(mailModel->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool());
@@ -215,7 +215,7 @@ private Q_SLOTS:
215 215
216 //Ensure all local data is processed 216 //Ensure all local data is processed
217 Sink::Store::synchronize(query).exec().waitForFinished(); 217 Sink::Store::synchronize(query).exec().waitForFinished();
218 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 218 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
219 219
220 auto targetPath = tempDir.path() + "/maildir1/cur/1365777830.R28.localhost.localdomain:2,S"; 220 auto targetPath = tempDir.path() + "/maildir1/cur/1365777830.R28.localhost.localdomain:2,S";
221 QFile file(targetPath); 221 QFile file(targetPath);
@@ -223,7 +223,7 @@ private Q_SLOTS:
223 223
224 //Ensure all local data is processed 224 //Ensure all local data is processed
225 Sink::Store::synchronize(query).exec().waitForFinished(); 225 Sink::Store::synchronize(query).exec().waitForFinished();
226 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 226 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
227 227
228 auto mailModel = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); 228 auto mailModel = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query);
229 QTRY_VERIFY(mailModel->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); 229 QTRY_VERIFY(mailModel->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool());
@@ -236,7 +236,7 @@ private Q_SLOTS:
236 query.resources << "org.kde.maildir.instance1"; 236 query.resources << "org.kde.maildir.instance1";
237 237
238 //Ensure all local data is processed 238 //Ensure all local data is processed
239 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 239 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
240 240
241 Sink::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); 241 Sink::ApplicationDomain::Folder folder("org.kde.maildir.instance1");
242 folder.setProperty("name", "testCreateFolder"); 242 folder.setProperty("name", "testCreateFolder");
@@ -244,7 +244,7 @@ private Q_SLOTS:
244 Sink::Store::create(folder).exec().waitForFinished(); 244 Sink::Store::create(folder).exec().waitForFinished();
245 245
246 //Ensure all local data is processed 246 //Ensure all local data is processed
247 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 247 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
248 248
249 auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; 249 auto targetPath = tempDir.path() + "/maildir1/testCreateFolder";
250 QFileInfo file(targetPath); 250 QFileInfo file(targetPath);
@@ -262,7 +262,7 @@ private Q_SLOTS:
262 Sink::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); 262 Sink::ApplicationDomain::Folder folder("org.kde.maildir.instance1");
263 folder.setProperty("name", "testCreateFolder"); 263 folder.setProperty("name", "testCreateFolder");
264 Sink::Store::create(folder).exec().waitForFinished(); 264 Sink::Store::create(folder).exec().waitForFinished();
265 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 265 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
266 QTRY_VERIFY(QFileInfo(targetPath).exists()); 266 QTRY_VERIFY(QFileInfo(targetPath).exists());
267 267
268 Sink::Query folderQuery; 268 Sink::Query folderQuery;
@@ -274,7 +274,7 @@ private Q_SLOTS:
274 auto createdFolder = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Folder::Ptr>(); 274 auto createdFolder = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Folder::Ptr>();
275 275
276 Sink::Store::remove(*createdFolder).exec().waitForFinished(); 276 Sink::Store::remove(*createdFolder).exec().waitForFinished();
277 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 277 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
278 QTRY_VERIFY(!QFileInfo(targetPath).exists()); 278 QTRY_VERIFY(!QFileInfo(targetPath).exists());
279 } 279 }
280 280
@@ -284,15 +284,16 @@ private Q_SLOTS:
284 query.resources << "org.kde.maildir.instance1"; 284 query.resources << "org.kde.maildir.instance1";
285 285
286 //Ensure all local data is processed 286 //Ensure all local data is processed
287 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 287 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
288 288
289 Sink::ApplicationDomain::Mail mail("org.kde.maildir.instance1"); 289 Sink::ApplicationDomain::Mail mail("org.kde.maildir.instance1");
290 mail.setProperty("name", "testCreateMail"); 290 mail.setProperty("name", "testCreateMail");
291 //FIXME instead of properties, ensure the mimeMessage property is used and the file is moved as expected
291 292
292 Sink::Store::create(mail).exec().waitForFinished(); 293 Sink::Store::create(mail).exec().waitForFinished();
293 294
294 //Ensure all local data is processed 295 //Ensure all local data is processed
295 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 296 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
296 297
297 auto targetPath = tempDir.path() + "/maildir1/new"; 298 auto targetPath = tempDir.path() + "/maildir1/new";
298 QDir dir(targetPath); 299 QDir dir(targetPath);
@@ -307,7 +308,7 @@ private Q_SLOTS:
307 308
308 auto query = Query::ResourceFilter("org.kde.maildir.instance1"); 309 auto query = Query::ResourceFilter("org.kde.maildir.instance1");
309 Store::synchronize(query).exec().waitForFinished(); 310 Store::synchronize(query).exec().waitForFinished();
310 Store::flushMessageQueue(query.resources).exec().waitForFinished(); 311 Resources::flushMessageQueue(query.resources).exec().waitForFinished();
311 312
312 auto result = Store::fetchOne<Folder>( 313 auto result = Store::fetchOne<Folder>(
313 Query::ResourceFilter("org.kde.maildir.instance1") + Query::PropertyFilter("name", "maildir1") + Query::RequestedProperties(QByteArrayList() << "name") 314 Query::ResourceFilter("org.kde.maildir.instance1") + Query::PropertyFilter("name", "maildir1") + Query::RequestedProperties(QByteArrayList() << "name")
@@ -324,7 +325,7 @@ private Q_SLOTS:
324 auto mail = mails.first(); 325 auto mail = mails.first();
325 326
326 return Store::remove(*mail) 327 return Store::remove(*mail)
327 .then(Store::flushReplayQueue(query.resources)) //The change needs to be replayed already 328 .then(Resources::flushReplayQueue(query.resources)) //The change needs to be replayed already
328 .then(Resources::inspect<Mail>(Resources::Inspection::ExistenceInspection(*mail, false))); 329 .then(Resources::inspect<Mail>(Resources::Inspection::ExistenceInspection(*mail, false)));
329 }) 330 })
330 .then<void>([](){}); 331 .then<void>([](){});
@@ -341,7 +342,7 @@ private Q_SLOTS:
341 342
342 auto query = Query::ResourceFilter("org.kde.maildir.instance1"); 343 auto query = Query::ResourceFilter("org.kde.maildir.instance1");
343 Store::synchronize(query).exec().waitForFinished(); 344 Store::synchronize(query).exec().waitForFinished();
344 Store::flushMessageQueue(query.resources).exec().waitForFinished(); 345 Resources::flushMessageQueue(query.resources).exec().waitForFinished();
345 346
346 Folder f; 347 Folder f;
347 348
@@ -361,7 +362,7 @@ private Q_SLOTS:
361 auto mail = mails.first(); 362 auto mail = mails.first();
362 mail->setProperty("unread", true); 363 mail->setProperty("unread", true);
363 return Store::modify(*mail) 364 return Store::modify(*mail)
364 .then<void>(Store::flushReplayQueue(query.resources)) //The change needs to be replayed already 365 .then<void>(Resources::flushReplayQueue(query.resources)) //The change needs to be replayed already
365 .then(Resources::inspect<Mail>(Resources::Inspection::PropertyInspection(*mail, "unread", true))) 366 .then(Resources::inspect<Mail>(Resources::Inspection::PropertyInspection(*mail, "unread", true)))
366 .then(Resources::inspect<Mail>(Resources::Inspection::PropertyInspection(*mail, "subject", mail->getProperty("subject")))); 367 .then(Resources::inspect<Mail>(Resources::Inspection::PropertyInspection(*mail, "subject", mail->getProperty("subject"))));
367 }) 368 })
diff --git a/tests/modelinteractivitytest.cpp b/tests/modelinteractivitytest.cpp
index 7b7d131..f180f9c 100644
--- a/tests/modelinteractivitytest.cpp
+++ b/tests/modelinteractivitytest.cpp
@@ -73,7 +73,7 @@ private Q_SLOTS:
73 query.resources << "org.kde.dummy.instance1"; 73 query.resources << "org.kde.dummy.instance1";
74 query.liveQuery = true; 74 query.liveQuery = true;
75 75
76 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 76 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
77 77
78 //Test 78 //Test
79 QTime time; 79 QTime time;
diff --git a/tests/querytest.cpp b/tests/querytest.cpp
index cac81c5..89d8693 100644
--- a/tests/querytest.cpp
+++ b/tests/querytest.cpp
@@ -86,7 +86,7 @@ private Q_SLOTS:
86 query.liveQuery = false; 86 query.liveQuery = false;
87 87
88 //Ensure all local data is processed 88 //Ensure all local data is processed
89 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 89 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
90 90
91 //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data 91 //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data
92 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); 92 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query);
@@ -161,7 +161,7 @@ private Q_SLOTS:
161 query.resources << "org.kde.dummy.instance1"; 161 query.resources << "org.kde.dummy.instance1";
162 162
163 //Ensure all local data is processed 163 //Ensure all local data is processed
164 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 164 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
165 165
166 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); 166 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query);
167 QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); 167 QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool());
@@ -181,7 +181,7 @@ private Q_SLOTS:
181 query.parentProperty = "parent"; 181 query.parentProperty = "parent";
182 182
183 //Ensure all local data is processed 183 //Ensure all local data is processed
184 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 184 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
185 185
186 //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data 186 //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data
187 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); 187 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query);
@@ -210,7 +210,7 @@ private Q_SLOTS:
210 query.propertyFilter.insert("uid", "test1"); 210 query.propertyFilter.insert("uid", "test1");
211 211
212 //Ensure all local data is processed 212 //Ensure all local data is processed
213 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 213 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
214 214
215 //We fetch before the data is available and rely on the live query mechanism to deliver the actual data 215 //We fetch before the data is available and rely on the live query mechanism to deliver the actual data
216 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); 216 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query);
@@ -230,7 +230,7 @@ private Q_SLOTS:
230 query.resources << "org.kde.dummy.instance1"; 230 query.resources << "org.kde.dummy.instance1";
231 231
232 //Ensure all local data is processed 232 //Ensure all local data is processed
233 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 233 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
234 234
235 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); 235 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query);
236 QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); 236 QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool());
@@ -251,7 +251,7 @@ private Q_SLOTS:
251 query.propertyFilter.insert("folder", folderEntity->identifier()); 251 query.propertyFilter.insert("folder", folderEntity->identifier());
252 252
253 //Ensure all local data is processed 253 //Ensure all local data is processed
254 Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); 254 Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished();
255 255
256 //We fetch before the data is available and rely on the live query mechanism to deliver the actual data 256 //We fetch before the data is available and rely on the live query mechanism to deliver the actual data
257 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); 257 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query);