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/genericresourcetest.cpp | |
parent | 17e7ee40c9185c0505883853345fd6024c675b1a (diff) | |
download | sink-bdb01c2c068df326f5a8328ed1492ab1bea388c5.tar.gz sink-bdb01c2c068df326f5a8328ed1492ab1bea388c5.zip |
Renamed Akonadi2 to Sink
(except for documentation).
Diffstat (limited to 'tests/genericresourcetest.cpp')
-rw-r--r-- | tests/genericresourcetest.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
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 | } |