diff options
Diffstat (limited to 'tests/dummyresourcetest.cpp')
-rw-r--r-- | tests/dummyresourcetest.cpp | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index d41f235..687a33b 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp | |||
@@ -30,11 +30,10 @@ private slots: | |||
30 | void initTestCase() | 30 | void initTestCase() |
31 | { | 31 | { |
32 | Sink::Test::initTest(); | 32 | Sink::Test::initTest(); |
33 | Sink::Log::setDebugOutputLevel(Sink::Log::Trace); | 33 | auto factory = Sink::ResourceFactory::load("sink.dummy"); |
34 | auto factory = Sink::ResourceFactory::load("org.kde.dummy"); | ||
35 | QVERIFY(factory); | 34 | QVERIFY(factory); |
36 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | 35 | DummyResource::removeFromDisk("sink.dummy.instance1"); |
37 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); | 36 | ResourceConfig::addResource("sink.dummy.instance1", "sink.dummy"); |
38 | } | 37 | } |
39 | 38 | ||
40 | void init() | 39 | void init() |
@@ -48,7 +47,7 @@ private slots: | |||
48 | void cleanup() | 47 | void cleanup() |
49 | { | 48 | { |
50 | qDebug() << "Test took " << time.elapsed(); | 49 | qDebug() << "Test took " << time.elapsed(); |
51 | Sink::Store::removeDataFromDisk(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); | 50 | Sink::Store::removeDataFromDisk(QByteArray("sink.dummy.instance1")).exec().waitForFinished(); |
52 | } | 51 | } |
53 | 52 | ||
54 | void testProperty() | 53 | void testProperty() |
@@ -60,13 +59,13 @@ private slots: | |||
60 | 59 | ||
61 | void testWriteToFacadeAndQueryByUid() | 60 | void testWriteToFacadeAndQueryByUid() |
62 | { | 61 | { |
63 | Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); | 62 | Sink::ApplicationDomain::Event event("sink.dummy.instance1"); |
64 | event.setProperty("uid", "testuid"); | 63 | event.setProperty("uid", "testuid"); |
65 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); | 64 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); |
66 | event.setProperty("summary", "summaryValue"); | 65 | event.setProperty("summary", "summaryValue"); |
67 | Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); | 66 | Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); |
68 | 67 | ||
69 | const auto query = Query::ResourceFilter("org.kde.dummy.instance1") ; | 68 | const auto query = Query::ResourceFilter("sink.dummy.instance1") ; |
70 | 69 | ||
71 | // Ensure all local data is processed | 70 | // Ensure all local data is processed |
72 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | 71 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
@@ -79,7 +78,7 @@ private slots: | |||
79 | 78 | ||
80 | void testWriteToFacadeAndQueryByUid2() | 79 | void testWriteToFacadeAndQueryByUid2() |
81 | { | 80 | { |
82 | Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); | 81 | Sink::ApplicationDomain::Event event("sink.dummy.instance1"); |
83 | event.setProperty("summary", "summaryValue"); | 82 | event.setProperty("summary", "summaryValue"); |
84 | 83 | ||
85 | event.setProperty("uid", "testuid"); | 84 | event.setProperty("uid", "testuid"); |
@@ -88,7 +87,7 @@ private slots: | |||
88 | event.setProperty("uid", "testuid2"); | 87 | event.setProperty("uid", "testuid2"); |
89 | Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); | 88 | Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); |
90 | 89 | ||
91 | const auto query = Query::ResourceFilter("org.kde.dummy.instance1") ; | 90 | const auto query = Query::ResourceFilter("sink.dummy.instance1") ; |
92 | 91 | ||
93 | // Ensure all local data is processed | 92 | // Ensure all local data is processed |
94 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | 93 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
@@ -103,7 +102,7 @@ private slots: | |||
103 | 102 | ||
104 | void testWriteToFacadeAndQueryBySummary() | 103 | void testWriteToFacadeAndQueryBySummary() |
105 | { | 104 | { |
106 | Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); | 105 | Sink::ApplicationDomain::Event event("sink.dummy.instance1"); |
107 | 106 | ||
108 | event.setProperty("uid", "testuid"); | 107 | event.setProperty("uid", "testuid"); |
109 | event.setProperty("summary", "summaryValue1"); | 108 | event.setProperty("summary", "summaryValue1"); |
@@ -113,7 +112,7 @@ private slots: | |||
113 | event.setProperty("summary", "summaryValue2"); | 112 | event.setProperty("summary", "summaryValue2"); |
114 | Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); | 113 | Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); |
115 | 114 | ||
116 | const auto query = Query::ResourceFilter("org.kde.dummy.instance1") ; | 115 | const auto query = Query::ResourceFilter("sink.dummy.instance1") ; |
117 | 116 | ||
118 | // Ensure all local data is processed | 117 | // Ensure all local data is processed |
119 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | 118 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
@@ -128,8 +127,8 @@ private slots: | |||
128 | 127 | ||
129 | void testResourceSync() | 128 | void testResourceSync() |
130 | { | 129 | { |
131 | auto pipeline = QSharedPointer<Sink::Pipeline>::create("org.kde.dummy.instance1"); | 130 | auto pipeline = QSharedPointer<Sink::Pipeline>::create("sink.dummy.instance1"); |
132 | DummyResource resource("org.kde.dummy.instance1", pipeline); | 131 | DummyResource resource("sink.dummy.instance1", pipeline); |
133 | auto job = resource.synchronizeWithSource(); | 132 | auto job = resource.synchronizeWithSource(); |
134 | // TODO pass in optional timeout? | 133 | // TODO pass in optional timeout? |
135 | auto future = job.exec(); | 134 | auto future = job.exec(); |
@@ -143,7 +142,7 @@ private slots: | |||
143 | 142 | ||
144 | void testSyncAndFacade() | 143 | void testSyncAndFacade() |
145 | { | 144 | { |
146 | const auto query = Query::ResourceFilter("org.kde.dummy.instance1"); | 145 | const auto query = Query::ResourceFilter("sink.dummy.instance1"); |
147 | 146 | ||
148 | // Ensure all local data is processed | 147 | // Ensure all local data is processed |
149 | Sink::Store::synchronize(query).exec().waitForFinished(); | 148 | Sink::Store::synchronize(query).exec().waitForFinished(); |
@@ -159,7 +158,7 @@ private slots: | |||
159 | 158 | ||
160 | void testSyncAndFacadeMail() | 159 | void testSyncAndFacadeMail() |
161 | { | 160 | { |
162 | const auto query = Query::ResourceFilter("org.kde.dummy.instance1"); | 161 | const auto query = Query::ResourceFilter("sink.dummy.instance1"); |
163 | 162 | ||
164 | // Ensure all local data is processed | 163 | // Ensure all local data is processed |
165 | Sink::Store::synchronize(query).exec().waitForFinished(); | 164 | Sink::Store::synchronize(query).exec().waitForFinished(); |
@@ -175,13 +174,13 @@ private slots: | |||
175 | 174 | ||
176 | void testWriteModifyDelete() | 175 | void testWriteModifyDelete() |
177 | { | 176 | { |
178 | Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); | 177 | Sink::ApplicationDomain::Event event("sink.dummy.instance1"); |
179 | event.setProperty("uid", "testuid"); | 178 | event.setProperty("uid", "testuid"); |
180 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); | 179 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); |
181 | event.setProperty("summary", "summaryValue"); | 180 | event.setProperty("summary", "summaryValue"); |
182 | Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); | 181 | Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); |
183 | 182 | ||
184 | const auto query = Query::ResourceFilter("org.kde.dummy.instance1") + Query::PropertyFilter("uid", "testuid"); | 183 | const auto query = Query::ResourceFilter("sink.dummy.instance1") + Query::PropertyFilter("uid", "testuid"); |
185 | 184 | ||
186 | // Ensure all local data is processed | 185 | // Ensure all local data is processed |
187 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | 186 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
@@ -230,14 +229,14 @@ private slots: | |||
230 | 229 | ||
231 | void testWriteModifyDeleteLive() | 230 | void testWriteModifyDeleteLive() |
232 | { | 231 | { |
233 | auto query = Query::ResourceFilter("org.kde.dummy.instance1"); | 232 | auto query = Query::ResourceFilter("sink.dummy.instance1"); |
234 | query.liveQuery = true; | 233 | query.liveQuery = true; |
235 | query += Query::PropertyFilter("uid", "testuid"); | 234 | query += Query::PropertyFilter("uid", "testuid"); |
236 | 235 | ||
237 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); | 236 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
238 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); | 237 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
239 | 238 | ||
240 | Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); | 239 | Sink::ApplicationDomain::Event event("sink.dummy.instance1"); |
241 | event.setProperty("uid", "testuid"); | 240 | event.setProperty("uid", "testuid"); |
242 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); | 241 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); |
243 | event.setProperty("summary", "summaryValue"); | 242 | event.setProperty("summary", "summaryValue"); |