diff options
Diffstat (limited to 'tests/dummyresourcetest.cpp')
-rw-r--r-- | tests/dummyresourcetest.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index 82c713d..7d9ad24 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp | |||
@@ -3,10 +3,11 @@ | |||
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 "commands.h" | 7 | #include "commands.h" |
8 | #include "entitybuffer.h" | 8 | #include "entitybuffer.h" |
9 | #include "resourceconfig.h" | 9 | #include "resourceconfig.h" |
10 | #include "resourcecontrol.h" | ||
10 | #include "modelresult.h" | 11 | #include "modelresult.h" |
11 | #include "pipeline.h" | 12 | #include "pipeline.h" |
12 | #include "log.h" | 13 | #include "log.h" |
@@ -19,6 +20,9 @@ | |||
19 | class DummyResourceTest : public QObject | 20 | class DummyResourceTest : public QObject |
20 | { | 21 | { |
21 | Q_OBJECT | 22 | Q_OBJECT |
23 | |||
24 | QTime time; | ||
25 | |||
22 | private Q_SLOTS: | 26 | private Q_SLOTS: |
23 | void initTestCase() | 27 | void initTestCase() |
24 | { | 28 | { |
@@ -29,20 +33,18 @@ private Q_SLOTS: | |||
29 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); | 33 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); |
30 | } | 34 | } |
31 | 35 | ||
32 | void cleanup() | ||
33 | { | ||
34 | Sink::Store::shutdown(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); | ||
35 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | ||
36 | auto factory = Sink::ResourceFactory::load("org.kde.dummy"); | ||
37 | QVERIFY(factory); | ||
38 | Sink::Store::start(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); | ||
39 | } | ||
40 | |||
41 | void init() | 36 | void init() |
42 | { | 37 | { |
43 | qDebug(); | 38 | qDebug(); |
44 | qDebug() << "-----------------------------------------"; | 39 | qDebug() << "-----------------------------------------"; |
45 | qDebug(); | 40 | qDebug(); |
41 | time.start(); | ||
42 | } | ||
43 | |||
44 | void cleanup() | ||
45 | { | ||
46 | qDebug() << "Test took " << time.elapsed(); | ||
47 | Sink::Store::removeDataFromDisk(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); | ||
46 | } | 48 | } |
47 | 49 | ||
48 | void testProperty() | 50 | void testProperty() |
@@ -64,7 +66,7 @@ private Q_SLOTS: | |||
64 | query.resources << "org.kde.dummy.instance1"; | 66 | query.resources << "org.kde.dummy.instance1"; |
65 | 67 | ||
66 | //Ensure all local data is processed | 68 | //Ensure all local data is processed |
67 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 69 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
68 | 70 | ||
69 | query.propertyFilter.insert("uid", "testuid"); | 71 | query.propertyFilter.insert("uid", "testuid"); |
70 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); | 72 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
@@ -88,7 +90,7 @@ private Q_SLOTS: | |||
88 | query.resources << "org.kde.dummy.instance1"; | 90 | query.resources << "org.kde.dummy.instance1"; |
89 | 91 | ||
90 | //Ensure all local data is processed | 92 | //Ensure all local data is processed |
91 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 93 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
92 | 94 | ||
93 | query.propertyFilter.insert("uid", "testuid"); | 95 | query.propertyFilter.insert("uid", "testuid"); |
94 | 96 | ||
@@ -116,7 +118,7 @@ private Q_SLOTS: | |||
116 | query.resources << "org.kde.dummy.instance1"; | 118 | query.resources << "org.kde.dummy.instance1"; |
117 | 119 | ||
118 | //Ensure all local data is processed | 120 | //Ensure all local data is processed |
119 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 121 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
120 | 122 | ||
121 | query.propertyFilter.insert("summary", "summaryValue2"); | 123 | query.propertyFilter.insert("summary", "summaryValue2"); |
122 | 124 | ||
@@ -150,7 +152,7 @@ private Q_SLOTS: | |||
150 | 152 | ||
151 | //Ensure all local data is processed | 153 | //Ensure all local data is processed |
152 | Sink::Store::synchronize(query).exec().waitForFinished(); | 154 | Sink::Store::synchronize(query).exec().waitForFinished(); |
153 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 155 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
154 | 156 | ||
155 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); | 157 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
156 | QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); | 158 | QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); |
@@ -167,7 +169,7 @@ private Q_SLOTS: | |||
167 | 169 | ||
168 | //Ensure all local data is processed | 170 | //Ensure all local data is processed |
169 | Sink::Store::synchronize(query).exec().waitForFinished(); | 171 | Sink::Store::synchronize(query).exec().waitForFinished(); |
170 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 172 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
171 | 173 | ||
172 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); | 174 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
173 | QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); | 175 | QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); |
@@ -190,7 +192,7 @@ private Q_SLOTS: | |||
190 | query.propertyFilter.insert("uid", "testuid"); | 192 | query.propertyFilter.insert("uid", "testuid"); |
191 | 193 | ||
192 | //Ensure all local data is processed | 194 | //Ensure all local data is processed |
193 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 195 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
194 | 196 | ||
195 | //Test create | 197 | //Test create |
196 | Sink::ApplicationDomain::Event event2; | 198 | Sink::ApplicationDomain::Event event2; |
@@ -209,7 +211,7 @@ private Q_SLOTS: | |||
209 | Sink::Store::modify<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished(); | 211 | Sink::Store::modify<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished(); |
210 | 212 | ||
211 | //Ensure all local data is processed | 213 | //Ensure all local data is processed |
212 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 214 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
213 | 215 | ||
214 | //Test modify | 216 | //Test modify |
215 | { | 217 | { |
@@ -224,7 +226,7 @@ private Q_SLOTS: | |||
224 | Sink::Store::remove<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished(); | 226 | Sink::Store::remove<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished(); |
225 | 227 | ||
226 | //Ensure all local data is processed | 228 | //Ensure all local data is processed |
227 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 229 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
228 | 230 | ||
229 | //Test remove | 231 | //Test remove |
230 | { | 232 | { |