diff options
-rw-r--r-- | common/clientapi.cpp | 2 | ||||
-rw-r--r-- | common/clientapi.h | 36 | ||||
-rw-r--r-- | common/domain/event.fbs | 2 | ||||
-rw-r--r-- | common/domainadaptor.h | 4 | ||||
-rw-r--r-- | common/test/clientapitest.cpp | 18 | ||||
-rw-r--r-- | dummyresource/domainadaptor.cpp | 25 | ||||
-rw-r--r-- | dummyresource/domainadaptor.h | 6 | ||||
-rw-r--r-- | dummyresource/facade.cpp | 29 | ||||
-rw-r--r-- | dummyresource/facade.h | 14 | ||||
-rw-r--r-- | dummyresource/resourcefactory.cpp | 2 | ||||
-rw-r--r-- | synchronizer/listener.cpp | 2 | ||||
-rw-r--r-- | tests/domainadaptortest.cpp | 36 | ||||
-rw-r--r-- | tests/dummyresourcebenchmark.cpp | 10 | ||||
-rw-r--r-- | tests/dummyresourcetest.cpp | 20 |
14 files changed, 102 insertions, 104 deletions
diff --git a/common/clientapi.cpp b/common/clientapi.cpp index 0281b79..48de1b0 100644 --- a/common/clientapi.cpp +++ b/common/clientapi.cpp | |||
@@ -14,7 +14,7 @@ namespace async | |||
14 | namespace Akonadi2 | 14 | namespace Akonadi2 |
15 | { | 15 | { |
16 | 16 | ||
17 | namespace Domain | 17 | namespace ApplicationDomain |
18 | { | 18 | { |
19 | 19 | ||
20 | template<> | 20 | template<> |
diff --git a/common/clientapi.h b/common/clientapi.h index 37fb185..5182547 100644 --- a/common/clientapi.h +++ b/common/clientapi.h | |||
@@ -163,7 +163,7 @@ namespace async { | |||
163 | namespace Akonadi2 { | 163 | namespace Akonadi2 { |
164 | 164 | ||
165 | /** | 165 | /** |
166 | * Standardized Domain Types | 166 | * Standardized Application Domain Types |
167 | * | 167 | * |
168 | * They don't adhere to any standard and can be freely extended | 168 | * They don't adhere to any standard and can be freely extended |
169 | * Their sole purpose is providing a standardized interface to access data. | 169 | * Their sole purpose is providing a standardized interface to access data. |
@@ -172,7 +172,7 @@ namespace Akonadi2 { | |||
172 | * | 172 | * |
173 | * These types will be frequently modified (for every new feature that should be exposed to the any client) | 173 | * These types will be frequently modified (for every new feature that should be exposed to the any client) |
174 | */ | 174 | */ |
175 | namespace Domain { | 175 | namespace ApplicationDomain { |
176 | 176 | ||
177 | /** | 177 | /** |
178 | * This class has to be implemented by resources and can be used as generic interface to access the buffer properties | 178 | * This class has to be implemented by resources and can be used as generic interface to access the buffer properties |
@@ -215,14 +215,14 @@ private: | |||
215 | * * provide a unified interface to read buffers (for zero-copy reading) | 215 | * * provide a unified interface to read buffers (for zero-copy reading) |
216 | * * record changes to generate changesets for modifications | 216 | * * record changes to generate changesets for modifications |
217 | */ | 217 | */ |
218 | class AkonadiDomainType { | 218 | class ApplicationDomainType { |
219 | public: | 219 | public: |
220 | AkonadiDomainType() | 220 | ApplicationDomainType() |
221 | :mAdaptor(new MemoryBufferAdaptor()) | 221 | :mAdaptor(new MemoryBufferAdaptor()) |
222 | { | 222 | { |
223 | 223 | ||
224 | } | 224 | } |
225 | AkonadiDomainType(const QByteArray &resourceName, const QByteArray &identifier, qint64 revision, const QSharedPointer<BufferAdaptor> &adaptor) | 225 | ApplicationDomainType(const QByteArray &resourceName, const QByteArray &identifier, qint64 revision, const QSharedPointer<BufferAdaptor> &adaptor) |
226 | : mAdaptor(adaptor), | 226 | : mAdaptor(adaptor), |
227 | mResourceName(resourceName), | 227 | mResourceName(resourceName), |
228 | mIdentifier(identifier), | 228 | mIdentifier(identifier), |
@@ -230,7 +230,7 @@ public: | |||
230 | { | 230 | { |
231 | } | 231 | } |
232 | 232 | ||
233 | virtual ~AkonadiDomainType() {} | 233 | virtual ~ApplicationDomainType() {} |
234 | 234 | ||
235 | virtual QVariant getProperty(const QByteArray &key) const { return mAdaptor->getProperty(key); } | 235 | virtual QVariant getProperty(const QByteArray &key) const { return mAdaptor->getProperty(key); } |
236 | virtual void setProperty(const QByteArray &key, const QVariant &value){ mChangeSet.insert(key, value); mAdaptor->setProperty(key, value); } | 236 | virtual void setProperty(const QByteArray &key, const QVariant &value){ mChangeSet.insert(key, value); mAdaptor->setProperty(key, value); } |
@@ -246,25 +246,25 @@ private: | |||
246 | qint64 mRevision; | 246 | qint64 mRevision; |
247 | }; | 247 | }; |
248 | 248 | ||
249 | struct Event : public AkonadiDomainType { | 249 | struct Event : public ApplicationDomainType { |
250 | typedef QSharedPointer<Event> Ptr; | 250 | typedef QSharedPointer<Event> Ptr; |
251 | using AkonadiDomainType::AkonadiDomainType; | 251 | using ApplicationDomainType::ApplicationDomainType; |
252 | }; | 252 | }; |
253 | 253 | ||
254 | struct Todo : public AkonadiDomainType { | 254 | struct Todo : public ApplicationDomainType { |
255 | typedef QSharedPointer<Todo> Ptr; | 255 | typedef QSharedPointer<Todo> Ptr; |
256 | using AkonadiDomainType::AkonadiDomainType; | 256 | using ApplicationDomainType::ApplicationDomainType; |
257 | }; | 257 | }; |
258 | 258 | ||
259 | struct Calendar : public AkonadiDomainType { | 259 | struct Calendar : public ApplicationDomainType { |
260 | typedef QSharedPointer<Calendar> Ptr; | 260 | typedef QSharedPointer<Calendar> Ptr; |
261 | using AkonadiDomainType::AkonadiDomainType; | 261 | using ApplicationDomainType::ApplicationDomainType; |
262 | }; | 262 | }; |
263 | 263 | ||
264 | class Mail : public AkonadiDomainType { | 264 | class Mail : public ApplicationDomainType { |
265 | }; | 265 | }; |
266 | 266 | ||
267 | class Folder : public AkonadiDomainType { | 267 | class Folder : public ApplicationDomainType { |
268 | }; | 268 | }; |
269 | 269 | ||
270 | /** | 270 | /** |
@@ -331,7 +331,7 @@ template<class DomainType> | |||
331 | class StoreFacade { | 331 | class StoreFacade { |
332 | public: | 332 | public: |
333 | virtual ~StoreFacade(){}; | 333 | virtual ~StoreFacade(){}; |
334 | QByteArray type() const { return Domain::getTypeName<DomainType>(); } | 334 | QByteArray type() const { return ApplicationDomain::getTypeName<DomainType>(); } |
335 | virtual Async::Job<void> create(const DomainType &domainObject) = 0; | 335 | virtual Async::Job<void> create(const DomainType &domainObject) = 0; |
336 | virtual Async::Job<void> modify(const DomainType &domainObject) = 0; | 336 | virtual Async::Job<void> modify(const DomainType &domainObject) = 0; |
337 | virtual Async::Job<void> remove(const DomainType &domainObject) = 0; | 337 | virtual Async::Job<void> remove(const DomainType &domainObject) = 0; |
@@ -362,7 +362,7 @@ public: | |||
362 | template<class DomainType, class Facade> | 362 | template<class DomainType, class Facade> |
363 | void registerFacade(const QByteArray &resource) | 363 | void registerFacade(const QByteArray &resource) |
364 | { | 364 | { |
365 | const QByteArray typeName = Domain::getTypeName<DomainType>(); | 365 | const QByteArray typeName = ApplicationDomain::getTypeName<DomainType>(); |
366 | mFacadeRegistry.insert(key(resource, typeName), [](){ return new Facade; }); | 366 | mFacadeRegistry.insert(key(resource, typeName), [](){ return new Facade; }); |
367 | } | 367 | } |
368 | 368 | ||
@@ -378,14 +378,14 @@ public: | |||
378 | template<class DomainType, class Facade> | 378 | template<class DomainType, class Facade> |
379 | void registerFacade(const QByteArray &resource, const std::function<void*(void)> &customFactoryFunction) | 379 | void registerFacade(const QByteArray &resource, const std::function<void*(void)> &customFactoryFunction) |
380 | { | 380 | { |
381 | const QByteArray typeName = Domain::getTypeName<DomainType>(); | 381 | const QByteArray typeName = ApplicationDomain::getTypeName<DomainType>(); |
382 | mFacadeRegistry.insert(key(resource, typeName), customFactoryFunction); | 382 | mFacadeRegistry.insert(key(resource, typeName), customFactoryFunction); |
383 | } | 383 | } |
384 | 384 | ||
385 | template<class DomainType> | 385 | template<class DomainType> |
386 | QSharedPointer<StoreFacade<DomainType> > getFacade(const QByteArray &resource) | 386 | QSharedPointer<StoreFacade<DomainType> > getFacade(const QByteArray &resource) |
387 | { | 387 | { |
388 | const QByteArray typeName = Domain::getTypeName<DomainType>(); | 388 | const QByteArray typeName = ApplicationDomain::getTypeName<DomainType>(); |
389 | auto factoryFunction = mFacadeRegistry.value(key(resource, typeName)); | 389 | auto factoryFunction = mFacadeRegistry.value(key(resource, typeName)); |
390 | if (factoryFunction) { | 390 | if (factoryFunction) { |
391 | return QSharedPointer<StoreFacade<DomainType> >(static_cast<StoreFacade<DomainType>* >(factoryFunction())); | 391 | return QSharedPointer<StoreFacade<DomainType> >(static_cast<StoreFacade<DomainType>* >(factoryFunction())); |
diff --git a/common/domain/event.fbs b/common/domain/event.fbs index 49ff270..0c6628b 100644 --- a/common/domain/event.fbs +++ b/common/domain/event.fbs | |||
@@ -1,4 +1,4 @@ | |||
1 | namespace Akonadi2.Domain.Buffer; | 1 | namespace Akonadi2.ApplicationDomain.Buffer; |
2 | 2 | ||
3 | table Event { | 3 | table Event { |
4 | uid:string; | 4 | uid:string; |
diff --git a/common/domainadaptor.h b/common/domainadaptor.h index 692c8c1..df3f8e5 100644 --- a/common/domainadaptor.h +++ b/common/domainadaptor.h | |||
@@ -68,8 +68,8 @@ class DomainTypeAdaptorFactory/* <typename DomainType, LocalBuffer, ResourceBuff | |||
68 | { | 68 | { |
69 | public: | 69 | public: |
70 | virtual ~DomainTypeAdaptorFactory() {}; | 70 | virtual ~DomainTypeAdaptorFactory() {}; |
71 | virtual QSharedPointer<Akonadi2::Domain::BufferAdaptor> createAdaptor(const Akonadi2::Entity &entity) = 0; | 71 | virtual QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor> createAdaptor(const Akonadi2::Entity &entity) = 0; |
72 | virtual void createBuffer(const Akonadi2::Domain::Event &event, flatbuffers::FlatBufferBuilder &fbb) {}; | 72 | virtual void createBuffer(const Akonadi2::ApplicationDomain::Event &event, flatbuffers::FlatBufferBuilder &fbb) {}; |
73 | 73 | ||
74 | protected: | 74 | protected: |
75 | QSharedPointer<PropertyMapper<LocalBuffer> > mLocalMapper; | 75 | QSharedPointer<PropertyMapper<LocalBuffer> > mLocalMapper; |
diff --git a/common/test/clientapitest.cpp b/common/test/clientapitest.cpp index c9e4d6d..24b3fb9 100644 --- a/common/test/clientapitest.cpp +++ b/common/test/clientapitest.cpp | |||
@@ -4,14 +4,14 @@ | |||
4 | 4 | ||
5 | #include "../clientapi.h" | 5 | #include "../clientapi.h" |
6 | 6 | ||
7 | class DummyResourceFacade : public Akonadi2::StoreFacade<Akonadi2::Domain::Event> | 7 | class DummyResourceFacade : public Akonadi2::StoreFacade<Akonadi2::ApplicationDomain::Event> |
8 | { | 8 | { |
9 | public: | 9 | public: |
10 | ~DummyResourceFacade(){}; | 10 | ~DummyResourceFacade(){}; |
11 | virtual Async::Job<void> create(const Akonadi2::Domain::Event &domainObject){ return Async::null<void>(); }; | 11 | virtual Async::Job<void> create(const Akonadi2::ApplicationDomain::Event &domainObject){ return Async::null<void>(); }; |
12 | virtual Async::Job<void> modify(const Akonadi2::Domain::Event &domainObject){ return Async::null<void>(); }; | 12 | virtual Async::Job<void> modify(const Akonadi2::ApplicationDomain::Event &domainObject){ return Async::null<void>(); }; |
13 | virtual Async::Job<void> remove(const Akonadi2::Domain::Event &domainObject){ return Async::null<void>(); }; | 13 | virtual Async::Job<void> remove(const Akonadi2::ApplicationDomain::Event &domainObject){ return Async::null<void>(); }; |
14 | virtual Async::Job<void> load(const Akonadi2::Query &query, const std::function<void(const Akonadi2::Domain::Event::Ptr &)> &resultCallback) | 14 | virtual Async::Job<void> load(const Akonadi2::Query &query, const std::function<void(const Akonadi2::ApplicationDomain::Event::Ptr &)> &resultCallback) |
15 | { | 15 | { |
16 | return Async::start<void>([this, resultCallback](Async::Future<void> &future) { | 16 | return Async::start<void>([this, resultCallback](Async::Future<void> &future) { |
17 | qDebug() << "load called"; | 17 | qDebug() << "load called"; |
@@ -22,7 +22,7 @@ public: | |||
22 | }); | 22 | }); |
23 | } | 23 | } |
24 | 24 | ||
25 | QList<Akonadi2::Domain::Event::Ptr> results; | 25 | QList<Akonadi2::ApplicationDomain::Event::Ptr> results; |
26 | }; | 26 | }; |
27 | 27 | ||
28 | class ClientAPITest : public QObject | 28 | class ClientAPITest : public QObject |
@@ -33,14 +33,14 @@ private Q_SLOTS: | |||
33 | void testLoad() | 33 | void testLoad() |
34 | { | 34 | { |
35 | DummyResourceFacade facade; | 35 | DummyResourceFacade facade; |
36 | facade.results << QSharedPointer<Akonadi2::Domain::Event>::create("resource", "id", 0, QSharedPointer<Akonadi2::Domain::BufferAdaptor>()); | 36 | facade.results << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); |
37 | 37 | ||
38 | Akonadi2::FacadeFactory::instance().registerFacade<Akonadi2::Domain::Event, DummyResourceFacade>("dummyresource", [facade](){ return new DummyResourceFacade(facade); }); | 38 | Akonadi2::FacadeFactory::instance().registerFacade<Akonadi2::ApplicationDomain::Event, DummyResourceFacade>("dummyresource", [facade](){ return new DummyResourceFacade(facade); }); |
39 | 39 | ||
40 | Akonadi2::Query query; | 40 | Akonadi2::Query query; |
41 | query.resources << "dummyresource"; | 41 | query.resources << "dummyresource"; |
42 | 42 | ||
43 | async::SyncListResult<Akonadi2::Domain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::Domain::Event>(query)); | 43 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); |
44 | result.exec(); | 44 | result.exec(); |
45 | QCOMPARE(result.size(), 1); | 45 | QCOMPARE(result.size(), 1); |
46 | } | 46 | } |
diff --git a/dummyresource/domainadaptor.cpp b/dummyresource/domainadaptor.cpp index 865a4c0..b133614 100644 --- a/dummyresource/domainadaptor.cpp +++ b/dummyresource/domainadaptor.cpp | |||
@@ -14,11 +14,8 @@ | |||
14 | using namespace DummyCalendar; | 14 | using namespace DummyCalendar; |
15 | using namespace flatbuffers; | 15 | using namespace flatbuffers; |
16 | 16 | ||
17 | using namespace DummyCalendar; | ||
18 | using namespace flatbuffers; | ||
19 | |||
20 | //This will become a generic implementation that simply takes the resource buffer and local buffer pointer | 17 | //This will become a generic implementation that simply takes the resource buffer and local buffer pointer |
21 | class DummyEventAdaptor : public Akonadi2::Domain::BufferAdaptor | 18 | class DummyEventAdaptor : public Akonadi2::ApplicationDomain::BufferAdaptor |
22 | { | 19 | { |
23 | public: | 20 | public: |
24 | DummyEventAdaptor() | 21 | DummyEventAdaptor() |
@@ -55,10 +52,10 @@ public: | |||
55 | return props; | 52 | return props; |
56 | } | 53 | } |
57 | 54 | ||
58 | Akonadi2::Domain::Buffer::Event const *mLocalBuffer; | 55 | Akonadi2::ApplicationDomain::Buffer::Event const *mLocalBuffer; |
59 | DummyEvent const *mResourceBuffer; | 56 | DummyEvent const *mResourceBuffer; |
60 | 57 | ||
61 | QSharedPointer<PropertyMapper<Akonadi2::Domain::Buffer::Event> > mLocalMapper; | 58 | QSharedPointer<PropertyMapper<Akonadi2::ApplicationDomain::Buffer::Event> > mLocalMapper; |
62 | QSharedPointer<PropertyMapper<DummyEvent> > mResourceMapper; | 59 | QSharedPointer<PropertyMapper<DummyEvent> > mResourceMapper; |
63 | }; | 60 | }; |
64 | 61 | ||
@@ -73,14 +70,14 @@ DummyEventAdaptorFactory::DummyEventAdaptorFactory() | |||
73 | } | 70 | } |
74 | return QVariant(); | 71 | return QVariant(); |
75 | }); | 72 | }); |
76 | mLocalMapper = QSharedPointer<PropertyMapper<Akonadi2::Domain::Buffer::Event> >::create(); | 73 | mLocalMapper = QSharedPointer<PropertyMapper<Akonadi2::ApplicationDomain::Buffer::Event> >::create(); |
77 | mLocalMapper->mReadAccessors.insert("summary", [](Akonadi2::Domain::Buffer::Event const *buffer) -> QVariant { | 74 | mLocalMapper->mReadAccessors.insert("summary", [](Akonadi2::ApplicationDomain::Buffer::Event const *buffer) -> QVariant { |
78 | if (buffer->summary()) { | 75 | if (buffer->summary()) { |
79 | return QString::fromStdString(buffer->summary()->c_str()); | 76 | return QString::fromStdString(buffer->summary()->c_str()); |
80 | } | 77 | } |
81 | return QVariant(); | 78 | return QVariant(); |
82 | }); | 79 | }); |
83 | mLocalMapper->mReadAccessors.insert("uid", [](Akonadi2::Domain::Buffer::Event const *buffer) -> QVariant { | 80 | mLocalMapper->mReadAccessors.insert("uid", [](Akonadi2::ApplicationDomain::Buffer::Event const *buffer) -> QVariant { |
84 | if (buffer->uid()) { | 81 | if (buffer->uid()) { |
85 | return QString::fromStdString(buffer->uid()->c_str()); | 82 | return QString::fromStdString(buffer->uid()->c_str()); |
86 | } | 83 | } |
@@ -90,10 +87,10 @@ DummyEventAdaptorFactory::DummyEventAdaptorFactory() | |||
90 | } | 87 | } |
91 | 88 | ||
92 | //TODO pass EntityBuffer instead? | 89 | //TODO pass EntityBuffer instead? |
93 | QSharedPointer<Akonadi2::Domain::BufferAdaptor> DummyEventAdaptorFactory::createAdaptor(const Akonadi2::Entity &entity) | 90 | QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor> DummyEventAdaptorFactory::createAdaptor(const Akonadi2::Entity &entity) |
94 | { | 91 | { |
95 | const auto resourceBuffer = Akonadi2::EntityBuffer::readBuffer<DummyEvent>(entity.resource()); | 92 | const auto resourceBuffer = Akonadi2::EntityBuffer::readBuffer<DummyEvent>(entity.resource()); |
96 | const auto localBuffer = Akonadi2::EntityBuffer::readBuffer<Akonadi2::Domain::Buffer::Event>(entity.local()); | 93 | const auto localBuffer = Akonadi2::EntityBuffer::readBuffer<Akonadi2::ApplicationDomain::Buffer::Event>(entity.local()); |
97 | // const auto metadataBuffer = Akonadi2::EntityBuffer::readBuffer<Akonadi2::Metadata>(entity.metadata()); | 94 | // const auto metadataBuffer = Akonadi2::EntityBuffer::readBuffer<Akonadi2::Metadata>(entity.metadata()); |
98 | 95 | ||
99 | auto adaptor = QSharedPointer<DummyEventAdaptor>::create(); | 96 | auto adaptor = QSharedPointer<DummyEventAdaptor>::create(); |
@@ -104,7 +101,7 @@ QSharedPointer<Akonadi2::Domain::BufferAdaptor> DummyEventAdaptorFactory::create | |||
104 | return adaptor; | 101 | return adaptor; |
105 | } | 102 | } |
106 | 103 | ||
107 | void DummyEventAdaptorFactory::createBuffer(const Akonadi2::Domain::Event &event, flatbuffers::FlatBufferBuilder &fbb) | 104 | void DummyEventAdaptorFactory::createBuffer(const Akonadi2::ApplicationDomain::Event &event, flatbuffers::FlatBufferBuilder &fbb) |
108 | { | 105 | { |
109 | flatbuffers::FlatBufferBuilder eventFbb; | 106 | flatbuffers::FlatBufferBuilder eventFbb; |
110 | eventFbb.Clear(); | 107 | eventFbb.Clear(); |
@@ -119,10 +116,10 @@ void DummyEventAdaptorFactory::createBuffer(const Akonadi2::Domain::Event &event | |||
119 | flatbuffers::FlatBufferBuilder localFbb; | 116 | flatbuffers::FlatBufferBuilder localFbb; |
120 | { | 117 | { |
121 | auto uid = localFbb.CreateString(event.getProperty("uid").toString().toStdString()); | 118 | auto uid = localFbb.CreateString(event.getProperty("uid").toString().toStdString()); |
122 | auto localBuilder = Akonadi2::Domain::Buffer::EventBuilder(localFbb); | 119 | auto localBuilder = Akonadi2::ApplicationDomain::Buffer::EventBuilder(localFbb); |
123 | localBuilder.add_uid(uid); | 120 | localBuilder.add_uid(uid); |
124 | auto location = localBuilder.Finish(); | 121 | auto location = localBuilder.Finish(); |
125 | Akonadi2::Domain::Buffer::FinishEventBuffer(localFbb, location); | 122 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(localFbb, location); |
126 | } | 123 | } |
127 | 124 | ||
128 | Akonadi2::EntityBuffer::assembleEntityBuffer(fbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize()); | 125 | Akonadi2::EntityBuffer::assembleEntityBuffer(fbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize()); |
diff --git a/dummyresource/domainadaptor.h b/dummyresource/domainadaptor.h index a2fb8a9..143121a 100644 --- a/dummyresource/domainadaptor.h +++ b/dummyresource/domainadaptor.h | |||
@@ -5,11 +5,11 @@ | |||
5 | #include "dummycalendar_generated.h" | 5 | #include "dummycalendar_generated.h" |
6 | #include "entity_generated.h" | 6 | #include "entity_generated.h" |
7 | 7 | ||
8 | class DummyEventAdaptorFactory : public DomainTypeAdaptorFactory<Akonadi2::Domain::Event, Akonadi2::Domain::Buffer::Event, DummyCalendar::DummyEvent> | 8 | class DummyEventAdaptorFactory : public DomainTypeAdaptorFactory<Akonadi2::ApplicationDomain::Event, Akonadi2::ApplicationDomain::Buffer::Event, DummyCalendar::DummyEvent> |
9 | { | 9 | { |
10 | public: | 10 | public: |
11 | DummyEventAdaptorFactory(); | 11 | DummyEventAdaptorFactory(); |
12 | virtual ~DummyEventAdaptorFactory() {}; | 12 | virtual ~DummyEventAdaptorFactory() {}; |
13 | virtual QSharedPointer<Akonadi2::Domain::BufferAdaptor> createAdaptor(const Akonadi2::Entity &entity); | 13 | virtual QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor> createAdaptor(const Akonadi2::Entity &entity); |
14 | virtual void createBuffer(const Akonadi2::Domain::Event &event, flatbuffers::FlatBufferBuilder &fbb); | 14 | virtual void createBuffer(const Akonadi2::ApplicationDomain::Event &event, flatbuffers::FlatBufferBuilder &fbb); |
15 | }; | 15 | }; |
diff --git a/dummyresource/facade.cpp b/dummyresource/facade.cpp index 7c64675..980833f 100644 --- a/dummyresource/facade.cpp +++ b/dummyresource/facade.cpp | |||
@@ -38,7 +38,7 @@ using namespace flatbuffers; | |||
38 | 38 | ||
39 | 39 | ||
40 | DummyResourceFacade::DummyResourceFacade() | 40 | DummyResourceFacade::DummyResourceFacade() |
41 | : Akonadi2::GenericFacade<Akonadi2::Domain::Event>("org.kde.dummy"), | 41 | : Akonadi2::GenericFacade<Akonadi2::ApplicationDomain::Event>("org.kde.dummy"), |
42 | mFactory(new DummyEventAdaptorFactory) | 42 | mFactory(new DummyEventAdaptorFactory) |
43 | { | 43 | { |
44 | } | 44 | } |
@@ -47,30 +47,30 @@ DummyResourceFacade::~DummyResourceFacade() | |||
47 | { | 47 | { |
48 | } | 48 | } |
49 | 49 | ||
50 | Async::Job<void> DummyResourceFacade::create(const Akonadi2::Domain::Event &domainObject) | 50 | Async::Job<void> DummyResourceFacade::create(const Akonadi2::ApplicationDomain::Event &domainObject) |
51 | { | 51 | { |
52 | flatbuffers::FlatBufferBuilder entityFbb; | 52 | flatbuffers::FlatBufferBuilder entityFbb; |
53 | mFactory->createBuffer(domainObject, entityFbb); | 53 | mFactory->createBuffer(domainObject, entityFbb); |
54 | return sendCreateCommand("event", QByteArray::fromRawData(reinterpret_cast<const char*>(entityFbb.GetBufferPointer()), entityFbb.GetSize())); | 54 | return sendCreateCommand("event", QByteArray::fromRawData(reinterpret_cast<const char*>(entityFbb.GetBufferPointer()), entityFbb.GetSize())); |
55 | } | 55 | } |
56 | 56 | ||
57 | Async::Job<void> DummyResourceFacade::modify(const Akonadi2::Domain::Event &domainObject) | 57 | Async::Job<void> DummyResourceFacade::modify(const Akonadi2::ApplicationDomain::Event &domainObject) |
58 | { | 58 | { |
59 | //Create message buffer and send to resource | 59 | //Create message buffer and send to resource |
60 | return Async::null<void>(); | 60 | return Async::null<void>(); |
61 | } | 61 | } |
62 | 62 | ||
63 | Async::Job<void> DummyResourceFacade::remove(const Akonadi2::Domain::Event &domainObject) | 63 | Async::Job<void> DummyResourceFacade::remove(const Akonadi2::ApplicationDomain::Event &domainObject) |
64 | { | 64 | { |
65 | //Create message buffer and send to resource | 65 | //Create message buffer and send to resource |
66 | return Async::null<void>(); | 66 | return Async::null<void>(); |
67 | } | 67 | } |
68 | 68 | ||
69 | static std::function<bool(const std::string &key, DummyEvent const *buffer, Akonadi2::Domain::Buffer::Event const *local)> prepareQuery(const Akonadi2::Query &query) | 69 | static std::function<bool(const std::string &key, DummyEvent const *buffer, Akonadi2::ApplicationDomain::Buffer::Event const *local)> prepareQuery(const Akonadi2::Query &query) |
70 | { | 70 | { |
71 | //Compose some functions to make query matching fast. | 71 | //Compose some functions to make query matching fast. |
72 | //This way we can process the query once, and convert all values into something that can be compared quickly | 72 | //This way we can process the query once, and convert all values into something that can be compared quickly |
73 | std::function<bool(const std::string &key, DummyEvent const *buffer, Akonadi2::Domain::Buffer::Event const *local)> preparedQuery; | 73 | std::function<bool(const std::string &key, DummyEvent const *buffer, Akonadi2::ApplicationDomain::Buffer::Event const *local)> preparedQuery; |
74 | if (!query.ids.isEmpty()) { | 74 | if (!query.ids.isEmpty()) { |
75 | //Match by id | 75 | //Match by id |
76 | //TODO: for id's a direct lookup would be way faster | 76 | //TODO: for id's a direct lookup would be way faster |
@@ -81,7 +81,7 @@ static std::function<bool(const std::string &key, DummyEvent const *buffer, Akon | |||
81 | for (const auto &id : query.ids) { | 81 | for (const auto &id : query.ids) { |
82 | ids << id.toStdString(); | 82 | ids << id.toStdString(); |
83 | } | 83 | } |
84 | preparedQuery = [ids](const std::string &key, DummyEvent const *buffer, Akonadi2::Domain::Buffer::Event const *local) { | 84 | preparedQuery = [ids](const std::string &key, DummyEvent const *buffer, Akonadi2::ApplicationDomain::Buffer::Event const *local) { |
85 | if (ids.contains(key)) { | 85 | if (ids.contains(key)) { |
86 | return true; | 86 | return true; |
87 | } | 87 | } |
@@ -90,7 +90,7 @@ static std::function<bool(const std::string &key, DummyEvent const *buffer, Akon | |||
90 | } else if (!query.propertyFilter.isEmpty()) { | 90 | } else if (!query.propertyFilter.isEmpty()) { |
91 | if (query.propertyFilter.contains("uid")) { | 91 | if (query.propertyFilter.contains("uid")) { |
92 | const QByteArray uid = query.propertyFilter.value("uid").toByteArray(); | 92 | const QByteArray uid = query.propertyFilter.value("uid").toByteArray(); |
93 | preparedQuery = [uid](const std::string &key, DummyEvent const *buffer, Akonadi2::Domain::Buffer::Event const *local) { | 93 | preparedQuery = [uid](const std::string &key, DummyEvent const *buffer, Akonadi2::ApplicationDomain::Buffer::Event const *local) { |
94 | if (local && local->uid() && (QByteArray::fromRawData(local->uid()->c_str(), local->uid()->size()) == uid)) { | 94 | if (local && local->uid() && (QByteArray::fromRawData(local->uid()->c_str(), local->uid()->size()) == uid)) { |
95 | return true; | 95 | return true; |
96 | } | 96 | } |
@@ -99,14 +99,14 @@ static std::function<bool(const std::string &key, DummyEvent const *buffer, Akon | |||
99 | } | 99 | } |
100 | } else { | 100 | } else { |
101 | //Match everything | 101 | //Match everything |
102 | preparedQuery = [](const std::string &key, DummyEvent const *buffer, Akonadi2::Domain::Buffer::Event const *local) { | 102 | preparedQuery = [](const std::string &key, DummyEvent const *buffer, Akonadi2::ApplicationDomain::Buffer::Event const *local) { |
103 | return true; | 103 | return true; |
104 | }; | 104 | }; |
105 | } | 105 | } |
106 | return preparedQuery; | 106 | return preparedQuery; |
107 | } | 107 | } |
108 | 108 | ||
109 | void DummyResourceFacade::readValue(QSharedPointer<Akonadi2::Storage> storage, const QByteArray &key, const std::function<void(const Akonadi2::Domain::Event::Ptr &)> &resultCallback, std::function<bool(const std::string &key, DummyEvent const *buffer, Akonadi2::Domain::Buffer::Event const *local)> preparedQuery) | 109 | void DummyResourceFacade::readValue(QSharedPointer<Akonadi2::Storage> storage, const QByteArray &key, const std::function<void(const Akonadi2::ApplicationDomain::Event::Ptr &)> &resultCallback, std::function<bool(const std::string &key, DummyEvent const *buffer, Akonadi2::ApplicationDomain::Buffer::Event const *local)> preparedQuery) |
110 | { | 110 | { |
111 | storage->scan(key, [=](void *keyValue, int keySize, void *dataValue, int dataSize) -> bool { | 111 | storage->scan(key, [=](void *keyValue, int keySize, void *dataValue, int dataSize) -> bool { |
112 | 112 | ||
@@ -119,7 +119,7 @@ void DummyResourceFacade::readValue(QSharedPointer<Akonadi2::Storage> storage, c | |||
119 | Akonadi2::EntityBuffer buffer(dataValue, dataSize); | 119 | Akonadi2::EntityBuffer buffer(dataValue, dataSize); |
120 | 120 | ||
121 | const auto resourceBuffer = Akonadi2::EntityBuffer::readBuffer<DummyEvent>(buffer.entity().resource()); | 121 | const auto resourceBuffer = Akonadi2::EntityBuffer::readBuffer<DummyEvent>(buffer.entity().resource()); |
122 | const auto localBuffer = Akonadi2::EntityBuffer::readBuffer<Akonadi2::Domain::Buffer::Event>(buffer.entity().local()); | 122 | const auto localBuffer = Akonadi2::EntityBuffer::readBuffer<Akonadi2::ApplicationDomain::Buffer::Event>(buffer.entity().local()); |
123 | const auto metadataBuffer = Akonadi2::EntityBuffer::readBuffer<Akonadi2::Metadata>(buffer.entity().metadata()); | 123 | const auto metadataBuffer = Akonadi2::EntityBuffer::readBuffer<Akonadi2::Metadata>(buffer.entity().metadata()); |
124 | 124 | ||
125 | if (!resourceBuffer || !metadataBuffer) { | 125 | if (!resourceBuffer || !metadataBuffer) { |
@@ -135,8 +135,8 @@ void DummyResourceFacade::readValue(QSharedPointer<Akonadi2::Storage> storage, c | |||
135 | //Not i.e. for tags that are stored as flags in each entity of an imap store. | 135 | //Not i.e. for tags that are stored as flags in each entity of an imap store. |
136 | auto adaptor = mFactory->createAdaptor(buffer.entity()); | 136 | auto adaptor = mFactory->createAdaptor(buffer.entity()); |
137 | //TODO only copy requested properties | 137 | //TODO only copy requested properties |
138 | auto memoryAdaptor = QSharedPointer<Akonadi2::Domain::MemoryBufferAdaptor>::create(*adaptor); | 138 | auto memoryAdaptor = QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create(*adaptor); |
139 | auto event = QSharedPointer<Akonadi2::Domain::Event>::create("org.kde.dummy", QByteArray::fromRawData(static_cast<char*>(keyValue), keySize), revision, memoryAdaptor); | 139 | auto event = QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("org.kde.dummy", QByteArray::fromRawData(static_cast<char*>(keyValue), keySize), revision, memoryAdaptor); |
140 | resultCallback(event); | 140 | resultCallback(event); |
141 | } | 141 | } |
142 | return true; | 142 | return true; |
@@ -146,7 +146,7 @@ void DummyResourceFacade::readValue(QSharedPointer<Akonadi2::Storage> storage, c | |||
146 | }); | 146 | }); |
147 | } | 147 | } |
148 | 148 | ||
149 | Async::Job<void> DummyResourceFacade::load(const Akonadi2::Query &query, const std::function<void(const Akonadi2::Domain::Event::Ptr &)> &resultCallback) | 149 | Async::Job<void> DummyResourceFacade::load(const Akonadi2::Query &query, const std::function<void(const Akonadi2::ApplicationDomain::Event::Ptr &)> &resultCallback) |
150 | { | 150 | { |
151 | return synchronizeResource(query.syncOnDemand, query.processAll).then<void>([=](Async::Future<void> &future) { | 151 | return synchronizeResource(query.syncOnDemand, query.processAll).then<void>([=](Async::Future<void> &future) { |
152 | //Now that the sync is complete we can execute the query | 152 | //Now that the sync is complete we can execute the query |
@@ -154,6 +154,7 @@ Async::Job<void> DummyResourceFacade::load(const Akonadi2::Query &query, const s | |||
154 | 154 | ||
155 | auto storage = QSharedPointer<Akonadi2::Storage>::create(Akonadi2::Store::storageLocation(), "org.kde.dummy"); | 155 | auto storage = QSharedPointer<Akonadi2::Storage>::create(Akonadi2::Store::storageLocation(), "org.kde.dummy"); |
156 | 156 | ||
157 | //Index lookups | ||
157 | QVector<QByteArray> keys; | 158 | QVector<QByteArray> keys; |
158 | if (query.propertyFilter.contains("uid")) { | 159 | if (query.propertyFilter.contains("uid")) { |
159 | static Index uidIndex(Akonadi2::Store::storageLocation(), "org.kde.dummy.index.uid", Akonadi2::Storage::ReadOnly); | 160 | static Index uidIndex(Akonadi2::Store::storageLocation(), "org.kde.dummy.index.uid", Akonadi2::Storage::ReadOnly); |
diff --git a/dummyresource/facade.h b/dummyresource/facade.h index 195c50f..7bef2cc 100644 --- a/dummyresource/facade.h +++ b/dummyresource/facade.h | |||
@@ -29,17 +29,17 @@ | |||
29 | #include "dummycalendar_generated.h" | 29 | #include "dummycalendar_generated.h" |
30 | #include "common/domainadaptor.h" | 30 | #include "common/domainadaptor.h" |
31 | 31 | ||
32 | class DummyResourceFacade : public Akonadi2::GenericFacade<Akonadi2::Domain::Event> | 32 | class DummyResourceFacade : public Akonadi2::GenericFacade<Akonadi2::ApplicationDomain::Event> |
33 | { | 33 | { |
34 | public: | 34 | public: |
35 | DummyResourceFacade(); | 35 | DummyResourceFacade(); |
36 | virtual ~DummyResourceFacade(); | 36 | virtual ~DummyResourceFacade(); |
37 | virtual Async::Job<void> create(const Akonadi2::Domain::Event &domainObject); | 37 | virtual Async::Job<void> create(const Akonadi2::ApplicationDomain::Event &domainObject); |
38 | virtual Async::Job<void> modify(const Akonadi2::Domain::Event &domainObject); | 38 | virtual Async::Job<void> modify(const Akonadi2::ApplicationDomain::Event &domainObject); |
39 | virtual Async::Job<void> remove(const Akonadi2::Domain::Event &domainObject); | 39 | virtual Async::Job<void> remove(const Akonadi2::ApplicationDomain::Event &domainObject); |
40 | virtual Async::Job<void> load(const Akonadi2::Query &query, const std::function<void(const Akonadi2::Domain::Event::Ptr &)> &resultCallback); | 40 | virtual Async::Job<void> load(const Akonadi2::Query &query, const std::function<void(const Akonadi2::ApplicationDomain::Event::Ptr &)> &resultCallback); |
41 | 41 | ||
42 | private: | 42 | private: |
43 | void readValue(QSharedPointer<Akonadi2::Storage> storage, const QByteArray &key, const std::function<void(const Akonadi2::Domain::Event::Ptr &)> &resultCallback, std::function<bool(const std::string &key, DummyCalendar::DummyEvent const *buffer, Akonadi2::Domain::Buffer::Event const *local)>); | 43 | void readValue(QSharedPointer<Akonadi2::Storage> storage, const QByteArray &key, const std::function<void(const Akonadi2::ApplicationDomain::Event::Ptr &)> &resultCallback, std::function<bool(const std::string &key, DummyCalendar::DummyEvent const *buffer, Akonadi2::ApplicationDomain::Buffer::Event const *local)>); |
44 | QSharedPointer<DomainTypeAdaptorFactory<Akonadi2::Domain::Event, Akonadi2::Domain::Buffer::Event, DummyCalendar::DummyEvent> > mFactory; | 44 | QSharedPointer<DomainTypeAdaptorFactory<Akonadi2::ApplicationDomain::Event, Akonadi2::ApplicationDomain::Buffer::Event, DummyCalendar::DummyEvent> > mFactory; |
45 | }; | 45 | }; |
diff --git a/dummyresource/resourcefactory.cpp b/dummyresource/resourcefactory.cpp index ea37466..04413c2 100644 --- a/dummyresource/resourcefactory.cpp +++ b/dummyresource/resourcefactory.cpp | |||
@@ -416,7 +416,7 @@ Akonadi2::Resource *DummyResourceFactory::createResource() | |||
416 | 416 | ||
417 | void DummyResourceFactory::registerFacades(Akonadi2::FacadeFactory &factory) | 417 | void DummyResourceFactory::registerFacades(Akonadi2::FacadeFactory &factory) |
418 | { | 418 | { |
419 | factory.registerFacade<Akonadi2::Domain::Event, DummyResourceFacade>(PLUGIN_NAME); | 419 | factory.registerFacade<Akonadi2::ApplicationDomain::Event, DummyResourceFacade>(PLUGIN_NAME); |
420 | } | 420 | } |
421 | 421 | ||
422 | #include "resourcefactory.moc" | 422 | #include "resourcefactory.moc" |
diff --git a/synchronizer/listener.cpp b/synchronizer/listener.cpp index 00d9207..7481537 100644 --- a/synchronizer/listener.cpp +++ b/synchronizer/listener.cpp | |||
@@ -365,7 +365,7 @@ void Listener::loadResource() | |||
365 | Log() << QString("Resource factory: %1").arg((qlonglong)resourceFactory); | 365 | Log() << QString("Resource factory: %1").arg((qlonglong)resourceFactory); |
366 | Log() << QString("\tResource: %1").arg((qlonglong)m_resource); | 366 | Log() << QString("\tResource: %1").arg((qlonglong)m_resource); |
367 | //TODO: this doesn't really list all the facades .. fix | 367 | //TODO: this doesn't really list all the facades .. fix |
368 | Log() << "\tFacades: " << Akonadi2::FacadeFactory::instance().getFacade<Akonadi2::Domain::Event>(m_resourceName)->type(); | 368 | Log() << "\tFacades: " << Akonadi2::FacadeFactory::instance().getFacade<Akonadi2::ApplicationDomain::Event>(m_resourceName)->type(); |
369 | m_resource->configurePipeline(m_pipeline); | 369 | m_resource->configurePipeline(m_pipeline); |
370 | } else { | 370 | } else { |
371 | Error() << "Failed to load resource " << m_resourceName; | 371 | Error() << "Failed to load resource " << m_resourceName; |
diff --git a/tests/domainadaptortest.cpp b/tests/domainadaptortest.cpp index e45a9a3..9cc3938 100644 --- a/tests/domainadaptortest.cpp +++ b/tests/domainadaptortest.cpp | |||
@@ -13,11 +13,11 @@ | |||
13 | #include "metadata_generated.h" | 13 | #include "metadata_generated.h" |
14 | #include "entity_generated.h" | 14 | #include "entity_generated.h" |
15 | 15 | ||
16 | class TestEventAdaptor : public Akonadi2::Domain::BufferAdaptor | 16 | class TestEventAdaptor : public Akonadi2::ApplicationDomain::BufferAdaptor |
17 | { | 17 | { |
18 | public: | 18 | public: |
19 | TestEventAdaptor() | 19 | TestEventAdaptor() |
20 | : Akonadi2::Domain::BufferAdaptor() | 20 | : Akonadi2::ApplicationDomain::BufferAdaptor() |
21 | { | 21 | { |
22 | } | 22 | } |
23 | 23 | ||
@@ -40,20 +40,20 @@ public: | |||
40 | return QVariant(); | 40 | return QVariant(); |
41 | } | 41 | } |
42 | 42 | ||
43 | Akonadi2::Domain::Buffer::Event const *mLocalBuffer; | 43 | Akonadi2::ApplicationDomain::Buffer::Event const *mLocalBuffer; |
44 | Akonadi2::Domain::Buffer::Event const *mResourceBuffer; | 44 | Akonadi2::ApplicationDomain::Buffer::Event const *mResourceBuffer; |
45 | 45 | ||
46 | QSharedPointer<PropertyMapper<Akonadi2::Domain::Buffer::Event> > mLocalMapper; | 46 | QSharedPointer<PropertyMapper<Akonadi2::ApplicationDomain::Buffer::Event> > mLocalMapper; |
47 | QSharedPointer<PropertyMapper<Akonadi2::Domain::Buffer::Event> > mResourceMapper; | 47 | QSharedPointer<PropertyMapper<Akonadi2::ApplicationDomain::Buffer::Event> > mResourceMapper; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | class TestFactory : public DomainTypeAdaptorFactory<Akonadi2::Domain::Event, Akonadi2::Domain::Buffer::Event, Akonadi2::Domain::Buffer::Event> | 50 | class TestFactory : public DomainTypeAdaptorFactory<Akonadi2::ApplicationDomain::Event, Akonadi2::ApplicationDomain::Buffer::Event, Akonadi2::ApplicationDomain::Buffer::Event> |
51 | { | 51 | { |
52 | public: | 52 | public: |
53 | TestFactory() | 53 | TestFactory() |
54 | { | 54 | { |
55 | mResourceMapper = QSharedPointer<PropertyMapper<Akonadi2::Domain::Buffer::Event> >::create(); | 55 | mResourceMapper = QSharedPointer<PropertyMapper<Akonadi2::ApplicationDomain::Buffer::Event> >::create(); |
56 | mResourceMapper->mReadAccessors.insert("summary", [](Akonadi2::Domain::Buffer::Event const *buffer) -> QVariant { | 56 | mResourceMapper->mReadAccessors.insert("summary", [](Akonadi2::ApplicationDomain::Buffer::Event const *buffer) -> QVariant { |
57 | if (buffer->summary()) { | 57 | if (buffer->summary()) { |
58 | return QString::fromStdString(buffer->summary()->c_str()); | 58 | return QString::fromStdString(buffer->summary()->c_str()); |
59 | } | 59 | } |
@@ -61,13 +61,13 @@ public: | |||
61 | }); | 61 | }); |
62 | } | 62 | } |
63 | 63 | ||
64 | virtual QSharedPointer<Akonadi2::Domain::BufferAdaptor> createAdaptor(const Akonadi2::Entity &entity) | 64 | virtual QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor> createAdaptor(const Akonadi2::Entity &entity) |
65 | { | 65 | { |
66 | Akonadi2::Domain::Buffer::Event const *resourceBuffer = 0; | 66 | Akonadi2::ApplicationDomain::Buffer::Event const *resourceBuffer = 0; |
67 | if (auto resourceData = entity.resource()) { | 67 | if (auto resourceData = entity.resource()) { |
68 | flatbuffers::Verifier verifyer(resourceData->Data(), resourceData->size()); | 68 | flatbuffers::Verifier verifyer(resourceData->Data(), resourceData->size()); |
69 | if (Akonadi2::Domain::Buffer::VerifyEventBuffer(verifyer)) { | 69 | if (Akonadi2::ApplicationDomain::Buffer::VerifyEventBuffer(verifyer)) { |
70 | resourceBuffer = Akonadi2::Domain::Buffer::GetEvent(resourceData->Data()); | 70 | resourceBuffer = Akonadi2::ApplicationDomain::Buffer::GetEvent(resourceData->Data()); |
71 | if (resourceBuffer->summary()) { | 71 | if (resourceBuffer->summary()) { |
72 | qDebug() << QString::fromStdString(std::string(resourceBuffer->summary()->c_str())); | 72 | qDebug() << QString::fromStdString(std::string(resourceBuffer->summary()->c_str())); |
73 | } | 73 | } |
@@ -82,11 +82,11 @@ public: | |||
82 | // } | 82 | // } |
83 | // } | 83 | // } |
84 | 84 | ||
85 | Akonadi2::Domain::Buffer::Event const *localBuffer = 0; | 85 | Akonadi2::ApplicationDomain::Buffer::Event const *localBuffer = 0; |
86 | if (auto localData = entity.local()) { | 86 | if (auto localData = entity.local()) { |
87 | flatbuffers::Verifier verifyer(localData->Data(), localData->size()); | 87 | flatbuffers::Verifier verifyer(localData->Data(), localData->size()); |
88 | if (Akonadi2::Domain::Buffer::VerifyEventBuffer(verifyer)) { | 88 | if (Akonadi2::ApplicationDomain::Buffer::VerifyEventBuffer(verifyer)) { |
89 | localBuffer = Akonadi2::Domain::Buffer::GetEvent(localData); | 89 | localBuffer = Akonadi2::ApplicationDomain::Buffer::GetEvent(localData); |
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
@@ -127,12 +127,12 @@ private Q_SLOTS: | |||
127 | static uint8_t rawData[100]; | 127 | static uint8_t rawData[100]; |
128 | auto attachment = m_fbb.CreateVector(rawData, 100); | 128 | auto attachment = m_fbb.CreateVector(rawData, 100); |
129 | 129 | ||
130 | auto builder = Akonadi2::Domain::Buffer::EventBuilder(m_fbb); | 130 | auto builder = Akonadi2::ApplicationDomain::Buffer::EventBuilder(m_fbb); |
131 | builder.add_summary(summary); | 131 | builder.add_summary(summary); |
132 | builder.add_description(description); | 132 | builder.add_description(description); |
133 | builder.add_attachment(attachment); | 133 | builder.add_attachment(attachment); |
134 | auto buffer = builder.Finish(); | 134 | auto buffer = builder.Finish(); |
135 | Akonadi2::Domain::Buffer::FinishEventBuffer(m_fbb, buffer); | 135 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(m_fbb, buffer); |
136 | 136 | ||
137 | flatbuffers::FlatBufferBuilder fbb; | 137 | flatbuffers::FlatBufferBuilder fbb; |
138 | Akonadi2::EntityBuffer::assembleEntityBuffer(fbb, metadataFbb.GetBufferPointer(), metadataFbb.GetSize(), m_fbb.GetBufferPointer(), m_fbb.GetSize(), m_fbb.GetBufferPointer(), m_fbb.GetSize()); | 138 | Akonadi2::EntityBuffer::assembleEntityBuffer(fbb, metadataFbb.GetBufferPointer(), metadataFbb.GetSize(), m_fbb.GetBufferPointer(), m_fbb.GetSize(), m_fbb.GetBufferPointer(), m_fbb.GetSize()); |
diff --git a/tests/dummyresourcebenchmark.cpp b/tests/dummyresourcebenchmark.cpp index 308a4e8..ea3f556 100644 --- a/tests/dummyresourcebenchmark.cpp +++ b/tests/dummyresourcebenchmark.cpp | |||
@@ -47,11 +47,11 @@ private Q_SLOTS: | |||
47 | time.start(); | 47 | time.start(); |
48 | int num = 10000; | 48 | int num = 10000; |
49 | for (int i = 0; i < num; i++) { | 49 | for (int i = 0; i < num; i++) { |
50 | Akonadi2::Domain::Event event; | 50 | Akonadi2::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 | event.setProperty("summary", "summaryValue"); | 53 | event.setProperty("summary", "summaryValue"); |
54 | Akonadi2::Store::create<Akonadi2::Domain::Event>(event, "org.kde.dummy"); | 54 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Event>(event, "org.kde.dummy"); |
55 | } | 55 | } |
56 | auto appendTime = time.elapsed(); | 56 | auto appendTime = time.elapsed(); |
57 | 57 | ||
@@ -63,7 +63,7 @@ private Q_SLOTS: | |||
63 | query.processAll = true; | 63 | query.processAll = true; |
64 | 64 | ||
65 | query.propertyFilter.insert("uid", "nonexistantuid"); | 65 | query.propertyFilter.insert("uid", "nonexistantuid"); |
66 | async::SyncListResult<Akonadi2::Domain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::Domain::Event>(query)); | 66 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); |
67 | result.exec(); | 67 | result.exec(); |
68 | } | 68 | } |
69 | auto allProcessedTime = time.elapsed(); | 69 | auto allProcessedTime = time.elapsed(); |
@@ -77,7 +77,7 @@ private Q_SLOTS: | |||
77 | query.processAll = false; | 77 | query.processAll = false; |
78 | 78 | ||
79 | query.propertyFilter.insert("uid", "testuid"); | 79 | query.propertyFilter.insert("uid", "testuid"); |
80 | async::SyncListResult<Akonadi2::Domain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::Domain::Event>(query)); | 80 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); |
81 | result.exec(); | 81 | result.exec(); |
82 | QCOMPARE(result.size(), num); | 82 | QCOMPARE(result.size(), num); |
83 | } | 83 | } |
@@ -146,7 +146,7 @@ private Q_SLOTS: | |||
146 | } | 146 | } |
147 | void testCreateCommand() | 147 | void testCreateCommand() |
148 | { | 148 | { |
149 | Akonadi2::Domain::Event event; | 149 | Akonadi2::ApplicationDomain::Event event; |
150 | 150 | ||
151 | QBENCHMARK { | 151 | QBENCHMARK { |
152 | auto mFactory = new DummyEventAdaptorFactory; | 152 | auto mFactory = new DummyEventAdaptorFactory; |
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index b185664..5fed7cd 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp | |||
@@ -49,26 +49,26 @@ private Q_SLOTS: | |||
49 | eventFbb.Clear(); | 49 | eventFbb.Clear(); |
50 | { | 50 | { |
51 | auto summary = eventFbb.CreateString("summary"); | 51 | auto summary = eventFbb.CreateString("summary"); |
52 | Akonadi2::Domain::Buffer::EventBuilder eventBuilder(eventFbb); | 52 | Akonadi2::ApplicationDomain::Buffer::EventBuilder eventBuilder(eventFbb); |
53 | eventBuilder.add_summary(summary); | 53 | eventBuilder.add_summary(summary); |
54 | auto eventLocation = eventBuilder.Finish(); | 54 | auto eventLocation = eventBuilder.Finish(); |
55 | Akonadi2::Domain::Buffer::FinishEventBuffer(eventFbb, eventLocation); | 55 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(eventFbb, eventLocation); |
56 | } | 56 | } |
57 | 57 | ||
58 | flatbuffers::FlatBufferBuilder localFbb; | 58 | flatbuffers::FlatBufferBuilder localFbb; |
59 | { | 59 | { |
60 | auto uid = localFbb.CreateString("testuid"); | 60 | auto uid = localFbb.CreateString("testuid"); |
61 | auto localBuilder = Akonadi2::Domain::Buffer::EventBuilder(localFbb); | 61 | auto localBuilder = Akonadi2::ApplicationDomain::Buffer::EventBuilder(localFbb); |
62 | localBuilder.add_uid(uid); | 62 | localBuilder.add_uid(uid); |
63 | auto location = localBuilder.Finish(); | 63 | auto location = localBuilder.Finish(); |
64 | Akonadi2::Domain::Buffer::FinishEventBuffer(localFbb, location); | 64 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(localFbb, location); |
65 | } | 65 | } |
66 | 66 | ||
67 | flatbuffers::FlatBufferBuilder entityFbb; | 67 | flatbuffers::FlatBufferBuilder entityFbb; |
68 | Akonadi2::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize()); | 68 | Akonadi2::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize()); |
69 | 69 | ||
70 | flatbuffers::FlatBufferBuilder fbb; | 70 | flatbuffers::FlatBufferBuilder fbb; |
71 | auto type = fbb.CreateString(Akonadi2::Domain::getTypeName<Akonadi2::Domain::Event>().toStdString().data()); | 71 | auto type = fbb.CreateString(Akonadi2::ApplicationDomain::getTypeName<Akonadi2::ApplicationDomain::Event>().toStdString().data()); |
72 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); | 72 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); |
73 | Akonadi2::Commands::CreateEntityBuilder builder(fbb); | 73 | Akonadi2::Commands::CreateEntityBuilder builder(fbb); |
74 | builder.add_domainType(type); | 74 | builder.add_domainType(type); |
@@ -98,18 +98,18 @@ private Q_SLOTS: | |||
98 | 98 | ||
99 | void testProperty() | 99 | void testProperty() |
100 | { | 100 | { |
101 | Akonadi2::Domain::Event event; | 101 | Akonadi2::ApplicationDomain::Event event; |
102 | event.setProperty("uid", "testuid"); | 102 | event.setProperty("uid", "testuid"); |
103 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); | 103 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); |
104 | } | 104 | } |
105 | 105 | ||
106 | void testWriteToFacadeAndQueryByUid() | 106 | void testWriteToFacadeAndQueryByUid() |
107 | { | 107 | { |
108 | Akonadi2::Domain::Event event; | 108 | Akonadi2::ApplicationDomain::Event event; |
109 | event.setProperty("uid", "testuid"); | 109 | event.setProperty("uid", "testuid"); |
110 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); | 110 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); |
111 | event.setProperty("summary", "summaryValue"); | 111 | event.setProperty("summary", "summaryValue"); |
112 | Akonadi2::Store::create<Akonadi2::Domain::Event>(event, "org.kde.dummy"); | 112 | Akonadi2::Store::create<Akonadi2::ApplicationDomain::Event>(event, "org.kde.dummy"); |
113 | 113 | ||
114 | Akonadi2::Query query; | 114 | Akonadi2::Query query; |
115 | query.resources << "org.kde.dummy"; | 115 | query.resources << "org.kde.dummy"; |
@@ -117,7 +117,7 @@ private Q_SLOTS: | |||
117 | query.processAll = true; | 117 | query.processAll = true; |
118 | 118 | ||
119 | query.propertyFilter.insert("uid", "testuid"); | 119 | query.propertyFilter.insert("uid", "testuid"); |
120 | async::SyncListResult<Akonadi2::Domain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::Domain::Event>(query)); | 120 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); |
121 | result.exec(); | 121 | result.exec(); |
122 | QCOMPARE(result.size(), 1); | 122 | QCOMPARE(result.size(), 1); |
123 | auto value = result.first(); | 123 | auto value = result.first(); |
@@ -147,7 +147,7 @@ private Q_SLOTS: | |||
147 | query.syncOnDemand = true; | 147 | query.syncOnDemand = true; |
148 | query.processAll = true; | 148 | query.processAll = true; |
149 | 149 | ||
150 | async::SyncListResult<Akonadi2::Domain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::Domain::Event>(query)); | 150 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Event>(query)); |
151 | result.exec(); | 151 | result.exec(); |
152 | QVERIFY(!result.isEmpty()); | 152 | QVERIFY(!result.isEmpty()); |
153 | auto value = result.first(); | 153 | auto value = result.first(); |