diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dummyresourcebenchmark.cpp | 11 | ||||
-rw-r--r-- | tests/dummyresourcetest.cpp | 8 | ||||
-rw-r--r-- | tests/genericresourcetest.cpp | 22 |
3 files changed, 18 insertions, 23 deletions
diff --git a/tests/dummyresourcebenchmark.cpp b/tests/dummyresourcebenchmark.cpp index 7d40779..4c649a9 100644 --- a/tests/dummyresourcebenchmark.cpp +++ b/tests/dummyresourcebenchmark.cpp | |||
@@ -8,11 +8,13 @@ | |||
8 | #include "commands.h" | 8 | #include "commands.h" |
9 | #include "entitybuffer.h" | 9 | #include "entitybuffer.h" |
10 | #include "synclistresult.h" | 10 | #include "synclistresult.h" |
11 | #include "pipeline.h" | ||
11 | 12 | ||
12 | #include "event_generated.h" | 13 | #include "event_generated.h" |
13 | #include "entity_generated.h" | 14 | #include "entity_generated.h" |
14 | #include "metadata_generated.h" | 15 | #include "metadata_generated.h" |
15 | #include "createentity_generated.h" | 16 | #include "createentity_generated.h" |
17 | |||
16 | #include <iostream> | 18 | #include <iostream> |
17 | 19 | ||
18 | static void removeFromDisk(const QString &name) | 20 | static void removeFromDisk(const QString &name) |
@@ -94,10 +96,9 @@ private Q_SLOTS: | |||
94 | time.start(); | 96 | time.start(); |
95 | int num = 10000; | 97 | int num = 10000; |
96 | 98 | ||
97 | Akonadi2::Pipeline pipeline("org.kde.dummy.instance1"); | 99 | auto pipeline = QSharedPointer<Akonadi2::Pipeline>::create("org.kde.dummy.instance1"); |
98 | QSignalSpy revisionSpy(&pipeline, SIGNAL(revisionUpdated())); | 100 | QSignalSpy revisionSpy(pipeline.data(), SIGNAL(revisionUpdated())); |
99 | DummyResource resource("org.kde.dummy.instance1"); | 101 | DummyResource resource("org.kde.dummy.instance1", pipeline); |
100 | resource.configurePipeline(&pipeline); | ||
101 | 102 | ||
102 | flatbuffers::FlatBufferBuilder eventFbb; | 103 | flatbuffers::FlatBufferBuilder eventFbb; |
103 | eventFbb.Clear(); | 104 | eventFbb.Clear(); |
@@ -133,7 +134,7 @@ private Q_SLOTS: | |||
133 | const QByteArray command(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); | 134 | const QByteArray command(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); |
134 | 135 | ||
135 | for (int i = 0; i < num; i++) { | 136 | for (int i = 0; i < num; i++) { |
136 | resource.processCommand(Akonadi2::Commands::CreateEntityCommand, command, &pipeline); | 137 | resource.processCommand(Akonadi2::Commands::CreateEntityCommand, command); |
137 | } | 138 | } |
138 | auto appendTime = time.elapsed(); | 139 | auto appendTime = time.elapsed(); |
139 | 140 | ||
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index 10cd7e3..1a4d6ca 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp | |||
@@ -12,6 +12,7 @@ | |||
12 | #include "commands.h" | 12 | #include "commands.h" |
13 | #include "entitybuffer.h" | 13 | #include "entitybuffer.h" |
14 | #include "resourceconfig.h" | 14 | #include "resourceconfig.h" |
15 | #include "pipeline.h" | ||
15 | 16 | ||
16 | static void removeFromDisk(const QString &name) | 17 | static void removeFromDisk(const QString &name) |
17 | { | 18 | { |
@@ -133,10 +134,9 @@ private Q_SLOTS: | |||
133 | 134 | ||
134 | void testResourceSync() | 135 | void testResourceSync() |
135 | { | 136 | { |
136 | Akonadi2::Pipeline pipeline("org.kde.dummy.instance1"); | 137 | auto pipeline = QSharedPointer<Akonadi2::Pipeline>::create("org.kde.dummy.instance1"); |
137 | DummyResource resource("org.kde.dummy.instance1"); | 138 | DummyResource resource("org.kde.dummy.instance1", pipeline); |
138 | resource.configurePipeline(&pipeline); | 139 | auto job = resource.synchronizeWithSource(); |
139 | auto job = resource.synchronizeWithSource(&pipeline); | ||
140 | //TODO pass in optional timeout? | 140 | //TODO pass in optional timeout? |
141 | auto future = job.exec(); | 141 | auto future = job.exec(); |
142 | future.waitForFinished(); | 142 | future.waitForFinished(); |
diff --git a/tests/genericresourcetest.cpp b/tests/genericresourcetest.cpp index 0b9a5c1..b6f629a 100644 --- a/tests/genericresourcetest.cpp +++ b/tests/genericresourcetest.cpp | |||
@@ -14,20 +14,15 @@ | |||
14 | class TestResource : public Akonadi2::GenericResource | 14 | class TestResource : public Akonadi2::GenericResource |
15 | { | 15 | { |
16 | public: | 16 | public: |
17 | TestResource(const QByteArray &instanceIdentifier) | 17 | TestResource(const QByteArray &instanceIdentifier, QSharedPointer<Akonadi2::Pipeline> pipeline) |
18 | : Akonadi2::GenericResource(instanceIdentifier) | 18 | : Akonadi2::GenericResource(instanceIdentifier, pipeline) |
19 | { | 19 | { |
20 | } | 20 | } |
21 | 21 | ||
22 | KAsync::Job<void> synchronizeWithSource(Akonadi2::Pipeline *pipeline) Q_DECL_OVERRIDE | 22 | KAsync::Job<void> synchronizeWithSource() Q_DECL_OVERRIDE |
23 | { | 23 | { |
24 | return KAsync::null<void>(); | 24 | return KAsync::null<void>(); |
25 | } | 25 | } |
26 | |||
27 | void configurePipeline(Akonadi2::Pipeline *pipeline) Q_DECL_OVERRIDE | ||
28 | { | ||
29 | GenericResource::configurePipeline(pipeline); | ||
30 | } | ||
31 | }; | 26 | }; |
32 | 27 | ||
33 | 28 | ||
@@ -89,12 +84,11 @@ private Q_SLOTS: | |||
89 | } | 84 | } |
90 | 85 | ||
91 | //Actual test | 86 | //Actual test |
92 | Akonadi2::Pipeline pipeline("org.kde.test.instance1"); | 87 | auto pipeline = QSharedPointer<Akonadi2::Pipeline>::create("org.kde.test.instance1"); |
93 | QSignalSpy revisionSpy(&pipeline, SIGNAL(revisionUpdated(qint64))); | 88 | QSignalSpy revisionSpy(pipeline.data(), SIGNAL(revisionUpdated(qint64))); |
94 | TestResource resource("org.kde.test.instance1"); | 89 | TestResource resource("org.kde.test.instance1", pipeline); |
95 | resource.configurePipeline(&pipeline); | 90 | resource.processCommand(Akonadi2::Commands::CreateEntityCommand, command); |
96 | resource.processCommand(Akonadi2::Commands::CreateEntityCommand, command, &pipeline); | 91 | resource.processCommand(Akonadi2::Commands::CreateEntityCommand, command); |
97 | resource.processCommand(Akonadi2::Commands::CreateEntityCommand, command, &pipeline); | ||
98 | 92 | ||
99 | QVERIFY(revisionSpy.isValid()); | 93 | QVERIFY(revisionSpy.isValid()); |
100 | QTRY_COMPARE(revisionSpy.count(), 2); | 94 | QTRY_COMPARE(revisionSpy.count(), 2); |