diff options
Diffstat (limited to 'tests/querytest.cpp')
-rw-r--r-- | tests/querytest.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/tests/querytest.cpp b/tests/querytest.cpp index 62db15b..16376b9 100644 --- a/tests/querytest.cpp +++ b/tests/querytest.cpp | |||
@@ -3,7 +3,8 @@ | |||
3 | #include <QString> | 3 | #include <QString> |
4 | 4 | ||
5 | #include "dummyresource/resourcefactory.h" | 5 | #include "dummyresource/resourcefactory.h" |
6 | #include "clientapi.h" | 6 | #include "store.h" |
7 | #include "resourcecontrol.h" | ||
7 | #include "commands.h" | 8 | #include "commands.h" |
8 | #include "resourceconfig.h" | 9 | #include "resourceconfig.h" |
9 | #include "log.h" | 10 | #include "log.h" |
@@ -23,17 +24,13 @@ private Q_SLOTS: | |||
23 | Sink::Log::setDebugOutputLevel(Sink::Log::Trace); | 24 | Sink::Log::setDebugOutputLevel(Sink::Log::Trace); |
24 | auto factory = Sink::ResourceFactory::load("org.kde.dummy"); | 25 | auto factory = Sink::ResourceFactory::load("org.kde.dummy"); |
25 | QVERIFY(factory); | 26 | QVERIFY(factory); |
26 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | ||
27 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); | 27 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); |
28 | Sink::Store::removeDataFromDisk(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); | ||
28 | } | 29 | } |
29 | 30 | ||
30 | void cleanup() | 31 | void cleanup() |
31 | { | 32 | { |
32 | Sink::Store::shutdown(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); | 33 | Sink::Store::removeDataFromDisk(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); |
33 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | ||
34 | auto factory = Sink::ResourceFactory::load("org.kde.dummy"); | ||
35 | QVERIFY(factory); | ||
36 | Sink::Store::start(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); | ||
37 | } | 34 | } |
38 | 35 | ||
39 | void init() | 36 | void init() |
@@ -90,7 +87,7 @@ private Q_SLOTS: | |||
90 | query.liveQuery = false; | 87 | query.liveQuery = false; |
91 | 88 | ||
92 | //Ensure all local data is processed | 89 | //Ensure all local data is processed |
93 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 90 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
94 | 91 | ||
95 | //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data | 92 | //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data |
96 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); | 93 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
@@ -165,7 +162,7 @@ private Q_SLOTS: | |||
165 | query.resources << "org.kde.dummy.instance1"; | 162 | query.resources << "org.kde.dummy.instance1"; |
166 | 163 | ||
167 | //Ensure all local data is processed | 164 | //Ensure all local data is processed |
168 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 165 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
169 | 166 | ||
170 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); | 167 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
171 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); | 168 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
@@ -185,7 +182,7 @@ private Q_SLOTS: | |||
185 | query.parentProperty = "parent"; | 182 | query.parentProperty = "parent"; |
186 | 183 | ||
187 | //Ensure all local data is processed | 184 | //Ensure all local data is processed |
188 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 185 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
189 | 186 | ||
190 | //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data | 187 | //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data |
191 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); | 188 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
@@ -214,7 +211,7 @@ private Q_SLOTS: | |||
214 | query.propertyFilter.insert("uid", "test1"); | 211 | query.propertyFilter.insert("uid", "test1"); |
215 | 212 | ||
216 | //Ensure all local data is processed | 213 | //Ensure all local data is processed |
217 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 214 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
218 | 215 | ||
219 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 216 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
220 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); | 217 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
@@ -234,7 +231,7 @@ private Q_SLOTS: | |||
234 | query.resources << "org.kde.dummy.instance1"; | 231 | query.resources << "org.kde.dummy.instance1"; |
235 | 232 | ||
236 | //Ensure all local data is processed | 233 | //Ensure all local data is processed |
237 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 234 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
238 | 235 | ||
239 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); | 236 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
240 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); | 237 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
@@ -255,7 +252,7 @@ private Q_SLOTS: | |||
255 | query.propertyFilter.insert("folder", folderEntity->identifier()); | 252 | query.propertyFilter.insert("folder", folderEntity->identifier()); |
256 | 253 | ||
257 | //Ensure all local data is processed | 254 | //Ensure all local data is processed |
258 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 255 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
259 | 256 | ||
260 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 257 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
261 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); | 258 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |