diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-01-20 19:07:07 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-01-20 19:07:07 +0100 |
commit | bdb01c2c068df326f5a8328ed1492ab1bea388c5 (patch) | |
tree | 25c2ee1b29bc481b6914c244ed9ca194b1415d16 /tests | |
parent | 17e7ee40c9185c0505883853345fd6024c675b1a (diff) | |
download | sink-bdb01c2c068df326f5a8328ed1492ab1bea388c5.tar.gz sink-bdb01c2c068df326f5a8328ed1492ab1bea388c5.zip |
Renamed Akonadi2 to Sink
(except for documentation).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 18 | ||||
-rw-r--r-- | tests/clientapitest.cpp | 118 | ||||
-rw-r--r-- | tests/databasepopulationandfacadequerybenchmark.cpp | 22 | ||||
-rw-r--r-- | tests/domainadaptortest.cpp | 26 | ||||
-rw-r--r-- | tests/dummyresourcebenchmark.cpp | 44 | ||||
-rw-r--r-- | tests/dummyresourcetest.cpp | 124 | ||||
-rw-r--r-- | tests/dummyresourcewritebenchmark.cpp | 24 | ||||
-rw-r--r-- | tests/genericfacadetest.cpp | 38 | ||||
-rw-r--r-- | tests/genericresourcebenchmark.cpp | 46 | ||||
-rw-r--r-- | tests/genericresourcetest.cpp | 28 | ||||
-rw-r--r-- | tests/hawd/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/hawd/dataset.cpp | 8 | ||||
-rw-r--r-- | tests/hawd/dataset.h | 4 | ||||
-rw-r--r-- | tests/indextest.cpp | 6 | ||||
-rw-r--r-- | tests/inspectiontest.cpp | 14 | ||||
-rw-r--r-- | tests/maildirresourcetest.cpp | 138 | ||||
-rw-r--r-- | tests/messagequeuetest.cpp | 24 | ||||
-rw-r--r-- | tests/modelinteractivitytest.cpp | 18 | ||||
-rw-r--r-- | tests/pipelinetest.cpp | 90 | ||||
-rw-r--r-- | tests/querytest.cpp | 136 | ||||
-rw-r--r-- | tests/resourcecommunicationtest.cpp | 20 | ||||
-rw-r--r-- | tests/storagebenchmark.cpp | 22 | ||||
-rw-r--r-- | tests/storagetest.cpp | 120 | ||||
-rw-r--r-- | tests/testimplementations.h | 16 |
24 files changed, 553 insertions, 553 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 38e5512..b01a329 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt | |||
@@ -15,7 +15,7 @@ macro(manual_tests) | |||
15 | add_executable(${_testname} ${_testname}.cpp testimplementations.cpp getrssusage.cpp) | 15 | add_executable(${_testname} ${_testname}.cpp testimplementations.cpp getrssusage.cpp) |
16 | generate_flatbuffers(${_testname} calendar) | 16 | generate_flatbuffers(${_testname} calendar) |
17 | qt5_use_modules(${_testname} Core Test Concurrent) | 17 | qt5_use_modules(${_testname} Core Test Concurrent) |
18 | target_link_libraries(${_testname} akonadi2common libhawd) | 18 | target_link_libraries(${_testname} sinkcommon libhawd) |
19 | endforeach(_testname) | 19 | endforeach(_testname) |
20 | endmacro(manual_tests) | 20 | endmacro(manual_tests) |
21 | 21 | ||
@@ -25,7 +25,7 @@ macro(auto_tests) | |||
25 | generate_flatbuffers(${_testname} calendar) | 25 | generate_flatbuffers(${_testname} calendar) |
26 | add_test(${_testname} ${_testname}) | 26 | add_test(${_testname} ${_testname}) |
27 | qt5_use_modules(${_testname} Core Test Concurrent) | 27 | qt5_use_modules(${_testname} Core Test Concurrent) |
28 | target_link_libraries(${_testname} akonadi2common libhawd) | 28 | target_link_libraries(${_testname} sinkcommon libhawd) |
29 | endforeach(_testname) | 29 | endforeach(_testname) |
30 | endmacro(auto_tests) | 30 | endmacro(auto_tests) |
31 | 31 | ||
@@ -53,16 +53,16 @@ auto_tests ( | |||
53 | modelinteractivitytest | 53 | modelinteractivitytest |
54 | inspectiontest | 54 | inspectiontest |
55 | ) | 55 | ) |
56 | target_link_libraries(dummyresourcetest akonadi2_resource_dummy) | 56 | target_link_libraries(dummyresourcetest sink_resource_dummy) |
57 | target_link_libraries(dummyresourcebenchmark akonadi2_resource_dummy) | 57 | target_link_libraries(dummyresourcebenchmark sink_resource_dummy) |
58 | target_link_libraries(dummyresourcewritebenchmark akonadi2_resource_dummy) | 58 | target_link_libraries(dummyresourcewritebenchmark sink_resource_dummy) |
59 | target_link_libraries(querytest akonadi2_resource_dummy) | 59 | target_link_libraries(querytest sink_resource_dummy) |
60 | target_link_libraries(modelinteractivitytest akonadi2_resource_dummy) | 60 | target_link_libraries(modelinteractivitytest sink_resource_dummy) |
61 | target_link_libraries(inspectiontest akonadi2_resource_dummy) | 61 | target_link_libraries(inspectiontest sink_resource_dummy) |
62 | 62 | ||
63 | if (BUILD_MAILDIR) | 63 | if (BUILD_MAILDIR) |
64 | auto_tests ( | 64 | auto_tests ( |
65 | maildirresourcetest | 65 | maildirresourcetest |
66 | ) | 66 | ) |
67 | target_link_libraries(maildirresourcetest akonadi2_resource_maildir) | 67 | target_link_libraries(maildirresourcetest sink_resource_maildir) |
68 | endif() | 68 | endif() |
diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp index 5942849..a85b03b 100644 --- a/tests/clientapitest.cpp +++ b/tests/clientapitest.cpp | |||
@@ -10,7 +10,7 @@ | |||
10 | #include "facadefactory.h" | 10 | #include "facadefactory.h" |
11 | 11 | ||
12 | template <typename T> | 12 | template <typename T> |
13 | class DummyResourceFacade : public Akonadi2::StoreFacade<T> | 13 | class DummyResourceFacade : public Sink::StoreFacade<T> |
14 | { | 14 | { |
15 | public: | 15 | public: |
16 | static std::shared_ptr<DummyResourceFacade<T> > registerFacade(const QByteArray &instanceIdentifier = QByteArray()) | 16 | static std::shared_ptr<DummyResourceFacade<T> > registerFacade(const QByteArray &instanceIdentifier = QByteArray()) |
@@ -19,7 +19,7 @@ public: | |||
19 | auto facade = std::make_shared<DummyResourceFacade<T> >(); | 19 | auto facade = std::make_shared<DummyResourceFacade<T> >(); |
20 | map.insert(instanceIdentifier, facade); | 20 | map.insert(instanceIdentifier, facade); |
21 | bool alwaysReturnFacade = instanceIdentifier.isEmpty(); | 21 | bool alwaysReturnFacade = instanceIdentifier.isEmpty(); |
22 | Akonadi2::FacadeFactory::instance().registerFacade<T, DummyResourceFacade<T> >("dummyresource", | 22 | Sink::FacadeFactory::instance().registerFacade<T, DummyResourceFacade<T> >("dummyresource", |
23 | [alwaysReturnFacade](const QByteArray &instanceIdentifier) { | 23 | [alwaysReturnFacade](const QByteArray &instanceIdentifier) { |
24 | if (alwaysReturnFacade) { | 24 | if (alwaysReturnFacade) { |
25 | return map.value(QByteArray()); | 25 | return map.value(QByteArray()); |
@@ -33,9 +33,9 @@ public: | |||
33 | KAsync::Job<void> create(const T &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); }; | 33 | KAsync::Job<void> create(const T &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); }; |
34 | KAsync::Job<void> modify(const T &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); }; | 34 | KAsync::Job<void> modify(const T &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); }; |
35 | KAsync::Job<void> remove(const T &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); }; | 35 | KAsync::Job<void> remove(const T &domainObject) Q_DECL_OVERRIDE { return KAsync::null<void>(); }; |
36 | QPair<KAsync::Job<void>, typename Akonadi2::ResultEmitter<typename T::Ptr>::Ptr > load(const Akonadi2::Query &query) Q_DECL_OVERRIDE | 36 | QPair<KAsync::Job<void>, typename Sink::ResultEmitter<typename T::Ptr>::Ptr > load(const Sink::Query &query) Q_DECL_OVERRIDE |
37 | { | 37 | { |
38 | auto resultProvider = new Akonadi2::ResultProvider<typename T::Ptr>(); | 38 | auto resultProvider = new Sink::ResultProvider<typename T::Ptr>(); |
39 | resultProvider->onDone([resultProvider]() { | 39 | resultProvider->onDone([resultProvider]() { |
40 | Trace() << "Result provider is done"; | 40 | Trace() << "Result provider is done"; |
41 | delete resultProvider; | 41 | delete resultProvider; |
@@ -67,7 +67,7 @@ public: | |||
67 | } | 67 | } |
68 | 68 | ||
69 | QList<typename T::Ptr> results; | 69 | QList<typename T::Ptr> results; |
70 | Akonadi2::ResultProviderInterface<typename T::Ptr> *mResultProvider; | 70 | Sink::ResultProviderInterface<typename T::Ptr> *mResultProvider; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | 73 | ||
@@ -83,117 +83,117 @@ private Q_SLOTS: | |||
83 | 83 | ||
84 | void initTestCase() | 84 | void initTestCase() |
85 | { | 85 | { |
86 | Akonadi2::FacadeFactory::instance().resetFactory(); | 86 | Sink::FacadeFactory::instance().resetFactory(); |
87 | ResourceConfig::clear(); | 87 | ResourceConfig::clear(); |
88 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Trace); | 88 | Sink::Log::setDebugOutputLevel(Sink::Log::Trace); |
89 | } | 89 | } |
90 | 90 | ||
91 | void testLoad() | 91 | void testLoad() |
92 | { | 92 | { |
93 | auto facade = DummyResourceFacade<Akonadi2::ApplicationDomain::Event>::registerFacade(); | 93 | auto facade = DummyResourceFacade<Sink::ApplicationDomain::Event>::registerFacade(); |
94 | facade->results << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 94 | facade->results << QSharedPointer<Sink::ApplicationDomain::Event>::create("resource", "id", 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); |
95 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); | 95 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); |
96 | 96 | ||
97 | Akonadi2::Query query; | 97 | Sink::Query query; |
98 | query.resources << "dummyresource.instance1"; | 98 | query.resources << "dummyresource.instance1"; |
99 | query.liveQuery = false; | 99 | query.liveQuery = false; |
100 | 100 | ||
101 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); | 101 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
102 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 102 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
103 | QCOMPARE(model->rowCount(QModelIndex()), 1); | 103 | QCOMPARE(model->rowCount(QModelIndex()), 1); |
104 | } | 104 | } |
105 | 105 | ||
106 | void testLoadWithoutResource() | 106 | void testLoadWithoutResource() |
107 | { | 107 | { |
108 | Akonadi2::Query query; | 108 | Sink::Query query; |
109 | query.resources << "nonexisting.resource"; | 109 | query.resources << "nonexisting.resource"; |
110 | query.liveQuery = false; | 110 | query.liveQuery = false; |
111 | 111 | ||
112 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); | 112 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
113 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 113 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
114 | } | 114 | } |
115 | 115 | ||
116 | //TODO: This test doesn't belong to this testsuite | 116 | //TODO: This test doesn't belong to this testsuite |
117 | void resourceManagement() | 117 | void resourceManagement() |
118 | { | 118 | { |
119 | ResourceConfig::clear(); | 119 | ResourceConfig::clear(); |
120 | Akonadi2::FacadeFactory::instance().registerStaticFacades(); | 120 | Sink::FacadeFactory::instance().registerStaticFacades(); |
121 | 121 | ||
122 | Akonadi2::ApplicationDomain::AkonadiResource res("", "dummyresource.identifier1", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 122 | Sink::ApplicationDomain::SinkResource res("", "dummyresource.identifier1", 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); |
123 | res.setProperty("identifier", "dummyresource.identifier1"); | 123 | res.setProperty("identifier", "dummyresource.identifier1"); |
124 | res.setProperty("type", "dummyresource"); | 124 | res.setProperty("type", "dummyresource"); |
125 | 125 | ||
126 | Akonadi2::Store::create(res).exec().waitForFinished(); | 126 | Sink::Store::create(res).exec().waitForFinished(); |
127 | { | 127 | { |
128 | Akonadi2::Query query; | 128 | Sink::Query query; |
129 | query.propertyFilter.insert("type", "dummyresource"); | 129 | query.propertyFilter.insert("type", "dummyresource"); |
130 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::AkonadiResource>(query); | 130 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::SinkResource>(query); |
131 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); | 131 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); |
132 | } | 132 | } |
133 | 133 | ||
134 | Akonadi2::Store::remove(res).exec().waitForFinished(); | 134 | Sink::Store::remove(res).exec().waitForFinished(); |
135 | { | 135 | { |
136 | Akonadi2::Query query; | 136 | Sink::Query query; |
137 | query.propertyFilter.insert("type", "dummyresource"); | 137 | query.propertyFilter.insert("type", "dummyresource"); |
138 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::AkonadiResource>(query); | 138 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::SinkResource>(query); |
139 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 139 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
140 | QCOMPARE(model->rowCount(QModelIndex()), 0); | 140 | QCOMPARE(model->rowCount(QModelIndex()), 0); |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | void testModelSingle() | 144 | void testModelSingle() |
145 | { | 145 | { |
146 | auto facade = DummyResourceFacade<Akonadi2::ApplicationDomain::Folder>::registerFacade(); | 146 | auto facade = DummyResourceFacade<Sink::ApplicationDomain::Folder>::registerFacade(); |
147 | facade->results << QSharedPointer<Akonadi2::ApplicationDomain::Folder>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 147 | facade->results << QSharedPointer<Sink::ApplicationDomain::Folder>::create("resource", "id", 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); |
148 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); | 148 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); |
149 | 149 | ||
150 | Akonadi2::Query query; | 150 | Sink::Query query; |
151 | query.resources << "dummyresource.instance1"; | 151 | query.resources << "dummyresource.instance1"; |
152 | query.liveQuery = false; | 152 | query.liveQuery = false; |
153 | 153 | ||
154 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | 154 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
155 | QTRY_COMPARE(model->rowCount(), 1); | 155 | QTRY_COMPARE(model->rowCount(), 1); |
156 | } | 156 | } |
157 | 157 | ||
158 | void testModelNested() | 158 | void testModelNested() |
159 | { | 159 | { |
160 | auto facade = DummyResourceFacade<Akonadi2::ApplicationDomain::Folder>::registerFacade(); | 160 | auto facade = DummyResourceFacade<Sink::ApplicationDomain::Folder>::registerFacade(); |
161 | auto folder = QSharedPointer<Akonadi2::ApplicationDomain::Folder>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 161 | auto folder = QSharedPointer<Sink::ApplicationDomain::Folder>::create("resource", "id", 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); |
162 | auto subfolder = QSharedPointer<Akonadi2::ApplicationDomain::Folder>::create("resource", "subId", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 162 | auto subfolder = QSharedPointer<Sink::ApplicationDomain::Folder>::create("resource", "subId", 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); |
163 | subfolder->setProperty("parent", "id"); | 163 | subfolder->setProperty("parent", "id"); |
164 | facade->results << folder << subfolder; | 164 | facade->results << folder << subfolder; |
165 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); | 165 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); |
166 | 166 | ||
167 | //Test | 167 | //Test |
168 | Akonadi2::Query query; | 168 | Sink::Query query; |
169 | query.resources << "dummyresource.instance1"; | 169 | query.resources << "dummyresource.instance1"; |
170 | query.liveQuery = false; | 170 | query.liveQuery = false; |
171 | query.parentProperty = "parent"; | 171 | query.parentProperty = "parent"; |
172 | 172 | ||
173 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | 173 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
174 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 174 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
175 | QCOMPARE(model->rowCount(), 1); | 175 | QCOMPARE(model->rowCount(), 1); |
176 | model->fetchMore(model->index(0, 0)); | 176 | model->fetchMore(model->index(0, 0)); |
177 | QTRY_VERIFY(model->data(model->index(0, 0), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 177 | QTRY_VERIFY(model->data(model->index(0, 0), Sink::Store::ChildrenFetchedRole).toBool()); |
178 | QCOMPARE(model->rowCount(model->index(0, 0)), 1); | 178 | QCOMPARE(model->rowCount(model->index(0, 0)), 1); |
179 | } | 179 | } |
180 | 180 | ||
181 | void testModelSignals() | 181 | void testModelSignals() |
182 | { | 182 | { |
183 | auto facade = DummyResourceFacade<Akonadi2::ApplicationDomain::Folder>::registerFacade(); | 183 | auto facade = DummyResourceFacade<Sink::ApplicationDomain::Folder>::registerFacade(); |
184 | auto folder = QSharedPointer<Akonadi2::ApplicationDomain::Folder>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 184 | auto folder = QSharedPointer<Sink::ApplicationDomain::Folder>::create("resource", "id", 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); |
185 | auto subfolder = QSharedPointer<Akonadi2::ApplicationDomain::Folder>::create("resource", "subId", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 185 | auto subfolder = QSharedPointer<Sink::ApplicationDomain::Folder>::create("resource", "subId", 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); |
186 | subfolder->setProperty("parent", "id"); | 186 | subfolder->setProperty("parent", "id"); |
187 | facade->results << folder << subfolder; | 187 | facade->results << folder << subfolder; |
188 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); | 188 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); |
189 | 189 | ||
190 | //Test | 190 | //Test |
191 | Akonadi2::Query query; | 191 | Sink::Query query; |
192 | query.resources << "dummyresource.instance1"; | 192 | query.resources << "dummyresource.instance1"; |
193 | query.liveQuery = false; | 193 | query.liveQuery = false; |
194 | query.parentProperty = "parent"; | 194 | query.parentProperty = "parent"; |
195 | 195 | ||
196 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | 196 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
197 | QSignalSpy spy(model.data(), SIGNAL(rowsInserted(const QModelIndex &, int, int))); | 197 | QSignalSpy spy(model.data(), SIGNAL(rowsInserted(const QModelIndex &, int, int))); |
198 | QVERIFY(spy.isValid()); | 198 | QVERIFY(spy.isValid()); |
199 | model->fetchMore(model->index(0, 0)); | 199 | model->fetchMore(model->index(0, 0)); |
@@ -202,20 +202,20 @@ private Q_SLOTS: | |||
202 | 202 | ||
203 | void testModelNestedLive() | 203 | void testModelNestedLive() |
204 | { | 204 | { |
205 | auto facade = DummyResourceFacade<Akonadi2::ApplicationDomain::Folder>::registerFacade(); | 205 | auto facade = DummyResourceFacade<Sink::ApplicationDomain::Folder>::registerFacade(); |
206 | auto folder = QSharedPointer<Akonadi2::ApplicationDomain::Folder>::create("dummyresource.instance1", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 206 | auto folder = QSharedPointer<Sink::ApplicationDomain::Folder>::create("dummyresource.instance1", "id", 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); |
207 | auto subfolder = QSharedPointer<Akonadi2::ApplicationDomain::Folder>::create("dummyresource.instance1", "subId", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 207 | auto subfolder = QSharedPointer<Sink::ApplicationDomain::Folder>::create("dummyresource.instance1", "subId", 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); |
208 | subfolder->setProperty("parent", "id"); | 208 | subfolder->setProperty("parent", "id"); |
209 | facade->results << folder << subfolder; | 209 | facade->results << folder << subfolder; |
210 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); | 210 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); |
211 | 211 | ||
212 | //Test | 212 | //Test |
213 | Akonadi2::Query query; | 213 | Sink::Query query; |
214 | query.resources << "dummyresource.instance1"; | 214 | query.resources << "dummyresource.instance1"; |
215 | query.liveQuery = true; | 215 | query.liveQuery = true; |
216 | query.parentProperty = "parent"; | 216 | query.parentProperty = "parent"; |
217 | 217 | ||
218 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | 218 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
219 | QTRY_COMPARE(model->rowCount(), 1); | 219 | QTRY_COMPARE(model->rowCount(), 1); |
220 | model->fetchMore(model->index(0, 0)); | 220 | model->fetchMore(model->index(0, 0)); |
221 | QTRY_COMPARE(model->rowCount(model->index(0, 0)), 1); | 221 | QTRY_COMPARE(model->rowCount(model->index(0, 0)), 1); |
@@ -225,7 +225,7 @@ private Q_SLOTS: | |||
225 | //Test new toplevel folder | 225 | //Test new toplevel folder |
226 | { | 226 | { |
227 | QSignalSpy rowsInsertedSpy(model.data(), SIGNAL(rowsInserted(const QModelIndex &, int, int))); | 227 | QSignalSpy rowsInsertedSpy(model.data(), SIGNAL(rowsInserted(const QModelIndex &, int, int))); |
228 | auto folder2 = QSharedPointer<Akonadi2::ApplicationDomain::Folder>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 228 | auto folder2 = QSharedPointer<Sink::ApplicationDomain::Folder>::create("resource", "id2", 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); |
229 | resultProvider->add(folder2); | 229 | resultProvider->add(folder2); |
230 | QTRY_COMPARE(model->rowCount(), 2); | 230 | QTRY_COMPARE(model->rowCount(), 2); |
231 | QTRY_COMPARE(rowsInsertedSpy.count(), 1); | 231 | QTRY_COMPARE(rowsInsertedSpy.count(), 1); |
@@ -255,24 +255,24 @@ private Q_SLOTS: | |||
255 | 255 | ||
256 | void testLoadMultiResource() | 256 | void testLoadMultiResource() |
257 | { | 257 | { |
258 | auto facade1 = DummyResourceFacade<Akonadi2::ApplicationDomain::Event>::registerFacade("dummyresource.instance1"); | 258 | auto facade1 = DummyResourceFacade<Sink::ApplicationDomain::Event>::registerFacade("dummyresource.instance1"); |
259 | facade1->results << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource1", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 259 | facade1->results << QSharedPointer<Sink::ApplicationDomain::Event>::create("resource1", "id", 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); |
260 | auto facade2 = DummyResourceFacade<Akonadi2::ApplicationDomain::Event>::registerFacade("dummyresource.instance2"); | 260 | auto facade2 = DummyResourceFacade<Sink::ApplicationDomain::Event>::registerFacade("dummyresource.instance2"); |
261 | facade2->results << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource2", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 261 | facade2->results << QSharedPointer<Sink::ApplicationDomain::Event>::create("resource2", "id", 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); |
262 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); | 262 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); |
263 | ResourceConfig::addResource("dummyresource.instance2", "dummyresource"); | 263 | ResourceConfig::addResource("dummyresource.instance2", "dummyresource"); |
264 | 264 | ||
265 | Akonadi2::Query query; | 265 | Sink::Query query; |
266 | query.liveQuery = false; | 266 | query.liveQuery = false; |
267 | 267 | ||
268 | int childrenFetchedCount = 0; | 268 | int childrenFetchedCount = 0; |
269 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); | 269 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
270 | QObject::connect(model.data(), &QAbstractItemModel::dataChanged, [&childrenFetchedCount](const QModelIndex &, const QModelIndex &, const QVector<int> &roles) { | 270 | QObject::connect(model.data(), &QAbstractItemModel::dataChanged, [&childrenFetchedCount](const QModelIndex &, const QModelIndex &, const QVector<int> &roles) { |
271 | if (roles.contains(Akonadi2::Store::ChildrenFetchedRole)) { | 271 | if (roles.contains(Sink::Store::ChildrenFetchedRole)) { |
272 | childrenFetchedCount++; | 272 | childrenFetchedCount++; |
273 | } | 273 | } |
274 | }); | 274 | }); |
275 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 275 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
276 | QCOMPARE(model->rowCount(QModelIndex()), 2); | 276 | QCOMPARE(model->rowCount(QModelIndex()), 2); |
277 | //Ensure children fetched is only emitted once (when all resources are done) | 277 | //Ensure children fetched is only emitted once (when all resources are done) |
278 | QTest::qWait(50); | 278 | QTest::qWait(50); |
@@ -281,17 +281,17 @@ private Q_SLOTS: | |||
281 | 281 | ||
282 | void testImperativeLoad() | 282 | void testImperativeLoad() |
283 | { | 283 | { |
284 | auto facade = DummyResourceFacade<Akonadi2::ApplicationDomain::Event>::registerFacade(); | 284 | auto facade = DummyResourceFacade<Sink::ApplicationDomain::Event>::registerFacade(); |
285 | facade->results << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 285 | facade->results << QSharedPointer<Sink::ApplicationDomain::Event>::create("resource", "id", 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); |
286 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); | 286 | ResourceConfig::addResource("dummyresource.instance1", "dummyresource"); |
287 | 287 | ||
288 | Akonadi2::Query query; | 288 | Sink::Query query; |
289 | query.resources << "dummyresource.instance1"; | 289 | query.resources << "dummyresource.instance1"; |
290 | query.liveQuery = false; | 290 | query.liveQuery = false; |
291 | 291 | ||
292 | bool gotValue = false; | 292 | bool gotValue = false; |
293 | auto result = Akonadi2::Store::fetchOne<Akonadi2::ApplicationDomain::Event>(query) | 293 | auto result = Sink::Store::fetchOne<Sink::ApplicationDomain::Event>(query) |
294 | .then<void, Akonadi2::ApplicationDomain::Event>([&gotValue](const Akonadi2::ApplicationDomain::Event &event) { | 294 | .then<void, Sink::ApplicationDomain::Event>([&gotValue](const Sink::ApplicationDomain::Event &event) { |
295 | gotValue = true; | 295 | gotValue = true; |
296 | }).exec(); | 296 | }).exec(); |
297 | result.waitForFinished(); | 297 | result.waitForFinished(); |
diff --git a/tests/databasepopulationandfacadequerybenchmark.cpp b/tests/databasepopulationandfacadequerybenchmark.cpp index 5a96bdd..8581c49 100644 --- a/tests/databasepopulationandfacadequerybenchmark.cpp +++ b/tests/databasepopulationandfacadequerybenchmark.cpp | |||
@@ -34,12 +34,12 @@ class DatabasePopulationAndFacadeQueryBenchmark : public QObject | |||
34 | 34 | ||
35 | void populateDatabase(int count) | 35 | void populateDatabase(int count) |
36 | { | 36 | { |
37 | Akonadi2::Storage(Akonadi2::storageLocation(), "identifier", Akonadi2::Storage::ReadWrite).removeFromDisk(); | 37 | Sink::Storage(Sink::storageLocation(), "identifier", Sink::Storage::ReadWrite).removeFromDisk(); |
38 | //Setup | 38 | //Setup |
39 | auto domainTypeAdaptorFactory = QSharedPointer<TestEventAdaptorFactory>::create(); | 39 | auto domainTypeAdaptorFactory = QSharedPointer<TestEventAdaptorFactory>::create(); |
40 | { | 40 | { |
41 | Akonadi2::Storage storage(Akonadi2::storageLocation(), identifier, Akonadi2::Storage::ReadWrite); | 41 | Sink::Storage storage(Sink::storageLocation(), identifier, Sink::Storage::ReadWrite); |
42 | auto transaction = storage.createTransaction(Akonadi2::Storage::ReadWrite); | 42 | auto transaction = storage.createTransaction(Sink::Storage::ReadWrite); |
43 | auto db = transaction.openDatabase("event.main"); | 43 | auto db = transaction.openDatabase("event.main"); |
44 | 44 | ||
45 | int bufferSizeTotal = 0; | 45 | int bufferSizeTotal = 0; |
@@ -47,7 +47,7 @@ class DatabasePopulationAndFacadeQueryBenchmark : public QObject | |||
47 | QByteArray attachment; | 47 | QByteArray attachment; |
48 | attachment.fill('c', 1000); | 48 | attachment.fill('c', 1000); |
49 | for (int i = 0; i < count; i++) { | 49 | for (int i = 0; i < count; i++) { |
50 | auto domainObject = Akonadi2::ApplicationDomain::Event::Ptr::create(); | 50 | auto domainObject = Sink::ApplicationDomain::Event::Ptr::create(); |
51 | domainObject->setProperty("uid", "uid"); | 51 | domainObject->setProperty("uid", "uid"); |
52 | domainObject->setProperty("summary", "summary"); | 52 | domainObject->setProperty("summary", "summary"); |
53 | domainObject->setProperty("attachment", attachment); | 53 | domainObject->setProperty("attachment", attachment); |
@@ -82,7 +82,7 @@ class DatabasePopulationAndFacadeQueryBenchmark : public QObject | |||
82 | { | 82 | { |
83 | const auto startingRss = getCurrentRSS(); | 83 | const auto startingRss = getCurrentRSS(); |
84 | 84 | ||
85 | Akonadi2::Query query; | 85 | Sink::Query query; |
86 | query.liveQuery = false; | 86 | query.liveQuery = false; |
87 | query.requestedProperties << "uid" << "summary"; | 87 | query.requestedProperties << "uid" << "summary"; |
88 | 88 | ||
@@ -90,22 +90,22 @@ class DatabasePopulationAndFacadeQueryBenchmark : public QObject | |||
90 | QTime time; | 90 | QTime time; |
91 | time.start(); | 91 | time.start(); |
92 | 92 | ||
93 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); | 93 | auto resultSet = QSharedPointer<Sink::ResultProvider<Sink::ApplicationDomain::Event::Ptr> >::create(); |
94 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); | 94 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); |
95 | TestResourceFacade facade(identifier, resourceAccess); | 95 | TestResourceFacade facade(identifier, resourceAccess); |
96 | 96 | ||
97 | auto ret = facade.load(query); | 97 | auto ret = facade.load(query); |
98 | ret.first.exec().waitForFinished(); | 98 | ret.first.exec().waitForFinished(); |
99 | auto emitter = ret.second; | 99 | auto emitter = ret.second; |
100 | QList<Akonadi2::ApplicationDomain::Event::Ptr> list; | 100 | QList<Sink::ApplicationDomain::Event::Ptr> list; |
101 | emitter->onAdded([&list](const Akonadi2::ApplicationDomain::Event::Ptr &event) { | 101 | emitter->onAdded([&list](const Sink::ApplicationDomain::Event::Ptr &event) { |
102 | list << event; | 102 | list << event; |
103 | }); | 103 | }); |
104 | bool done = false; | 104 | bool done = false; |
105 | emitter->onInitialResultSetComplete([&done](const Akonadi2::ApplicationDomain::Event::Ptr &event) { | 105 | emitter->onInitialResultSetComplete([&done](const Sink::ApplicationDomain::Event::Ptr &event) { |
106 | done = true; | 106 | done = true; |
107 | }); | 107 | }); |
108 | emitter->fetch(Akonadi2::ApplicationDomain::Event::Ptr()); | 108 | emitter->fetch(Sink::ApplicationDomain::Event::Ptr()); |
109 | QTRY_VERIFY(done); | 109 | QTRY_VERIFY(done); |
110 | QCOMPARE(list.size(), count); | 110 | QCOMPARE(list.size(), count); |
111 | 111 | ||
@@ -114,7 +114,7 @@ class DatabasePopulationAndFacadeQueryBenchmark : public QObject | |||
114 | const auto finalRss = getCurrentRSS(); | 114 | const auto finalRss = getCurrentRSS(); |
115 | const auto rssGrowth = finalRss - startingRss; | 115 | const auto rssGrowth = finalRss - startingRss; |
116 | //Since the database is memory mapped it is attributted to the resident set size. | 116 | //Since the database is memory mapped it is attributted to the resident set size. |
117 | const auto rssWithoutDb = finalRss - Akonadi2::Storage(Akonadi2::storageLocation(), identifier, Akonadi2::Storage::ReadWrite).diskUsage(); | 117 | const auto rssWithoutDb = finalRss - Sink::Storage(Sink::storageLocation(), identifier, Sink::Storage::ReadWrite).diskUsage(); |
118 | const auto peakRss = getPeakRSS(); | 118 | const auto peakRss = getPeakRSS(); |
119 | //How much peak deviates from final rss in percent (should be around 0) | 119 | //How much peak deviates from final rss in percent (should be around 0) |
120 | const auto percentageRssError = static_cast<double>(peakRss - finalRss)*100.0/static_cast<double>(finalRss); | 120 | const auto percentageRssError = static_cast<double>(peakRss - finalRss)*100.0/static_cast<double>(finalRss); |
diff --git a/tests/domainadaptortest.cpp b/tests/domainadaptortest.cpp index b3d2a00..ff8f639 100644 --- a/tests/domainadaptortest.cpp +++ b/tests/domainadaptortest.cpp | |||
@@ -13,12 +13,12 @@ | |||
13 | #include "metadata_generated.h" | 13 | #include "metadata_generated.h" |
14 | #include "entity_generated.h" | 14 | #include "entity_generated.h" |
15 | 15 | ||
16 | class TestFactory : public DomainTypeAdaptorFactory<Akonadi2::ApplicationDomain::Event, Akonadi2::ApplicationDomain::Buffer::Event, Akonadi2::ApplicationDomain::Buffer::EventBuilder> | 16 | class TestFactory : public DomainTypeAdaptorFactory<Sink::ApplicationDomain::Event, Sink::ApplicationDomain::Buffer::Event, Sink::ApplicationDomain::Buffer::EventBuilder> |
17 | { | 17 | { |
18 | public: | 18 | public: |
19 | TestFactory() | 19 | TestFactory() |
20 | { | 20 | { |
21 | mResourceWriteMapper = Akonadi2::ApplicationDomain::TypeImplementation<Akonadi2::ApplicationDomain::Event>::initializeWritePropertyMapper(); | 21 | mResourceWriteMapper = Sink::ApplicationDomain::TypeImplementation<Sink::ApplicationDomain::Event>::initializeWritePropertyMapper(); |
22 | } | 22 | } |
23 | }; | 23 | }; |
24 | 24 | ||
@@ -39,27 +39,27 @@ private Q_SLOTS: | |||
39 | 39 | ||
40 | void testCreateBufferPart() | 40 | void testCreateBufferPart() |
41 | { | 41 | { |
42 | auto writeMapper = Akonadi2::ApplicationDomain::TypeImplementation<Akonadi2::ApplicationDomain::Event>::initializeWritePropertyMapper(); | 42 | auto writeMapper = Sink::ApplicationDomain::TypeImplementation<Sink::ApplicationDomain::Event>::initializeWritePropertyMapper(); |
43 | 43 | ||
44 | Akonadi2::ApplicationDomain::Event event; | 44 | Sink::ApplicationDomain::Event event; |
45 | event.setProperty("summary", "foo"); | 45 | event.setProperty("summary", "foo"); |
46 | 46 | ||
47 | flatbuffers::FlatBufferBuilder fbb; | 47 | flatbuffers::FlatBufferBuilder fbb; |
48 | auto pos = createBufferPart<Akonadi2::ApplicationDomain::Buffer::EventBuilder, Akonadi2::ApplicationDomain::Buffer::Event>(event, fbb, *writeMapper); | 48 | auto pos = createBufferPart<Sink::ApplicationDomain::Buffer::EventBuilder, Sink::ApplicationDomain::Buffer::Event>(event, fbb, *writeMapper); |
49 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(fbb, pos); | 49 | Sink::ApplicationDomain::Buffer::FinishEventBuffer(fbb, pos); |
50 | 50 | ||
51 | flatbuffers::Verifier verifier(fbb.GetBufferPointer(), fbb.GetSize()); | 51 | flatbuffers::Verifier verifier(fbb.GetBufferPointer(), fbb.GetSize()); |
52 | QVERIFY(verifier.VerifyBuffer<Akonadi2::ApplicationDomain::Buffer::Event>()); | 52 | QVERIFY(verifier.VerifyBuffer<Sink::ApplicationDomain::Buffer::Event>()); |
53 | } | 53 | } |
54 | 54 | ||
55 | void testAdaptor() | 55 | void testAdaptor() |
56 | { | 56 | { |
57 | //Create entity buffer | 57 | //Create entity buffer |
58 | flatbuffers::FlatBufferBuilder metadataFbb; | 58 | flatbuffers::FlatBufferBuilder metadataFbb; |
59 | auto metadataBuilder = Akonadi2::MetadataBuilder(metadataFbb); | 59 | auto metadataBuilder = Sink::MetadataBuilder(metadataFbb); |
60 | metadataBuilder.add_revision(1); | 60 | metadataBuilder.add_revision(1); |
61 | auto metadataBuffer = metadataBuilder.Finish(); | 61 | auto metadataBuffer = metadataBuilder.Finish(); |
62 | Akonadi2::FinishMetadataBuffer(metadataFbb, metadataBuffer); | 62 | Sink::FinishMetadataBuffer(metadataFbb, metadataBuffer); |
63 | 63 | ||
64 | flatbuffers::FlatBufferBuilder m_fbb; | 64 | flatbuffers::FlatBufferBuilder m_fbb; |
65 | auto summary = m_fbb.CreateString("summary1"); | 65 | auto summary = m_fbb.CreateString("summary1"); |
@@ -67,20 +67,20 @@ private Q_SLOTS: | |||
67 | static uint8_t rawData[100]; | 67 | static uint8_t rawData[100]; |
68 | auto attachment = m_fbb.CreateVector(rawData, 100); | 68 | auto attachment = m_fbb.CreateVector(rawData, 100); |
69 | 69 | ||
70 | auto builder = Akonadi2::ApplicationDomain::Buffer::EventBuilder(m_fbb); | 70 | auto builder = Sink::ApplicationDomain::Buffer::EventBuilder(m_fbb); |
71 | builder.add_summary(summary); | 71 | builder.add_summary(summary); |
72 | builder.add_description(description); | 72 | builder.add_description(description); |
73 | builder.add_attachment(attachment); | 73 | builder.add_attachment(attachment); |
74 | auto buffer = builder.Finish(); | 74 | auto buffer = builder.Finish(); |
75 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(m_fbb, buffer); | 75 | Sink::ApplicationDomain::Buffer::FinishEventBuffer(m_fbb, buffer); |
76 | 76 | ||
77 | flatbuffers::FlatBufferBuilder fbb; | 77 | flatbuffers::FlatBufferBuilder fbb; |
78 | Akonadi2::EntityBuffer::assembleEntityBuffer(fbb, metadataFbb.GetBufferPointer(), metadataFbb.GetSize(), m_fbb.GetBufferPointer(), m_fbb.GetSize(), m_fbb.GetBufferPointer(), m_fbb.GetSize()); | 78 | Sink::EntityBuffer::assembleEntityBuffer(fbb, metadataFbb.GetBufferPointer(), metadataFbb.GetSize(), m_fbb.GetBufferPointer(), m_fbb.GetSize(), m_fbb.GetBufferPointer(), m_fbb.GetSize()); |
79 | 79 | ||
80 | //Extract entity buffer | 80 | //Extract entity buffer |
81 | { | 81 | { |
82 | std::string data(reinterpret_cast<const char*>(fbb.GetBufferPointer()), fbb.GetSize()); | 82 | std::string data(reinterpret_cast<const char*>(fbb.GetBufferPointer()), fbb.GetSize()); |
83 | Akonadi2::EntityBuffer buffer((void*)(data.data()), data.size()); | 83 | Sink::EntityBuffer buffer((void*)(data.data()), data.size()); |
84 | 84 | ||
85 | TestFactory factory; | 85 | TestFactory factory; |
86 | auto adaptor = factory.createAdaptor(buffer.entity()); | 86 | auto adaptor = factory.createAdaptor(buffer.entity()); |
diff --git a/tests/dummyresourcebenchmark.cpp b/tests/dummyresourcebenchmark.cpp index c52eee3..e511613 100644 --- a/tests/dummyresourcebenchmark.cpp +++ b/tests/dummyresourcebenchmark.cpp | |||
@@ -30,8 +30,8 @@ private: | |||
30 | private Q_SLOTS: | 30 | private Q_SLOTS: |
31 | void initTestCase() | 31 | void initTestCase() |
32 | { | 32 | { |
33 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Warning); | 33 | Sink::Log::setDebugOutputLevel(Sink::Log::Warning); |
34 | auto factory = Akonadi2::ResourceFactory::load("org.kde.dummy"); | 34 | auto factory = Sink::ResourceFactory::load("org.kde.dummy"); |
35 | QVERIFY(factory); | 35 | QVERIFY(factory); |
36 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); | 36 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); |
37 | num = 5000; | 37 | num = 5000; |
@@ -79,20 +79,20 @@ private Q_SLOTS: | |||
79 | time.start(); | 79 | time.start(); |
80 | QList<KAsync::Future<void> > waitCondition; | 80 | QList<KAsync::Future<void> > waitCondition; |
81 | for (int i = 0; i < num; i++) { | 81 | for (int i = 0; i < num; i++) { |
82 | Akonadi2::ApplicationDomain::Event event("org.kde.dummy.instance1"); | 82 | Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); |
83 | event.setProperty("uid", "testuid"); | 83 | event.setProperty("uid", "testuid"); |
84 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); | 84 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); |
85 | event.setProperty("summary", "summaryValue"); | 85 | event.setProperty("summary", "summaryValue"); |
86 | waitCondition << Akonadi2::Store::create<Akonadi2::ApplicationDomain::Event>(event).exec(); | 86 | waitCondition << Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec(); |
87 | } | 87 | } |
88 | waitForCompletion(waitCondition).exec().waitForFinished(); | 88 | waitForCompletion(waitCondition).exec().waitForFinished(); |
89 | auto appendTime = time.elapsed(); | 89 | auto appendTime = time.elapsed(); |
90 | 90 | ||
91 | //Ensure everything is processed | 91 | //Ensure everything is processed |
92 | { | 92 | { |
93 | Akonadi2::Query query; | 93 | Sink::Query query; |
94 | query.resources << "org.kde.dummy.instance1"; | 94 | query.resources << "org.kde.dummy.instance1"; |
95 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 95 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
96 | } | 96 | } |
97 | auto allProcessedTime = time.elapsed(); | 97 | auto allProcessedTime = time.elapsed(); |
98 | 98 | ||
@@ -119,11 +119,11 @@ private Q_SLOTS: | |||
119 | //Measure query | 119 | //Measure query |
120 | { | 120 | { |
121 | time.start(); | 121 | time.start(); |
122 | Akonadi2::Query query; | 122 | Sink::Query query; |
123 | query.resources << "org.kde.dummy.instance1"; | 123 | query.resources << "org.kde.dummy.instance1"; |
124 | 124 | ||
125 | query.propertyFilter.insert("uid", "testuid"); | 125 | query.propertyFilter.insert("uid", "testuid"); |
126 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); | 126 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
127 | QTRY_COMPARE(model->rowCount(QModelIndex()), num); | 127 | QTRY_COMPARE(model->rowCount(QModelIndex()), num); |
128 | } | 128 | } |
129 | auto queryTime = time.elapsed(); | 129 | auto queryTime = time.elapsed(); |
@@ -142,44 +142,44 @@ private Q_SLOTS: | |||
142 | QTime time; | 142 | QTime time; |
143 | time.start(); | 143 | time.start(); |
144 | 144 | ||
145 | auto pipeline = QSharedPointer<Akonadi2::Pipeline>::create("org.kde.dummy.instance1"); | 145 | auto pipeline = QSharedPointer<Sink::Pipeline>::create("org.kde.dummy.instance1"); |
146 | DummyResource resource("org.kde.dummy.instance1", pipeline); | 146 | DummyResource resource("org.kde.dummy.instance1", pipeline); |
147 | 147 | ||
148 | flatbuffers::FlatBufferBuilder eventFbb; | 148 | flatbuffers::FlatBufferBuilder eventFbb; |
149 | eventFbb.Clear(); | 149 | eventFbb.Clear(); |
150 | { | 150 | { |
151 | auto summary = eventFbb.CreateString("summary"); | 151 | auto summary = eventFbb.CreateString("summary"); |
152 | Akonadi2::ApplicationDomain::Buffer::EventBuilder eventBuilder(eventFbb); | 152 | Sink::ApplicationDomain::Buffer::EventBuilder eventBuilder(eventFbb); |
153 | eventBuilder.add_summary(summary); | 153 | eventBuilder.add_summary(summary); |
154 | auto eventLocation = eventBuilder.Finish(); | 154 | auto eventLocation = eventBuilder.Finish(); |
155 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(eventFbb, eventLocation); | 155 | Sink::ApplicationDomain::Buffer::FinishEventBuffer(eventFbb, eventLocation); |
156 | } | 156 | } |
157 | 157 | ||
158 | flatbuffers::FlatBufferBuilder localFbb; | 158 | flatbuffers::FlatBufferBuilder localFbb; |
159 | { | 159 | { |
160 | auto uid = localFbb.CreateString("testuid"); | 160 | auto uid = localFbb.CreateString("testuid"); |
161 | auto localBuilder = Akonadi2::ApplicationDomain::Buffer::EventBuilder(localFbb); | 161 | auto localBuilder = Sink::ApplicationDomain::Buffer::EventBuilder(localFbb); |
162 | localBuilder.add_uid(uid); | 162 | localBuilder.add_uid(uid); |
163 | auto location = localBuilder.Finish(); | 163 | auto location = localBuilder.Finish(); |
164 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(localFbb, location); | 164 | Sink::ApplicationDomain::Buffer::FinishEventBuffer(localFbb, location); |
165 | } | 165 | } |
166 | 166 | ||
167 | flatbuffers::FlatBufferBuilder entityFbb; | 167 | flatbuffers::FlatBufferBuilder entityFbb; |
168 | Akonadi2::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize()); | 168 | Sink::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize()); |
169 | 169 | ||
170 | flatbuffers::FlatBufferBuilder fbb; | 170 | flatbuffers::FlatBufferBuilder fbb; |
171 | auto type = fbb.CreateString(Akonadi2::ApplicationDomain::getTypeName<Akonadi2::ApplicationDomain::Event>().toStdString().data()); | 171 | auto type = fbb.CreateString(Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Event>().toStdString().data()); |
172 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); | 172 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); |
173 | Akonadi2::Commands::CreateEntityBuilder builder(fbb); | 173 | Sink::Commands::CreateEntityBuilder builder(fbb); |
174 | builder.add_domainType(type); | 174 | builder.add_domainType(type); |
175 | builder.add_delta(delta); | 175 | builder.add_delta(delta); |
176 | auto location = builder.Finish(); | 176 | auto location = builder.Finish(); |
177 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); | 177 | Sink::Commands::FinishCreateEntityBuffer(fbb, location); |
178 | 178 | ||
179 | const QByteArray command(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); | 179 | const QByteArray command(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); |
180 | 180 | ||
181 | for (int i = 0; i < num; i++) { | 181 | for (int i = 0; i < num; i++) { |
182 | resource.processCommand(Akonadi2::Commands::CreateEntityCommand, command); | 182 | resource.processCommand(Sink::Commands::CreateEntityCommand, command); |
183 | } | 183 | } |
184 | auto appendTime = time.elapsed(); | 184 | auto appendTime = time.elapsed(); |
185 | 185 | ||
@@ -203,7 +203,7 @@ private Q_SLOTS: | |||
203 | 203 | ||
204 | void testCreateCommand() | 204 | void testCreateCommand() |
205 | { | 205 | { |
206 | Akonadi2::ApplicationDomain::Event event; | 206 | Sink::ApplicationDomain::Event event; |
207 | 207 | ||
208 | QBENCHMARK { | 208 | QBENCHMARK { |
209 | auto mFactory = new DummyEventAdaptorFactory; | 209 | auto mFactory = new DummyEventAdaptorFactory; |
@@ -217,9 +217,9 @@ private Q_SLOTS: | |||
217 | auto entityId = fbb.CreateString(""); | 217 | auto entityId = fbb.CreateString(""); |
218 | auto type = fbb.CreateString("event"); | 218 | auto type = fbb.CreateString("event"); |
219 | // auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); | 219 | // auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); |
220 | auto delta = Akonadi2::EntityBuffer::appendAsVector(fbb, entityFbb.GetBufferPointer(), entityFbb.GetSize()); | 220 | auto delta = Sink::EntityBuffer::appendAsVector(fbb, entityFbb.GetBufferPointer(), entityFbb.GetSize()); |
221 | auto location = Akonadi2::Commands::CreateCreateEntity(fbb, entityId, type, delta); | 221 | auto location = Sink::Commands::CreateCreateEntity(fbb, entityId, type, delta); |
222 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); | 222 | Sink::Commands::FinishCreateEntityBuffer(fbb, location); |
223 | } | 223 | } |
224 | } | 224 | } |
225 | 225 | ||
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index 72a24b6..82c713d 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp | |||
@@ -22,8 +22,8 @@ class DummyResourceTest : public QObject | |||
22 | private Q_SLOTS: | 22 | private Q_SLOTS: |
23 | void initTestCase() | 23 | void initTestCase() |
24 | { | 24 | { |
25 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Trace); | 25 | Sink::Log::setDebugOutputLevel(Sink::Log::Trace); |
26 | auto factory = Akonadi2::ResourceFactory::load("org.kde.dummy"); | 26 | auto factory = Sink::ResourceFactory::load("org.kde.dummy"); |
27 | QVERIFY(factory); | 27 | QVERIFY(factory); |
28 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | 28 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); |
29 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); | 29 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); |
@@ -31,11 +31,11 @@ private Q_SLOTS: | |||
31 | 31 | ||
32 | void cleanup() | 32 | void cleanup() |
33 | { | 33 | { |
34 | Akonadi2::Store::shutdown(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); | 34 | Sink::Store::shutdown(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); |
35 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | 35 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); |
36 | auto factory = Akonadi2::ResourceFactory::load("org.kde.dummy"); | 36 | auto factory = Sink::ResourceFactory::load("org.kde.dummy"); |
37 | QVERIFY(factory); | 37 | QVERIFY(factory); |
38 | Akonadi2::Store::start(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); | 38 | Sink::Store::start(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); |
39 | } | 39 | } |
40 | 40 | ||
41 | void init() | 41 | void init() |
@@ -47,54 +47,54 @@ private Q_SLOTS: | |||
47 | 47 | ||
48 | void testProperty() | 48 | void testProperty() |
49 | { | 49 | { |
50 | Akonadi2::ApplicationDomain::Event event; | 50 | Sink::ApplicationDomain::Event event; |
51 | event.setProperty("uid", "testuid"); | 51 | event.setProperty("uid", "testuid"); |
52 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); | 52 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); |
53 | } | 53 | } |
54 | 54 | ||
55 | void testWriteToFacadeAndQueryByUid() | 55 | void testWriteToFacadeAndQueryByUid() |
56 | { | 56 | { |
57 | Akonadi2::ApplicationDomain::Event event("org.kde.dummy.instance1"); | 57 | Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); |
58 | event.setProperty("uid", "testuid"); | 58 | event.setProperty("uid", "testuid"); |
59 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); | 59 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); |
60 | event.setProperty("summary", "summaryValue"); | 60 | event.setProperty("summary", "summaryValue"); |
61 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Event>(event).exec().waitForFinished(); | 61 | Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); |
62 | 62 | ||
63 | Akonadi2::Query query; | 63 | Sink::Query query; |
64 | query.resources << "org.kde.dummy.instance1"; | 64 | query.resources << "org.kde.dummy.instance1"; |
65 | 65 | ||
66 | //Ensure all local data is processed | 66 | //Ensure all local data is processed |
67 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 67 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
68 | 68 | ||
69 | query.propertyFilter.insert("uid", "testuid"); | 69 | query.propertyFilter.insert("uid", "testuid"); |
70 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); | 70 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
71 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); | 71 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); |
72 | auto value = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Event::Ptr>(); | 72 | auto value = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Event::Ptr>(); |
73 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); | 73 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); |
74 | } | 74 | } |
75 | 75 | ||
76 | void testWriteToFacadeAndQueryByUid2() | 76 | void testWriteToFacadeAndQueryByUid2() |
77 | { | 77 | { |
78 | Akonadi2::ApplicationDomain::Event event("org.kde.dummy.instance1"); | 78 | Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); |
79 | event.setProperty("summary", "summaryValue"); | 79 | event.setProperty("summary", "summaryValue"); |
80 | 80 | ||
81 | event.setProperty("uid", "testuid"); | 81 | event.setProperty("uid", "testuid"); |
82 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Event>(event).exec().waitForFinished(); | 82 | Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); |
83 | 83 | ||
84 | event.setProperty("uid", "testuid2"); | 84 | event.setProperty("uid", "testuid2"); |
85 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Event>(event).exec().waitForFinished(); | 85 | Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); |
86 | 86 | ||
87 | Akonadi2::Query query; | 87 | Sink::Query query; |
88 | query.resources << "org.kde.dummy.instance1"; | 88 | query.resources << "org.kde.dummy.instance1"; |
89 | 89 | ||
90 | //Ensure all local data is processed | 90 | //Ensure all local data is processed |
91 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 91 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
92 | 92 | ||
93 | query.propertyFilter.insert("uid", "testuid"); | 93 | query.propertyFilter.insert("uid", "testuid"); |
94 | 94 | ||
95 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); | 95 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
96 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); | 96 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); |
97 | auto value = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Event::Ptr>(); | 97 | auto value = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Event::Ptr>(); |
98 | 98 | ||
99 | qDebug() << value->getProperty("uid").toByteArray(); | 99 | qDebug() << value->getProperty("uid").toByteArray(); |
100 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); | 100 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); |
@@ -102,27 +102,27 @@ private Q_SLOTS: | |||
102 | 102 | ||
103 | void testWriteToFacadeAndQueryBySummary() | 103 | void testWriteToFacadeAndQueryBySummary() |
104 | { | 104 | { |
105 | Akonadi2::ApplicationDomain::Event event("org.kde.dummy.instance1"); | 105 | Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); |
106 | 106 | ||
107 | event.setProperty("uid", "testuid"); | 107 | event.setProperty("uid", "testuid"); |
108 | event.setProperty("summary", "summaryValue1"); | 108 | event.setProperty("summary", "summaryValue1"); |
109 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Event>(event).exec().waitForFinished(); | 109 | Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); |
110 | 110 | ||
111 | event.setProperty("uid", "testuid2"); | 111 | event.setProperty("uid", "testuid2"); |
112 | event.setProperty("summary", "summaryValue2"); | 112 | event.setProperty("summary", "summaryValue2"); |
113 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Event>(event).exec().waitForFinished(); | 113 | Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); |
114 | 114 | ||
115 | Akonadi2::Query query; | 115 | Sink::Query query; |
116 | query.resources << "org.kde.dummy.instance1"; | 116 | query.resources << "org.kde.dummy.instance1"; |
117 | 117 | ||
118 | //Ensure all local data is processed | 118 | //Ensure all local data is processed |
119 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 119 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
120 | 120 | ||
121 | query.propertyFilter.insert("summary", "summaryValue2"); | 121 | query.propertyFilter.insert("summary", "summaryValue2"); |
122 | 122 | ||
123 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); | 123 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
124 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); | 124 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); |
125 | auto value = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Event::Ptr>(); | 125 | auto value = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Event::Ptr>(); |
126 | 126 | ||
127 | qDebug() << value->getProperty("uid").toByteArray(); | 127 | qDebug() << value->getProperty("uid").toByteArray(); |
128 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid2")); | 128 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid2")); |
@@ -130,7 +130,7 @@ private Q_SLOTS: | |||
130 | 130 | ||
131 | void testResourceSync() | 131 | void testResourceSync() |
132 | { | 132 | { |
133 | auto pipeline = QSharedPointer<Akonadi2::Pipeline>::create("org.kde.dummy.instance1"); | 133 | auto pipeline = QSharedPointer<Sink::Pipeline>::create("org.kde.dummy.instance1"); |
134 | DummyResource resource("org.kde.dummy.instance1", pipeline); | 134 | DummyResource resource("org.kde.dummy.instance1", pipeline); |
135 | auto job = resource.synchronizeWithSource(); | 135 | auto job = resource.synchronizeWithSource(); |
136 | //TODO pass in optional timeout? | 136 | //TODO pass in optional timeout? |
@@ -145,16 +145,16 @@ private Q_SLOTS: | |||
145 | 145 | ||
146 | void testSyncAndFacade() | 146 | void testSyncAndFacade() |
147 | { | 147 | { |
148 | Akonadi2::Query query; | 148 | Sink::Query query; |
149 | query.resources << "org.kde.dummy.instance1"; | 149 | query.resources << "org.kde.dummy.instance1"; |
150 | 150 | ||
151 | //Ensure all local data is processed | 151 | //Ensure all local data is processed |
152 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 152 | Sink::Store::synchronize(query).exec().waitForFinished(); |
153 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 153 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
154 | 154 | ||
155 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); | 155 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
156 | QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); | 156 | QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); |
157 | auto value = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Event::Ptr>(); | 157 | auto value = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Event::Ptr>(); |
158 | 158 | ||
159 | QVERIFY(!value->getProperty("summary").toString().isEmpty()); | 159 | QVERIFY(!value->getProperty("summary").toString().isEmpty()); |
160 | qDebug() << value->getProperty("summary").toString(); | 160 | qDebug() << value->getProperty("summary").toString(); |
@@ -162,16 +162,16 @@ private Q_SLOTS: | |||
162 | 162 | ||
163 | void testSyncAndFacadeMail() | 163 | void testSyncAndFacadeMail() |
164 | { | 164 | { |
165 | Akonadi2::Query query; | 165 | Sink::Query query; |
166 | query.resources << "org.kde.dummy.instance1"; | 166 | query.resources << "org.kde.dummy.instance1"; |
167 | 167 | ||
168 | //Ensure all local data is processed | 168 | //Ensure all local data is processed |
169 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 169 | Sink::Store::synchronize(query).exec().waitForFinished(); |
170 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 170 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
171 | 171 | ||
172 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 172 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
173 | QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); | 173 | QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); |
174 | auto value = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Mail::Ptr>(); | 174 | auto value = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Mail::Ptr>(); |
175 | 175 | ||
176 | QVERIFY(!value->getProperty("subject").toString().isEmpty()); | 176 | QVERIFY(!value->getProperty("subject").toString().isEmpty()); |
177 | qDebug() << value->getProperty("subject").toString(); | 177 | qDebug() << value->getProperty("subject").toString(); |
@@ -179,25 +179,25 @@ private Q_SLOTS: | |||
179 | 179 | ||
180 | void testWriteModifyDelete() | 180 | void testWriteModifyDelete() |
181 | { | 181 | { |
182 | Akonadi2::ApplicationDomain::Event event("org.kde.dummy.instance1"); | 182 | Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); |
183 | event.setProperty("uid", "testuid"); | 183 | event.setProperty("uid", "testuid"); |
184 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); | 184 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); |
185 | event.setProperty("summary", "summaryValue"); | 185 | event.setProperty("summary", "summaryValue"); |
186 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Event>(event).exec().waitForFinished(); | 186 | Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); |
187 | 187 | ||
188 | Akonadi2::Query query; | 188 | Sink::Query query; |
189 | query.resources << "org.kde.dummy.instance1"; | 189 | query.resources << "org.kde.dummy.instance1"; |
190 | query.propertyFilter.insert("uid", "testuid"); | 190 | query.propertyFilter.insert("uid", "testuid"); |
191 | 191 | ||
192 | //Ensure all local data is processed | 192 | //Ensure all local data is processed |
193 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 193 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
194 | 194 | ||
195 | //Test create | 195 | //Test create |
196 | Akonadi2::ApplicationDomain::Event event2; | 196 | Sink::ApplicationDomain::Event event2; |
197 | { | 197 | { |
198 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); | 198 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
199 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); | 199 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); |
200 | auto value = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Event::Ptr>(); | 200 | auto value = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Event::Ptr>(); |
201 | 201 | ||
202 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); | 202 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); |
203 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue")); | 203 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue")); |
@@ -206,30 +206,30 @@ private Q_SLOTS: | |||
206 | 206 | ||
207 | event2.setProperty("uid", "testuid"); | 207 | event2.setProperty("uid", "testuid"); |
208 | event2.setProperty("summary", "summaryValue2"); | 208 | event2.setProperty("summary", "summaryValue2"); |
209 | Akonadi2::Store::modify<Akonadi2::ApplicationDomain::Event>(event2).exec().waitForFinished(); | 209 | Sink::Store::modify<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished(); |
210 | 210 | ||
211 | //Ensure all local data is processed | 211 | //Ensure all local data is processed |
212 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 212 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
213 | 213 | ||
214 | //Test modify | 214 | //Test modify |
215 | { | 215 | { |
216 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); | 216 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
217 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); | 217 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); |
218 | auto value = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Event::Ptr>(); | 218 | auto value = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Event::Ptr>(); |
219 | 219 | ||
220 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); | 220 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); |
221 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue2")); | 221 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue2")); |
222 | } | 222 | } |
223 | 223 | ||
224 | Akonadi2::Store::remove<Akonadi2::ApplicationDomain::Event>(event2).exec().waitForFinished(); | 224 | Sink::Store::remove<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished(); |
225 | 225 | ||
226 | //Ensure all local data is processed | 226 | //Ensure all local data is processed |
227 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 227 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
228 | 228 | ||
229 | //Test remove | 229 | //Test remove |
230 | { | 230 | { |
231 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); | 231 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
232 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 232 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
233 | QTRY_COMPARE(model->rowCount(QModelIndex()), 0); | 233 | QTRY_COMPARE(model->rowCount(QModelIndex()), 0); |
234 | } | 234 | } |
235 | } | 235 | } |
@@ -237,25 +237,25 @@ private Q_SLOTS: | |||
237 | void testWriteModifyDeleteLive() | 237 | void testWriteModifyDeleteLive() |
238 | { | 238 | { |
239 | 239 | ||
240 | Akonadi2::Query query; | 240 | Sink::Query query; |
241 | query.resources << "org.kde.dummy.instance1"; | 241 | query.resources << "org.kde.dummy.instance1"; |
242 | query.liveQuery = true; | 242 | query.liveQuery = true; |
243 | query.propertyFilter.insert("uid", "testuid"); | 243 | query.propertyFilter.insert("uid", "testuid"); |
244 | 244 | ||
245 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); | 245 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
246 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 246 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
247 | 247 | ||
248 | Akonadi2::ApplicationDomain::Event event("org.kde.dummy.instance1"); | 248 | Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); |
249 | event.setProperty("uid", "testuid"); | 249 | event.setProperty("uid", "testuid"); |
250 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); | 250 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); |
251 | event.setProperty("summary", "summaryValue"); | 251 | event.setProperty("summary", "summaryValue"); |
252 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Event>(event).exec().waitForFinished(); | 252 | Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); |
253 | 253 | ||
254 | //Test create | 254 | //Test create |
255 | Akonadi2::ApplicationDomain::Event event2; | 255 | Sink::ApplicationDomain::Event event2; |
256 | { | 256 | { |
257 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); | 257 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); |
258 | auto value = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Event::Ptr>(); | 258 | auto value = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Event::Ptr>(); |
259 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); | 259 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); |
260 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue")); | 260 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue")); |
261 | event2 = *value; | 261 | event2 = *value; |
@@ -263,18 +263,18 @@ private Q_SLOTS: | |||
263 | 263 | ||
264 | event2.setProperty("uid", "testuid"); | 264 | event2.setProperty("uid", "testuid"); |
265 | event2.setProperty("summary", "summaryValue2"); | 265 | event2.setProperty("summary", "summaryValue2"); |
266 | Akonadi2::Store::modify<Akonadi2::ApplicationDomain::Event>(event2).exec().waitForFinished(); | 266 | Sink::Store::modify<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished(); |
267 | 267 | ||
268 | //Test modify | 268 | //Test modify |
269 | { | 269 | { |
270 | //TODO wait for a change signal | 270 | //TODO wait for a change signal |
271 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); | 271 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); |
272 | auto value = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Event::Ptr>(); | 272 | auto value = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Event::Ptr>(); |
273 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); | 273 | QCOMPARE(value->getProperty("uid").toByteArray(), QByteArray("testuid")); |
274 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue2")); | 274 | QCOMPARE(value->getProperty("summary").toByteArray(), QByteArray("summaryValue2")); |
275 | } | 275 | } |
276 | 276 | ||
277 | Akonadi2::Store::remove<Akonadi2::ApplicationDomain::Event>(event2).exec().waitForFinished(); | 277 | Sink::Store::remove<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished(); |
278 | 278 | ||
279 | //Test remove | 279 | //Test remove |
280 | { | 280 | { |
diff --git a/tests/dummyresourcewritebenchmark.cpp b/tests/dummyresourcewritebenchmark.cpp index 1e7f1ef..1a8893b 100644 --- a/tests/dummyresourcewritebenchmark.cpp +++ b/tests/dummyresourcewritebenchmark.cpp | |||
@@ -60,33 +60,33 @@ static QByteArray createEntityBuffer(int &bufferSize) | |||
60 | eventFbb.Clear(); | 60 | eventFbb.Clear(); |
61 | { | 61 | { |
62 | auto summary = eventFbb.CreateString("summary"); | 62 | auto summary = eventFbb.CreateString("summary"); |
63 | Akonadi2::ApplicationDomain::Buffer::EventBuilder eventBuilder(eventFbb); | 63 | Sink::ApplicationDomain::Buffer::EventBuilder eventBuilder(eventFbb); |
64 | eventBuilder.add_summary(summary); | 64 | eventBuilder.add_summary(summary); |
65 | auto eventLocation = eventBuilder.Finish(); | 65 | auto eventLocation = eventBuilder.Finish(); |
66 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(eventFbb, eventLocation); | 66 | Sink::ApplicationDomain::Buffer::FinishEventBuffer(eventFbb, eventLocation); |
67 | } | 67 | } |
68 | 68 | ||
69 | flatbuffers::FlatBufferBuilder localFbb; | 69 | flatbuffers::FlatBufferBuilder localFbb; |
70 | { | 70 | { |
71 | auto uid = localFbb.CreateString("testuid"); | 71 | auto uid = localFbb.CreateString("testuid"); |
72 | auto localBuilder = Akonadi2::ApplicationDomain::Buffer::EventBuilder(localFbb); | 72 | auto localBuilder = Sink::ApplicationDomain::Buffer::EventBuilder(localFbb); |
73 | localBuilder.add_uid(uid); | 73 | localBuilder.add_uid(uid); |
74 | auto location = localBuilder.Finish(); | 74 | auto location = localBuilder.Finish(); |
75 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(localFbb, location); | 75 | Sink::ApplicationDomain::Buffer::FinishEventBuffer(localFbb, location); |
76 | } | 76 | } |
77 | 77 | ||
78 | flatbuffers::FlatBufferBuilder entityFbb; | 78 | flatbuffers::FlatBufferBuilder entityFbb; |
79 | Akonadi2::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize()); | 79 | Sink::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize()); |
80 | bufferSize = entityFbb.GetSize(); | 80 | bufferSize = entityFbb.GetSize(); |
81 | 81 | ||
82 | flatbuffers::FlatBufferBuilder fbb; | 82 | flatbuffers::FlatBufferBuilder fbb; |
83 | auto type = fbb.CreateString(Akonadi2::ApplicationDomain::getTypeName<Akonadi2::ApplicationDomain::Event>().toStdString().data()); | 83 | auto type = fbb.CreateString(Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Event>().toStdString().data()); |
84 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); | 84 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); |
85 | Akonadi2::Commands::CreateEntityBuilder builder(fbb); | 85 | Sink::Commands::CreateEntityBuilder builder(fbb); |
86 | builder.add_domainType(type); | 86 | builder.add_domainType(type); |
87 | builder.add_delta(delta); | 87 | builder.add_delta(delta); |
88 | auto location = builder.Finish(); | 88 | auto location = builder.Finish(); |
89 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); | 89 | Sink::Commands::FinishCreateEntityBuffer(fbb, location); |
90 | 90 | ||
91 | return QByteArray(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); | 91 | return QByteArray(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); |
92 | } | 92 | } |
@@ -109,7 +109,7 @@ class DummyResourceWriteBenchmark : public QObject | |||
109 | QTime time; | 109 | QTime time; |
110 | time.start(); | 110 | time.start(); |
111 | 111 | ||
112 | auto pipeline = QSharedPointer<Akonadi2::Pipeline>::create("org.kde.dummy.instance1"); | 112 | auto pipeline = QSharedPointer<Sink::Pipeline>::create("org.kde.dummy.instance1"); |
113 | DummyResource resource("org.kde.dummy.instance1", pipeline); | 113 | DummyResource resource("org.kde.dummy.instance1", pipeline); |
114 | 114 | ||
115 | int bufferSize = 0; | 115 | int bufferSize = 0; |
@@ -117,7 +117,7 @@ class DummyResourceWriteBenchmark : public QObject | |||
117 | 117 | ||
118 | const auto startingRss = getCurrentRSS(); | 118 | const auto startingRss = getCurrentRSS(); |
119 | for (int i = 0; i < num; i++) { | 119 | for (int i = 0; i < num; i++) { |
120 | resource.processCommand(Akonadi2::Commands::CreateEntityCommand, command); | 120 | resource.processCommand(Sink::Commands::CreateEntityCommand, command); |
121 | } | 121 | } |
122 | auto appendTime = time.elapsed(); | 122 | auto appendTime = time.elapsed(); |
123 | auto bufferSizeTotal = bufferSize * num; | 123 | auto bufferSizeTotal = bufferSize * num; |
@@ -174,7 +174,7 @@ class DummyResourceWriteBenchmark : public QObject | |||
174 | private Q_SLOTS: | 174 | private Q_SLOTS: |
175 | void initTestCase() | 175 | void initTestCase() |
176 | { | 176 | { |
177 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Warning); | 177 | Sink::Log::setDebugOutputLevel(Sink::Log::Warning); |
178 | } | 178 | } |
179 | 179 | ||
180 | void cleanup() | 180 | void cleanup() |
@@ -215,7 +215,7 @@ private Q_SLOTS: | |||
215 | 215 | ||
216 | void getFreePages() | 216 | void getFreePages() |
217 | { | 217 | { |
218 | std::system(QString("mdb_stat %1/%2 -ff").arg(Akonadi2::storageLocation()).arg("org.kde.dummy.instance1").toLatin1().constData()); | 218 | std::system(QString("mdb_stat %1/%2 -ff").arg(Sink::storageLocation()).arg("org.kde.dummy.instance1").toLatin1().constData()); |
219 | } | 219 | } |
220 | 220 | ||
221 | //This allows to run individual parts without doing a cleanup, but still cleaning up normally | 221 | //This allows to run individual parts without doing a cleanup, but still cleaning up normally |
diff --git a/tests/genericfacadetest.cpp b/tests/genericfacadetest.cpp index bb95f4e..63e93f8 100644 --- a/tests/genericfacadetest.cpp +++ b/tests/genericfacadetest.cpp | |||
@@ -26,20 +26,20 @@ private Q_SLOTS: | |||
26 | 26 | ||
27 | void init() | 27 | void init() |
28 | { | 28 | { |
29 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Trace); | 29 | Sink::Log::setDebugOutputLevel(Sink::Log::Trace); |
30 | } | 30 | } |
31 | 31 | ||
32 | void testLoad() | 32 | void testLoad() |
33 | { | 33 | { |
34 | Akonadi2::Query query; | 34 | Sink::Query query; |
35 | query.liveQuery = false; | 35 | query.liveQuery = false; |
36 | 36 | ||
37 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); | 37 | auto resultSet = QSharedPointer<Sink::ResultProvider<Sink::ApplicationDomain::Event::Ptr> >::create(); |
38 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); | 38 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); |
39 | // storage->mResults << Akonadi2::ApplicationDomain::Event::Ptr::create(); | 39 | // storage->mResults << Sink::ApplicationDomain::Event::Ptr::create(); |
40 | TestResourceFacade facade("identifier", resourceAccess); | 40 | TestResourceFacade facade("identifier", resourceAccess); |
41 | 41 | ||
42 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); | 42 | async::SyncListResult<Sink::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(); |
@@ -52,15 +52,15 @@ private Q_SLOTS: | |||
52 | 52 | ||
53 | void testLiveQuery() | 53 | void testLiveQuery() |
54 | { | 54 | { |
55 | Akonadi2::Query query; | 55 | Sink::Query query; |
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<Sink::ResultProvider<Sink::ApplicationDomain::Event::Ptr> >::create(); |
59 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); | 59 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); |
60 | // storage->mResults << Akonadi2::ApplicationDomain::Event::Ptr::create(); | 60 | // storage->mResults << Sink::ApplicationDomain::Event::Ptr::create(); |
61 | TestResourceFacade facade("identifier", resourceAccess); | 61 | TestResourceFacade facade("identifier", resourceAccess); |
62 | 62 | ||
63 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); | 63 | async::SyncListResult<Sink::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); |
64 | 64 | ||
65 | facade.load(query, *resultSet).exec().waitForFinished(); | 65 | facade.load(query, *resultSet).exec().waitForFinished(); |
66 | resultSet->initialResultSetComplete(); | 66 | resultSet->initialResultSetComplete(); |
@@ -70,7 +70,7 @@ private Q_SLOTS: | |||
70 | 70 | ||
71 | //Enter a second result | 71 | //Enter a second result |
72 | // storage->mResults.clear(); | 72 | // storage->mResults.clear(); |
73 | // storage->mResults << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); | 73 | // storage->mResults << QSharedPointer<Sink::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Sink::ApplicationDomain::BufferAdaptor>()); |
74 | // storage->mLatestRevision = 2; | 74 | // storage->mLatestRevision = 2; |
75 | resourceAccess->emit revisionChanged(2); | 75 | resourceAccess->emit revisionChanged(2); |
76 | 76 | ||
@@ -83,17 +83,17 @@ private Q_SLOTS: | |||
83 | 83 | ||
84 | void testLiveQueryModify() | 84 | void testLiveQueryModify() |
85 | { | 85 | { |
86 | Akonadi2::Query query; | 86 | Sink::Query query; |
87 | query.liveQuery = true; | 87 | query.liveQuery = true; |
88 | 88 | ||
89 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); | 89 | auto resultSet = QSharedPointer<Sink::ResultProvider<Sink::ApplicationDomain::Event::Ptr> >::create(); |
90 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); | 90 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); |
91 | auto entity = QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 91 | auto entity = QSharedPointer<Sink::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); |
92 | entity->setProperty("test", "test1"); | 92 | entity->setProperty("test", "test1"); |
93 | // storage->mResults << entity; | 93 | // storage->mResults << entity; |
94 | TestResourceFacade facade("identifier", resourceAccess); | 94 | TestResourceFacade facade("identifier", resourceAccess); |
95 | 95 | ||
96 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); | 96 | async::SyncListResult<Sink::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); |
97 | 97 | ||
98 | facade.load(query, *resultSet).exec().waitForFinished(); | 98 | facade.load(query, *resultSet).exec().waitForFinished(); |
99 | resultSet->initialResultSetComplete(); | 99 | resultSet->initialResultSetComplete(); |
@@ -103,7 +103,7 @@ private Q_SLOTS: | |||
103 | 103 | ||
104 | //Modify the entity again | 104 | //Modify the entity again |
105 | // storage->mResults.clear(); | 105 | // storage->mResults.clear(); |
106 | entity = QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 106 | entity = QSharedPointer<Sink::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); |
107 | entity->setProperty("test", "test2"); | 107 | entity->setProperty("test", "test2"); |
108 | // storage->mModifications << entity; | 108 | // storage->mModifications << entity; |
109 | // storage->mLatestRevision = 2; | 109 | // storage->mLatestRevision = 2; |
@@ -119,16 +119,16 @@ private Q_SLOTS: | |||
119 | 119 | ||
120 | void testLiveQueryRemove() | 120 | void testLiveQueryRemove() |
121 | { | 121 | { |
122 | Akonadi2::Query query; | 122 | Sink::Query query; |
123 | query.liveQuery = true; | 123 | query.liveQuery = true; |
124 | 124 | ||
125 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); | 125 | auto resultSet = QSharedPointer<Sink::ResultProvider<Sink::ApplicationDomain::Event::Ptr> >::create(); |
126 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); | 126 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); |
127 | auto entity = QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); | 127 | auto entity = QSharedPointer<Sink::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Sink::ApplicationDomain::BufferAdaptor>()); |
128 | // storage->mResults << entity; | 128 | // storage->mResults << entity; |
129 | TestResourceFacade facade("identifier", resourceAccess); | 129 | TestResourceFacade facade("identifier", resourceAccess); |
130 | 130 | ||
131 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); | 131 | async::SyncListResult<Sink::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); |
132 | 132 | ||
133 | facade.load(query, *resultSet).exec().waitForFinished(); | 133 | facade.load(query, *resultSet).exec().waitForFinished(); |
134 | resultSet->initialResultSetComplete(); | 134 | resultSet->initialResultSetComplete(); |
diff --git a/tests/genericresourcebenchmark.cpp b/tests/genericresourcebenchmark.cpp index fbe0d12..7f0d3a2 100644 --- a/tests/genericresourcebenchmark.cpp +++ b/tests/genericresourcebenchmark.cpp | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | static void removeFromDisk(const QString &name) | 21 | static void removeFromDisk(const QString &name) |
22 | { | 22 | { |
23 | Akonadi2::Storage store(Akonadi2::storageLocation(), name, Akonadi2::Storage::ReadWrite); | 23 | Sink::Storage store(Sink::storageLocation(), name, Sink::Storage::ReadWrite); |
24 | store.removeFromDisk(); | 24 | store.removeFromDisk(); |
25 | } | 25 | } |
26 | 26 | ||
@@ -30,39 +30,39 @@ static QByteArray createEntityBuffer() | |||
30 | eventFbb.Clear(); | 30 | eventFbb.Clear(); |
31 | { | 31 | { |
32 | auto summary = eventFbb.CreateString("summary"); | 32 | auto summary = eventFbb.CreateString("summary"); |
33 | Akonadi2::ApplicationDomain::Buffer::EventBuilder eventBuilder(eventFbb); | 33 | Sink::ApplicationDomain::Buffer::EventBuilder eventBuilder(eventFbb); |
34 | eventBuilder.add_summary(summary); | 34 | eventBuilder.add_summary(summary); |
35 | auto eventLocation = eventBuilder.Finish(); | 35 | auto eventLocation = eventBuilder.Finish(); |
36 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(eventFbb, eventLocation); | 36 | Sink::ApplicationDomain::Buffer::FinishEventBuffer(eventFbb, eventLocation); |
37 | } | 37 | } |
38 | 38 | ||
39 | flatbuffers::FlatBufferBuilder localFbb; | 39 | flatbuffers::FlatBufferBuilder localFbb; |
40 | { | 40 | { |
41 | auto uid = localFbb.CreateString("testuid"); | 41 | auto uid = localFbb.CreateString("testuid"); |
42 | auto localBuilder = Akonadi2::ApplicationDomain::Buffer::EventBuilder(localFbb); | 42 | auto localBuilder = Sink::ApplicationDomain::Buffer::EventBuilder(localFbb); |
43 | localBuilder.add_uid(uid); | 43 | localBuilder.add_uid(uid); |
44 | auto location = localBuilder.Finish(); | 44 | auto location = localBuilder.Finish(); |
45 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(localFbb, location); | 45 | Sink::ApplicationDomain::Buffer::FinishEventBuffer(localFbb, location); |
46 | } | 46 | } |
47 | 47 | ||
48 | flatbuffers::FlatBufferBuilder entityFbb; | 48 | flatbuffers::FlatBufferBuilder entityFbb; |
49 | Akonadi2::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize()); | 49 | Sink::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize()); |
50 | 50 | ||
51 | flatbuffers::FlatBufferBuilder fbb; | 51 | flatbuffers::FlatBufferBuilder fbb; |
52 | auto type = fbb.CreateString(Akonadi2::ApplicationDomain::getTypeName<Akonadi2::ApplicationDomain::Event>().toStdString().data()); | 52 | auto type = fbb.CreateString(Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Event>().toStdString().data()); |
53 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); | 53 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); |
54 | Akonadi2::Commands::CreateEntityBuilder builder(fbb); | 54 | Sink::Commands::CreateEntityBuilder builder(fbb); |
55 | builder.add_domainType(type); | 55 | builder.add_domainType(type); |
56 | builder.add_delta(delta); | 56 | builder.add_delta(delta); |
57 | auto location = builder.Finish(); | 57 | auto location = builder.Finish(); |
58 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); | 58 | Sink::Commands::FinishCreateEntityBuffer(fbb, location); |
59 | 59 | ||
60 | return QByteArray(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); | 60 | return QByteArray(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); |
61 | } | 61 | } |
62 | 62 | ||
63 | class IndexUpdater : public Akonadi2::Preprocessor { | 63 | class IndexUpdater : public Sink::Preprocessor { |
64 | public: | 64 | public: |
65 | void newEntity(const QByteArray &uid, qint64 revision, const Akonadi2::ApplicationDomain::BufferAdaptor &newEntity, Akonadi2::Storage::Transaction &transaction) Q_DECL_OVERRIDE | 65 | void newEntity(const QByteArray &uid, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &newEntity, Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE |
66 | { | 66 | { |
67 | for (int i = 0; i < 10; i++) { | 67 | for (int i = 0; i < 10; i++) { |
68 | Index ridIndex(QString("index.index%1").arg(i).toLatin1(), transaction); | 68 | Index ridIndex(QString("index.index%1").arg(i).toLatin1(), transaction); |
@@ -70,11 +70,11 @@ public: | |||
70 | } | 70 | } |
71 | } | 71 | } |
72 | 72 | ||
73 | void modifiedEntity(const QByteArray &key, qint64 revision, const Akonadi2::ApplicationDomain::BufferAdaptor &oldEntity, const Akonadi2::ApplicationDomain::BufferAdaptor &newEntity, Akonadi2::Storage::Transaction &transaction) Q_DECL_OVERRIDE | 73 | void modifiedEntity(const QByteArray &key, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &oldEntity, const Sink::ApplicationDomain::BufferAdaptor &newEntity, Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE |
74 | { | 74 | { |
75 | } | 75 | } |
76 | 76 | ||
77 | void deletedEntity(const QByteArray &key, qint64 revision, const Akonadi2::ApplicationDomain::BufferAdaptor &oldEntity, Akonadi2::Storage::Transaction &transaction) Q_DECL_OVERRIDE | 77 | void deletedEntity(const QByteArray &key, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &oldEntity, Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE |
78 | { | 78 | { |
79 | } | 79 | } |
80 | }; | 80 | }; |
@@ -89,7 +89,7 @@ private Q_SLOTS: | |||
89 | 89 | ||
90 | void init() | 90 | void init() |
91 | { | 91 | { |
92 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Warning); | 92 | Sink::Log::setDebugOutputLevel(Sink::Log::Warning); |
93 | } | 93 | } |
94 | 94 | ||
95 | void initTestCase() | 95 | void initTestCase() |
@@ -104,7 +104,7 @@ private Q_SLOTS: | |||
104 | { | 104 | { |
105 | int num = 10000; | 105 | int num = 10000; |
106 | 106 | ||
107 | auto pipeline = QSharedPointer<Akonadi2::Pipeline>::create("org.kde.test.instance1"); | 107 | auto pipeline = QSharedPointer<Sink::Pipeline>::create("org.kde.test.instance1"); |
108 | TestResource resource("org.kde.test.instance1", pipeline); | 108 | TestResource resource("org.kde.test.instance1", pipeline); |
109 | 109 | ||
110 | auto command = createEntityBuffer(); | 110 | auto command = createEntityBuffer(); |
@@ -113,7 +113,7 @@ private Q_SLOTS: | |||
113 | time.start(); | 113 | time.start(); |
114 | 114 | ||
115 | for (int i = 0; i < num; i++) { | 115 | for (int i = 0; i < num; i++) { |
116 | resource.processCommand(Akonadi2::Commands::CreateEntityCommand, command); | 116 | resource.processCommand(Sink::Commands::CreateEntityCommand, command); |
117 | } | 117 | } |
118 | auto appendTime = time.elapsed(); | 118 | auto appendTime = time.elapsed(); |
119 | 119 | ||
@@ -139,13 +139,13 @@ private Q_SLOTS: | |||
139 | { | 139 | { |
140 | int num = 50000; | 140 | int num = 50000; |
141 | 141 | ||
142 | auto pipeline = QSharedPointer<Akonadi2::Pipeline>::create("org.kde.test.instance1"); | 142 | auto pipeline = QSharedPointer<Sink::Pipeline>::create("org.kde.test.instance1"); |
143 | 143 | ||
144 | auto eventFactory = QSharedPointer<TestEventAdaptorFactory>::create(); | 144 | auto eventFactory = QSharedPointer<TestEventAdaptorFactory>::create(); |
145 | const QByteArray resourceIdentifier = "org.kde.test.instance1"; | 145 | const QByteArray resourceIdentifier = "org.kde.test.instance1"; |
146 | auto indexer = QSharedPointer<IndexUpdater>::create(); | 146 | auto indexer = QSharedPointer<IndexUpdater>::create(); |
147 | 147 | ||
148 | pipeline->setPreprocessors("event", QVector<Akonadi2::Preprocessor*>() << indexer.data()); | 148 | pipeline->setPreprocessors("event", QVector<Sink::Preprocessor*>() << indexer.data()); |
149 | pipeline->setAdaptorFactory("event", eventFactory); | 149 | pipeline->setAdaptorFactory("event", eventFactory); |
150 | 150 | ||
151 | TestResource resource("org.kde.test.instance1", pipeline); | 151 | TestResource resource("org.kde.test.instance1", pipeline); |
@@ -156,7 +156,7 @@ private Q_SLOTS: | |||
156 | time.start(); | 156 | time.start(); |
157 | 157 | ||
158 | for (int i = 0; i < num; i++) { | 158 | for (int i = 0; i < num; i++) { |
159 | resource.processCommand(Akonadi2::Commands::CreateEntityCommand, command); | 159 | resource.processCommand(Sink::Commands::CreateEntityCommand, command); |
160 | } | 160 | } |
161 | auto appendTime = time.elapsed(); | 161 | auto appendTime = time.elapsed(); |
162 | 162 | ||
@@ -180,7 +180,7 @@ private Q_SLOTS: | |||
180 | 180 | ||
181 | void testCreateCommand() | 181 | void testCreateCommand() |
182 | { | 182 | { |
183 | Akonadi2::ApplicationDomain::Event event; | 183 | Sink::ApplicationDomain::Event event; |
184 | 184 | ||
185 | QBENCHMARK { | 185 | QBENCHMARK { |
186 | auto mFactory = new TestEventAdaptorFactory; | 186 | auto mFactory = new TestEventAdaptorFactory; |
@@ -193,9 +193,9 @@ private Q_SLOTS: | |||
193 | //This is the resource buffer type and not the domain type | 193 | //This is the resource buffer type and not the domain type |
194 | auto type = fbb.CreateString("event"); | 194 | auto type = fbb.CreateString("event"); |
195 | // auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); | 195 | // auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); |
196 | auto delta = Akonadi2::EntityBuffer::appendAsVector(fbb, entityFbb.GetBufferPointer(), entityFbb.GetSize()); | 196 | auto delta = Sink::EntityBuffer::appendAsVector(fbb, entityFbb.GetBufferPointer(), entityFbb.GetSize()); |
197 | auto location = Akonadi2::Commands::CreateCreateEntity(fbb, type, delta); | 197 | auto location = Sink::Commands::CreateCreateEntity(fbb, type, delta); |
198 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); | 198 | Sink::Commands::FinishCreateEntityBuffer(fbb, location); |
199 | } | 199 | } |
200 | } | 200 | } |
201 | 201 | ||
diff --git a/tests/genericresourcetest.cpp b/tests/genericresourcetest.cpp index 0c64659..76c604e 100644 --- a/tests/genericresourcetest.cpp +++ b/tests/genericresourcetest.cpp | |||
@@ -26,8 +26,8 @@ private Q_SLOTS: | |||
26 | 26 | ||
27 | void init() | 27 | void init() |
28 | { | 28 | { |
29 | Akonadi2::GenericResource::removeFromDisk("org.kde.test.instance1"); | 29 | Sink::GenericResource::removeFromDisk("org.kde.test.instance1"); |
30 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Trace); | 30 | Sink::Log::setDebugOutputLevel(Sink::Log::Trace); |
31 | } | 31 | } |
32 | 32 | ||
33 | ///Ensure the resource can process messages | 33 | ///Ensure the resource can process messages |
@@ -37,46 +37,46 @@ private Q_SLOTS: | |||
37 | eventFbb.Clear(); | 37 | eventFbb.Clear(); |
38 | { | 38 | { |
39 | auto summary = eventFbb.CreateString("summary"); | 39 | auto summary = eventFbb.CreateString("summary"); |
40 | Akonadi2::ApplicationDomain::Buffer::EventBuilder eventBuilder(eventFbb); | 40 | Sink::ApplicationDomain::Buffer::EventBuilder eventBuilder(eventFbb); |
41 | eventBuilder.add_summary(summary); | 41 | eventBuilder.add_summary(summary); |
42 | auto eventLocation = eventBuilder.Finish(); | 42 | auto eventLocation = eventBuilder.Finish(); |
43 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(eventFbb, eventLocation); | 43 | Sink::ApplicationDomain::Buffer::FinishEventBuffer(eventFbb, eventLocation); |
44 | } | 44 | } |
45 | 45 | ||
46 | flatbuffers::FlatBufferBuilder localFbb; | 46 | flatbuffers::FlatBufferBuilder localFbb; |
47 | { | 47 | { |
48 | auto uid = localFbb.CreateString("testuid"); | 48 | auto uid = localFbb.CreateString("testuid"); |
49 | auto localBuilder = Akonadi2::ApplicationDomain::Buffer::EventBuilder(localFbb); | 49 | auto localBuilder = Sink::ApplicationDomain::Buffer::EventBuilder(localFbb); |
50 | localBuilder.add_uid(uid); | 50 | localBuilder.add_uid(uid); |
51 | auto location = localBuilder.Finish(); | 51 | auto location = localBuilder.Finish(); |
52 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(localFbb, location); | 52 | Sink::ApplicationDomain::Buffer::FinishEventBuffer(localFbb, location); |
53 | } | 53 | } |
54 | 54 | ||
55 | flatbuffers::FlatBufferBuilder entityFbb; | 55 | flatbuffers::FlatBufferBuilder entityFbb; |
56 | Akonadi2::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize()); | 56 | Sink::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize()); |
57 | 57 | ||
58 | flatbuffers::FlatBufferBuilder fbb; | 58 | flatbuffers::FlatBufferBuilder fbb; |
59 | auto type = fbb.CreateString(Akonadi2::ApplicationDomain::getTypeName<Akonadi2::ApplicationDomain::Event>().toStdString().data()); | 59 | auto type = fbb.CreateString(Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Event>().toStdString().data()); |
60 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); | 60 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); |
61 | Akonadi2::Commands::CreateEntityBuilder builder(fbb); | 61 | Sink::Commands::CreateEntityBuilder builder(fbb); |
62 | builder.add_domainType(type); | 62 | builder.add_domainType(type); |
63 | builder.add_delta(delta); | 63 | builder.add_delta(delta); |
64 | auto location = builder.Finish(); | 64 | auto location = builder.Finish(); |
65 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); | 65 | Sink::Commands::FinishCreateEntityBuffer(fbb, location); |
66 | 66 | ||
67 | const QByteArray command(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); | 67 | const QByteArray command(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); |
68 | { | 68 | { |
69 | flatbuffers::Verifier verifyer(reinterpret_cast<const uint8_t *>(command.data()), command.size()); | 69 | flatbuffers::Verifier verifyer(reinterpret_cast<const uint8_t *>(command.data()), command.size()); |
70 | QVERIFY(Akonadi2::Commands::VerifyCreateEntityBuffer(verifyer)); | 70 | QVERIFY(Sink::Commands::VerifyCreateEntityBuffer(verifyer)); |
71 | } | 71 | } |
72 | 72 | ||
73 | //Actual test | 73 | //Actual test |
74 | auto pipeline = QSharedPointer<Akonadi2::Pipeline>::create("org.kde.test.instance1"); | 74 | auto pipeline = QSharedPointer<Sink::Pipeline>::create("org.kde.test.instance1"); |
75 | QSignalSpy revisionSpy(pipeline.data(), SIGNAL(revisionUpdated(qint64))); | 75 | QSignalSpy revisionSpy(pipeline.data(), SIGNAL(revisionUpdated(qint64))); |
76 | QVERIFY(revisionSpy.isValid()); | 76 | QVERIFY(revisionSpy.isValid()); |
77 | TestResource resource("org.kde.test.instance1", pipeline); | 77 | TestResource resource("org.kde.test.instance1", pipeline); |
78 | resource.processCommand(Akonadi2::Commands::CreateEntityCommand, command); | 78 | resource.processCommand(Sink::Commands::CreateEntityCommand, command); |
79 | resource.processCommand(Akonadi2::Commands::CreateEntityCommand, command); | 79 | resource.processCommand(Sink::Commands::CreateEntityCommand, command); |
80 | resource.processAllMessages().exec().waitForFinished(); | 80 | resource.processAllMessages().exec().waitForFinished(); |
81 | QCOMPARE(revisionSpy.last().at(0).toInt(), 2); | 81 | QCOMPARE(revisionSpy.last().at(0).toInt(), 2); |
82 | } | 82 | } |
diff --git a/tests/hawd/CMakeLists.txt b/tests/hawd/CMakeLists.txt index 071f2ba..268e7a9 100644 --- a/tests/hawd/CMakeLists.txt +++ b/tests/hawd/CMakeLists.txt | |||
@@ -26,7 +26,7 @@ set(SRCS | |||
26 | add_library(lib${PROJECT_NAME} SHARED ${lib_SRCS}) | 26 | add_library(lib${PROJECT_NAME} SHARED ${lib_SRCS}) |
27 | generate_export_header(lib${PROJECT_NAME} BASE_NAME HAWD EXPORT_FILE_NAME hawd_export.h) | 27 | generate_export_header(lib${PROJECT_NAME} BASE_NAME HAWD EXPORT_FILE_NAME hawd_export.h) |
28 | qt5_use_modules(lib${PROJECT_NAME} Core) | 28 | qt5_use_modules(lib${PROJECT_NAME} Core) |
29 | target_link_libraries(lib${PROJECT_NAME} akonadi2common) | 29 | target_link_libraries(lib${PROJECT_NAME} sinkcommon) |
30 | if (LIBGIT2_FOUND) | 30 | if (LIBGIT2_FOUND) |
31 | target_link_libraries(lib${PROJECT_NAME} ${LIBGIT2_LIBRARIES}) | 31 | target_link_libraries(lib${PROJECT_NAME} ${LIBGIT2_LIBRARIES}) |
32 | endif(LIBGIT2_FOUND) | 32 | endif(LIBGIT2_FOUND) |
diff --git a/tests/hawd/dataset.cpp b/tests/hawd/dataset.cpp index 93eb5cd..fd931e8 100644 --- a/tests/hawd/dataset.cpp +++ b/tests/hawd/dataset.cpp | |||
@@ -215,7 +215,7 @@ QString Dataset::Row::toString(const QStringList &cols, int standardCols, const | |||
215 | 215 | ||
216 | Dataset::Dataset(const QString &name, const State &state) | 216 | Dataset::Dataset(const QString &name, const State &state) |
217 | : m_definition(state.datasetDefinition(name)), | 217 | : m_definition(state.datasetDefinition(name)), |
218 | m_storage(state.resultsPath(), name, Akonadi2::Storage::ReadWrite), | 218 | m_storage(state.resultsPath(), name, Sink::Storage::ReadWrite), |
219 | m_commitHash(state.commitHash()), | 219 | m_commitHash(state.commitHash()), |
220 | m_transaction(std::move(m_storage.createTransaction())) | 220 | m_transaction(std::move(m_storage.createTransaction())) |
221 | { | 221 | { |
@@ -270,13 +270,13 @@ void Dataset::eachRow(const std::function<void(const Row &row)> &resultHandler) | |||
270 | resultHandler(row); | 270 | resultHandler(row); |
271 | return true; | 271 | return true; |
272 | }, | 272 | }, |
273 | Akonadi2::Storage::basicErrorHandler()); | 273 | Sink::Storage::basicErrorHandler()); |
274 | } | 274 | } |
275 | 275 | ||
276 | Dataset::Row Dataset::row(qint64 key) | 276 | Dataset::Row Dataset::row(qint64 key) |
277 | { | 277 | { |
278 | if (key < 1) { | 278 | if (key < 1) { |
279 | Row row(*this, Akonadi2::Storage::maxRevision(m_transaction)); | 279 | Row row(*this, Sink::Storage::maxRevision(m_transaction)); |
280 | row.setCommitHash(m_commitHash); | 280 | row.setCommitHash(m_commitHash); |
281 | return row; | 281 | return row; |
282 | } | 282 | } |
@@ -287,7 +287,7 @@ Dataset::Row Dataset::row(qint64 key) | |||
287 | row.fromBinary(value); | 287 | row.fromBinary(value); |
288 | return true; | 288 | return true; |
289 | }, | 289 | }, |
290 | Akonadi2::Storage::basicErrorHandler() | 290 | Sink::Storage::basicErrorHandler() |
291 | ); | 291 | ); |
292 | return row; | 292 | return row; |
293 | } | 293 | } |
diff --git a/tests/hawd/dataset.h b/tests/hawd/dataset.h index cdfd3f2..0fca8f0 100644 --- a/tests/hawd/dataset.h +++ b/tests/hawd/dataset.h | |||
@@ -84,8 +84,8 @@ public: | |||
84 | 84 | ||
85 | private: | 85 | private: |
86 | DatasetDefinition m_definition; | 86 | DatasetDefinition m_definition; |
87 | Akonadi2::Storage m_storage; | 87 | Sink::Storage m_storage; |
88 | Akonadi2::Storage::Transaction m_transaction; | 88 | Sink::Storage::Transaction m_transaction; |
89 | QString m_commitHash; | 89 | QString m_commitHash; |
90 | }; | 90 | }; |
91 | 91 | ||
diff --git a/tests/indextest.cpp b/tests/indextest.cpp index edaf907..7ec95ce 100644 --- a/tests/indextest.cpp +++ b/tests/indextest.cpp | |||
@@ -16,19 +16,19 @@ class IndexTest : public QObject | |||
16 | private Q_SLOTS: | 16 | private Q_SLOTS: |
17 | void initTestCase() | 17 | void initTestCase() |
18 | { | 18 | { |
19 | Akonadi2::Storage store("./testindex", "org.kde.dummy.testindex", Akonadi2::Storage::ReadWrite); | 19 | Sink::Storage store("./testindex", "org.kde.dummy.testindex", Sink::Storage::ReadWrite); |
20 | store.removeFromDisk(); | 20 | store.removeFromDisk(); |
21 | } | 21 | } |
22 | 22 | ||
23 | void cleanup() | 23 | void cleanup() |
24 | { | 24 | { |
25 | Akonadi2::Storage store("./testindex", "org.kde.dummy.testindex", Akonadi2::Storage::ReadWrite); | 25 | Sink::Storage store("./testindex", "org.kde.dummy.testindex", Sink::Storage::ReadWrite); |
26 | store.removeFromDisk(); | 26 | store.removeFromDisk(); |
27 | } | 27 | } |
28 | 28 | ||
29 | void testIndex() | 29 | void testIndex() |
30 | { | 30 | { |
31 | Index index("./testindex", "org.kde.dummy.testindex", Akonadi2::Storage::ReadWrite); | 31 | Index index("./testindex", "org.kde.dummy.testindex", Sink::Storage::ReadWrite); |
32 | //The first key is specifically a substring of the second key | 32 | //The first key is specifically a substring of the second key |
33 | index.add("key", "value1"); | 33 | index.add("key", "value1"); |
34 | index.add("keyFoo", "value2"); | 34 | index.add("keyFoo", "value2"); |
diff --git a/tests/inspectiontest.cpp b/tests/inspectiontest.cpp index 29cce6c..c876aa9 100644 --- a/tests/inspectiontest.cpp +++ b/tests/inspectiontest.cpp | |||
@@ -18,8 +18,8 @@ class InspectionTest : public QObject | |||
18 | private Q_SLOTS: | 18 | private Q_SLOTS: |
19 | void initTestCase() | 19 | void initTestCase() |
20 | { | 20 | { |
21 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Trace); | 21 | Sink::Log::setDebugOutputLevel(Sink::Log::Trace); |
22 | auto factory = Akonadi2::ResourceFactory::load("org.kde.dummy"); | 22 | auto factory = Sink::ResourceFactory::load("org.kde.dummy"); |
23 | QVERIFY(factory); | 23 | QVERIFY(factory); |
24 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | 24 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); |
25 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); | 25 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); |
@@ -27,11 +27,11 @@ private Q_SLOTS: | |||
27 | 27 | ||
28 | void cleanup() | 28 | void cleanup() |
29 | { | 29 | { |
30 | Akonadi2::Store::shutdown(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); | 30 | Sink::Store::shutdown(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); |
31 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | 31 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); |
32 | auto factory = Akonadi2::ResourceFactory::load("org.kde.dummy"); | 32 | auto factory = Sink::ResourceFactory::load("org.kde.dummy"); |
33 | QVERIFY(factory); | 33 | QVERIFY(factory); |
34 | Akonadi2::Store::start(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); | 34 | Sink::Store::start(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); |
35 | } | 35 | } |
36 | 36 | ||
37 | void testInspection_data() | 37 | void testInspection_data() |
@@ -44,8 +44,8 @@ private Q_SLOTS: | |||
44 | void testInspection() | 44 | void testInspection() |
45 | { | 45 | { |
46 | QFETCH(bool, success); | 46 | QFETCH(bool, success); |
47 | using namespace Akonadi2; | 47 | using namespace Sink; |
48 | using namespace Akonadi2::ApplicationDomain; | 48 | using namespace Sink::ApplicationDomain; |
49 | 49 | ||
50 | Mail mail(QByteArray("org.kde.dummy.instance1"), QByteArray("identifier"), 0, QSharedPointer<MemoryBufferAdaptor::MemoryBufferAdaptor>::create()); | 50 | Mail mail(QByteArray("org.kde.dummy.instance1"), QByteArray("identifier"), 0, QSharedPointer<MemoryBufferAdaptor::MemoryBufferAdaptor>::create()); |
51 | 51 | ||
diff --git a/tests/maildirresourcetest.cpp b/tests/maildirresourcetest.cpp index ec4f6a4..6ad6ca6 100644 --- a/tests/maildirresourcetest.cpp +++ b/tests/maildirresourcetest.cpp | |||
@@ -57,18 +57,18 @@ private Q_SLOTS: | |||
57 | { | 57 | { |
58 | targetPath = tempDir.path() + "/maildir1/"; | 58 | targetPath = tempDir.path() + "/maildir1/"; |
59 | 59 | ||
60 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Trace); | 60 | Sink::Log::setDebugOutputLevel(Sink::Log::Trace); |
61 | MaildirResource::removeFromDisk("org.kde.maildir.instance1"); | 61 | MaildirResource::removeFromDisk("org.kde.maildir.instance1"); |
62 | Akonadi2::ApplicationDomain::AkonadiResource resource; | 62 | Sink::ApplicationDomain::SinkResource resource; |
63 | resource.setProperty("identifier", "org.kde.maildir.instance1"); | 63 | resource.setProperty("identifier", "org.kde.maildir.instance1"); |
64 | resource.setProperty("type", "org.kde.maildir"); | 64 | resource.setProperty("type", "org.kde.maildir"); |
65 | resource.setProperty("path", targetPath); | 65 | resource.setProperty("path", targetPath); |
66 | Akonadi2::Store::create(resource).exec().waitForFinished(); | 66 | Sink::Store::create(resource).exec().waitForFinished(); |
67 | } | 67 | } |
68 | 68 | ||
69 | void cleanup() | 69 | void cleanup() |
70 | { | 70 | { |
71 | Akonadi2::Store::shutdown(QByteArray("org.kde.maildir.instance1")).exec().waitForFinished(); | 71 | Sink::Store::shutdown(QByteArray("org.kde.maildir.instance1")).exec().waitForFinished(); |
72 | MaildirResource::removeFromDisk("org.kde.maildir.instance1"); | 72 | MaildirResource::removeFromDisk("org.kde.maildir.instance1"); |
73 | QDir dir(targetPath); | 73 | QDir dir(targetPath); |
74 | dir.removeRecursively(); | 74 | dir.removeRecursively(); |
@@ -80,46 +80,46 @@ private Q_SLOTS: | |||
80 | qDebug() << "-----------------------------------------"; | 80 | qDebug() << "-----------------------------------------"; |
81 | qDebug(); | 81 | qDebug(); |
82 | copyRecursively(TESTDATAPATH "/maildir1", targetPath); | 82 | copyRecursively(TESTDATAPATH "/maildir1", targetPath); |
83 | Akonadi2::Store::start(QByteArray("org.kde.maildir.instance1")).exec().waitForFinished(); | 83 | Sink::Store::start(QByteArray("org.kde.maildir.instance1")).exec().waitForFinished(); |
84 | } | 84 | } |
85 | 85 | ||
86 | void testListFolders() | 86 | void testListFolders() |
87 | { | 87 | { |
88 | Akonadi2::Query query; | 88 | Sink::Query query; |
89 | query.resources << "org.kde.maildir.instance1"; | 89 | query.resources << "org.kde.maildir.instance1"; |
90 | 90 | ||
91 | //Ensure all local data is processed | 91 | //Ensure all local data is processed |
92 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 92 | Sink::Store::synchronize(query).exec().waitForFinished(); |
93 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 93 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
94 | 94 | ||
95 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | 95 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
96 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 96 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
97 | QCOMPARE(model->rowCount(QModelIndex()), 2); | 97 | QCOMPARE(model->rowCount(QModelIndex()), 2); |
98 | } | 98 | } |
99 | 99 | ||
100 | void testListFolderTree() | 100 | void testListFolderTree() |
101 | { | 101 | { |
102 | Akonadi2::Query query; | 102 | Sink::Query query; |
103 | query.resources << "org.kde.maildir.instance1"; | 103 | query.resources << "org.kde.maildir.instance1"; |
104 | query.parentProperty = "parent"; | 104 | query.parentProperty = "parent"; |
105 | 105 | ||
106 | //Ensure all local data is processed | 106 | //Ensure all local data is processed |
107 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 107 | Sink::Store::synchronize(query).exec().waitForFinished(); |
108 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 108 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
109 | 109 | ||
110 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | 110 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
111 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 111 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
112 | QCOMPARE(model->rowCount(QModelIndex()), 1); | 112 | QCOMPARE(model->rowCount(QModelIndex()), 1); |
113 | auto parentIndex = model->index(0, 0, QModelIndex()); | 113 | auto parentIndex = model->index(0, 0, QModelIndex()); |
114 | model->fetchMore(parentIndex); | 114 | model->fetchMore(parentIndex); |
115 | QTRY_VERIFY(model->data(parentIndex, Akonadi2::Store::ChildrenFetchedRole).toBool()); | 115 | QTRY_VERIFY(model->data(parentIndex, Sink::Store::ChildrenFetchedRole).toBool()); |
116 | QCOMPARE(model->rowCount(parentIndex), 1); | 116 | QCOMPARE(model->rowCount(parentIndex), 1); |
117 | } | 117 | } |
118 | 118 | ||
119 | void testListMailsOfFolder() | 119 | void testListMailsOfFolder() |
120 | { | 120 | { |
121 | using namespace Akonadi2; | 121 | using namespace Sink; |
122 | using namespace Akonadi2::ApplicationDomain; | 122 | using namespace Sink::ApplicationDomain; |
123 | //Ensure all local data is processed | 123 | //Ensure all local data is processed |
124 | auto query = Query::ResourceFilter("org.kde.maildir.instance1"); | 124 | auto query = Query::ResourceFilter("org.kde.maildir.instance1"); |
125 | Store::synchronize(query).exec().waitForFinished(); | 125 | Store::synchronize(query).exec().waitForFinished(); |
@@ -143,18 +143,18 @@ private Q_SLOTS: | |||
143 | 143 | ||
144 | void testMailContent() | 144 | void testMailContent() |
145 | { | 145 | { |
146 | Akonadi2::Query query; | 146 | Sink::Query query; |
147 | query.resources << "org.kde.maildir.instance1"; | 147 | query.resources << "org.kde.maildir.instance1"; |
148 | query.requestedProperties << "folder" << "subject" << "mimeMessage" << "date"; | 148 | query.requestedProperties << "folder" << "subject" << "mimeMessage" << "date"; |
149 | 149 | ||
150 | //Ensure all local data is processed | 150 | //Ensure all local data is processed |
151 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 151 | Sink::Store::synchronize(query).exec().waitForFinished(); |
152 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 152 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
153 | 153 | ||
154 | auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 154 | auto mailModel = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
155 | QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 155 | QTRY_VERIFY(mailModel->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
156 | QVERIFY(mailModel->rowCount(QModelIndex()) >= 1); | 156 | QVERIFY(mailModel->rowCount(QModelIndex()) >= 1); |
157 | auto mail = mailModel->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Mail::Ptr>(); | 157 | auto mail = mailModel->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Mail::Ptr>(); |
158 | QVERIFY(!mail->getProperty("subject").toString().isEmpty()); | 158 | QVERIFY(!mail->getProperty("subject").toString().isEmpty()); |
159 | QVERIFY(!mail->getProperty("mimeMessage").toString().isEmpty()); | 159 | QVERIFY(!mail->getProperty("mimeMessage").toString().isEmpty()); |
160 | QVERIFY(mail->getProperty("date").toDateTime().isValid()); | 160 | QVERIFY(mail->getProperty("date").toDateTime().isValid()); |
@@ -163,85 +163,85 @@ private Q_SLOTS: | |||
163 | 163 | ||
164 | void testSyncFolderMove() | 164 | void testSyncFolderMove() |
165 | { | 165 | { |
166 | Akonadi2::Query query; | 166 | Sink::Query query; |
167 | query.resources << "org.kde.maildir.instance1"; | 167 | query.resources << "org.kde.maildir.instance1"; |
168 | query.requestedProperties << "name"; | 168 | query.requestedProperties << "name"; |
169 | 169 | ||
170 | //Ensure all local data is processed | 170 | //Ensure all local data is processed |
171 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 171 | Sink::Store::synchronize(query).exec().waitForFinished(); |
172 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 172 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
173 | 173 | ||
174 | auto targetPath = tempDir.path() + "/maildir1/"; | 174 | auto targetPath = tempDir.path() + "/maildir1/"; |
175 | QDir dir(targetPath); | 175 | QDir dir(targetPath); |
176 | QVERIFY(dir.rename("inbox", "newbox")); | 176 | QVERIFY(dir.rename("inbox", "newbox")); |
177 | 177 | ||
178 | //Ensure all local data is processed | 178 | //Ensure all local data is processed |
179 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 179 | Sink::Store::synchronize(query).exec().waitForFinished(); |
180 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 180 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
181 | 181 | ||
182 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | 182 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
183 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 183 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
184 | QCOMPARE(model->rowCount(QModelIndex()), 2); | 184 | QCOMPARE(model->rowCount(QModelIndex()), 2); |
185 | QCOMPARE(model->match(model->index(0, 0, QModelIndex()), Qt::DisplayRole, QStringLiteral("newbox"), 1).size(), 1); | 185 | QCOMPARE(model->match(model->index(0, 0, QModelIndex()), Qt::DisplayRole, QStringLiteral("newbox"), 1).size(), 1); |
186 | } | 186 | } |
187 | 187 | ||
188 | void testReSyncMail() | 188 | void testReSyncMail() |
189 | { | 189 | { |
190 | Akonadi2::Query query; | 190 | Sink::Query query; |
191 | query.resources << "org.kde.maildir.instance1"; | 191 | query.resources << "org.kde.maildir.instance1"; |
192 | query.requestedProperties << "folder" << "subject"; | 192 | query.requestedProperties << "folder" << "subject"; |
193 | 193 | ||
194 | //Ensure all local data is processed | 194 | //Ensure all local data is processed |
195 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 195 | Sink::Store::synchronize(query).exec().waitForFinished(); |
196 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 196 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
197 | 197 | ||
198 | //Ensure all local data is processed | 198 | //Ensure all local data is processed |
199 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 199 | Sink::Store::synchronize(query).exec().waitForFinished(); |
200 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 200 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
201 | 201 | ||
202 | auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 202 | auto mailModel = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
203 | QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 203 | QTRY_VERIFY(mailModel->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
204 | QCOMPARE(mailModel->rowCount(QModelIndex()), 2); | 204 | QCOMPARE(mailModel->rowCount(QModelIndex()), 2); |
205 | } | 205 | } |
206 | 206 | ||
207 | void testSyncMailRemoval() | 207 | void testSyncMailRemoval() |
208 | { | 208 | { |
209 | Akonadi2::Query query; | 209 | Sink::Query query; |
210 | query.resources << "org.kde.maildir.instance1"; | 210 | query.resources << "org.kde.maildir.instance1"; |
211 | query.requestedProperties << "folder" << "subject"; | 211 | query.requestedProperties << "folder" << "subject"; |
212 | 212 | ||
213 | //Ensure all local data is processed | 213 | //Ensure all local data is processed |
214 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 214 | Sink::Store::synchronize(query).exec().waitForFinished(); |
215 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 215 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
216 | 216 | ||
217 | auto targetPath = tempDir.path() + "/maildir1/cur/1365777830.R28.localhost.localdomain:2,S"; | 217 | auto targetPath = tempDir.path() + "/maildir1/cur/1365777830.R28.localhost.localdomain:2,S"; |
218 | QFile file(targetPath); | 218 | QFile file(targetPath); |
219 | QVERIFY(file.remove()); | 219 | QVERIFY(file.remove()); |
220 | 220 | ||
221 | //Ensure all local data is processed | 221 | //Ensure all local data is processed |
222 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 222 | Sink::Store::synchronize(query).exec().waitForFinished(); |
223 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 223 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
224 | 224 | ||
225 | auto mailModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 225 | auto mailModel = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
226 | QTRY_VERIFY(mailModel->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 226 | QTRY_VERIFY(mailModel->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
227 | QCOMPARE(mailModel->rowCount(QModelIndex()), 1); | 227 | QCOMPARE(mailModel->rowCount(QModelIndex()), 1); |
228 | } | 228 | } |
229 | 229 | ||
230 | void testCreateFolder() | 230 | void testCreateFolder() |
231 | { | 231 | { |
232 | Akonadi2::Query query; | 232 | Sink::Query query; |
233 | query.resources << "org.kde.maildir.instance1"; | 233 | query.resources << "org.kde.maildir.instance1"; |
234 | 234 | ||
235 | //Ensure all local data is processed | 235 | //Ensure all local data is processed |
236 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 236 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
237 | 237 | ||
238 | Akonadi2::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); | 238 | Sink::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); |
239 | folder.setProperty("name", "testCreateFolder"); | 239 | folder.setProperty("name", "testCreateFolder"); |
240 | 240 | ||
241 | Akonadi2::Store::create(folder).exec().waitForFinished(); | 241 | Sink::Store::create(folder).exec().waitForFinished(); |
242 | 242 | ||
243 | //Ensure all local data is processed | 243 | //Ensure all local data is processed |
244 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 244 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
245 | 245 | ||
246 | auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; | 246 | auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; |
247 | QFileInfo file(targetPath); | 247 | QFileInfo file(targetPath); |
@@ -251,45 +251,45 @@ private Q_SLOTS: | |||
251 | 251 | ||
252 | void testRemoveFolder() | 252 | void testRemoveFolder() |
253 | { | 253 | { |
254 | Akonadi2::Query query; | 254 | Sink::Query query; |
255 | query.resources << "org.kde.maildir.instance1"; | 255 | query.resources << "org.kde.maildir.instance1"; |
256 | 256 | ||
257 | auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; | 257 | auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; |
258 | 258 | ||
259 | Akonadi2::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); | 259 | Sink::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); |
260 | folder.setProperty("name", "testCreateFolder"); | 260 | folder.setProperty("name", "testCreateFolder"); |
261 | Akonadi2::Store::create(folder).exec().waitForFinished(); | 261 | Sink::Store::create(folder).exec().waitForFinished(); |
262 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 262 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
263 | QTRY_VERIFY(QFileInfo(targetPath).exists()); | 263 | QTRY_VERIFY(QFileInfo(targetPath).exists()); |
264 | 264 | ||
265 | Akonadi2::Query folderQuery; | 265 | Sink::Query folderQuery; |
266 | folderQuery.resources << "org.kde.maildir.instance1"; | 266 | folderQuery.resources << "org.kde.maildir.instance1"; |
267 | folderQuery.propertyFilter.insert("name", "testCreateFolder"); | 267 | folderQuery.propertyFilter.insert("name", "testCreateFolder"); |
268 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(folderQuery); | 268 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(folderQuery); |
269 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 269 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
270 | QCOMPARE(model->rowCount(QModelIndex()), 1); | 270 | QCOMPARE(model->rowCount(QModelIndex()), 1); |
271 | auto createdFolder = model->index(0, 0, QModelIndex()).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Folder::Ptr>(); | 271 | auto createdFolder = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Folder::Ptr>(); |
272 | 272 | ||
273 | Akonadi2::Store::remove(*createdFolder).exec().waitForFinished(); | 273 | Sink::Store::remove(*createdFolder).exec().waitForFinished(); |
274 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 274 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
275 | QTRY_VERIFY(!QFileInfo(targetPath).exists()); | 275 | QTRY_VERIFY(!QFileInfo(targetPath).exists()); |
276 | } | 276 | } |
277 | 277 | ||
278 | void testCreateMail() | 278 | void testCreateMail() |
279 | { | 279 | { |
280 | Akonadi2::Query query; | 280 | Sink::Query query; |
281 | query.resources << "org.kde.maildir.instance1"; | 281 | query.resources << "org.kde.maildir.instance1"; |
282 | 282 | ||
283 | //Ensure all local data is processed | 283 | //Ensure all local data is processed |
284 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 284 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
285 | 285 | ||
286 | Akonadi2::ApplicationDomain::Mail mail("org.kde.maildir.instance1"); | 286 | Sink::ApplicationDomain::Mail mail("org.kde.maildir.instance1"); |
287 | mail.setProperty("name", "testCreateMail"); | 287 | mail.setProperty("name", "testCreateMail"); |
288 | 288 | ||
289 | Akonadi2::Store::create(mail).exec().waitForFinished(); | 289 | Sink::Store::create(mail).exec().waitForFinished(); |
290 | 290 | ||
291 | //Ensure all local data is processed | 291 | //Ensure all local data is processed |
292 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 292 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
293 | 293 | ||
294 | auto targetPath = tempDir.path() + "/maildir1/new"; | 294 | auto targetPath = tempDir.path() + "/maildir1/new"; |
295 | QDir dir(targetPath); | 295 | QDir dir(targetPath); |
@@ -299,8 +299,8 @@ private Q_SLOTS: | |||
299 | 299 | ||
300 | void testRemoveMail() | 300 | void testRemoveMail() |
301 | { | 301 | { |
302 | using namespace Akonadi2; | 302 | using namespace Sink; |
303 | using namespace Akonadi2::ApplicationDomain; | 303 | using namespace Sink::ApplicationDomain; |
304 | 304 | ||
305 | auto query = Query::ResourceFilter("org.kde.maildir.instance1"); | 305 | auto query = Query::ResourceFilter("org.kde.maildir.instance1"); |
306 | Store::synchronize(query).exec().waitForFinished(); | 306 | Store::synchronize(query).exec().waitForFinished(); |
@@ -333,8 +333,8 @@ private Q_SLOTS: | |||
333 | 333 | ||
334 | void testMarkMailAsRead() | 334 | void testMarkMailAsRead() |
335 | { | 335 | { |
336 | using namespace Akonadi2; | 336 | using namespace Sink; |
337 | using namespace Akonadi2::ApplicationDomain; | 337 | using namespace Sink::ApplicationDomain; |
338 | 338 | ||
339 | auto query = Query::ResourceFilter("org.kde.maildir.instance1"); | 339 | auto query = Query::ResourceFilter("org.kde.maildir.instance1"); |
340 | Store::synchronize(query).exec().waitForFinished(); | 340 | Store::synchronize(query).exec().waitForFinished(); |
diff --git a/tests/messagequeuetest.cpp b/tests/messagequeuetest.cpp index 7d406ed..c835b53 100644 --- a/tests/messagequeuetest.cpp +++ b/tests/messagequeuetest.cpp | |||
@@ -17,8 +17,8 @@ class MessageQueueTest : public QObject | |||
17 | private Q_SLOTS: | 17 | private Q_SLOTS: |
18 | void initTestCase() | 18 | void initTestCase() |
19 | { | 19 | { |
20 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Trace); | 20 | Sink::Log::setDebugOutputLevel(Sink::Log::Trace); |
21 | Akonadi2::Storage store(Akonadi2::Store::storageLocation(), "org.kde.dummy.testqueue", Akonadi2::Storage::ReadWrite); | 21 | Sink::Storage store(Sink::Store::storageLocation(), "org.kde.dummy.testqueue", Sink::Storage::ReadWrite); |
22 | store.removeFromDisk(); | 22 | store.removeFromDisk(); |
23 | } | 23 | } |
24 | 24 | ||
@@ -28,13 +28,13 @@ private Q_SLOTS: | |||
28 | 28 | ||
29 | void cleanup() | 29 | void cleanup() |
30 | { | 30 | { |
31 | Akonadi2::Storage store(Akonadi2::Store::storageLocation(), "org.kde.dummy.testqueue", Akonadi2::Storage::ReadWrite); | 31 | Sink::Storage store(Sink::Store::storageLocation(), "org.kde.dummy.testqueue", Sink::Storage::ReadWrite); |
32 | store.removeFromDisk(); | 32 | store.removeFromDisk(); |
33 | } | 33 | } |
34 | 34 | ||
35 | void testEmpty() | 35 | void testEmpty() |
36 | { | 36 | { |
37 | MessageQueue queue(Akonadi2::Store::storageLocation(), "org.kde.dummy.testqueue"); | 37 | MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); |
38 | QVERIFY(queue.isEmpty()); | 38 | QVERIFY(queue.isEmpty()); |
39 | queue.enqueue("value"); | 39 | queue.enqueue("value"); |
40 | QVERIFY(!queue.isEmpty()); | 40 | QVERIFY(!queue.isEmpty()); |
@@ -42,7 +42,7 @@ private Q_SLOTS: | |||
42 | 42 | ||
43 | void testDequeueEmpty() | 43 | void testDequeueEmpty() |
44 | { | 44 | { |
45 | MessageQueue queue(Akonadi2::Store::storageLocation(), "org.kde.dummy.testqueue"); | 45 | MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); |
46 | bool gotValue = false; | 46 | bool gotValue = false; |
47 | bool gotError = false; | 47 | bool gotError = false; |
48 | queue.dequeue([&](void *ptr, int size, std::function<void(bool success)> callback) { | 48 | queue.dequeue([&](void *ptr, int size, std::function<void(bool success)> callback) { |
@@ -57,7 +57,7 @@ private Q_SLOTS: | |||
57 | 57 | ||
58 | void testEnqueue() | 58 | void testEnqueue() |
59 | { | 59 | { |
60 | MessageQueue queue(Akonadi2::Store::storageLocation(), "org.kde.dummy.testqueue"); | 60 | MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); |
61 | QSignalSpy spy(&queue, SIGNAL(messageReady())); | 61 | QSignalSpy spy(&queue, SIGNAL(messageReady())); |
62 | queue.enqueue("value1"); | 62 | queue.enqueue("value1"); |
63 | QCOMPARE(spy.size(), 1); | 63 | QCOMPARE(spy.size(), 1); |
@@ -65,7 +65,7 @@ private Q_SLOTS: | |||
65 | 65 | ||
66 | void testDrained() | 66 | void testDrained() |
67 | { | 67 | { |
68 | MessageQueue queue(Akonadi2::Store::storageLocation(), "org.kde.dummy.testqueue"); | 68 | MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); |
69 | QSignalSpy spy(&queue, SIGNAL(drained())); | 69 | QSignalSpy spy(&queue, SIGNAL(drained())); |
70 | queue.enqueue("value1"); | 70 | queue.enqueue("value1"); |
71 | 71 | ||
@@ -81,7 +81,7 @@ private Q_SLOTS: | |||
81 | values << "value1"; | 81 | values << "value1"; |
82 | values << "value2"; | 82 | values << "value2"; |
83 | 83 | ||
84 | MessageQueue queue(Akonadi2::Store::storageLocation(), "org.kde.dummy.testqueue"); | 84 | MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); |
85 | for (const QByteArray &value : values) { | 85 | for (const QByteArray &value : values) { |
86 | queue.enqueue(value); | 86 | queue.enqueue(value); |
87 | } | 87 | } |
@@ -112,7 +112,7 @@ private Q_SLOTS: | |||
112 | values << "value1"; | 112 | values << "value1"; |
113 | values << "value2"; | 113 | values << "value2"; |
114 | 114 | ||
115 | MessageQueue queue(Akonadi2::Store::storageLocation(), "org.kde.dummy.testqueue"); | 115 | MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); |
116 | for (const QByteArray &value : values) { | 116 | for (const QByteArray &value : values) { |
117 | queue.enqueue(value); | 117 | queue.enqueue(value); |
118 | } | 118 | } |
@@ -151,7 +151,7 @@ private Q_SLOTS: | |||
151 | */ | 151 | */ |
152 | void testNestedEnqueue() | 152 | void testNestedEnqueue() |
153 | { | 153 | { |
154 | MessageQueue queue(Akonadi2::Store::storageLocation(), "org.kde.dummy.testqueue"); | 154 | MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); |
155 | queue.enqueue("value1"); | 155 | queue.enqueue("value1"); |
156 | 156 | ||
157 | bool gotError = false; | 157 | bool gotError = false; |
@@ -167,7 +167,7 @@ private Q_SLOTS: | |||
167 | 167 | ||
168 | void testBatchDequeue() | 168 | void testBatchDequeue() |
169 | { | 169 | { |
170 | MessageQueue queue(Akonadi2::Store::storageLocation(), "org.kde.dummy.testqueue"); | 170 | MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); |
171 | queue.enqueue("value1"); | 171 | queue.enqueue("value1"); |
172 | queue.enqueue("value2"); | 172 | queue.enqueue("value2"); |
173 | queue.enqueue("value3"); | 173 | queue.enqueue("value3"); |
@@ -188,7 +188,7 @@ private Q_SLOTS: | |||
188 | 188 | ||
189 | void testBatchEnqueue() | 189 | void testBatchEnqueue() |
190 | { | 190 | { |
191 | MessageQueue queue(Akonadi2::Store::storageLocation(), "org.kde.dummy.testqueue"); | 191 | MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); |
192 | QSignalSpy spy(&queue, SIGNAL(messageReady())); | 192 | QSignalSpy spy(&queue, SIGNAL(messageReady())); |
193 | queue.startTransaction(); | 193 | queue.startTransaction(); |
194 | queue.enqueue("value1"); | 194 | queue.enqueue("value1"); |
diff --git a/tests/modelinteractivitytest.cpp b/tests/modelinteractivitytest.cpp index 59c2c6f..14c9fd0 100644 --- a/tests/modelinteractivitytest.cpp +++ b/tests/modelinteractivitytest.cpp | |||
@@ -45,16 +45,16 @@ class ModelinteractivityTest : public QObject | |||
45 | private Q_SLOTS: | 45 | private Q_SLOTS: |
46 | void initTestCase() | 46 | void initTestCase() |
47 | { | 47 | { |
48 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Warning); | 48 | Sink::Log::setDebugOutputLevel(Sink::Log::Warning); |
49 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | 49 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); |
50 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); | 50 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); |
51 | } | 51 | } |
52 | 52 | ||
53 | void cleanup() | 53 | void cleanup() |
54 | { | 54 | { |
55 | Akonadi2::Store::shutdown(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); | 55 | Sink::Store::shutdown(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); |
56 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | 56 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); |
57 | Akonadi2::Store::start(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); | 57 | Sink::Store::start(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); |
58 | } | 58 | } |
59 | 59 | ||
60 | void init() | 60 | void init() |
@@ -65,24 +65,24 @@ private Q_SLOTS: | |||
65 | { | 65 | { |
66 | //Setup | 66 | //Setup |
67 | { | 67 | { |
68 | Akonadi2::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); | 68 | Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); |
69 | for (int i = 0; i < 1000; i++) { | 69 | for (int i = 0; i < 1000; i++) { |
70 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Mail>(mail).exec().waitForFinished(); | 70 | Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished(); |
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
74 | Akonadi2::Query query; | 74 | Sink::Query query; |
75 | query.resources << "org.kde.dummy.instance1"; | 75 | query.resources << "org.kde.dummy.instance1"; |
76 | query.liveQuery = true; | 76 | query.liveQuery = true; |
77 | 77 | ||
78 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 78 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
79 | 79 | ||
80 | //Test | 80 | //Test |
81 | QTime time; | 81 | QTime time; |
82 | time.start(); | 82 | time.start(); |
83 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 83 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
84 | blockingTime += time.elapsed(); | 84 | blockingTime += time.elapsed(); |
85 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 85 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
86 | //Never block longer than 10 ms | 86 | //Never block longer than 10 ms |
87 | QVERIFY2(blockingTime < 10, QString("Total blocking time: %1").arg(blockingTime).toLatin1().data()); | 87 | QVERIFY2(blockingTime < 10, QString("Total blocking time: %1").arg(blockingTime).toLatin1().data()); |
88 | } | 88 | } |
diff --git a/tests/pipelinetest.cpp b/tests/pipelinetest.cpp index f0fd1a4..c74d319 100644 --- a/tests/pipelinetest.cpp +++ b/tests/pipelinetest.cpp | |||
@@ -22,14 +22,14 @@ | |||
22 | 22 | ||
23 | static void removeFromDisk(const QString &name) | 23 | static void removeFromDisk(const QString &name) |
24 | { | 24 | { |
25 | Akonadi2::Storage store(Akonadi2::Store::storageLocation(), name, Akonadi2::Storage::ReadWrite); | 25 | Sink::Storage store(Sink::Store::storageLocation(), name, Sink::Storage::ReadWrite); |
26 | store.removeFromDisk(); | 26 | store.removeFromDisk(); |
27 | } | 27 | } |
28 | 28 | ||
29 | static QList<QByteArray> getKeys(const QByteArray &dbEnv, const QByteArray &name) | 29 | static QList<QByteArray> getKeys(const QByteArray &dbEnv, const QByteArray &name) |
30 | { | 30 | { |
31 | Akonadi2::Storage store(Akonadi2::storageLocation(), dbEnv, Akonadi2::Storage::ReadOnly); | 31 | Sink::Storage store(Sink::storageLocation(), dbEnv, Sink::Storage::ReadOnly); |
32 | auto transaction = store.createTransaction(Akonadi2::Storage::ReadOnly); | 32 | auto transaction = store.createTransaction(Sink::Storage::ReadOnly); |
33 | auto db = transaction.openDatabase(name, nullptr, false); | 33 | auto db = transaction.openDatabase(name, nullptr, false); |
34 | QList<QByteArray> result; | 34 | QList<QByteArray> result; |
35 | db.scan("", [&](const QByteArray &key, const QByteArray &value) { | 35 | db.scan("", [&](const QByteArray &key, const QByteArray &value) { |
@@ -41,8 +41,8 @@ static QList<QByteArray> getKeys(const QByteArray &dbEnv, const QByteArray &name | |||
41 | 41 | ||
42 | static QByteArray getEntity(const QByteArray &dbEnv, const QByteArray &name, const QByteArray &uid) | 42 | static QByteArray getEntity(const QByteArray &dbEnv, const QByteArray &name, const QByteArray &uid) |
43 | { | 43 | { |
44 | Akonadi2::Storage store(Akonadi2::storageLocation(), dbEnv, Akonadi2::Storage::ReadOnly); | 44 | Sink::Storage store(Sink::storageLocation(), dbEnv, Sink::Storage::ReadOnly); |
45 | auto transaction = store.createTransaction(Akonadi2::Storage::ReadOnly); | 45 | auto transaction = store.createTransaction(Sink::Storage::ReadOnly); |
46 | auto db = transaction.openDatabase(name, nullptr, false); | 46 | auto db = transaction.openDatabase(name, nullptr, false); |
47 | QByteArray result; | 47 | QByteArray result; |
48 | db.scan(uid, [&](const QByteArray &key, const QByteArray &value) { | 48 | db.scan(uid, [&](const QByteArray &key, const QByteArray &value) { |
@@ -57,41 +57,41 @@ flatbuffers::FlatBufferBuilder &createEvent(flatbuffers::FlatBufferBuilder &enti | |||
57 | flatbuffers::FlatBufferBuilder eventFbb; | 57 | flatbuffers::FlatBufferBuilder eventFbb; |
58 | eventFbb.Clear(); | 58 | eventFbb.Clear(); |
59 | { | 59 | { |
60 | Akonadi2::ApplicationDomain::Buffer::EventBuilder eventBuilder(eventFbb); | 60 | Sink::ApplicationDomain::Buffer::EventBuilder eventBuilder(eventFbb); |
61 | auto eventLocation = eventBuilder.Finish(); | 61 | auto eventLocation = eventBuilder.Finish(); |
62 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(eventFbb, eventLocation); | 62 | Sink::ApplicationDomain::Buffer::FinishEventBuffer(eventFbb, eventLocation); |
63 | } | 63 | } |
64 | 64 | ||
65 | flatbuffers::FlatBufferBuilder localFbb; | 65 | flatbuffers::FlatBufferBuilder localFbb; |
66 | { | 66 | { |
67 | auto uid = localFbb.CreateString("testuid"); | 67 | auto uid = localFbb.CreateString("testuid"); |
68 | auto summary = localFbb.CreateString(s.toStdString()); | 68 | auto summary = localFbb.CreateString(s.toStdString()); |
69 | auto localBuilder = Akonadi2::ApplicationDomain::Buffer::EventBuilder(localFbb); | 69 | auto localBuilder = Sink::ApplicationDomain::Buffer::EventBuilder(localFbb); |
70 | localBuilder.add_uid(uid); | 70 | localBuilder.add_uid(uid); |
71 | localBuilder.add_summary(summary); | 71 | localBuilder.add_summary(summary); |
72 | auto location = localBuilder.Finish(); | 72 | auto location = localBuilder.Finish(); |
73 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(localFbb, location); | 73 | Sink::ApplicationDomain::Buffer::FinishEventBuffer(localFbb, location); |
74 | } | 74 | } |
75 | 75 | ||
76 | Akonadi2::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize()); | 76 | Sink::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize()); |
77 | return entityFbb; | 77 | return entityFbb; |
78 | } | 78 | } |
79 | 79 | ||
80 | QByteArray createEntityCommand(const flatbuffers::FlatBufferBuilder &entityFbb) | 80 | QByteArray createEntityCommand(const flatbuffers::FlatBufferBuilder &entityFbb) |
81 | { | 81 | { |
82 | flatbuffers::FlatBufferBuilder fbb; | 82 | flatbuffers::FlatBufferBuilder fbb; |
83 | auto type = fbb.CreateString(Akonadi2::ApplicationDomain::getTypeName<Akonadi2::ApplicationDomain::Event>().toStdString().data()); | 83 | auto type = fbb.CreateString(Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Event>().toStdString().data()); |
84 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); | 84 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); |
85 | Akonadi2::Commands::CreateEntityBuilder builder(fbb); | 85 | Sink::Commands::CreateEntityBuilder builder(fbb); |
86 | builder.add_domainType(type); | 86 | builder.add_domainType(type); |
87 | builder.add_delta(delta); | 87 | builder.add_delta(delta); |
88 | auto location = builder.Finish(); | 88 | auto location = builder.Finish(); |
89 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); | 89 | Sink::Commands::FinishCreateEntityBuffer(fbb, location); |
90 | 90 | ||
91 | const QByteArray command(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); | 91 | const QByteArray command(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); |
92 | { | 92 | { |
93 | flatbuffers::Verifier verifyer(reinterpret_cast<const uint8_t *>(command.data()), command.size()); | 93 | flatbuffers::Verifier verifyer(reinterpret_cast<const uint8_t *>(command.data()), command.size()); |
94 | Q_ASSERT(Akonadi2::Commands::VerifyCreateEntityBuffer(verifyer)); | 94 | Q_ASSERT(Sink::Commands::VerifyCreateEntityBuffer(verifyer)); |
95 | } | 95 | } |
96 | return command; | 96 | return command; |
97 | } | 97 | } |
@@ -99,22 +99,22 @@ QByteArray createEntityCommand(const flatbuffers::FlatBufferBuilder &entityFbb) | |||
99 | QByteArray modifyEntityCommand(const flatbuffers::FlatBufferBuilder &entityFbb, const QByteArray &uid, qint64 revision) | 99 | QByteArray modifyEntityCommand(const flatbuffers::FlatBufferBuilder &entityFbb, const QByteArray &uid, qint64 revision) |
100 | { | 100 | { |
101 | flatbuffers::FlatBufferBuilder fbb; | 101 | flatbuffers::FlatBufferBuilder fbb; |
102 | auto type = fbb.CreateString(Akonadi2::ApplicationDomain::getTypeName<Akonadi2::ApplicationDomain::Event>().toStdString().data()); | 102 | auto type = fbb.CreateString(Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Event>().toStdString().data()); |
103 | auto id = fbb.CreateString(std::string(uid.constData(), uid.size())); | 103 | auto id = fbb.CreateString(std::string(uid.constData(), uid.size())); |
104 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); | 104 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); |
105 | // auto delta = Akonadi2::EntityBuffer::appendAsVector(fbb, buffer.constData(), buffer.size()); | 105 | // auto delta = Sink::EntityBuffer::appendAsVector(fbb, buffer.constData(), buffer.size()); |
106 | Akonadi2::Commands::ModifyEntityBuilder builder(fbb); | 106 | Sink::Commands::ModifyEntityBuilder builder(fbb); |
107 | builder.add_domainType(type); | 107 | builder.add_domainType(type); |
108 | builder.add_delta(delta); | 108 | builder.add_delta(delta); |
109 | builder.add_revision(revision); | 109 | builder.add_revision(revision); |
110 | builder.add_entityId(id); | 110 | builder.add_entityId(id); |
111 | auto location = builder.Finish(); | 111 | auto location = builder.Finish(); |
112 | Akonadi2::Commands::FinishModifyEntityBuffer(fbb, location); | 112 | Sink::Commands::FinishModifyEntityBuffer(fbb, location); |
113 | 113 | ||
114 | const QByteArray command(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); | 114 | const QByteArray command(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); |
115 | { | 115 | { |
116 | flatbuffers::Verifier verifyer(reinterpret_cast<const uint8_t *>(command.data()), command.size()); | 116 | flatbuffers::Verifier verifyer(reinterpret_cast<const uint8_t *>(command.data()), command.size()); |
117 | Q_ASSERT(Akonadi2::Commands::VerifyCreateEntityBuffer(verifyer)); | 117 | Q_ASSERT(Sink::Commands::VerifyCreateEntityBuffer(verifyer)); |
118 | } | 118 | } |
119 | return command; | 119 | return command; |
120 | } | 120 | } |
@@ -122,38 +122,38 @@ QByteArray modifyEntityCommand(const flatbuffers::FlatBufferBuilder &entityFbb, | |||
122 | QByteArray deleteEntityCommand(const QByteArray &uid, qint64 revision) | 122 | QByteArray deleteEntityCommand(const QByteArray &uid, qint64 revision) |
123 | { | 123 | { |
124 | flatbuffers::FlatBufferBuilder fbb; | 124 | flatbuffers::FlatBufferBuilder fbb; |
125 | auto type = fbb.CreateString(Akonadi2::ApplicationDomain::getTypeName<Akonadi2::ApplicationDomain::Event>().toStdString().data()); | 125 | auto type = fbb.CreateString(Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Event>().toStdString().data()); |
126 | auto id = fbb.CreateString(std::string(uid.constData(), uid.size())); | 126 | auto id = fbb.CreateString(std::string(uid.constData(), uid.size())); |
127 | Akonadi2::Commands::DeleteEntityBuilder builder(fbb); | 127 | Sink::Commands::DeleteEntityBuilder builder(fbb); |
128 | builder.add_domainType(type); | 128 | builder.add_domainType(type); |
129 | builder.add_revision(revision); | 129 | builder.add_revision(revision); |
130 | builder.add_entityId(id); | 130 | builder.add_entityId(id); |
131 | auto location = builder.Finish(); | 131 | auto location = builder.Finish(); |
132 | Akonadi2::Commands::FinishDeleteEntityBuffer(fbb, location); | 132 | Sink::Commands::FinishDeleteEntityBuffer(fbb, location); |
133 | 133 | ||
134 | const QByteArray command(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); | 134 | const QByteArray command(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); |
135 | { | 135 | { |
136 | flatbuffers::Verifier verifyer(reinterpret_cast<const uint8_t *>(command.data()), command.size()); | 136 | flatbuffers::Verifier verifyer(reinterpret_cast<const uint8_t *>(command.data()), command.size()); |
137 | Q_ASSERT(Akonadi2::Commands::VerifyDeleteEntityBuffer(verifyer)); | 137 | Q_ASSERT(Sink::Commands::VerifyDeleteEntityBuffer(verifyer)); |
138 | } | 138 | } |
139 | return command; | 139 | return command; |
140 | } | 140 | } |
141 | 141 | ||
142 | class TestProcessor : public Akonadi2::Preprocessor { | 142 | class TestProcessor : public Sink::Preprocessor { |
143 | public: | 143 | public: |
144 | void newEntity(const QByteArray &uid, qint64 revision, const Akonadi2::ApplicationDomain::BufferAdaptor &newEntity, Akonadi2::Storage::Transaction &transaction) Q_DECL_OVERRIDE | 144 | void newEntity(const QByteArray &uid, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &newEntity, Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE |
145 | { | 145 | { |
146 | newUids << uid; | 146 | newUids << uid; |
147 | newRevisions << revision; | 147 | newRevisions << revision; |
148 | } | 148 | } |
149 | 149 | ||
150 | void modifiedEntity(const QByteArray &uid, qint64 revision, const Akonadi2::ApplicationDomain::BufferAdaptor &oldEntity, const Akonadi2::ApplicationDomain::BufferAdaptor &newEntity, Akonadi2::Storage::Transaction &transaction) Q_DECL_OVERRIDE | 150 | void modifiedEntity(const QByteArray &uid, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &oldEntity, const Sink::ApplicationDomain::BufferAdaptor &newEntity, Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE |
151 | { | 151 | { |
152 | modifiedUids << uid; | 152 | modifiedUids << uid; |
153 | modifiedRevisions << revision; | 153 | modifiedRevisions << revision; |
154 | } | 154 | } |
155 | 155 | ||
156 | void deletedEntity(const QByteArray &uid, qint64 revision, const Akonadi2::ApplicationDomain::BufferAdaptor &oldEntity, Akonadi2::Storage::Transaction &transaction) Q_DECL_OVERRIDE | 156 | void deletedEntity(const QByteArray &uid, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &oldEntity, Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE |
157 | { | 157 | { |
158 | deletedUids << uid; | 158 | deletedUids << uid; |
159 | deletedRevisions << revision; | 159 | deletedRevisions << revision; |
@@ -178,7 +178,7 @@ class PipelineTest : public QObject | |||
178 | private Q_SLOTS: | 178 | private Q_SLOTS: |
179 | void initTestCase() | 179 | void initTestCase() |
180 | { | 180 | { |
181 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Trace); | 181 | Sink::Log::setDebugOutputLevel(Sink::Log::Trace); |
182 | } | 182 | } |
183 | 183 | ||
184 | void init() | 184 | void init() |
@@ -191,7 +191,7 @@ private Q_SLOTS: | |||
191 | flatbuffers::FlatBufferBuilder entityFbb; | 191 | flatbuffers::FlatBufferBuilder entityFbb; |
192 | auto command = createEntityCommand(createEvent(entityFbb)); | 192 | auto command = createEntityCommand(createEvent(entityFbb)); |
193 | 193 | ||
194 | Akonadi2::Pipeline pipeline("org.kde.pipelinetest.instance1"); | 194 | Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); |
195 | pipeline.startTransaction(); | 195 | pipeline.startTransaction(); |
196 | pipeline.newEntity(command.constData(), command.size()); | 196 | pipeline.newEntity(command.constData(), command.size()); |
197 | pipeline.commit(); | 197 | pipeline.commit(); |
@@ -205,7 +205,7 @@ private Q_SLOTS: | |||
205 | flatbuffers::FlatBufferBuilder entityFbb; | 205 | flatbuffers::FlatBufferBuilder entityFbb; |
206 | auto command = createEntityCommand(createEvent(entityFbb)); | 206 | auto command = createEntityCommand(createEvent(entityFbb)); |
207 | 207 | ||
208 | Akonadi2::Pipeline pipeline("org.kde.pipelinetest.instance1"); | 208 | Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); |
209 | 209 | ||
210 | auto adaptorFactory = QSharedPointer<TestEventAdaptorFactory>::create(); | 210 | auto adaptorFactory = QSharedPointer<TestEventAdaptorFactory>::create(); |
211 | pipeline.setAdaptorFactory("event", adaptorFactory); | 211 | pipeline.setAdaptorFactory("event", adaptorFactory); |
@@ -219,7 +219,7 @@ private Q_SLOTS: | |||
219 | auto keys = getKeys("org.kde.pipelinetest.instance1", "event.main"); | 219 | auto keys = getKeys("org.kde.pipelinetest.instance1", "event.main"); |
220 | QCOMPARE(keys.size(), 1); | 220 | QCOMPARE(keys.size(), 1); |
221 | const auto key = keys.first(); | 221 | const auto key = keys.first(); |
222 | const auto uid = Akonadi2::Storage::uidFromKey(key); | 222 | const auto uid = Sink::Storage::uidFromKey(key); |
223 | 223 | ||
224 | //Execute the modification | 224 | //Execute the modification |
225 | entityFbb.Clear(); | 225 | entityFbb.Clear(); |
@@ -229,9 +229,9 @@ private Q_SLOTS: | |||
229 | pipeline.commit(); | 229 | pipeline.commit(); |
230 | 230 | ||
231 | //Ensure we've got the new revision with the modification | 231 | //Ensure we've got the new revision with the modification |
232 | auto buffer = getEntity("org.kde.pipelinetest.instance1", "event.main", Akonadi2::Storage::assembleKey(uid, 2)); | 232 | auto buffer = getEntity("org.kde.pipelinetest.instance1", "event.main", Sink::Storage::assembleKey(uid, 2)); |
233 | QVERIFY(!buffer.isEmpty()); | 233 | QVERIFY(!buffer.isEmpty()); |
234 | Akonadi2::EntityBuffer entityBuffer(buffer.data(), buffer.size()); | 234 | Sink::EntityBuffer entityBuffer(buffer.data(), buffer.size()); |
235 | auto adaptor = adaptorFactory->createAdaptor(entityBuffer.entity()); | 235 | auto adaptor = adaptorFactory->createAdaptor(entityBuffer.entity()); |
236 | QCOMPARE(adaptor->getProperty("summary").toString(), QString("summary2")); | 236 | QCOMPARE(adaptor->getProperty("summary").toString(), QString("summary2")); |
237 | 237 | ||
@@ -252,7 +252,7 @@ private Q_SLOTS: | |||
252 | flatbuffers::FlatBufferBuilder entityFbb; | 252 | flatbuffers::FlatBufferBuilder entityFbb; |
253 | auto command = createEntityCommand(createEvent(entityFbb)); | 253 | auto command = createEntityCommand(createEvent(entityFbb)); |
254 | 254 | ||
255 | Akonadi2::Pipeline pipeline("org.kde.pipelinetest.instance1"); | 255 | Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); |
256 | 256 | ||
257 | auto adaptorFactory = QSharedPointer<TestEventAdaptorFactory>::create(); | 257 | auto adaptorFactory = QSharedPointer<TestEventAdaptorFactory>::create(); |
258 | pipeline.setAdaptorFactory("event", adaptorFactory); | 258 | pipeline.setAdaptorFactory("event", adaptorFactory); |
@@ -265,7 +265,7 @@ private Q_SLOTS: | |||
265 | //Get uid of written entity | 265 | //Get uid of written entity |
266 | auto keys = getKeys("org.kde.pipelinetest.instance1", "event.main"); | 266 | auto keys = getKeys("org.kde.pipelinetest.instance1", "event.main"); |
267 | QCOMPARE(keys.size(), 1); | 267 | QCOMPARE(keys.size(), 1); |
268 | const auto uid = Akonadi2::Storage::uidFromKey(keys.first()); | 268 | const auto uid = Sink::Storage::uidFromKey(keys.first()); |
269 | 269 | ||
270 | 270 | ||
271 | //Create another operation inbetween | 271 | //Create another operation inbetween |
@@ -285,9 +285,9 @@ private Q_SLOTS: | |||
285 | pipeline.commit(); | 285 | pipeline.commit(); |
286 | 286 | ||
287 | //Ensure we've got the new revision with the modification | 287 | //Ensure we've got the new revision with the modification |
288 | auto buffer = getEntity("org.kde.pipelinetest.instance1", "event.main", Akonadi2::Storage::assembleKey(uid, 3)); | 288 | auto buffer = getEntity("org.kde.pipelinetest.instance1", "event.main", Sink::Storage::assembleKey(uid, 3)); |
289 | QVERIFY(!buffer.isEmpty()); | 289 | QVERIFY(!buffer.isEmpty()); |
290 | Akonadi2::EntityBuffer entityBuffer(buffer.data(), buffer.size()); | 290 | Sink::EntityBuffer entityBuffer(buffer.data(), buffer.size()); |
291 | auto adaptor = adaptorFactory->createAdaptor(entityBuffer.entity()); | 291 | auto adaptor = adaptorFactory->createAdaptor(entityBuffer.entity()); |
292 | QCOMPARE(adaptor->getProperty("summary").toString(), QString("summary2")); | 292 | QCOMPARE(adaptor->getProperty("summary").toString(), QString("summary2")); |
293 | } | 293 | } |
@@ -296,7 +296,7 @@ private Q_SLOTS: | |||
296 | { | 296 | { |
297 | flatbuffers::FlatBufferBuilder entityFbb; | 297 | flatbuffers::FlatBufferBuilder entityFbb; |
298 | auto command = createEntityCommand(createEvent(entityFbb)); | 298 | auto command = createEntityCommand(createEvent(entityFbb)); |
299 | Akonadi2::Pipeline pipeline("org.kde.pipelinetest.instance1"); | 299 | Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); |
300 | pipeline.setAdaptorFactory("event", QSharedPointer<TestEventAdaptorFactory>::create()); | 300 | pipeline.setAdaptorFactory("event", QSharedPointer<TestEventAdaptorFactory>::create()); |
301 | 301 | ||
302 | //Create the initial revision | 302 | //Create the initial revision |
@@ -307,7 +307,7 @@ private Q_SLOTS: | |||
307 | auto result = getKeys("org.kde.pipelinetest.instance1", "event.main"); | 307 | auto result = getKeys("org.kde.pipelinetest.instance1", "event.main"); |
308 | QCOMPARE(result.size(), 1); | 308 | QCOMPARE(result.size(), 1); |
309 | 309 | ||
310 | const auto uid = Akonadi2::Storage::uidFromKey(result.first()); | 310 | const auto uid = Sink::Storage::uidFromKey(result.first()); |
311 | 311 | ||
312 | //Delete entity | 312 | //Delete entity |
313 | auto deleteCommand = deleteEntityCommand(uid, 1); | 313 | auto deleteCommand = deleteEntityCommand(uid, 1); |
@@ -333,8 +333,8 @@ private Q_SLOTS: | |||
333 | 333 | ||
334 | TestProcessor testProcessor; | 334 | TestProcessor testProcessor; |
335 | 335 | ||
336 | Akonadi2::Pipeline pipeline("org.kde.pipelinetest.instance1"); | 336 | Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); |
337 | pipeline.setPreprocessors("event", QVector<Akonadi2::Preprocessor*>() << &testProcessor); | 337 | pipeline.setPreprocessors("event", QVector<Sink::Preprocessor*>() << &testProcessor); |
338 | pipeline.startTransaction(); | 338 | pipeline.startTransaction(); |
339 | pipeline.setAdaptorFactory("event", QSharedPointer<TestEventAdaptorFactory>::create()); | 339 | pipeline.setAdaptorFactory("event", QSharedPointer<TestEventAdaptorFactory>::create()); |
340 | 340 | ||
@@ -345,21 +345,21 @@ private Q_SLOTS: | |||
345 | QCOMPARE(testProcessor.newUids.size(), 1); | 345 | QCOMPARE(testProcessor.newUids.size(), 1); |
346 | QCOMPARE(testProcessor.newRevisions.size(), 1); | 346 | QCOMPARE(testProcessor.newRevisions.size(), 1); |
347 | //Key doesn't contain revision and is just the uid | 347 | //Key doesn't contain revision and is just the uid |
348 | QCOMPARE(testProcessor.newUids.at(0), Akonadi2::Storage::uidFromKey(testProcessor.newUids.at(0))); | 348 | QCOMPARE(testProcessor.newUids.at(0), Sink::Storage::uidFromKey(testProcessor.newUids.at(0))); |
349 | } | 349 | } |
350 | pipeline.commit(); | 350 | pipeline.commit(); |
351 | entityFbb.Clear(); | 351 | entityFbb.Clear(); |
352 | pipeline.startTransaction(); | 352 | pipeline.startTransaction(); |
353 | auto keys = getKeys("org.kde.pipelinetest.instance1", "event.main"); | 353 | auto keys = getKeys("org.kde.pipelinetest.instance1", "event.main"); |
354 | QCOMPARE(keys.size(), 1); | 354 | QCOMPARE(keys.size(), 1); |
355 | const auto uid = Akonadi2::Storage::uidFromKey(keys.first()); | 355 | const auto uid = Sink::Storage::uidFromKey(keys.first()); |
356 | { | 356 | { |
357 | auto modifyCommand = modifyEntityCommand(createEvent(entityFbb, "summary2"), uid, 1); | 357 | auto modifyCommand = modifyEntityCommand(createEvent(entityFbb, "summary2"), uid, 1); |
358 | pipeline.modifiedEntity(modifyCommand.constData(), modifyCommand.size()); | 358 | pipeline.modifiedEntity(modifyCommand.constData(), modifyCommand.size()); |
359 | QCOMPARE(testProcessor.modifiedUids.size(), 1); | 359 | QCOMPARE(testProcessor.modifiedUids.size(), 1); |
360 | QCOMPARE(testProcessor.modifiedRevisions.size(), 1); | 360 | QCOMPARE(testProcessor.modifiedRevisions.size(), 1); |
361 | //Key doesn't contain revision and is just the uid | 361 | //Key doesn't contain revision and is just the uid |
362 | QCOMPARE(testProcessor.modifiedUids.at(0), Akonadi2::Storage::uidFromKey(testProcessor.modifiedUids.at(0))); | 362 | QCOMPARE(testProcessor.modifiedUids.at(0), Sink::Storage::uidFromKey(testProcessor.modifiedUids.at(0))); |
363 | } | 363 | } |
364 | pipeline.commit(); | 364 | pipeline.commit(); |
365 | entityFbb.Clear(); | 365 | entityFbb.Clear(); |
@@ -371,7 +371,7 @@ private Q_SLOTS: | |||
371 | QCOMPARE(testProcessor.deletedUids.size(), 1); | 371 | QCOMPARE(testProcessor.deletedUids.size(), 1); |
372 | QCOMPARE(testProcessor.deletedSummaries.size(), 1); | 372 | QCOMPARE(testProcessor.deletedSummaries.size(), 1); |
373 | //Key doesn't contain revision and is just the uid | 373 | //Key doesn't contain revision and is just the uid |
374 | QCOMPARE(testProcessor.deletedUids.at(0), Akonadi2::Storage::uidFromKey(testProcessor.deletedUids.at(0))); | 374 | QCOMPARE(testProcessor.deletedUids.at(0), Sink::Storage::uidFromKey(testProcessor.deletedUids.at(0))); |
375 | QCOMPARE(testProcessor.deletedSummaries.at(0), QByteArray("summary2")); | 375 | QCOMPARE(testProcessor.deletedSummaries.at(0), QByteArray("summary2")); |
376 | } | 376 | } |
377 | } | 377 | } |
diff --git a/tests/querytest.cpp b/tests/querytest.cpp index f9344cd..62db15b 100644 --- a/tests/querytest.cpp +++ b/tests/querytest.cpp | |||
@@ -20,8 +20,8 @@ class QueryTest : public QObject | |||
20 | private Q_SLOTS: | 20 | private Q_SLOTS: |
21 | void initTestCase() | 21 | void initTestCase() |
22 | { | 22 | { |
23 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Trace); | 23 | Sink::Log::setDebugOutputLevel(Sink::Log::Trace); |
24 | auto factory = Akonadi2::ResourceFactory::load("org.kde.dummy"); | 24 | auto factory = Sink::ResourceFactory::load("org.kde.dummy"); |
25 | QVERIFY(factory); | 25 | QVERIFY(factory); |
26 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | 26 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); |
27 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); | 27 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); |
@@ -29,11 +29,11 @@ private Q_SLOTS: | |||
29 | 29 | ||
30 | void cleanup() | 30 | void cleanup() |
31 | { | 31 | { |
32 | Akonadi2::Store::shutdown(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); | 32 | Sink::Store::shutdown(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); |
33 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); | 33 | DummyResource::removeFromDisk("org.kde.dummy.instance1"); |
34 | auto factory = Akonadi2::ResourceFactory::load("org.kde.dummy"); | 34 | auto factory = Sink::ResourceFactory::load("org.kde.dummy"); |
35 | QVERIFY(factory); | 35 | QVERIFY(factory); |
36 | Akonadi2::Store::start(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); | 36 | Sink::Store::start(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); |
37 | } | 37 | } |
38 | 38 | ||
39 | void init() | 39 | void init() |
@@ -46,13 +46,13 @@ private Q_SLOTS: | |||
46 | void testNoResources() | 46 | void testNoResources() |
47 | { | 47 | { |
48 | //Test | 48 | //Test |
49 | Akonadi2::Query query; | 49 | Sink::Query query; |
50 | query.resources << "foobar"; | 50 | query.resources << "foobar"; |
51 | query.liveQuery = true; | 51 | query.liveQuery = true; |
52 | 52 | ||
53 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 53 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
54 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 54 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
55 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 55 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
56 | QCOMPARE(model->rowCount(), 0); | 56 | QCOMPARE(model->rowCount(), 0); |
57 | } | 57 | } |
58 | 58 | ||
@@ -61,17 +61,17 @@ private Q_SLOTS: | |||
61 | { | 61 | { |
62 | //Setup | 62 | //Setup |
63 | { | 63 | { |
64 | Akonadi2::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); | 64 | Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); |
65 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Mail>(mail).exec().waitForFinished(); | 65 | Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished(); |
66 | } | 66 | } |
67 | 67 | ||
68 | //Test | 68 | //Test |
69 | Akonadi2::Query query; | 69 | Sink::Query query; |
70 | query.resources << "org.kde.dummy.instance1"; | 70 | query.resources << "org.kde.dummy.instance1"; |
71 | query.liveQuery = true; | 71 | query.liveQuery = true; |
72 | 72 | ||
73 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 73 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
74 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 74 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
75 | model->fetchMore(QModelIndex()); | 75 | model->fetchMore(QModelIndex()); |
76 | QTRY_COMPARE(model->rowCount(), 1); | 76 | QTRY_COMPARE(model->rowCount(), 1); |
77 | } | 77 | } |
@@ -80,23 +80,23 @@ private Q_SLOTS: | |||
80 | { | 80 | { |
81 | //Setup | 81 | //Setup |
82 | { | 82 | { |
83 | Akonadi2::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); | 83 | Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); |
84 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Mail>(mail).exec().waitForFinished(); | 84 | Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished(); |
85 | } | 85 | } |
86 | 86 | ||
87 | //Test | 87 | //Test |
88 | Akonadi2::Query query; | 88 | Sink::Query query; |
89 | query.resources << "org.kde.dummy.instance1"; | 89 | query.resources << "org.kde.dummy.instance1"; |
90 | query.liveQuery = false; | 90 | query.liveQuery = false; |
91 | 91 | ||
92 | //Ensure all local data is processed | 92 | //Ensure all local data is processed |
93 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 93 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
94 | 94 | ||
95 | //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data | 95 | //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data |
96 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 96 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
97 | 97 | ||
98 | model->fetchMore(QModelIndex()); | 98 | model->fetchMore(QModelIndex()); |
99 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 99 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
100 | QCOMPARE(model->rowCount(), 1); | 100 | QCOMPARE(model->rowCount(), 1); |
101 | } | 101 | } |
102 | 102 | ||
@@ -105,31 +105,31 @@ private Q_SLOTS: | |||
105 | QByteArray id; | 105 | QByteArray id; |
106 | //Setup | 106 | //Setup |
107 | { | 107 | { |
108 | Akonadi2::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); | 108 | Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); |
109 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Mail>(mail).exec().waitForFinished(); | 109 | Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished(); |
110 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Mail>(mail).exec().waitForFinished(); | 110 | Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished(); |
111 | 111 | ||
112 | Akonadi2::Query query; | 112 | Sink::Query query; |
113 | query.resources << "org.kde.dummy.instance1"; | 113 | query.resources << "org.kde.dummy.instance1"; |
114 | 114 | ||
115 | //Ensure all local data is processed | 115 | //Ensure all local data is processed |
116 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 116 | Sink::Store::synchronize(query).exec().waitForFinished(); |
117 | 117 | ||
118 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 118 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
119 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 119 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
120 | model->fetchMore(QModelIndex()); | 120 | model->fetchMore(QModelIndex()); |
121 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 121 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
122 | QVERIFY(model->rowCount() >= 1); | 122 | QVERIFY(model->rowCount() >= 1); |
123 | id = model->index(0, 0).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Mail::Ptr>()->identifier(); | 123 | id = model->index(0, 0).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Mail::Ptr>()->identifier(); |
124 | } | 124 | } |
125 | 125 | ||
126 | //Test | 126 | //Test |
127 | Akonadi2::Query query; | 127 | Sink::Query query; |
128 | query.resources << "org.kde.dummy.instance1"; | 128 | query.resources << "org.kde.dummy.instance1"; |
129 | query.ids << id; | 129 | query.ids << id; |
130 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 130 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
131 | model->fetchMore(QModelIndex()); | 131 | model->fetchMore(QModelIndex()); |
132 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 132 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
133 | QCOMPARE(model->rowCount(), 1); | 133 | QCOMPARE(model->rowCount(), 1); |
134 | } | 134 | } |
135 | 135 | ||
@@ -137,20 +137,20 @@ private Q_SLOTS: | |||
137 | { | 137 | { |
138 | //Setup | 138 | //Setup |
139 | { | 139 | { |
140 | Akonadi2::ApplicationDomain::Folder folder("org.kde.dummy.instance1"); | 140 | Sink::ApplicationDomain::Folder folder("org.kde.dummy.instance1"); |
141 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Folder>(folder).exec().waitForFinished(); | 141 | Sink::Store::create<Sink::ApplicationDomain::Folder>(folder).exec().waitForFinished(); |
142 | } | 142 | } |
143 | 143 | ||
144 | //Test | 144 | //Test |
145 | Akonadi2::Query query; | 145 | Sink::Query query; |
146 | query.resources << "org.kde.dummy.instance1"; | 146 | query.resources << "org.kde.dummy.instance1"; |
147 | query.liveQuery = true; | 147 | query.liveQuery = true; |
148 | 148 | ||
149 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 149 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
150 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | 150 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
151 | model->fetchMore(QModelIndex()); | 151 | model->fetchMore(QModelIndex()); |
152 | QTRY_COMPARE(model->rowCount(), 1); | 152 | QTRY_COMPARE(model->rowCount(), 1); |
153 | auto folderEntity = model->index(0, 0).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Folder::Ptr>(); | 153 | auto folderEntity = model->index(0, 0).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Folder::Ptr>(); |
154 | QVERIFY(!folderEntity->identifier().isEmpty()); | 154 | QVERIFY(!folderEntity->identifier().isEmpty()); |
155 | } | 155 | } |
156 | 156 | ||
@@ -158,42 +158,42 @@ private Q_SLOTS: | |||
158 | { | 158 | { |
159 | //Setup | 159 | //Setup |
160 | { | 160 | { |
161 | Akonadi2::ApplicationDomain::Folder folder("org.kde.dummy.instance1"); | 161 | Sink::ApplicationDomain::Folder folder("org.kde.dummy.instance1"); |
162 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Folder>(folder).exec().waitForFinished(); | 162 | Sink::Store::create<Sink::ApplicationDomain::Folder>(folder).exec().waitForFinished(); |
163 | 163 | ||
164 | Akonadi2::Query query; | 164 | Sink::Query query; |
165 | query.resources << "org.kde.dummy.instance1"; | 165 | query.resources << "org.kde.dummy.instance1"; |
166 | 166 | ||
167 | //Ensure all local data is processed | 167 | //Ensure all local data is processed |
168 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 168 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
169 | 169 | ||
170 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | 170 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
171 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 171 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
172 | QCOMPARE(model->rowCount(), 1); | 172 | QCOMPARE(model->rowCount(), 1); |
173 | 173 | ||
174 | auto folderEntity = model->index(0, 0).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Folder::Ptr>(); | 174 | auto folderEntity = model->index(0, 0).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Folder::Ptr>(); |
175 | QVERIFY(!folderEntity->identifier().isEmpty()); | 175 | QVERIFY(!folderEntity->identifier().isEmpty()); |
176 | 176 | ||
177 | Akonadi2::ApplicationDomain::Folder subfolder("org.kde.dummy.instance1"); | 177 | Sink::ApplicationDomain::Folder subfolder("org.kde.dummy.instance1"); |
178 | subfolder.setProperty("parent", folderEntity->identifier()); | 178 | subfolder.setProperty("parent", folderEntity->identifier()); |
179 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Folder>(subfolder).exec().waitForFinished(); | 179 | Sink::Store::create<Sink::ApplicationDomain::Folder>(subfolder).exec().waitForFinished(); |
180 | } | 180 | } |
181 | 181 | ||
182 | //Test | 182 | //Test |
183 | Akonadi2::Query query; | 183 | Sink::Query query; |
184 | query.resources << "org.kde.dummy.instance1"; | 184 | query.resources << "org.kde.dummy.instance1"; |
185 | query.parentProperty = "parent"; | 185 | query.parentProperty = "parent"; |
186 | 186 | ||
187 | //Ensure all local data is processed | 187 | //Ensure all local data is processed |
188 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 188 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
189 | 189 | ||
190 | //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data | 190 | //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data |
191 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | 191 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
192 | model->fetchMore(QModelIndex()); | 192 | model->fetchMore(QModelIndex()); |
193 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 193 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
194 | QCOMPARE(model->rowCount(), 1); | 194 | QCOMPARE(model->rowCount(), 1); |
195 | model->fetchMore(model->index(0, 0)); | 195 | model->fetchMore(model->index(0, 0)); |
196 | QTRY_VERIFY(model->data(model->index(0, 0), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 196 | QTRY_VERIFY(model->data(model->index(0, 0), Sink::Store::ChildrenFetchedRole).toBool()); |
197 | QCOMPARE(model->rowCount(model->index(0, 0)), 1); | 197 | QCOMPARE(model->rowCount(model->index(0, 0)), 1); |
198 | } | 198 | } |
199 | 199 | ||
@@ -201,65 +201,65 @@ private Q_SLOTS: | |||
201 | { | 201 | { |
202 | //Setup | 202 | //Setup |
203 | { | 203 | { |
204 | Akonadi2::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); | 204 | Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); |
205 | mail.setProperty("uid", "test1"); | 205 | mail.setProperty("uid", "test1"); |
206 | mail.setProperty("sender", "doe@example.org"); | 206 | mail.setProperty("sender", "doe@example.org"); |
207 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Mail>(mail).exec().waitForFinished(); | 207 | Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished(); |
208 | } | 208 | } |
209 | 209 | ||
210 | //Test | 210 | //Test |
211 | Akonadi2::Query query; | 211 | Sink::Query query; |
212 | query.resources << "org.kde.dummy.instance1"; | 212 | query.resources << "org.kde.dummy.instance1"; |
213 | query.liveQuery = false; | 213 | query.liveQuery = false; |
214 | query.propertyFilter.insert("uid", "test1"); | 214 | query.propertyFilter.insert("uid", "test1"); |
215 | 215 | ||
216 | //Ensure all local data is processed | 216 | //Ensure all local data is processed |
217 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 217 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
218 | 218 | ||
219 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 219 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
220 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 220 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
221 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 221 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
222 | QCOMPARE(model->rowCount(), 1); | 222 | QCOMPARE(model->rowCount(), 1); |
223 | } | 223 | } |
224 | 224 | ||
225 | void testMailByFolder() | 225 | void testMailByFolder() |
226 | { | 226 | { |
227 | //Setup | 227 | //Setup |
228 | Akonadi2::ApplicationDomain::Folder::Ptr folderEntity; | 228 | Sink::ApplicationDomain::Folder::Ptr folderEntity; |
229 | { | 229 | { |
230 | Akonadi2::ApplicationDomain::Folder folder("org.kde.dummy.instance1"); | 230 | Sink::ApplicationDomain::Folder folder("org.kde.dummy.instance1"); |
231 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Folder>(folder).exec().waitForFinished(); | 231 | Sink::Store::create<Sink::ApplicationDomain::Folder>(folder).exec().waitForFinished(); |
232 | 232 | ||
233 | Akonadi2::Query query; | 233 | Sink::Query query; |
234 | query.resources << "org.kde.dummy.instance1"; | 234 | query.resources << "org.kde.dummy.instance1"; |
235 | 235 | ||
236 | //Ensure all local data is processed | 236 | //Ensure all local data is processed |
237 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 237 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
238 | 238 | ||
239 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Folder>(query); | 239 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
240 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 240 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
241 | QCOMPARE(model->rowCount(), 1); | 241 | QCOMPARE(model->rowCount(), 1); |
242 | 242 | ||
243 | folderEntity = model->index(0, 0).data(Akonadi2::Store::DomainObjectRole).value<Akonadi2::ApplicationDomain::Folder::Ptr>(); | 243 | folderEntity = model->index(0, 0).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Folder::Ptr>(); |
244 | QVERIFY(!folderEntity->identifier().isEmpty()); | 244 | QVERIFY(!folderEntity->identifier().isEmpty()); |
245 | 245 | ||
246 | Akonadi2::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); | 246 | Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); |
247 | mail.setProperty("uid", "test1"); | 247 | mail.setProperty("uid", "test1"); |
248 | mail.setProperty("folder", folderEntity->identifier()); | 248 | mail.setProperty("folder", folderEntity->identifier()); |
249 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Mail>(mail).exec().waitForFinished(); | 249 | Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished(); |
250 | } | 250 | } |
251 | 251 | ||
252 | //Test | 252 | //Test |
253 | Akonadi2::Query query; | 253 | Sink::Query query; |
254 | query.resources << "org.kde.dummy.instance1"; | 254 | query.resources << "org.kde.dummy.instance1"; |
255 | query.propertyFilter.insert("folder", folderEntity->identifier()); | 255 | query.propertyFilter.insert("folder", folderEntity->identifier()); |
256 | 256 | ||
257 | //Ensure all local data is processed | 257 | //Ensure all local data is processed |
258 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 258 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
259 | 259 | ||
260 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 260 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
261 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 261 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
262 | QTRY_VERIFY(model->data(QModelIndex(), Akonadi2::Store::ChildrenFetchedRole).toBool()); | 262 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
263 | QCOMPARE(model->rowCount(), 1); | 263 | QCOMPARE(model->rowCount(), 1); |
264 | } | 264 | } |
265 | }; | 265 | }; |
diff --git a/tests/resourcecommunicationtest.cpp b/tests/resourcecommunicationtest.cpp index 1b09c5f..f9ea3de 100644 --- a/tests/resourcecommunicationtest.cpp +++ b/tests/resourcecommunicationtest.cpp | |||
@@ -16,9 +16,9 @@ private Q_SLOTS: | |||
16 | { | 16 | { |
17 | const QByteArray resourceIdentifier("test"); | 17 | const QByteArray resourceIdentifier("test"); |
18 | Listener listener(resourceIdentifier); | 18 | Listener listener(resourceIdentifier); |
19 | Akonadi2::ResourceAccess resourceAccess(resourceIdentifier); | 19 | Sink::ResourceAccess resourceAccess(resourceIdentifier); |
20 | 20 | ||
21 | QSignalSpy spy(&resourceAccess, &Akonadi2::ResourceAccess::ready); | 21 | QSignalSpy spy(&resourceAccess, &Sink::ResourceAccess::ready); |
22 | resourceAccess.open(); | 22 | resourceAccess.open(); |
23 | QTRY_COMPARE(spy.size(), 1); | 23 | QTRY_COMPARE(spy.size(), 1); |
24 | } | 24 | } |
@@ -27,14 +27,14 @@ private Q_SLOTS: | |||
27 | { | 27 | { |
28 | const QByteArray resourceIdentifier("test"); | 28 | const QByteArray resourceIdentifier("test"); |
29 | Listener listener(resourceIdentifier); | 29 | Listener listener(resourceIdentifier); |
30 | Akonadi2::ResourceAccess resourceAccess(resourceIdentifier); | 30 | Sink::ResourceAccess resourceAccess(resourceIdentifier); |
31 | resourceAccess.open(); | 31 | resourceAccess.open(); |
32 | 32 | ||
33 | flatbuffers::FlatBufferBuilder fbb; | 33 | flatbuffers::FlatBufferBuilder fbb; |
34 | auto name = fbb.CreateString("test"); | 34 | auto name = fbb.CreateString("test"); |
35 | auto command = Akonadi2::Commands::CreateHandshake(fbb, name); | 35 | auto command = Sink::Commands::CreateHandshake(fbb, name); |
36 | Akonadi2::Commands::FinishHandshakeBuffer(fbb, command); | 36 | Sink::Commands::FinishHandshakeBuffer(fbb, command); |
37 | auto result = resourceAccess.sendCommand(Akonadi2::Commands::HandshakeCommand, fbb).exec(); | 37 | auto result = resourceAccess.sendCommand(Sink::Commands::HandshakeCommand, fbb).exec(); |
38 | result.waitForFinished(); | 38 | result.waitForFinished(); |
39 | QVERIFY(!result.errorCode()); | 39 | QVERIFY(!result.errorCode()); |
40 | } | 40 | } |
@@ -43,14 +43,14 @@ private Q_SLOTS: | |||
43 | { | 43 | { |
44 | const QByteArray resourceIdentifier("test"); | 44 | const QByteArray resourceIdentifier("test"); |
45 | Listener listener(resourceIdentifier); | 45 | Listener listener(resourceIdentifier); |
46 | Akonadi2::ResourceAccess resourceAccess(resourceIdentifier); | 46 | Sink::ResourceAccess resourceAccess(resourceIdentifier); |
47 | resourceAccess.open(); | 47 | resourceAccess.open(); |
48 | 48 | ||
49 | const int count = 500; | 49 | const int count = 500; |
50 | int complete = 0; | 50 | int complete = 0; |
51 | int errors = 0; | 51 | int errors = 0; |
52 | for (int i = 0; i < count; i++) { | 52 | for (int i = 0; i < count; i++) { |
53 | auto result = resourceAccess.sendCommand(Akonadi2::Commands::PingCommand) | 53 | auto result = resourceAccess.sendCommand(Sink::Commands::PingCommand) |
54 | .then<void>([&complete]() { | 54 | .then<void>([&complete]() { |
55 | complete++; | 55 | complete++; |
56 | }, | 56 | }, |
@@ -69,14 +69,14 @@ private Q_SLOTS: | |||
69 | qDebug(); | 69 | qDebug(); |
70 | const QByteArray resourceIdentifier("test"); | 70 | const QByteArray resourceIdentifier("test"); |
71 | Listener listener(resourceIdentifier); | 71 | Listener listener(resourceIdentifier); |
72 | Akonadi2::ResourceAccess resourceAccess(resourceIdentifier); | 72 | Sink::ResourceAccess resourceAccess(resourceIdentifier); |
73 | resourceAccess.open(); | 73 | resourceAccess.open(); |
74 | 74 | ||
75 | const int count = 10; | 75 | const int count = 10; |
76 | int complete = 0; | 76 | int complete = 0; |
77 | int errors = 0; | 77 | int errors = 0; |
78 | for (int i = 0; i < count; i++) { | 78 | for (int i = 0; i < count; i++) { |
79 | resourceAccess.sendCommand(Akonadi2::Commands::PingCommand) | 79 | resourceAccess.sendCommand(Sink::Commands::PingCommand) |
80 | .then<void>([&complete]() { | 80 | .then<void>([&complete]() { |
81 | complete++; | 81 | complete++; |
82 | }, | 82 | }, |
diff --git a/tests/storagebenchmark.cpp b/tests/storagebenchmark.cpp index 3e7b609..eada4ee 100644 --- a/tests/storagebenchmark.cpp +++ b/tests/storagebenchmark.cpp | |||
@@ -54,7 +54,7 @@ private: | |||
54 | private Q_SLOTS: | 54 | private Q_SLOTS: |
55 | void initTestCase() | 55 | void initTestCase() |
56 | { | 56 | { |
57 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Warning); | 57 | Sink::Log::setDebugOutputLevel(Sink::Log::Warning); |
58 | testDataPath = "./testdb"; | 58 | testDataPath = "./testdb"; |
59 | dbName = "test"; | 59 | dbName = "test"; |
60 | filePath = testDataPath + "buffer.fb"; | 60 | filePath = testDataPath + "buffer.fb"; |
@@ -62,7 +62,7 @@ private Q_SLOTS: | |||
62 | 62 | ||
63 | void cleanupTestCase() | 63 | void cleanupTestCase() |
64 | { | 64 | { |
65 | Akonadi2::Storage store(testDataPath, dbName); | 65 | Sink::Storage store(testDataPath, dbName); |
66 | store.removeFromDisk(); | 66 | store.removeFromDisk(); |
67 | } | 67 | } |
68 | 68 | ||
@@ -70,7 +70,7 @@ private Q_SLOTS: | |||
70 | { | 70 | { |
71 | auto event = createEvent(); | 71 | auto event = createEvent(); |
72 | 72 | ||
73 | QScopedPointer<Akonadi2::Storage> store(new Akonadi2::Storage(testDataPath, dbName, Akonadi2::Storage::ReadWrite)); | 73 | QScopedPointer<Sink::Storage> store(new Sink::Storage(testDataPath, dbName, Sink::Storage::ReadWrite)); |
74 | 74 | ||
75 | const char *keyPrefix = "key"; | 75 | const char *keyPrefix = "key"; |
76 | 76 | ||
@@ -78,12 +78,12 @@ private Q_SLOTS: | |||
78 | time.start(); | 78 | time.start(); |
79 | //Test db write time | 79 | //Test db write time |
80 | { | 80 | { |
81 | auto transaction = store->createTransaction(Akonadi2::Storage::ReadWrite); | 81 | auto transaction = store->createTransaction(Sink::Storage::ReadWrite); |
82 | for (int i = 0; i < count; i++) { | 82 | for (int i = 0; i < count; i++) { |
83 | transaction.openDatabase().write(keyPrefix + QByteArray::number(i), event); | 83 | transaction.openDatabase().write(keyPrefix + QByteArray::number(i), event); |
84 | if ((i % 10000) == 0) { | 84 | if ((i % 10000) == 0) { |
85 | transaction.commit(); | 85 | transaction.commit(); |
86 | transaction = store->createTransaction(Akonadi2::Storage::ReadWrite); | 86 | transaction = store->createTransaction(Sink::Storage::ReadWrite); |
87 | } | 87 | } |
88 | } | 88 | } |
89 | transaction.commit(); | 89 | transaction.commit(); |
@@ -105,7 +105,7 @@ private Q_SLOTS: | |||
105 | 105 | ||
106 | //Db read time | 106 | //Db read time |
107 | { | 107 | { |
108 | auto transaction = store->createTransaction(Akonadi2::Storage::ReadOnly); | 108 | auto transaction = store->createTransaction(Sink::Storage::ReadOnly); |
109 | auto db = transaction.openDatabase(); | 109 | auto db = transaction.openDatabase(); |
110 | for (int i = 0; i < count; i++) { | 110 | for (int i = 0; i < count; i++) { |
111 | db.scan(keyPrefix + QByteArray::number(i), [](const QByteArray &key, const QByteArray &value) -> bool { return true; }); | 111 | db.scan(keyPrefix + QByteArray::number(i), [](const QByteArray &key, const QByteArray &value) -> bool { return true; }); |
@@ -126,7 +126,7 @@ private Q_SLOTS: | |||
126 | 126 | ||
127 | void testSizes() | 127 | void testSizes() |
128 | { | 128 | { |
129 | Akonadi2::Storage store(testDataPath, dbName); | 129 | Sink::Storage store(testDataPath, dbName); |
130 | qDebug() << "Database size [kb]: " << store.diskUsage()/1024; | 130 | qDebug() << "Database size [kb]: " << store.diskUsage()/1024; |
131 | 131 | ||
132 | QFileInfo fileInfo(filePath); | 132 | QFileInfo fileInfo(filePath); |
@@ -135,11 +135,11 @@ private Q_SLOTS: | |||
135 | 135 | ||
136 | void testScan() | 136 | void testScan() |
137 | { | 137 | { |
138 | QScopedPointer<Akonadi2::Storage> store(new Akonadi2::Storage(testDataPath, dbName, Akonadi2::Storage::ReadOnly)); | 138 | QScopedPointer<Sink::Storage> store(new Sink::Storage(testDataPath, dbName, Sink::Storage::ReadOnly)); |
139 | 139 | ||
140 | QBENCHMARK { | 140 | QBENCHMARK { |
141 | int hit = 0; | 141 | int hit = 0; |
142 | store->createTransaction(Akonadi2::Storage::ReadOnly).openDatabase().scan("", [&](const QByteArray &key, const QByteArray &value) -> bool { | 142 | store->createTransaction(Sink::Storage::ReadOnly).openDatabase().scan("", [&](const QByteArray &key, const QByteArray &value) -> bool { |
143 | if (key == "key10000") { | 143 | if (key == "key10000") { |
144 | //qDebug() << "hit"; | 144 | //qDebug() << "hit"; |
145 | hit++; | 145 | hit++; |
@@ -152,11 +152,11 @@ private Q_SLOTS: | |||
152 | 152 | ||
153 | void testKeyLookup() | 153 | void testKeyLookup() |
154 | { | 154 | { |
155 | QScopedPointer<Akonadi2::Storage> store(new Akonadi2::Storage(testDataPath, dbName, Akonadi2::Storage::ReadOnly)); | 155 | QScopedPointer<Sink::Storage> store(new Sink::Storage(testDataPath, dbName, Sink::Storage::ReadOnly)); |
156 | 156 | ||
157 | QBENCHMARK { | 157 | QBENCHMARK { |
158 | int hit = 0; | 158 | int hit = 0; |
159 | store->createTransaction(Akonadi2::Storage::ReadOnly).openDatabase().scan("key40000", [&](const QByteArray &key, const QByteArray &value) -> bool { | 159 | store->createTransaction(Sink::Storage::ReadOnly).openDatabase().scan("key40000", [&](const QByteArray &key, const QByteArray &value) -> bool { |
160 | hit++; | 160 | hit++; |
161 | return true; | 161 | return true; |
162 | }); | 162 | }); |
diff --git a/tests/storagetest.cpp b/tests/storagetest.cpp index d950961..b0db1ac 100644 --- a/tests/storagetest.cpp +++ b/tests/storagetest.cpp | |||
@@ -21,14 +21,14 @@ private: | |||
21 | 21 | ||
22 | void populate(int count) | 22 | void populate(int count) |
23 | { | 23 | { |
24 | Akonadi2::Storage storage(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | 24 | Sink::Storage storage(testDataPath, dbName, Sink::Storage::ReadWrite); |
25 | auto transaction = storage.createTransaction(Akonadi2::Storage::ReadWrite); | 25 | auto transaction = storage.createTransaction(Sink::Storage::ReadWrite); |
26 | for (int i = 0; i < count; i++) { | 26 | for (int i = 0; i < count; i++) { |
27 | //This should perhaps become an implementation detail of the db? | 27 | //This should perhaps become an implementation detail of the db? |
28 | if (i % 10000 == 0) { | 28 | if (i % 10000 == 0) { |
29 | if (i > 0) { | 29 | if (i > 0) { |
30 | transaction.commit(); | 30 | transaction.commit(); |
31 | transaction = std::move(storage.createTransaction(Akonadi2::Storage::ReadWrite)); | 31 | transaction = std::move(storage.createTransaction(Sink::Storage::ReadWrite)); |
32 | } | 32 | } |
33 | } | 33 | } |
34 | transaction.openDatabase().write(keyPrefix + QByteArray::number(i), keyPrefix + QByteArray::number(i)); | 34 | transaction.openDatabase().write(keyPrefix + QByteArray::number(i), keyPrefix + QByteArray::number(i)); |
@@ -36,12 +36,12 @@ private: | |||
36 | transaction.commit(); | 36 | transaction.commit(); |
37 | } | 37 | } |
38 | 38 | ||
39 | bool verify(Akonadi2::Storage &storage, int i) | 39 | bool verify(Sink::Storage &storage, int i) |
40 | { | 40 | { |
41 | bool success = true; | 41 | bool success = true; |
42 | bool keyMatch = true; | 42 | bool keyMatch = true; |
43 | const auto reference = keyPrefix + QByteArray::number(i); | 43 | const auto reference = keyPrefix + QByteArray::number(i); |
44 | storage.createTransaction(Akonadi2::Storage::ReadOnly).openDatabase().scan(keyPrefix + QByteArray::number(i), | 44 | storage.createTransaction(Sink::Storage::ReadOnly).openDatabase().scan(keyPrefix + QByteArray::number(i), |
45 | [&keyMatch, &reference](const QByteArray &key, const QByteArray &value) -> bool { | 45 | [&keyMatch, &reference](const QByteArray &key, const QByteArray &value) -> bool { |
46 | if (value != reference) { | 46 | if (value != reference) { |
47 | qDebug() << "Mismatch while reading"; | 47 | qDebug() << "Mismatch while reading"; |
@@ -49,7 +49,7 @@ private: | |||
49 | } | 49 | } |
50 | return keyMatch; | 50 | return keyMatch; |
51 | }, | 51 | }, |
52 | [&success](const Akonadi2::Storage::Error &error) { | 52 | [&success](const Sink::Storage::Error &error) { |
53 | qDebug() << error.message; | 53 | qDebug() << error.message; |
54 | success = false; | 54 | success = false; |
55 | } | 55 | } |
@@ -62,20 +62,20 @@ private Q_SLOTS: | |||
62 | { | 62 | { |
63 | testDataPath = "./testdb"; | 63 | testDataPath = "./testdb"; |
64 | dbName = "test"; | 64 | dbName = "test"; |
65 | Akonadi2::Storage storage(testDataPath, dbName); | 65 | Sink::Storage storage(testDataPath, dbName); |
66 | storage.removeFromDisk(); | 66 | storage.removeFromDisk(); |
67 | } | 67 | } |
68 | 68 | ||
69 | void cleanup() | 69 | void cleanup() |
70 | { | 70 | { |
71 | Akonadi2::Storage storage(testDataPath, dbName); | 71 | Sink::Storage storage(testDataPath, dbName); |
72 | storage.removeFromDisk(); | 72 | storage.removeFromDisk(); |
73 | } | 73 | } |
74 | 74 | ||
75 | void testCleanup() | 75 | void testCleanup() |
76 | { | 76 | { |
77 | populate(1); | 77 | populate(1); |
78 | Akonadi2::Storage storage(testDataPath, dbName); | 78 | Sink::Storage storage(testDataPath, dbName); |
79 | storage.removeFromDisk(); | 79 | storage.removeFromDisk(); |
80 | QFileInfo info(testDataPath + "/" + dbName); | 80 | QFileInfo info(testDataPath + "/" + dbName); |
81 | QVERIFY(!info.exists()); | 81 | QVERIFY(!info.exists()); |
@@ -89,7 +89,7 @@ private Q_SLOTS: | |||
89 | 89 | ||
90 | //ensure we can read everything back correctly | 90 | //ensure we can read everything back correctly |
91 | { | 91 | { |
92 | Akonadi2::Storage storage(testDataPath, dbName); | 92 | Sink::Storage storage(testDataPath, dbName); |
93 | for (int i = 0; i < count; i++) { | 93 | for (int i = 0; i < count; i++) { |
94 | QVERIFY(verify(storage, i)); | 94 | QVERIFY(verify(storage, i)); |
95 | } | 95 | } |
@@ -104,8 +104,8 @@ private Q_SLOTS: | |||
104 | //ensure we can scan for values | 104 | //ensure we can scan for values |
105 | { | 105 | { |
106 | int hit = 0; | 106 | int hit = 0; |
107 | Akonadi2::Storage store(testDataPath, dbName); | 107 | Sink::Storage store(testDataPath, dbName); |
108 | store.createTransaction(Akonadi2::Storage::ReadOnly).openDatabase().scan("", [&](const QByteArray &key, const QByteArray &value) -> bool { | 108 | store.createTransaction(Sink::Storage::ReadOnly).openDatabase().scan("", [&](const QByteArray &key, const QByteArray &value) -> bool { |
109 | if (key == "key50") { | 109 | if (key == "key50") { |
110 | hit++; | 110 | hit++; |
111 | } | 111 | } |
@@ -118,8 +118,8 @@ private Q_SLOTS: | |||
118 | { | 118 | { |
119 | int hit = 0; | 119 | int hit = 0; |
120 | bool foundInvalidValue = false; | 120 | bool foundInvalidValue = false; |
121 | Akonadi2::Storage store(testDataPath, dbName); | 121 | Sink::Storage store(testDataPath, dbName); |
122 | store.createTransaction(Akonadi2::Storage::ReadOnly).openDatabase().scan("key50", [&](const QByteArray &key, const QByteArray &value) -> bool { | 122 | store.createTransaction(Sink::Storage::ReadOnly).openDatabase().scan("key50", [&](const QByteArray &key, const QByteArray &value) -> bool { |
123 | if (key != "key50") { | 123 | if (key != "key50") { |
124 | foundInvalidValue = true; | 124 | foundInvalidValue = true; |
125 | } | 125 | } |
@@ -134,10 +134,10 @@ private Q_SLOTS: | |||
134 | void testNestedOperations() | 134 | void testNestedOperations() |
135 | { | 135 | { |
136 | populate(3); | 136 | populate(3); |
137 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | 137 | Sink::Storage store(testDataPath, dbName, Sink::Storage::ReadWrite); |
138 | auto transaction = store.createTransaction(Akonadi2::Storage::ReadWrite); | 138 | auto transaction = store.createTransaction(Sink::Storage::ReadWrite); |
139 | transaction.openDatabase().scan("key1", [&](const QByteArray &key, const QByteArray &value) -> bool { | 139 | transaction.openDatabase().scan("key1", [&](const QByteArray &key, const QByteArray &value) -> bool { |
140 | transaction.openDatabase().remove(key, [](const Akonadi2::Storage::Error &) { | 140 | transaction.openDatabase().remove(key, [](const Sink::Storage::Error &) { |
141 | QVERIFY(false); | 141 | QVERIFY(false); |
142 | }); | 142 | }); |
143 | return false; | 143 | return false; |
@@ -147,9 +147,9 @@ private Q_SLOTS: | |||
147 | void testNestedTransactions() | 147 | void testNestedTransactions() |
148 | { | 148 | { |
149 | populate(3); | 149 | populate(3); |
150 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | 150 | Sink::Storage store(testDataPath, dbName, Sink::Storage::ReadWrite); |
151 | store.createTransaction(Akonadi2::Storage::ReadOnly).openDatabase().scan("key1", [&](const QByteArray &key, const QByteArray &value) -> bool { | 151 | store.createTransaction(Sink::Storage::ReadOnly).openDatabase().scan("key1", [&](const QByteArray &key, const QByteArray &value) -> bool { |
152 | store.createTransaction(Akonadi2::Storage::ReadWrite).openDatabase().remove(key, [](const Akonadi2::Storage::Error &) { | 152 | store.createTransaction(Sink::Storage::ReadWrite).openDatabase().remove(key, [](const Sink::Storage::Error &) { |
153 | QVERIFY(false); | 153 | QVERIFY(false); |
154 | }); | 154 | }); |
155 | return false; | 155 | return false; |
@@ -160,9 +160,9 @@ private Q_SLOTS: | |||
160 | { | 160 | { |
161 | bool gotResult = false; | 161 | bool gotResult = false; |
162 | bool gotError = false; | 162 | bool gotError = false; |
163 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | 163 | Sink::Storage store(testDataPath, dbName, Sink::Storage::ReadWrite); |
164 | auto transaction = store.createTransaction(Akonadi2::Storage::ReadOnly); | 164 | auto transaction = store.createTransaction(Sink::Storage::ReadOnly); |
165 | auto db = transaction.openDatabase("default", [&](const Akonadi2::Storage::Error &error) { | 165 | auto db = transaction.openDatabase("default", [&](const Sink::Storage::Error &error) { |
166 | qDebug() << error.message; | 166 | qDebug() << error.message; |
167 | gotError = true; | 167 | gotError = true; |
168 | }); | 168 | }); |
@@ -170,7 +170,7 @@ private Q_SLOTS: | |||
170 | gotResult = true; | 170 | gotResult = true; |
171 | return false; | 171 | return false; |
172 | }, | 172 | }, |
173 | [&](const Akonadi2::Storage::Error &error) { | 173 | [&](const Sink::Storage::Error &error) { |
174 | qDebug() << error.message; | 174 | qDebug() << error.message; |
175 | gotError = true; | 175 | gotError = true; |
176 | }); | 176 | }); |
@@ -195,8 +195,8 @@ private Q_SLOTS: | |||
195 | const int concurrencyLevel = 20; | 195 | const int concurrencyLevel = 20; |
196 | for (int num = 0; num < concurrencyLevel; num++) { | 196 | for (int num = 0; num < concurrencyLevel; num++) { |
197 | futures << QtConcurrent::run([this, count, &error](){ | 197 | futures << QtConcurrent::run([this, count, &error](){ |
198 | Akonadi2::Storage storage(testDataPath, dbName, Akonadi2::Storage::ReadOnly); | 198 | Sink::Storage storage(testDataPath, dbName, Sink::Storage::ReadOnly); |
199 | Akonadi2::Storage storage2(testDataPath, dbName + "2", Akonadi2::Storage::ReadOnly); | 199 | Sink::Storage storage2(testDataPath, dbName + "2", Sink::Storage::ReadOnly); |
200 | for (int i = 0; i < count; i++) { | 200 | for (int i = 0; i < count; i++) { |
201 | if (!verify(storage, i)) { | 201 | if (!verify(storage, i)) { |
202 | error = true; | 202 | error = true; |
@@ -212,9 +212,9 @@ private Q_SLOTS: | |||
212 | } | 212 | } |
213 | 213 | ||
214 | { | 214 | { |
215 | Akonadi2::Storage storage(testDataPath, dbName); | 215 | Sink::Storage storage(testDataPath, dbName); |
216 | storage.removeFromDisk(); | 216 | storage.removeFromDisk(); |
217 | Akonadi2::Storage storage2(testDataPath, dbName + "2"); | 217 | Sink::Storage storage2(testDataPath, dbName + "2"); |
218 | storage2.removeFromDisk(); | 218 | storage2.removeFromDisk(); |
219 | } | 219 | } |
220 | } | 220 | } |
@@ -223,8 +223,8 @@ private Q_SLOTS: | |||
223 | { | 223 | { |
224 | bool gotResult = false; | 224 | bool gotResult = false; |
225 | bool gotError = false; | 225 | bool gotError = false; |
226 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | 226 | Sink::Storage store(testDataPath, dbName, Sink::Storage::ReadWrite); |
227 | auto transaction = store.createTransaction(Akonadi2::Storage::ReadWrite); | 227 | auto transaction = store.createTransaction(Sink::Storage::ReadWrite); |
228 | auto db = transaction.openDatabase("default", nullptr, false); | 228 | auto db = transaction.openDatabase("default", nullptr, false); |
229 | db.write("key","value"); | 229 | db.write("key","value"); |
230 | db.write("key","value"); | 230 | db.write("key","value"); |
@@ -233,7 +233,7 @@ private Q_SLOTS: | |||
233 | gotResult = true; | 233 | gotResult = true; |
234 | return true; | 234 | return true; |
235 | }, | 235 | }, |
236 | [&](const Akonadi2::Storage::Error &error) { | 236 | [&](const Sink::Storage::Error &error) { |
237 | qDebug() << error.message; | 237 | qDebug() << error.message; |
238 | gotError = true; | 238 | gotError = true; |
239 | }); | 239 | }); |
@@ -246,8 +246,8 @@ private Q_SLOTS: | |||
246 | { | 246 | { |
247 | bool gotResult = false; | 247 | bool gotResult = false; |
248 | bool gotError = false; | 248 | bool gotError = false; |
249 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | 249 | Sink::Storage store(testDataPath, dbName, Sink::Storage::ReadWrite); |
250 | auto transaction = store.createTransaction(Akonadi2::Storage::ReadWrite); | 250 | auto transaction = store.createTransaction(Sink::Storage::ReadWrite); |
251 | auto db = transaction.openDatabase("default", nullptr, true); | 251 | auto db = transaction.openDatabase("default", nullptr, true); |
252 | db.write("key","value1"); | 252 | db.write("key","value1"); |
253 | db.write("key","value2"); | 253 | db.write("key","value2"); |
@@ -255,7 +255,7 @@ private Q_SLOTS: | |||
255 | gotResult = true; | 255 | gotResult = true; |
256 | return true; | 256 | return true; |
257 | }, | 257 | }, |
258 | [&](const Akonadi2::Storage::Error &error) { | 258 | [&](const Sink::Storage::Error &error) { |
259 | qDebug() << error.message; | 259 | qDebug() << error.message; |
260 | gotError = true; | 260 | gotError = true; |
261 | }); | 261 | }); |
@@ -268,12 +268,12 @@ private Q_SLOTS: | |||
268 | { | 268 | { |
269 | bool gotResult = false; | 269 | bool gotResult = false; |
270 | bool gotError = false; | 270 | bool gotError = false; |
271 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadOnly); | 271 | Sink::Storage store(testDataPath, dbName, Sink::Storage::ReadOnly); |
272 | int numValues = store.createTransaction(Akonadi2::Storage::ReadOnly).openDatabase("test").scan("", [&](const QByteArray &key, const QByteArray &value) -> bool { | 272 | int numValues = store.createTransaction(Sink::Storage::ReadOnly).openDatabase("test").scan("", [&](const QByteArray &key, const QByteArray &value) -> bool { |
273 | gotResult = true; | 273 | gotResult = true; |
274 | return false; | 274 | return false; |
275 | }, | 275 | }, |
276 | [&](const Akonadi2::Storage::Error &error) { | 276 | [&](const Sink::Storage::Error &error) { |
277 | qDebug() << error.message; | 277 | qDebug() << error.message; |
278 | gotError = true; | 278 | gotError = true; |
279 | }); | 279 | }); |
@@ -285,8 +285,8 @@ private Q_SLOTS: | |||
285 | void testWriteToNamedDb() | 285 | void testWriteToNamedDb() |
286 | { | 286 | { |
287 | bool gotError = false; | 287 | bool gotError = false; |
288 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | 288 | Sink::Storage store(testDataPath, dbName, Sink::Storage::ReadWrite); |
289 | store.createTransaction(Akonadi2::Storage::ReadWrite).openDatabase("test").write("key1", "value1", [&](const Akonadi2::Storage::Error &error) { | 289 | store.createTransaction(Sink::Storage::ReadWrite).openDatabase("test").write("key1", "value1", [&](const Sink::Storage::Error &error) { |
290 | qDebug() << error.message; | 290 | qDebug() << error.message; |
291 | gotError = true; | 291 | gotError = true; |
292 | }); | 292 | }); |
@@ -296,8 +296,8 @@ private Q_SLOTS: | |||
296 | void testWriteDuplicatesToNamedDb() | 296 | void testWriteDuplicatesToNamedDb() |
297 | { | 297 | { |
298 | bool gotError = false; | 298 | bool gotError = false; |
299 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | 299 | Sink::Storage store(testDataPath, dbName, Sink::Storage::ReadWrite); |
300 | store.createTransaction(Akonadi2::Storage::ReadWrite).openDatabase("test", nullptr, true).write("key1", "value1", [&](const Akonadi2::Storage::Error &error) { | 300 | store.createTransaction(Sink::Storage::ReadWrite).openDatabase("test", nullptr, true).write("key1", "value1", [&](const Sink::Storage::Error &error) { |
301 | qDebug() << error.message; | 301 | qDebug() << error.message; |
302 | gotError = true; | 302 | gotError = true; |
303 | }); | 303 | }); |
@@ -307,8 +307,8 @@ private Q_SLOTS: | |||
307 | //By default we want only exact matches | 307 | //By default we want only exact matches |
308 | void testSubstringKeys() | 308 | void testSubstringKeys() |
309 | { | 309 | { |
310 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | 310 | Sink::Storage store(testDataPath, dbName, Sink::Storage::ReadWrite); |
311 | auto transaction = store.createTransaction(Akonadi2::Storage::ReadWrite); | 311 | auto transaction = store.createTransaction(Sink::Storage::ReadWrite); |
312 | auto db = transaction.openDatabase("test", nullptr, true); | 312 | auto db = transaction.openDatabase("test", nullptr, true); |
313 | db.write("sub","value1"); | 313 | db.write("sub","value1"); |
314 | db.write("subsub","value2"); | 314 | db.write("subsub","value2"); |
@@ -321,8 +321,8 @@ private Q_SLOTS: | |||
321 | 321 | ||
322 | void testFindSubstringKeys() | 322 | void testFindSubstringKeys() |
323 | { | 323 | { |
324 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | 324 | Sink::Storage store(testDataPath, dbName, Sink::Storage::ReadWrite); |
325 | auto transaction = store.createTransaction(Akonadi2::Storage::ReadWrite); | 325 | auto transaction = store.createTransaction(Sink::Storage::ReadWrite); |
326 | auto db = transaction.openDatabase("test", nullptr, false); | 326 | auto db = transaction.openDatabase("test", nullptr, false); |
327 | db.write("sub","value1"); | 327 | db.write("sub","value1"); |
328 | db.write("subsub","value2"); | 328 | db.write("subsub","value2"); |
@@ -336,8 +336,8 @@ private Q_SLOTS: | |||
336 | 336 | ||
337 | void testKeySorting() | 337 | void testKeySorting() |
338 | { | 338 | { |
339 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | 339 | Sink::Storage store(testDataPath, dbName, Sink::Storage::ReadWrite); |
340 | auto transaction = store.createTransaction(Akonadi2::Storage::ReadWrite); | 340 | auto transaction = store.createTransaction(Sink::Storage::ReadWrite); |
341 | auto db = transaction.openDatabase("test", nullptr, false); | 341 | auto db = transaction.openDatabase("test", nullptr, false); |
342 | db.write("sub_2","value2"); | 342 | db.write("sub_2","value2"); |
343 | db.write("sub_1","value1"); | 343 | db.write("sub_1","value1"); |
@@ -357,8 +357,8 @@ private Q_SLOTS: | |||
357 | //Ensure we don't retrieve a key that is greater than the current key. We only want equal keys. | 357 | //Ensure we don't retrieve a key that is greater than the current key. We only want equal keys. |
358 | void testKeyRange() | 358 | void testKeyRange() |
359 | { | 359 | { |
360 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | 360 | Sink::Storage store(testDataPath, dbName, Sink::Storage::ReadWrite); |
361 | auto transaction = store.createTransaction(Akonadi2::Storage::ReadWrite); | 361 | auto transaction = store.createTransaction(Sink::Storage::ReadWrite); |
362 | auto db = transaction.openDatabase("test", nullptr, true); | 362 | auto db = transaction.openDatabase("test", nullptr, true); |
363 | db.write("sub1","value1"); | 363 | db.write("sub1","value1"); |
364 | int numValues = db.scan("sub", [&](const QByteArray &key, const QByteArray &value) -> bool { | 364 | int numValues = db.scan("sub", [&](const QByteArray &key, const QByteArray &value) -> bool { |
@@ -370,8 +370,8 @@ private Q_SLOTS: | |||
370 | 370 | ||
371 | void testFindLatest() | 371 | void testFindLatest() |
372 | { | 372 | { |
373 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | 373 | Sink::Storage store(testDataPath, dbName, Sink::Storage::ReadWrite); |
374 | auto transaction = store.createTransaction(Akonadi2::Storage::ReadWrite); | 374 | auto transaction = store.createTransaction(Sink::Storage::ReadWrite); |
375 | auto db = transaction.openDatabase("test", nullptr, false); | 375 | auto db = transaction.openDatabase("test", nullptr, false); |
376 | db.write("sub1","value1"); | 376 | db.write("sub1","value1"); |
377 | db.write("sub2","value2"); | 377 | db.write("sub2","value2"); |
@@ -387,8 +387,8 @@ private Q_SLOTS: | |||
387 | 387 | ||
388 | void testFindLatestInSingle() | 388 | void testFindLatestInSingle() |
389 | { | 389 | { |
390 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | 390 | Sink::Storage store(testDataPath, dbName, Sink::Storage::ReadWrite); |
391 | auto transaction = store.createTransaction(Akonadi2::Storage::ReadWrite); | 391 | auto transaction = store.createTransaction(Sink::Storage::ReadWrite); |
392 | auto db = transaction.openDatabase("test", nullptr, false); | 392 | auto db = transaction.openDatabase("test", nullptr, false); |
393 | db.write("sub2","value2"); | 393 | db.write("sub2","value2"); |
394 | QByteArray result; | 394 | QByteArray result; |
@@ -401,8 +401,8 @@ private Q_SLOTS: | |||
401 | 401 | ||
402 | void testFindLast() | 402 | void testFindLast() |
403 | { | 403 | { |
404 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | 404 | Sink::Storage store(testDataPath, dbName, Sink::Storage::ReadWrite); |
405 | auto transaction = store.createTransaction(Akonadi2::Storage::ReadWrite); | 405 | auto transaction = store.createTransaction(Sink::Storage::ReadWrite); |
406 | auto db = transaction.openDatabase("test", nullptr, false); | 406 | auto db = transaction.openDatabase("test", nullptr, false); |
407 | db.write("sub2","value2"); | 407 | db.write("sub2","value2"); |
408 | db.write("wub3","value3"); | 408 | db.write("wub3","value3"); |
@@ -416,11 +416,11 @@ private Q_SLOTS: | |||
416 | 416 | ||
417 | void testRecordRevision() | 417 | void testRecordRevision() |
418 | { | 418 | { |
419 | Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); | 419 | Sink::Storage store(testDataPath, dbName, Sink::Storage::ReadWrite); |
420 | auto transaction = store.createTransaction(Akonadi2::Storage::ReadWrite); | 420 | auto transaction = store.createTransaction(Sink::Storage::ReadWrite); |
421 | Akonadi2::Storage::recordRevision(transaction, 1, "uid", "type"); | 421 | Sink::Storage::recordRevision(transaction, 1, "uid", "type"); |
422 | QCOMPARE(Akonadi2::Storage::getTypeFromRevision(transaction, 1), QByteArray("type")); | 422 | QCOMPARE(Sink::Storage::getTypeFromRevision(transaction, 1), QByteArray("type")); |
423 | QCOMPARE(Akonadi2::Storage::getUidFromRevision(transaction, 1), QByteArray("uid")); | 423 | QCOMPARE(Sink::Storage::getUidFromRevision(transaction, 1), QByteArray("uid")); |
424 | } | 424 | } |
425 | }; | 425 | }; |
426 | 426 | ||
diff --git a/tests/testimplementations.h b/tests/testimplementations.h index a47a775..785c408 100644 --- a/tests/testimplementations.h +++ b/tests/testimplementations.h | |||
@@ -30,7 +30,7 @@ | |||
30 | //Replace with something different | 30 | //Replace with something different |
31 | #include "event_generated.h" | 31 | #include "event_generated.h" |
32 | 32 | ||
33 | class TestEventAdaptorFactory : public DomainTypeAdaptorFactory<Akonadi2::ApplicationDomain::Event, Akonadi2::ApplicationDomain::Buffer::Event, Akonadi2::ApplicationDomain::Buffer::EventBuilder> | 33 | class TestEventAdaptorFactory : public DomainTypeAdaptorFactory<Sink::ApplicationDomain::Event, Sink::ApplicationDomain::Buffer::Event, Sink::ApplicationDomain::Buffer::EventBuilder> |
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | TestEventAdaptorFactory() | 36 | TestEventAdaptorFactory() |
@@ -41,7 +41,7 @@ public: | |||
41 | virtual ~TestEventAdaptorFactory() {}; | 41 | virtual ~TestEventAdaptorFactory() {}; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | class TestResourceAccess : public Akonadi2::ResourceAccessInterface | 44 | class TestResourceAccess : public Sink::ResourceAccessInterface |
45 | { | 45 | { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | public: | 47 | public: |
@@ -55,11 +55,11 @@ public Q_SLOTS: | |||
55 | void close() Q_DECL_OVERRIDE {} | 55 | void close() Q_DECL_OVERRIDE {} |
56 | }; | 56 | }; |
57 | 57 | ||
58 | class TestResourceFacade : public Akonadi2::GenericFacade<Akonadi2::ApplicationDomain::Event> | 58 | class TestResourceFacade : public Sink::GenericFacade<Sink::ApplicationDomain::Event> |
59 | { | 59 | { |
60 | public: | 60 | public: |
61 | TestResourceFacade(const QByteArray &instanceIdentifier, const QSharedPointer<Akonadi2::ResourceAccessInterface> resourceAccess) | 61 | TestResourceFacade(const QByteArray &instanceIdentifier, const QSharedPointer<Sink::ResourceAccessInterface> resourceAccess) |
62 | : Akonadi2::GenericFacade<Akonadi2::ApplicationDomain::Event>(instanceIdentifier, QSharedPointer<TestEventAdaptorFactory>::create(), resourceAccess) | 62 | : Sink::GenericFacade<Sink::ApplicationDomain::Event>(instanceIdentifier, QSharedPointer<TestEventAdaptorFactory>::create(), resourceAccess) |
63 | { | 63 | { |
64 | 64 | ||
65 | } | 65 | } |
@@ -69,11 +69,11 @@ public: | |||
69 | } | 69 | } |
70 | }; | 70 | }; |
71 | 71 | ||
72 | class TestResource : public Akonadi2::GenericResource | 72 | class TestResource : public Sink::GenericResource |
73 | { | 73 | { |
74 | public: | 74 | public: |
75 | TestResource(const QByteArray &instanceIdentifier, QSharedPointer<Akonadi2::Pipeline> pipeline) | 75 | TestResource(const QByteArray &instanceIdentifier, QSharedPointer<Sink::Pipeline> pipeline) |
76 | : Akonadi2::GenericResource(instanceIdentifier, pipeline) | 76 | : Sink::GenericResource(instanceIdentifier, pipeline) |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||