diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-06-17 00:57:24 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-06-17 00:57:24 +0200 |
commit | 4eb94786232aee936cd6371824764705c9359538 (patch) | |
tree | c5347ae86c4088676f78d59d647c9a30e636b53b /tests/dummyresourcetest.cpp | |
parent | 7819a02582fea02cd6da56aa4526492d281df07a (diff) | |
download | sink-4eb94786232aee936cd6371824764705c9359538.tar.gz sink-4eb94786232aee936cd6371824764705c9359538.zip |
An almost generic query implementation.
With equality filter on arbitrary properties as a bonus.
Diffstat (limited to 'tests/dummyresourcetest.cpp')
-rw-r--r-- | tests/dummyresourcetest.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index fe04d99..4c27b10 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp | |||
@@ -124,6 +124,57 @@ private Q_SLOTS: | |||
124 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); | 124 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); |
125 | } | 125 | } |
126 | 126 | ||
127 | void testWriteToFacadeAndQueryByUid2() | ||
128 | { | ||
129 | Akonadi2::ApplicationDomain::Event event; | ||
130 | event.setProperty("summary", "summaryValue"); | ||
131 | |||
132 | event.setProperty("uid", "testuid"); | ||
133 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Event>(event, "org.kde.dummy.instance1"); | ||
134 | |||
135 | event.setProperty("uid", "testuid2"); | ||
136 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Event>(event, "org.kde.dummy.instance1"); | ||
137 | |||
138 | Akonadi2::Query query; | ||
139 | query.resources << "org.kde.dummy.instance1"; | ||
140 | query.syncOnDemand = false; | ||
141 | query.processAll = true; | ||
142 | |||
143 | query.propertyFilter.insert("uid", "testuid"); | ||
144 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); | ||
145 | result.exec(); | ||
146 | QCOMPARE(result.size(), 1); | ||
147 | auto value = result.first(); | ||
148 | qDebug() << value->getProperty("uid").toByteArray(); | ||
149 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); | ||
150 | } | ||
151 | |||
152 | void testWriteToFacadeAndQueryBySummary() | ||
153 | { | ||
154 | Akonadi2::ApplicationDomain::Event event; | ||
155 | |||
156 | event.setProperty("uid", "testuid"); | ||
157 | event.setProperty("summary", "summaryValue1"); | ||
158 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Event>(event, "org.kde.dummy.instance1"); | ||
159 | |||
160 | event.setProperty("uid", "testuid2"); | ||
161 | event.setProperty("summary", "summaryValue2"); | ||
162 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Event>(event, "org.kde.dummy.instance1"); | ||
163 | |||
164 | Akonadi2::Query query; | ||
165 | query.resources << "org.kde.dummy.instance1"; | ||
166 | query.syncOnDemand = false; | ||
167 | query.processAll = true; | ||
168 | |||
169 | query.propertyFilter.insert("summary", "summaryValue2"); | ||
170 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); | ||
171 | result.exec(); | ||
172 | QCOMPARE(result.size(), 1); | ||
173 | auto value = result.first(); | ||
174 | qDebug() << value->getProperty("uid").toByteArray(); | ||
175 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid2")); | ||
176 | } | ||
177 | |||
127 | void testResourceSync() | 178 | void testResourceSync() |
128 | { | 179 | { |
129 | Akonadi2::Pipeline pipeline("org.kde.dummy.instance1"); | 180 | Akonadi2::Pipeline pipeline("org.kde.dummy.instance1"); |