diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 10 | ||||
-rw-r--r-- | tests/clientapitest.cpp | 218 | ||||
-rw-r--r-- | tests/dummyresourcebenchmark.cpp | 40 | ||||
-rw-r--r-- | tests/dummyresourcetest.cpp | 105 | ||||
-rw-r--r-- | tests/genericfacadebenchmark.cpp | 6 | ||||
-rw-r--r-- | tests/genericfacadetest.cpp | 47 | ||||
-rw-r--r-- | tests/pipelinetest.cpp | 2 | ||||
-rw-r--r-- | tests/querytest.cpp | 161 | ||||
-rw-r--r-- | tests/storagetest.cpp | 30 | ||||
-rw-r--r-- | tests/testimplementations.h | 31 |
10 files changed, 480 insertions, 170 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5629cdb..11fe415 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt | |||
@@ -30,8 +30,8 @@ endmacro(auto_tests) | |||
30 | manual_tests ( | 30 | manual_tests ( |
31 | storagebenchmark | 31 | storagebenchmark |
32 | dummyresourcebenchmark | 32 | dummyresourcebenchmark |
33 | genericresourcebenchmark | 33 | # genericresourcebenchmark |
34 | genericfacadebenchmark | 34 | # genericfacadebenchmark |
35 | ) | 35 | ) |
36 | 36 | ||
37 | auto_tests ( | 37 | auto_tests ( |
@@ -41,12 +41,14 @@ auto_tests ( | |||
41 | domainadaptortest | 41 | domainadaptortest |
42 | messagequeuetest | 42 | messagequeuetest |
43 | indextest | 43 | indextest |
44 | genericresourcetest | 44 | # genericresourcetest |
45 | genericfacadetest | 45 | # genericfacadetest |
46 | resourcecommunicationtest | 46 | resourcecommunicationtest |
47 | pipelinetest | 47 | pipelinetest |
48 | querytest | ||
48 | ) | 49 | ) |
49 | 50 | ||
50 | target_link_libraries(dummyresourcetest akonadi2_resource_dummy) | 51 | target_link_libraries(dummyresourcetest akonadi2_resource_dummy) |
51 | target_link_libraries(dummyresourcebenchmark akonadi2_resource_dummy) | 52 | target_link_libraries(dummyresourcebenchmark akonadi2_resource_dummy) |
53 | target_link_libraries(querytest akonadi2_resource_dummy) | ||
52 | 54 | ||
diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp index 665d29b..8f956ab 100644 --- a/tests/clientapitest.cpp +++ b/tests/clientapitest.cpp | |||
@@ -4,30 +4,60 @@ | |||
4 | 4 | ||
5 | #include "clientapi.h" | 5 | #include "clientapi.h" |
6 | #include "facade.h" | 6 | #include "facade.h" |
7 | #include "synclistresult.h" | ||
8 | #include "resourceconfig.h" | 7 | #include "resourceconfig.h" |
8 | #include "modelresult.h" | ||
9 | #include "resultprovider.h" | ||
10 | #include "facadefactory.h" | ||
9 | 11 | ||
10 | class DummyResourceFacade : public Akonadi2::StoreFacade<Akonadi2::ApplicationDomain::Event> | 12 | template <typename T> |
13 | class DummyResourceFacade : public Akonadi2::StoreFacade<T> | ||
11 | { | 14 | { |
12 | public: | 15 | public: |
16 | static std::shared_ptr<DummyResourceFacade<T> > registerFacade() | ||
17 | { | ||
18 | auto facade = std::make_shared<DummyResourceFacade<T> >(); | ||
19 | Akonadi2::FacadeFactory::instance().registerFacade<T, DummyResourceFacade<T> >("dummyresource", | ||
20 | [facade](const QByteArray &instanceIdentifier) { | ||
21 | return facade; | ||
22 | } | ||
23 | ); | ||
24 | return facade; | ||
25 | } | ||
13 | ~DummyResourceFacade(){}; | 26 | ~DummyResourceFacade(){}; |
14 | KAsync::Job<void> create(const Akonadi2::ApplicationDomain::Event &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); }; | 27 | KAsync::Job<void> create(const T &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); }; |
15 | KAsync::Job<void> modify(const Akonadi2::ApplicationDomain::Event &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); }; | 28 | KAsync::Job<void> modify(const T &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); }; |
16 | KAsync::Job<void> remove(const Akonadi2::ApplicationDomain::Event &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); }; | 29 | KAsync::Job<void> remove(const T &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); }; |
17 | KAsync::Job<void> load(const Akonadi2::Query &query, const QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> > &resultProvider) Q_DECL_OVERRIDE | 30 | QPair<KAsync::Job<void>, typename Akonadi2::ResultEmitter<typename T::Ptr>::Ptr > load(const Akonadi2::Query &query) Q_DECL_OVERRIDE |
18 | { | 31 | { |
19 | capturedResultProvider = resultProvider; | 32 | auto resultProvider = new Akonadi2::ResultProvider<typename T::Ptr>(); |
20 | return KAsync::start<void>([this, resultProvider, query]() { | 33 | resultProvider->onDone([resultProvider]() { |
34 | Trace() << "Result provider is done"; | ||
35 | delete resultProvider; | ||
36 | }); | ||
37 | //We have to do it this way, otherwise we're not setting the fetcher right | ||
38 | auto emitter = resultProvider->emitter(); | ||
39 | |||
40 | resultProvider->setFetcher([query, resultProvider, this](const typename T::Ptr &parent) { | ||
41 | Trace() << "Running the fetcher"; | ||
21 | for (const auto &res : results) { | 42 | for (const auto &res : results) { |
22 | resultProvider->add(res); | 43 | qDebug() << "Parent filter " << query.propertyFilter.value("parent").toByteArray() << res->identifier(); |
44 | if (!query.propertyFilter.contains("parent") || query.propertyFilter.value("parent").toByteArray() == res->getProperty("parent").toByteArray()) { | ||
45 | resultProvider->add(res); | ||
46 | } | ||
23 | } | 47 | } |
48 | resultProvider->initialResultSetComplete(parent); | ||
49 | }); | ||
50 | auto job = KAsync::start<void>([query, resultProvider]() { | ||
24 | }); | 51 | }); |
52 | mResultProvider = resultProvider; | ||
53 | return qMakePair(job, emitter); | ||
25 | } | 54 | } |
26 | 55 | ||
27 | QList<Akonadi2::ApplicationDomain::Event::Ptr> results; | 56 | QList<typename T::Ptr> results; |
28 | QWeakPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> > capturedResultProvider; | 57 | Akonadi2::ResultProviderInterface<typename T::Ptr> *mResultProvider; |
29 | }; | 58 | }; |
30 | 59 | ||
60 | |||
31 | /** | 61 | /** |
32 | * Test of the client api implementation. | 62 | * Test of the client api implementation. |
33 | * | 63 | * |
@@ -38,56 +68,26 @@ class ClientAPITest : public QObject | |||
38 | Q_OBJECT | 68 | Q_OBJECT |
39 | private Q_SLOTS: | 69 | private Q_SLOTS: |
40 | 70 | ||
41 | static std::shared_ptr<DummyResourceFacade> registerDummyFacade() | ||
42 | { | ||
43 | auto facade = std::make_shared<DummyResourceFacade>(); | ||
44 | Akonadi2::FacadeFactory::instance().registerFacade<Akonadi2::ApplicationDomain::Event, DummyResourceFacade>("dummyresource", | ||
45 | [facade](const QByteArray &instanceIdentifier) { | ||
46 | return facade; | ||
47 | } | ||
48 | ); | ||
49 | return facade; | ||
50 | } | ||
51 | |||
52 | void initTestCase() | 71 | void initTestCase() |
53 | { | 72 | { |
54 | Akonadi2::FacadeFactory::instance().resetFactory(); | 73 | Akonadi2::FacadeFactory::instance().resetFactory(); |
55 | ResourceConfig::clear(); | 74 | ResourceConfig::clear(); |
75 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Trace); | ||
56 | } | 76 | } |
57 | 77 | ||
58 | void testLoad() | 78 | void testLoad() |
59 | { | 79 | { |
60 | auto facade = registerDummyFacade(); | 80 | auto facade = DummyResourceFacade<Akonadi2::ApplicationDomain::Event>::registerFacade(); |
61 | facade->results << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); | 81 | facade->results << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); |
62 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); | 82 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); |
63 | 83 | ||
64 | Akonadi2::Query query; | 84 | Akonadi2::Query query; |
65 | query.resources << "dummyresource.instance1"; | 85 | query.resources << "dummyresource.instance1"; |
66 | query.liveQuery = false; | 86 | query.liveQuery = false; |
67 | 87 | ||
68 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); | 88 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); |
69 | result.exec(); | 89 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); |
70 | QCOMPARE(result.size(), 1); | 90 | QCOMPARE(model->rowCount(QModelIndex()), 1); |
71 | } | ||
72 | |||
73 | //The query provider is supposed to delete itself | ||
74 | void testQueryLifetime() | ||
75 | { | ||
76 | auto facade = registerDummyFacade(); | ||
77 | facade->results << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); | ||
78 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); | ||
79 | |||
80 | Akonadi2::Query query; | ||
81 | query.resources << "dummyresource.instance1"; | ||
82 | query.liveQuery = true; | ||
83 | |||
84 | { | ||
85 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); | ||
86 | result.exec(); | ||
87 | QCOMPARE(result.size(), 1); | ||
88 | } | ||
89 | //It's running in a separate thread, so we have to wait for a moment until the query provider deletes itself. | ||
90 | QTRY_VERIFY(!facade->capturedResultProvider); | ||
91 | } | 91 | } |
92 | 92 | ||
93 | //TODO: This test doesn't belong to this testsuite | 93 | //TODO: This test doesn't belong to this testsuite |
@@ -104,21 +104,133 @@ private Q_SLOTS: | |||
104 | { | 104 | { |
105 | Akonadi2::Query query; | 105 | Akonadi2::Query query; |
106 | query.propertyFilter.insert("type", "dummyresource"); | 106 | query.propertyFilter.insert("type", "dummyresource"); |
107 | async::SyncListResult<Akonadi2::ApplicationDomain::AkonadiResource::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::AkonadiResource>(query)); | 107 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::AkonadiResource>(query); |
108 | result.exec(); | 108 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); |
109 | QCOMPARE(result.size(), 1); | ||
110 | } | 109 | } |
111 | 110 | ||
112 | Akonadi2::Store::remove(res).exec().waitForFinished(); | 111 | Akonadi2::Store::remove(res).exec().waitForFinished(); |
113 | { | 112 | { |
114 | Akonadi2::Query query; | 113 | Akonadi2::Query query; |
115 | query.propertyFilter.insert("type", "dummyresource"); | 114 | query.propertyFilter.insert("type", "dummyresource"); |
116 | async::SyncListResult<Akonadi2::ApplicationDomain::AkonadiResource::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::AkonadiResource>(query)); | 115 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::AkonadiResource>(query); |
117 | result.exec(); | 116 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); |
118 | QCOMPARE(result.size(), 0); | 117 | QCOMPARE(model->rowCount(QModelIndex()), 0); |
119 | } | 118 | } |
120 | } | 119 | } |
121 | 120 | ||
121 | void testModelSingle() | ||
122 | { | ||
123 | auto facade = DummyResourceFacade<Akonadi2::ApplicationDomain::Folder>::registerFacade(); | ||
124 | facade->results << QSharedPointer<Akonadi2::ApplicationDomain::Folder>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | ||
125 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); | ||
126 | |||
127 | Akonadi2::Query query; | ||
128 | query.resources << "dummyresource.instance1"; | ||
129 | query.liveQuery = false; | ||
130 | |||
131 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | ||
132 | QTRY_COMPARE(model->rowCount(), 1); | ||
133 | } | ||
134 | |||
135 | void testModelNested() | ||
136 | { | ||
137 | auto facade = DummyResourceFacade<Akonadi2::ApplicationDomain::Folder>::registerFacade(); | ||
138 | auto folder = QSharedPointer<Akonadi2::ApplicationDomain::Folder>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | ||
139 | auto subfolder = QSharedPointer<Akonadi2::ApplicationDomain::Folder>::create("resource", "subId", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | ||
140 | subfolder->setProperty("parent", "id"); | ||
141 | facade->results << folder << subfolder; | ||
142 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); | ||
143 | |||
144 | //Test | ||
145 | Akonadi2::Query query; | ||
146 | query.resources << "dummyresource.instance1"; | ||
147 | query.liveQuery = false; | ||
148 | query.parentProperty = "parent"; | ||
149 | |||
150 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | ||
151 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | ||
152 | QCOMPARE(model->rowCount(), 1); | ||
153 | model->fetchMore(model->index(0, 0)); | ||
154 | QTRY_VERIFY(model->data(model->index(0, 0), Akonadi2::Store::ChildrenFetchedRole).toBool()); | ||
155 | QCOMPARE(model->rowCount(model->index(0, 0)), 1); | ||
156 | } | ||
157 | |||
158 | void testModelSignals() | ||
159 | { | ||
160 | auto facade = DummyResourceFacade<Akonadi2::ApplicationDomain::Folder>::registerFacade(); | ||
161 | auto folder = QSharedPointer<Akonadi2::ApplicationDomain::Folder>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | ||
162 | auto subfolder = QSharedPointer<Akonadi2::ApplicationDomain::Folder>::create("resource", "subId", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | ||
163 | subfolder->setProperty("parent", "id"); | ||
164 | facade->results << folder << subfolder; | ||
165 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); | ||
166 | |||
167 | //Test | ||
168 | Akonadi2::Query query; | ||
169 | query.resources << "dummyresource.instance1"; | ||
170 | query.liveQuery = false; | ||
171 | query.parentProperty = "parent"; | ||
172 | |||
173 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | ||
174 | QSignalSpy spy(model.data(), SIGNAL(rowsInserted(const QModelIndex &, int, int))); | ||
175 | QVERIFY(spy.isValid()); | ||
176 | model->fetchMore(model->index(0, 0)); | ||
177 | QTRY_VERIFY(spy.count() >= 1); | ||
178 | } | ||
179 | |||
180 | void testModelNestedLive() | ||
181 | { | ||
182 | auto facade = DummyResourceFacade<Akonadi2::ApplicationDomain::Folder>::registerFacade(); | ||
183 | auto folder = QSharedPointer<Akonadi2::ApplicationDomain::Folder>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | ||
184 | auto subfolder = QSharedPointer<Akonadi2::ApplicationDomain::Folder>::create("resource", "subId", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | ||
185 | subfolder->setProperty("parent", "id"); | ||
186 | facade->results << folder << subfolder; | ||
187 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); | ||
188 | |||
189 | //Test | ||
190 | Akonadi2::Query query; | ||
191 | query.resources << "dummyresource.instance1"; | ||
192 | query.liveQuery = true; | ||
193 | query.parentProperty = "parent"; | ||
194 | |||
195 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | ||
196 | QTRY_COMPARE(model->rowCount(), 1); | ||
197 | model->fetchMore(model->index(0, 0)); | ||
198 | QTRY_COMPARE(model->rowCount(model->index(0, 0)), 1); | ||
199 | |||
200 | auto resultProvider = facade->mResultProvider; | ||
201 | |||
202 | //Test new toplevel folder | ||
203 | { | ||
204 | QSignalSpy rowsInsertedSpy(model.data(), SIGNAL(rowsInserted(const QModelIndex &, int, int))); | ||
205 | auto folder2 = QSharedPointer<Akonadi2::ApplicationDomain::Folder>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | ||
206 | resultProvider->add(folder2); | ||
207 | QTRY_COMPARE(model->rowCount(), 2); | ||
208 | QTRY_COMPARE(rowsInsertedSpy.count(), 1); | ||
209 | QCOMPARE(rowsInsertedSpy.at(0).at(0).value<QModelIndex>(), QModelIndex()); | ||
210 | } | ||
211 | |||
212 | //Test changed name | ||
213 | { | ||
214 | QSignalSpy dataChanged(model.data(), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &, const QVector<int> &))); | ||
215 | folder->setProperty("subject", "modifiedSubject"); | ||
216 | resultProvider->modify(folder); | ||
217 | QTRY_COMPARE(model->rowCount(), 2); | ||
218 | QTRY_COMPARE(dataChanged.count(), 1); | ||
219 | } | ||
220 | |||
221 | //Test removal | ||
222 | { | ||
223 | QSignalSpy rowsRemovedSpy(model.data(), SIGNAL(rowsRemoved(const QModelIndex &, int, int))); | ||
224 | folder->setProperty("subject", "modifiedSubject"); | ||
225 | resultProvider->remove(subfolder); | ||
226 | QTRY_COMPARE(model->rowCount(model->index(0, 0)), 0); | ||
227 | QTRY_COMPARE(rowsRemovedSpy.count(), 1); | ||
228 | } | ||
229 | |||
230 | //TODO: A modification can also be a move | ||
231 | } | ||
232 | |||
233 | |||
122 | }; | 234 | }; |
123 | 235 | ||
124 | QTEST_MAIN(ClientAPITest) | 236 | QTEST_MAIN(ClientAPITest) |
diff --git a/tests/dummyresourcebenchmark.cpp b/tests/dummyresourcebenchmark.cpp index 242ac76..6eaf065 100644 --- a/tests/dummyresourcebenchmark.cpp +++ b/tests/dummyresourcebenchmark.cpp | |||
@@ -7,9 +7,9 @@ | |||
7 | #include "clientapi.h" | 7 | #include "clientapi.h" |
8 | #include "commands.h" | 8 | #include "commands.h" |
9 | #include "entitybuffer.h" | 9 | #include "entitybuffer.h" |
10 | #include "synclistresult.h" | ||
11 | #include "pipeline.h" | 10 | #include "pipeline.h" |
12 | #include "log.h" | 11 | #include "log.h" |
12 | #include "resourceconfig.h" | ||
13 | 13 | ||
14 | #include "event_generated.h" | 14 | #include "event_generated.h" |
15 | #include "entity_generated.h" | 15 | #include "entity_generated.h" |
@@ -24,18 +24,20 @@ | |||
24 | class DummyResourceBenchmark : public QObject | 24 | class DummyResourceBenchmark : public QObject |
25 | { | 25 | { |
26 | Q_OBJECT | 26 | Q_OBJECT |
27 | private: | ||
28 | int num; | ||
27 | private Q_SLOTS: | 29 | private Q_SLOTS: |
28 | void initTestCase() | 30 | void initTestCase() |
29 | { | 31 | { |
30 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Warning); | 32 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Warning); |
31 | auto factory = Akonadi2::ResourceFactory::load("org.kde.dummy"); | 33 | auto factory = Akonadi2::ResourceFactory::load("org.kde.dummy"); |
32 | QVERIFY(factory); | 34 | QVERIFY(factory); |
33 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | 35 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); |
36 | num = 5000; | ||
34 | } | 37 | } |
35 | 38 | ||
36 | void cleanup() | 39 | void cleanup() |
37 | { | 40 | { |
38 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | ||
39 | } | 41 | } |
40 | 42 | ||
41 | static KAsync::Job<void> waitForCompletion(QList<KAsync::Future<void> > &futures) | 43 | static KAsync::Job<void> waitForCompletion(QList<KAsync::Future<void> > &futures) |
@@ -68,11 +70,12 @@ private Q_SLOTS: | |||
68 | }); | 70 | }); |
69 | } | 71 | } |
70 | 72 | ||
71 | void testWriteToFacadeAndQueryByUid() | 73 | void testWriteToFacade() |
72 | { | 74 | { |
75 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | ||
76 | |||
73 | QTime time; | 77 | QTime time; |
74 | time.start(); | 78 | time.start(); |
75 | int num = 100; | ||
76 | QList<KAsync::Future<void> > waitCondition; | 79 | QList<KAsync::Future<void> > waitCondition; |
77 | for (int i = 0; i < num; i++) { | 80 | for (int i = 0; i < num; i++) { |
78 | Akonadi2::ApplicationDomain::Event event("org.kde.dummy.instance1"); | 81 | Akonadi2::ApplicationDomain::Event event("org.kde.dummy.instance1"); |
@@ -90,13 +93,17 @@ private Q_SLOTS: | |||
90 | query.resources << "org.kde.dummy.instance1"; | 93 | query.resources << "org.kde.dummy.instance1"; |
91 | query.syncOnDemand = false; | 94 | query.syncOnDemand = false; |
92 | query.processAll = true; | 95 | query.processAll = true; |
93 | 96 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | |
94 | query.propertyFilter.insert("uid", "nonexistantuid"); | ||
95 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); | ||
96 | result.exec(); | ||
97 | } | 97 | } |
98 | auto allProcessedTime = time.elapsed(); | 98 | auto allProcessedTime = time.elapsed(); |
99 | qDebug() << "Append to messagequeue " << appendTime; | ||
100 | qDebug() << "All processed: " << allProcessedTime << "/sec " << num*1000/allProcessedTime; | ||
101 | } | ||
99 | 102 | ||
103 | void testQueryByUid() | ||
104 | { | ||
105 | QTime time; | ||
106 | time.start(); | ||
100 | //Measure query | 107 | //Measure query |
101 | { | 108 | { |
102 | time.start(); | 109 | time.start(); |
@@ -106,20 +113,17 @@ private Q_SLOTS: | |||
106 | query.processAll = false; | 113 | query.processAll = false; |
107 | 114 | ||
108 | query.propertyFilter.insert("uid", "testuid"); | 115 | query.propertyFilter.insert("uid", "testuid"); |
109 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); | 116 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); |
110 | result.exec(); | 117 | QTRY_COMPARE(model->rowCount(QModelIndex()), num); |
111 | QCOMPARE(result.size(), num); | ||
112 | } | 118 | } |
113 | qDebug() << "Append to messagequeue " << appendTime; | ||
114 | qDebug() << "All processed: " << allProcessedTime << "/sec " << num*1000/allProcessedTime; | ||
115 | qDebug() << "Query Time: " << time.elapsed() << "/sec " << num*1000/time.elapsed(); | 119 | qDebug() << "Query Time: " << time.elapsed() << "/sec " << num*1000/time.elapsed(); |
116 | } | 120 | } |
117 | 121 | ||
118 | void testWriteInProcess() | 122 | void testWriteInProcess() |
119 | { | 123 | { |
124 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | ||
120 | QTime time; | 125 | QTime time; |
121 | time.start(); | 126 | time.start(); |
122 | int num = 100; | ||
123 | 127 | ||
124 | auto pipeline = QSharedPointer<Akonadi2::Pipeline>::create("org.kde.dummy.instance1"); | 128 | auto pipeline = QSharedPointer<Akonadi2::Pipeline>::create("org.kde.dummy.instance1"); |
125 | DummyResource resource("org.kde.dummy.instance1", pipeline); | 129 | DummyResource resource("org.kde.dummy.instance1", pipeline); |
@@ -191,6 +195,12 @@ private Q_SLOTS: | |||
191 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); | 195 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); |
192 | } | 196 | } |
193 | } | 197 | } |
198 | |||
199 | //This allows to run individual parts without doing a cleanup, but still cleaning up normally | ||
200 | void testCleanupForCompleteTest() | ||
201 | { | ||
202 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | ||
203 | } | ||
194 | }; | 204 | }; |
195 | 205 | ||
196 | QTEST_MAIN(DummyResourceBenchmark) | 206 | QTEST_MAIN(DummyResourceBenchmark) |
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index d027266..20c725f 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp | |||
@@ -4,10 +4,10 @@ | |||
4 | 4 | ||
5 | #include "dummyresource/resourcefactory.h" | 5 | #include "dummyresource/resourcefactory.h" |
6 | #include "clientapi.h" | 6 | #include "clientapi.h" |
7 | #include "synclistresult.h" | ||
8 | #include "commands.h" | 7 | #include "commands.h" |
9 | #include "entitybuffer.h" | 8 | #include "entitybuffer.h" |
10 | #include "resourceconfig.h" | 9 | #include "resourceconfig.h" |
10 | #include "modelresult.h" | ||
11 | #include "pipeline.h" | 11 | #include "pipeline.h" |
12 | #include "log.h" | 12 | #include "log.h" |
13 | 13 | ||
@@ -64,11 +64,13 @@ private Q_SLOTS: | |||
64 | query.syncOnDemand = false; | 64 | query.syncOnDemand = false; |
65 | query.processAll = true; | 65 | query.processAll = true; |
66 | 66 | ||
67 | //Ensure all local data is processed | ||
68 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | ||
69 | |||
67 | query.propertyFilter.insert("uid", "testuid"); | 70 | query.propertyFilter.insert("uid", "testuid"); |
68 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); | 71 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); |
69 | result.exec(); | 72 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); |
70 | QCOMPARE(result.size(), 1); | 73 | auto value = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Event::Ptr>(); |
71 | auto value = result.first(); | ||
72 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); | 74 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); |
73 | } | 75 | } |
74 | 76 | ||
@@ -88,11 +90,15 @@ private Q_SLOTS: | |||
88 | query.syncOnDemand = false; | 90 | query.syncOnDemand = false; |
89 | query.processAll = true; | 91 | query.processAll = true; |
90 | 92 | ||
93 | //Ensure all local data is processed | ||
94 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | ||
95 | |||
91 | query.propertyFilter.insert("uid", "testuid"); | 96 | query.propertyFilter.insert("uid", "testuid"); |
92 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); | 97 | |
93 | result.exec(); | 98 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); |
94 | QCOMPARE(result.size(), 1); | 99 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); |
95 | auto value = result.first(); | 100 | auto value = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Event::Ptr>(); |
101 | |||
96 | qDebug() << value->getProperty("uid").toByteArray(); | 102 | qDebug() << value->getProperty("uid").toByteArray(); |
97 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); | 103 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); |
98 | } | 104 | } |
@@ -114,11 +120,15 @@ private Q_SLOTS: | |||
114 | query.syncOnDemand = false; | 120 | query.syncOnDemand = false; |
115 | query.processAll = true; | 121 | query.processAll = true; |
116 | 122 | ||
123 | //Ensure all local data is processed | ||
124 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | ||
125 | |||
117 | query.propertyFilter.insert("summary", "summaryValue2"); | 126 | query.propertyFilter.insert("summary", "summaryValue2"); |
118 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); | 127 | |
119 | result.exec(); | 128 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); |
120 | QCOMPARE(result.size(), 1); | 129 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); |
121 | auto value = result.first(); | 130 | auto value = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Event::Ptr>(); |
131 | |||
122 | qDebug() << value->getProperty("uid").toByteArray(); | 132 | qDebug() << value->getProperty("uid").toByteArray(); |
123 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid2")); | 133 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid2")); |
124 | } | 134 | } |
@@ -145,10 +155,13 @@ private Q_SLOTS: | |||
145 | query.syncOnDemand = true; | 155 | query.syncOnDemand = true; |
146 | query.processAll = true; | 156 | query.processAll = true; |
147 | 157 | ||
148 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); | 158 | //Ensure all local data is processed |
149 | result.exec(); | 159 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); |
150 | QVERIFY(!result.isEmpty()); | 160 | |
151 | auto value = result.first(); | 161 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); |
162 | QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); | ||
163 | auto value = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Event::Ptr>(); | ||
164 | |||
152 | QVERIFY(!value->getProperty("summary").toString().isEmpty()); | 165 | QVERIFY(!value->getProperty("summary").toString().isEmpty()); |
153 | qDebug() << value->getProperty("summary").toString(); | 166 | qDebug() << value->getProperty("summary").toString(); |
154 | } | 167 | } |
@@ -160,10 +173,13 @@ private Q_SLOTS: | |||
160 | query.syncOnDemand = true; | 173 | query.syncOnDemand = true; |
161 | query.processAll = true; | 174 | query.processAll = true; |
162 | 175 | ||
163 | async::SyncListResult<Akonadi2::ApplicationDomain::Mail::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Mail>(query)); | 176 | //Ensure all local data is processed |
164 | result.exec(); | 177 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); |
165 | QVERIFY(!result.isEmpty()); | 178 | |
166 | auto value = result.first(); | 179 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); |
180 | QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); | ||
181 | auto value = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Mail::Ptr>(); | ||
182 | |||
167 | QVERIFY(!value->getProperty("subject").toString().isEmpty()); | 183 | QVERIFY(!value->getProperty("subject").toString().isEmpty()); |
168 | qDebug() << value->getProperty("subject").toString(); | 184 | qDebug() << value->getProperty("subject").toString(); |
169 | } | 185 | } |
@@ -182,13 +198,16 @@ private Q_SLOTS: | |||
182 | query.processAll = true; | 198 | query.processAll = true; |
183 | query.propertyFilter.insert("uid", "testuid"); | 199 | query.propertyFilter.insert("uid", "testuid"); |
184 | 200 | ||
201 | //Ensure all local data is processed | ||
202 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | ||
203 | |||
185 | //Test create | 204 | //Test create |
186 | Akonadi2::ApplicationDomain::Event event2; | 205 | Akonadi2::ApplicationDomain::Event event2; |
187 | { | 206 | { |
188 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); | 207 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); |
189 | result.exec(); | 208 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); |
190 | QCOMPARE(result.size(), 1); | 209 | auto value = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Event::Ptr>(); |
191 | auto value = result.first(); | 210 | |
192 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); | 211 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); |
193 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue")); | 212 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue")); |
194 | event2 = *value; | 213 | event2 = *value; |
@@ -198,23 +217,29 @@ private Q_SLOTS: | |||
198 | event2.setProperty("summary", "summaryValue2"); | 217 | event2.setProperty("summary", "summaryValue2"); |
199 | Akonadi2::Store::modify<Akonadi2::ApplicationDomain::Event>(event2).exec().waitForFinished(); | 218 | Akonadi2::Store::modify<Akonadi2::ApplicationDomain::Event>(event2).exec().waitForFinished(); |
200 | 219 | ||
220 | //Ensure all local data is processed | ||
221 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | ||
222 | |||
201 | //Test modify | 223 | //Test modify |
202 | { | 224 | { |
203 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); | 225 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); |
204 | result.exec(); | 226 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); |
205 | QCOMPARE(result.size(), 1); | 227 | auto value = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Event::Ptr>(); |
206 | auto value = result.first(); | 228 | |
207 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); | 229 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); |
208 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue2")); | 230 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue2")); |
209 | } | 231 | } |
210 | 232 | ||
211 | Akonadi2::Store::remove<Akonadi2::ApplicationDomain::Event>(event2).exec().waitForFinished(); | 233 | Akonadi2::Store::remove<Akonadi2::ApplicationDomain::Event>(event2).exec().waitForFinished(); |
212 | 234 | ||
235 | //Ensure all local data is processed | ||
236 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | ||
237 | |||
213 | //Test remove | 238 | //Test remove |
214 | { | 239 | { |
215 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); | 240 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); |
216 | result.exec(); | 241 | //TODO ensure the initial query is done |
217 | QTRY_COMPARE(result.size(), 0); | 242 | QTRY_COMPARE(model->rowCount(QModelIndex()), 0); |
218 | } | 243 | } |
219 | } | 244 | } |
220 | 245 | ||
@@ -228,9 +253,8 @@ private Q_SLOTS: | |||
228 | query.liveQuery = true; | 253 | query.liveQuery = true; |
229 | query.propertyFilter.insert("uid", "testuid"); | 254 | query.propertyFilter.insert("uid", "testuid"); |
230 | 255 | ||
231 | 256 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); | |
232 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); | 257 | //TODO ensure the initial query is done |
233 | result.exec(); | ||
234 | 258 | ||
235 | Akonadi2::ApplicationDomain::Event event("org.kde.dummy.instance1"); | 259 | Akonadi2::ApplicationDomain::Event event("org.kde.dummy.instance1"); |
236 | event.setProperty("uid", "testuid"); | 260 | event.setProperty("uid", "testuid"); |
@@ -241,8 +265,8 @@ private Q_SLOTS: | |||
241 | //Test create | 265 | //Test create |
242 | Akonadi2::ApplicationDomain::Event event2; | 266 | Akonadi2::ApplicationDomain::Event event2; |
243 | { | 267 | { |
244 | QTRY_COMPARE(result.size(), 1); | 268 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); |
245 | auto value = result.first(); | 269 | auto value = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Event::Ptr>(); |
246 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); | 270 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); |
247 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue")); | 271 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue")); |
248 | event2 = *value; | 272 | event2 = *value; |
@@ -254,8 +278,9 @@ private Q_SLOTS: | |||
254 | 278 | ||
255 | //Test modify | 279 | //Test modify |
256 | { | 280 | { |
257 | QTRY_COMPARE(result.size(), 1); | 281 | //TODO wait for a change signal |
258 | auto value = result.first(); | 282 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); |
283 | auto value = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Event::Ptr>(); | ||
259 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); | 284 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); |
260 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue2")); | 285 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue2")); |
261 | } | 286 | } |
@@ -264,7 +289,7 @@ private Q_SLOTS: | |||
264 | 289 | ||
265 | //Test remove | 290 | //Test remove |
266 | { | 291 | { |
267 | QTRY_COMPARE(result.size(), 0); | 292 | QTRY_COMPARE(model->rowCount(QModelIndex()), 0); |
268 | } | 293 | } |
269 | } | 294 | } |
270 | 295 | ||
diff --git a/tests/genericfacadebenchmark.cpp b/tests/genericfacadebenchmark.cpp index 29c91d7..703acd1 100644 --- a/tests/genericfacadebenchmark.cpp +++ b/tests/genericfacadebenchmark.cpp | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <common/domainadaptor.h> | 8 | #include <common/domainadaptor.h> |
9 | #include <common/resultprovider.h> | 9 | #include <common/resultprovider.h> |
10 | #include <common/synclistresult.h> | 10 | #include <common/synclistresult.h> |
11 | #include <common/definitions.h> | ||
11 | 12 | ||
12 | #include "event_generated.h" | 13 | #include "event_generated.h" |
13 | 14 | ||
@@ -56,12 +57,11 @@ private Q_SLOTS: | |||
56 | QBENCHMARK { | 57 | QBENCHMARK { |
57 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); | 58 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); |
58 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); | 59 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); |
59 | auto storage = QSharedPointer<EntityStorage<Akonadi2::ApplicationDomain::Event> >::create("identifier"); | 60 | TestResourceFacade facade(identifier, resourceAccess); |
60 | TestResourceFacade facade(identifier, storage, resourceAccess); | ||
61 | 61 | ||
62 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); | 62 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); |
63 | 63 | ||
64 | facade.load(query, resultSet).exec().waitForFinished(); | 64 | facade.load(query, *resultSet).exec().waitForFinished(); |
65 | resultSet->initialResultSetComplete(); | 65 | resultSet->initialResultSetComplete(); |
66 | 66 | ||
67 | //We have to wait for the events that deliver the results to be processed by the eventloop | 67 | //We have to wait for the events that deliver the results to be processed by the eventloop |
diff --git a/tests/genericfacadetest.cpp b/tests/genericfacadetest.cpp index 67320c3..bb95f4e 100644 --- a/tests/genericfacadetest.cpp +++ b/tests/genericfacadetest.cpp | |||
@@ -17,6 +17,7 @@ | |||
17 | * Test for the generic facade implementation. | 17 | * Test for the generic facade implementation. |
18 | * | 18 | * |
19 | * This test doesn't use the actual storage and thus only tests the update logic of the facade. | 19 | * This test doesn't use the actual storage and thus only tests the update logic of the facade. |
20 | * //FIXME this now uses the actual storage | ||
20 | */ | 21 | */ |
21 | class GenericFacadeTest : public QObject | 22 | class GenericFacadeTest : public QObject |
22 | { | 23 | { |
@@ -34,14 +35,13 @@ private Q_SLOTS: | |||
34 | query.liveQuery = false; | 35 | query.liveQuery = false; |
35 | 36 | ||
36 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); | 37 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); |
37 | auto storage = QSharedPointer<TestEntityStorage>::create("identifier"); | ||
38 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); | 38 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); |
39 | storage->mResults << Akonadi2::ApplicationDomain::Event::Ptr::create(); | 39 | // storage->mResults << Akonadi2::ApplicationDomain::Event::Ptr::create(); |
40 | TestResourceFacade facade("identifier", storage, resourceAccess); | 40 | TestResourceFacade facade("identifier", resourceAccess); |
41 | 41 | ||
42 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); | 42 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); |
43 | 43 | ||
44 | facade.load(query, resultSet).exec().waitForFinished(); | 44 | facade.load(query, *resultSet).exec().waitForFinished(); |
45 | resultSet->initialResultSetComplete(); | 45 | resultSet->initialResultSetComplete(); |
46 | 46 | ||
47 | //We have to wait for the events that deliver the results to be processed by the eventloop | 47 | //We have to wait for the events that deliver the results to be processed by the eventloop |
@@ -56,23 +56,22 @@ private Q_SLOTS: | |||
56 | query.liveQuery = true; | 56 | query.liveQuery = true; |
57 | 57 | ||
58 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); | 58 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); |
59 | auto storage = QSharedPointer<TestEntityStorage>::create("identifier"); | ||
60 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); | 59 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); |
61 | storage->mResults << Akonadi2::ApplicationDomain::Event::Ptr::create(); | 60 | // storage->mResults << Akonadi2::ApplicationDomain::Event::Ptr::create(); |
62 | TestResourceFacade facade("identifier", storage, resourceAccess); | 61 | TestResourceFacade facade("identifier", resourceAccess); |
63 | 62 | ||
64 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); | 63 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); |
65 | 64 | ||
66 | facade.load(query, resultSet).exec().waitForFinished(); | 65 | facade.load(query, *resultSet).exec().waitForFinished(); |
67 | resultSet->initialResultSetComplete(); | 66 | resultSet->initialResultSetComplete(); |
68 | 67 | ||
69 | result.exec(); | 68 | result.exec(); |
70 | QCOMPARE(result.size(), 1); | 69 | QCOMPARE(result.size(), 1); |
71 | 70 | ||
72 | //Enter a second result | 71 | //Enter a second result |
73 | storage->mResults.clear(); | 72 | // storage->mResults.clear(); |
74 | storage->mResults << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); | 73 | // storage->mResults << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); |
75 | storage->mLatestRevision = 2; | 74 | // storage->mLatestRevision = 2; |
76 | resourceAccess->emit revisionChanged(2); | 75 | resourceAccess->emit revisionChanged(2); |
77 | 76 | ||
78 | //Hack to get event loop in synclistresult to abort again | 77 | //Hack to get event loop in synclistresult to abort again |
@@ -88,27 +87,26 @@ private Q_SLOTS: | |||
88 | query.liveQuery = true; | 87 | query.liveQuery = true; |
89 | 88 | ||
90 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); | 89 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); |
91 | auto storage = QSharedPointer<TestEntityStorage>::create("identifier"); | ||
92 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); | 90 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); |
93 | auto entity = QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 91 | auto entity = QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); |
94 | entity->setProperty("test", "test1"); | 92 | entity->setProperty("test", "test1"); |
95 | storage->mResults << entity; | 93 | // storage->mResults << entity; |
96 | TestResourceFacade facade("identifier", storage, resourceAccess); | 94 | TestResourceFacade facade("identifier", resourceAccess); |
97 | 95 | ||
98 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); | 96 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); |
99 | 97 | ||
100 | facade.load(query, resultSet).exec().waitForFinished(); | 98 | facade.load(query, *resultSet).exec().waitForFinished(); |
101 | resultSet->initialResultSetComplete(); | 99 | resultSet->initialResultSetComplete(); |
102 | 100 | ||
103 | result.exec(); | 101 | result.exec(); |
104 | QCOMPARE(result.size(), 1); | 102 | QCOMPARE(result.size(), 1); |
105 | 103 | ||
106 | //Modify the entity again | 104 | //Modify the entity again |
107 | storage->mResults.clear(); | 105 | // storage->mResults.clear(); |
108 | entity = QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 106 | entity = QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); |
109 | entity->setProperty("test", "test2"); | 107 | entity->setProperty("test", "test2"); |
110 | storage->mModifications << entity; | 108 | // storage->mModifications << entity; |
111 | storage->mLatestRevision = 2; | 109 | // storage->mLatestRevision = 2; |
112 | resourceAccess->emit revisionChanged(2); | 110 | resourceAccess->emit revisionChanged(2); |
113 | 111 | ||
114 | //Hack to get event loop in synclistresult to abort again | 112 | //Hack to get event loop in synclistresult to abort again |
@@ -125,24 +123,23 @@ private Q_SLOTS: | |||
125 | query.liveQuery = true; | 123 | query.liveQuery = true; |
126 | 124 | ||
127 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); | 125 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); |
128 | auto storage = QSharedPointer<TestEntityStorage>::create("identifier"); | ||
129 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); | 126 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); |
130 | auto entity = QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); | 127 | auto entity = QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); |
131 | storage->mResults << entity; | 128 | // storage->mResults << entity; |
132 | TestResourceFacade facade("identifier", storage, resourceAccess); | 129 | TestResourceFacade facade("identifier", resourceAccess); |
133 | 130 | ||
134 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); | 131 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); |
135 | 132 | ||
136 | facade.load(query, resultSet).exec().waitForFinished(); | 133 | facade.load(query, *resultSet).exec().waitForFinished(); |
137 | resultSet->initialResultSetComplete(); | 134 | resultSet->initialResultSetComplete(); |
138 | 135 | ||
139 | result.exec(); | 136 | result.exec(); |
140 | QCOMPARE(result.size(), 1); | 137 | QCOMPARE(result.size(), 1); |
141 | 138 | ||
142 | //Remove the entity again | 139 | //Remove the entity again |
143 | storage->mResults.clear(); | 140 | // storage->mResults.clear(); |
144 | storage->mRemovals << entity; | 141 | // storage->mRemovals << entity; |
145 | storage->mLatestRevision = 2; | 142 | // storage->mLatestRevision = 2; |
146 | resourceAccess->emit revisionChanged(2); | 143 | resourceAccess->emit revisionChanged(2); |
147 | 144 | ||
148 | //Hack to get event loop in synclistresult to abort again | 145 | //Hack to get event loop in synclistresult to abort again |
diff --git a/tests/pipelinetest.cpp b/tests/pipelinetest.cpp index 47090a8..f0fd1a4 100644 --- a/tests/pipelinetest.cpp +++ b/tests/pipelinetest.cpp | |||
@@ -12,13 +12,13 @@ | |||
12 | #include "deleteentity_generated.h" | 12 | #include "deleteentity_generated.h" |
13 | #include "dummyresource/resourcefactory.h" | 13 | #include "dummyresource/resourcefactory.h" |
14 | #include "clientapi.h" | 14 | #include "clientapi.h" |
15 | #include "synclistresult.h" | ||
16 | #include "commands.h" | 15 | #include "commands.h" |
17 | #include "entitybuffer.h" | 16 | #include "entitybuffer.h" |
18 | #include "resourceconfig.h" | 17 | #include "resourceconfig.h" |
19 | #include "pipeline.h" | 18 | #include "pipeline.h" |
20 | #include "log.h" | 19 | #include "log.h" |
21 | #include "domainadaptor.h" | 20 | #include "domainadaptor.h" |
21 | #include "definitions.h" | ||
22 | 22 | ||
23 | static void removeFromDisk(const QString &name) | 23 | static void removeFromDisk(const QString &name) |
24 | { | 24 | { |
diff --git a/tests/querytest.cpp b/tests/querytest.cpp new file mode 100644 index 0000000..669bf58 --- /dev/null +++ b/tests/querytest.cpp | |||
@@ -0,0 +1,161 @@ | |||
1 | #include <QtTest> | ||
2 | |||
3 | #include <QString> | ||
4 | |||
5 | #include "dummyresource/resourcefactory.h" | ||
6 | #include "clientapi.h" | ||
7 | #include "commands.h" | ||
8 | #include "resourceconfig.h" | ||
9 | #include "log.h" | ||
10 | #include "modelresult.h" | ||
11 | |||
12 | /** | ||
13 | * Test of the query system using the dummy resource. | ||
14 | * | ||
15 | * This test requires the dummy resource installed. | ||
16 | */ | ||
17 | class QueryTest : public QObject | ||
18 | { | ||
19 | Q_OBJECT | ||
20 | private Q_SLOTS: | ||
21 | void initTestCase() | ||
22 | { | ||
23 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Trace); | ||
24 | auto factory = Akonadi2::ResourceFactory::load("org.kde.dummy"); | ||
25 | QVERIFY(factory); | ||
26 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | ||
27 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); | ||
28 | } | ||
29 | |||
30 | void cleanup() | ||
31 | { | ||
32 | Akonadi2::Store::shutdown(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); | ||
33 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | ||
34 | auto factory = Akonadi2::ResourceFactory::load("org.kde.dummy"); | ||
35 | QVERIFY(factory); | ||
36 | } | ||
37 | |||
38 | void init() | ||
39 | { | ||
40 | qDebug(); | ||
41 | qDebug() << "-----------------------------------------"; | ||
42 | qDebug(); | ||
43 | } | ||
44 | |||
45 | void testSingle() | ||
46 | { | ||
47 | //Setup | ||
48 | { | ||
49 | Akonadi2::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); | ||
50 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Mail>(mail).exec().waitForFinished(); | ||
51 | } | ||
52 | |||
53 | //Test | ||
54 | Akonadi2::Query query; | ||
55 | query.resources << "org.kde.dummy.instance1"; | ||
56 | query.syncOnDemand = false; | ||
57 | query.processAll = false; | ||
58 | query.liveQuery = true; | ||
59 | |||
60 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data | ||
61 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | ||
62 | model->fetchMore(QModelIndex()); | ||
63 | QTRY_COMPARE(model->rowCount(), 1); | ||
64 | } | ||
65 | |||
66 | void testSingleWithDelay() | ||
67 | { | ||
68 | //Setup | ||
69 | { | ||
70 | Akonadi2::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); | ||
71 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Mail>(mail).exec().waitForFinished(); | ||
72 | } | ||
73 | |||
74 | //Test | ||
75 | Akonadi2::Query query; | ||
76 | query.resources << "org.kde.dummy.instance1"; | ||
77 | query.syncOnDemand = false; | ||
78 | query.processAll = true; | ||
79 | query.liveQuery = false; | ||
80 | |||
81 | //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data | ||
82 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | ||
83 | |||
84 | //Ensure all local data is processed | ||
85 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | ||
86 | |||
87 | model->fetchMore(QModelIndex()); | ||
88 | QVERIFY(model->rowCount() < 2); | ||
89 | QTRY_COMPARE(model->rowCount(), 1); | ||
90 | } | ||
91 | |||
92 | void testFolder() | ||
93 | { | ||
94 | //Setup | ||
95 | { | ||
96 | Akonadi2::ApplicationDomain::Folder folder("org.kde.dummy.instance1"); | ||
97 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Folder>(folder).exec().waitForFinished(); | ||
98 | } | ||
99 | |||
100 | //Test | ||
101 | Akonadi2::Query query; | ||
102 | query.resources << "org.kde.dummy.instance1"; | ||
103 | query.syncOnDemand = false; | ||
104 | query.processAll = false; | ||
105 | query.liveQuery = true; | ||
106 | |||
107 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data | ||
108 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | ||
109 | model->fetchMore(QModelIndex()); | ||
110 | QTRY_COMPARE(model->rowCount(), 1); | ||
111 | auto folderEntity = model->index(0, 0).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Folder::Ptr>(); | ||
112 | QVERIFY(!folderEntity->identifier().isEmpty()); | ||
113 | } | ||
114 | |||
115 | void testFolderTree() | ||
116 | { | ||
117 | //Setup | ||
118 | { | ||
119 | Akonadi2::ApplicationDomain::Folder folder("org.kde.dummy.instance1"); | ||
120 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Folder>(folder).exec().waitForFinished(); | ||
121 | |||
122 | Akonadi2::Query query; | ||
123 | query.resources << "org.kde.dummy.instance1"; | ||
124 | query.syncOnDemand = false; | ||
125 | query.processAll = true; | ||
126 | |||
127 | //Ensure all local data is processed | ||
128 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | ||
129 | |||
130 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | ||
131 | QTRY_COMPARE(model->rowCount(), 1); | ||
132 | |||
133 | auto folderEntity = model->index(0, 0).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Folder::Ptr>(); | ||
134 | QVERIFY(!folderEntity->identifier().isEmpty()); | ||
135 | |||
136 | Akonadi2::ApplicationDomain::Folder subfolder("org.kde.dummy.instance1"); | ||
137 | subfolder.setProperty("parent", folderEntity->identifier()); | ||
138 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Folder>(subfolder).exec().waitForFinished(); | ||
139 | } | ||
140 | |||
141 | //Test | ||
142 | Akonadi2::Query query; | ||
143 | query.resources << "org.kde.dummy.instance1"; | ||
144 | query.syncOnDemand = false; | ||
145 | query.processAll = true; | ||
146 | query.parentProperty = "parent"; | ||
147 | |||
148 | //Ensure all local data is processed | ||
149 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | ||
150 | |||
151 | //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data | ||
152 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | ||
153 | model->fetchMore(QModelIndex()); | ||
154 | QTRY_COMPARE(model->rowCount(), 1); | ||
155 | model->fetchMore(model->index(0, 0)); | ||
156 | QTRY_COMPARE(model->rowCount(model->index(0, 0)), 1); | ||
157 | } | ||
158 | }; | ||
159 | |||
160 | QTEST_MAIN(QueryTest) | ||
161 | #include "querytest.moc" | ||
diff --git a/tests/storagetest.cpp b/tests/storagetest.cpp index bef8755..d950961 100644 --- a/tests/storagetest.cpp +++ b/tests/storagetest.cpp | |||
@@ -376,6 +376,7 @@ private Q_SLOTS: | |||
376 | db.write("sub1","value1"); | 376 | db.write("sub1","value1"); |
377 | db.write("sub2","value2"); | 377 | db.write("sub2","value2"); |
378 | db.write("wub3","value3"); | 378 | db.write("wub3","value3"); |
379 | db.write("wub4","value4"); | ||
379 | QByteArray result; | 380 | QByteArray result; |
380 | db.findLatest("sub", [&](const QByteArray &key, const QByteArray &value) { | 381 | db.findLatest("sub", [&](const QByteArray &key, const QByteArray &value) { |
381 | result = value; | 382 | result = value; |
@@ -384,6 +385,35 @@ private Q_SLOTS: | |||
384 | QCOMPARE(result, QByteArray("value2")); | 385 | QCOMPARE(result, QByteArray("value2")); |
385 | } | 386 | } |
386 | 387 | ||
388 | void testFindLatestInSingle() | ||
389 | { | ||
390 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | ||
391 | auto transaction = store.createTransaction(Akonadi2::Storage::ReadWrite); | ||
392 | auto db = transaction.openDatabase("test", nullptr, false); | ||
393 | db.write("sub2","value2"); | ||
394 | QByteArray result; | ||
395 | db.findLatest("sub", [&](const QByteArray &key, const QByteArray &value) { | ||
396 | result = value; | ||
397 | }); | ||
398 | |||
399 | QCOMPARE(result, QByteArray("value2")); | ||
400 | } | ||
401 | |||
402 | void testFindLast() | ||
403 | { | ||
404 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | ||
405 | auto transaction = store.createTransaction(Akonadi2::Storage::ReadWrite); | ||
406 | auto db = transaction.openDatabase("test", nullptr, false); | ||
407 | db.write("sub2","value2"); | ||
408 | db.write("wub3","value3"); | ||
409 | QByteArray result; | ||
410 | db.findLatest("wub", [&](const QByteArray &key, const QByteArray &value) { | ||
411 | result = value; | ||
412 | }); | ||
413 | |||
414 | QCOMPARE(result, QByteArray("value3")); | ||
415 | } | ||
416 | |||
387 | void testRecordRevision() | 417 | void testRecordRevision() |
388 | { | 418 | { |
389 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | 419 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); |
diff --git a/tests/testimplementations.h b/tests/testimplementations.h index eee78b0..a47a775 100644 --- a/tests/testimplementations.h +++ b/tests/testimplementations.h | |||
@@ -21,13 +21,10 @@ | |||
21 | 21 | ||
22 | #include <Async/Async> | 22 | #include <Async/Async> |
23 | 23 | ||
24 | #include <common/entitystorage.h> | ||
25 | #include <common/domainadaptor.h> | 24 | #include <common/domainadaptor.h> |
26 | #include <common/resultprovider.h> | 25 | #include <common/resultprovider.h> |
27 | #include <common/synclistresult.h> | ||
28 | #include <common/resourceaccess.h> | 26 | #include <common/resourceaccess.h> |
29 | #include <common/facade.h> | 27 | #include <common/facade.h> |
30 | #include <common/entitystorage.h> | ||
31 | #include <common/genericresource.h> | 28 | #include <common/genericresource.h> |
32 | 29 | ||
33 | //Replace with something different | 30 | //Replace with something different |
@@ -44,30 +41,6 @@ public: | |||
44 | virtual ~TestEventAdaptorFactory() {}; | 41 | virtual ~TestEventAdaptorFactory() {}; |
45 | }; | 42 | }; |
46 | 43 | ||
47 | class TestEntityStorage : public EntityStorage<Akonadi2::ApplicationDomain::Event> | ||
48 | { | ||
49 | public: | ||
50 | using EntityStorage::EntityStorage; | ||
51 | virtual qint64 read(const Akonadi2::Query &query, qint64 oldRevision, const QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> > &resultProvider) Q_DECL_OVERRIDE | ||
52 | { | ||
53 | for (const auto &res : mResults) { | ||
54 | resultProvider->add(res); | ||
55 | } | ||
56 | for (const auto &res : mModifications) { | ||
57 | resultProvider->modify(res); | ||
58 | } | ||
59 | for (const auto &res : mRemovals) { | ||
60 | resultProvider->remove(res); | ||
61 | } | ||
62 | return mLatestRevision; | ||
63 | } | ||
64 | |||
65 | QList<Akonadi2::ApplicationDomain::Event::Ptr> mResults; | ||
66 | QList<Akonadi2::ApplicationDomain::Event::Ptr> mModifications; | ||
67 | QList<Akonadi2::ApplicationDomain::Event::Ptr> mRemovals; | ||
68 | qint64 mLatestRevision; | ||
69 | }; | ||
70 | |||
71 | class TestResourceAccess : public Akonadi2::ResourceAccessInterface | 44 | class TestResourceAccess : public Akonadi2::ResourceAccessInterface |
72 | { | 45 | { |
73 | Q_OBJECT | 46 | Q_OBJECT |
@@ -85,8 +58,8 @@ public Q_SLOTS: | |||
85 | class TestResourceFacade : public Akonadi2::GenericFacade<Akonadi2::ApplicationDomain::Event> | 58 | class TestResourceFacade : public Akonadi2::GenericFacade<Akonadi2::ApplicationDomain::Event> |
86 | { | 59 | { |
87 | public: | 60 | public: |
88 | TestResourceFacade(const QByteArray &instanceIdentifier, const QSharedPointer<EntityStorage<Akonadi2::ApplicationDomain::Event> > storage, const QSharedPointer<Akonadi2::ResourceAccessInterface> resourceAccess) | 61 | TestResourceFacade(const QByteArray &instanceIdentifier, const QSharedPointer<Akonadi2::ResourceAccessInterface> resourceAccess) |
89 | : Akonadi2::GenericFacade<Akonadi2::ApplicationDomain::Event>(instanceIdentifier, QSharedPointer<TestEventAdaptorFactory>::create(), storage, resourceAccess) | 62 | : Akonadi2::GenericFacade<Akonadi2::ApplicationDomain::Event>(instanceIdentifier, QSharedPointer<TestEventAdaptorFactory>::create(), resourceAccess) |
90 | { | 63 | { |
91 | 64 | ||
92 | } | 65 | } |