diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/domainadaptortest.cpp | 36 | ||||
-rw-r--r-- | tests/dummyresourcebenchmark.cpp | 10 | ||||
-rw-r--r-- | tests/dummyresourcetest.cpp | 20 |
3 files changed, 33 insertions, 33 deletions
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(); |