diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/dummyresourcebenchmark.cpp | 22 |
2 files changed, 22 insertions, 1 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8257c8a..a38471f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt | |||
@@ -2,6 +2,7 @@ add_subdirectory(hawd) | |||
2 | 2 | ||
3 | set(CMAKE_AUTOMOC ON) | 3 | set(CMAKE_AUTOMOC ON) |
4 | include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/hawd) | 4 | include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/hawd) |
5 | include_directories (${CMAKE_CURRENT_BINARY_DIR}/../dummyresource) | ||
5 | 6 | ||
6 | generate_flatbuffers(calendar) | 7 | generate_flatbuffers(calendar) |
7 | 8 | ||
diff --git a/tests/dummyresourcebenchmark.cpp b/tests/dummyresourcebenchmark.cpp index 7375ff8..308a4e8 100644 --- a/tests/dummyresourcebenchmark.cpp +++ b/tests/dummyresourcebenchmark.cpp | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <QString> | 3 | #include <QString> |
4 | 4 | ||
5 | #include "dummyresource/resourcefactory.h" | 5 | #include "dummyresource/resourcefactory.h" |
6 | #include "dummyresource/domainadaptor.h" | ||
6 | #include "clientapi.h" | 7 | #include "clientapi.h" |
7 | #include "commands.h" | 8 | #include "commands.h" |
8 | #include "entitybuffer.h" | 9 | #include "entitybuffer.h" |
@@ -11,7 +12,6 @@ | |||
11 | #include "entity_generated.h" | 12 | #include "entity_generated.h" |
12 | #include "metadata_generated.h" | 13 | #include "metadata_generated.h" |
13 | #include "createentity_generated.h" | 14 | #include "createentity_generated.h" |
14 | #include "dummyresource/resourcefactory.h" | ||
15 | 15 | ||
16 | static void removeFromDisk(const QString &name) | 16 | static void removeFromDisk(const QString &name) |
17 | { | 17 | { |
@@ -144,6 +144,26 @@ private Q_SLOTS: | |||
144 | qDebug() << "Append to messagequeue " << appendTime; | 144 | qDebug() << "Append to messagequeue " << appendTime; |
145 | qDebug() << "All processed: " << allProcessedTime << "/sec " << num*1000/allProcessedTime; | 145 | qDebug() << "All processed: " << allProcessedTime << "/sec " << num*1000/allProcessedTime; |
146 | } | 146 | } |
147 | void testCreateCommand() | ||
148 | { | ||
149 | Akonadi2::Domain::Event event; | ||
150 | |||
151 | QBENCHMARK { | ||
152 | auto mFactory = new DummyEventAdaptorFactory; | ||
153 | static flatbuffers::FlatBufferBuilder entityFbb; | ||
154 | entityFbb.Clear(); | ||
155 | mFactory->createBuffer(event, entityFbb); | ||
156 | |||
157 | static flatbuffers::FlatBufferBuilder fbb; | ||
158 | fbb.Clear(); | ||
159 | //This is the resource buffer type and not the domain type | ||
160 | auto type = fbb.CreateString("event"); | ||
161 | // auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); | ||
162 | auto delta = Akonadi2::EntityBuffer::appendAsVector(fbb, entityFbb.GetBufferPointer(), entityFbb.GetSize()); | ||
163 | auto location = Akonadi2::Commands::CreateCreateEntity(fbb, type, delta); | ||
164 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); | ||
165 | } | ||
166 | } | ||
147 | }; | 167 | }; |
148 | 168 | ||
149 | QTEST_MAIN(DummyResourceBenchmark) | 169 | QTEST_MAIN(DummyResourceBenchmark) |