summaryrefslogtreecommitdiffstats
path: root/tests/dummyresourcetest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dummyresourcetest.cpp')
-rw-r--r--tests/dummyresourcetest.cpp35
1 files changed, 17 insertions, 18 deletions
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp
index 8b5a8fa..33304e1 100644
--- a/tests/dummyresourcetest.cpp
+++ b/tests/dummyresourcetest.cpp
@@ -14,7 +14,7 @@
14 14
15/** 15/**
16 * Test of complete system using the dummy resource. 16 * Test of complete system using the dummy resource.
17 * 17 *
18 * This test requires the dummy resource installed. 18 * This test requires the dummy resource installed.
19 */ 19 */
20class DummyResourceTest : public QObject 20class DummyResourceTest : public QObject
@@ -65,7 +65,7 @@ private slots:
65 Sink::Query query; 65 Sink::Query query;
66 query.resources << "org.kde.dummy.instance1"; 66 query.resources << "org.kde.dummy.instance1";
67 67
68 //Ensure all local data is processed 68 // Ensure all local data is processed
69 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); 69 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished();
70 70
71 query.propertyFilter.insert("uid", "testuid"); 71 query.propertyFilter.insert("uid", "testuid");
@@ -89,7 +89,7 @@ private slots:
89 Sink::Query query; 89 Sink::Query query;
90 query.resources << "org.kde.dummy.instance1"; 90 query.resources << "org.kde.dummy.instance1";
91 91
92 //Ensure all local data is processed 92 // Ensure all local data is processed
93 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); 93 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished();
94 94
95 query.propertyFilter.insert("uid", "testuid"); 95 query.propertyFilter.insert("uid", "testuid");
@@ -117,7 +117,7 @@ private slots:
117 Sink::Query query; 117 Sink::Query query;
118 query.resources << "org.kde.dummy.instance1"; 118 query.resources << "org.kde.dummy.instance1";
119 119
120 //Ensure all local data is processed 120 // Ensure all local data is processed
121 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); 121 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished();
122 122
123 query.propertyFilter.insert("summary", "summaryValue2"); 123 query.propertyFilter.insert("summary", "summaryValue2");
@@ -135,7 +135,7 @@ private slots:
135 auto pipeline = QSharedPointer<Sink::Pipeline>::create("org.kde.dummy.instance1"); 135 auto pipeline = QSharedPointer<Sink::Pipeline>::create("org.kde.dummy.instance1");
136 DummyResource resource("org.kde.dummy.instance1", pipeline); 136 DummyResource resource("org.kde.dummy.instance1", pipeline);
137 auto job = resource.synchronizeWithSource(); 137 auto job = resource.synchronizeWithSource();
138 //TODO pass in optional timeout? 138 // TODO pass in optional timeout?
139 auto future = job.exec(); 139 auto future = job.exec();
140 future.waitForFinished(); 140 future.waitForFinished();
141 QVERIFY(!future.errorCode()); 141 QVERIFY(!future.errorCode());
@@ -150,7 +150,7 @@ private slots:
150 Sink::Query query; 150 Sink::Query query;
151 query.resources << "org.kde.dummy.instance1"; 151 query.resources << "org.kde.dummy.instance1";
152 152
153 //Ensure all local data is processed 153 // Ensure all local data is processed
154 Sink::Store::synchronize(query).exec().waitForFinished(); 154 Sink::Store::synchronize(query).exec().waitForFinished();
155 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); 155 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished();
156 156
@@ -167,7 +167,7 @@ private slots:
167 Sink::Query query; 167 Sink::Query query;
168 query.resources << "org.kde.dummy.instance1"; 168 query.resources << "org.kde.dummy.instance1";
169 169
170 //Ensure all local data is processed 170 // Ensure all local data is processed
171 Sink::Store::synchronize(query).exec().waitForFinished(); 171 Sink::Store::synchronize(query).exec().waitForFinished();
172 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); 172 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished();
173 173
@@ -191,10 +191,10 @@ private slots:
191 query.resources << "org.kde.dummy.instance1"; 191 query.resources << "org.kde.dummy.instance1";
192 query.propertyFilter.insert("uid", "testuid"); 192 query.propertyFilter.insert("uid", "testuid");
193 193
194 //Ensure all local data is processed 194 // Ensure all local data is processed
195 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); 195 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished();
196 196
197 //Test create 197 // Test create
198 Sink::ApplicationDomain::Event event2; 198 Sink::ApplicationDomain::Event event2;
199 { 199 {
200 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); 200 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query);
@@ -210,10 +210,10 @@ private slots:
210 event2.setProperty("summary", "summaryValue2"); 210 event2.setProperty("summary", "summaryValue2");
211 Sink::Store::modify<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished(); 211 Sink::Store::modify<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished();
212 212
213 //Ensure all local data is processed 213 // Ensure all local data is processed
214 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); 214 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished();
215 215
216 //Test modify 216 // Test modify
217 { 217 {
218 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); 218 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query);
219 QTRY_COMPARE(model->rowCount(QModelIndex()), 1); 219 QTRY_COMPARE(model->rowCount(QModelIndex()), 1);
@@ -225,10 +225,10 @@ private slots:
225 225
226 Sink::Store::remove<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished(); 226 Sink::Store::remove<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished();
227 227
228 //Ensure all local data is processed 228 // Ensure all local data is processed
229 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); 229 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished();
230 230
231 //Test remove 231 // Test remove
232 { 232 {
233 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); 233 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query);
234 QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); 234 QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool());
@@ -253,7 +253,7 @@ private slots:
253 event.setProperty("summary", "summaryValue"); 253 event.setProperty("summary", "summaryValue");
254 Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); 254 Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished();
255 255
256 //Test create 256 // Test create
257 Sink::ApplicationDomain::Event event2; 257 Sink::ApplicationDomain::Event event2;
258 { 258 {
259 QTRY_COMPARE(model->rowCount(QModelIndex()), 1); 259 QTRY_COMPARE(model->rowCount(QModelIndex()), 1);
@@ -267,9 +267,9 @@ private slots:
267 event2.setProperty("summary", "summaryValue2"); 267 event2.setProperty("summary", "summaryValue2");
268 Sink::Store::modify<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished(); 268 Sink::Store::modify<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished();
269 269
270 //Test modify 270 // Test modify
271 { 271 {
272 //TODO wait for a change signal 272 // TODO wait for a change signal
273 QTRY_COMPARE(model->rowCount(QModelIndex()), 1); 273 QTRY_COMPARE(model->rowCount(QModelIndex()), 1);
274 auto value = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Event::Ptr>(); 274 auto value = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Event::Ptr>();
275 QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); 275 QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid"));
@@ -278,12 +278,11 @@ private slots:
278 278
279 Sink::Store::remove<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished(); 279 Sink::Store::remove<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished();
280 280
281 //Test remove 281 // Test remove
282 { 282 {
283 QTRY_COMPARE(model->rowCount(QModelIndex()), 0); 283 QTRY_COMPARE(model->rowCount(QModelIndex()), 0);
284 } 284 }
285 } 285 }
286
287}; 286};
288 287
289QTEST_MAIN(DummyResourceTest) 288QTEST_MAIN(DummyResourceTest)