From 016fea734d09df707be9a16a4ad6a1107f41549f Mon Sep 17 00:00:00 2001 From: Minijackson Date: Wed, 27 Jun 2018 11:12:38 +0200 Subject: Fix pipelinetest + remove useless commented lines --- tests/pipelinetest.cpp | 13 ++++++------- tests/storagetest.cpp | 9 +++++---- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/pipelinetest.cpp b/tests/pipelinetest.cpp index 5165d35..2610305 100644 --- a/tests/pipelinetest.cpp +++ b/tests/pipelinetest.cpp @@ -22,6 +22,8 @@ #include "adaptorfactoryregistry.h" #include "storage/key.h" +// TODO: fix test + static void removeFromDisk(const QString &name) { Sink::Storage::DataStore store(Sink::Store::storageLocation(), name, Sink::Storage::DataStore::ReadWrite); @@ -379,8 +381,7 @@ private slots: pipeline.newEntity(command.constData(), command.size()); QCOMPARE(testProcessor->newUids.size(), 1); QCOMPARE(testProcessor->newRevisions.size(), 1); - // Key doesn't contain revision and is just the uid - const auto uid = Sink::Storage::Key::fromDisplayByteArray(testProcessor->newUids.at(0)).identifier().toDisplayByteArray(); + const auto uid = Sink::Storage::Identifier::fromDisplayByteArray(testProcessor->newUids.at(0)).toDisplayByteArray(); QCOMPARE(testProcessor->newUids.at(0), uid); } pipeline.commit(); @@ -388,14 +389,13 @@ private slots: pipeline.startTransaction(); auto keys = getKeys(instanceIdentifier(), "event.main"); QCOMPARE(keys.size(), 1); - const auto uid = Sink::Storage::Key::fromDisplayByteArray(keys.first()).identifier().toDisplayByteArray(); + const auto uid = Sink::Storage::Key::fromInternalByteArray(keys.first()).identifier().toDisplayByteArray(); { auto modifyCommand = modifyEntityCommand(createEvent(entityFbb, "summary2"), uid, 1); pipeline.modifiedEntity(modifyCommand.constData(), modifyCommand.size()); QCOMPARE(testProcessor->modifiedUids.size(), 1); QCOMPARE(testProcessor->modifiedRevisions.size(), 1); - // Key doesn't contain revision and is just the uid - const auto uid2 = Sink::Storage::Key::fromDisplayByteArray(testProcessor->modifiedUids.at(0)).identifier().toDisplayByteArray(); + const auto uid2 = Sink::Storage::Identifier::fromDisplayByteArray(testProcessor->modifiedUids.at(0)).toDisplayByteArray(); QCOMPARE(testProcessor->modifiedUids.at(0), uid2); } pipeline.commit(); @@ -407,8 +407,7 @@ private slots: QCOMPARE(testProcessor->deletedUids.size(), 1); QCOMPARE(testProcessor->deletedUids.size(), 1); QCOMPARE(testProcessor->deletedSummaries.size(), 1); - // Key doesn't contain revision and is just the uid - const auto uid2 = Sink::Storage::Key::fromDisplayByteArray(testProcessor->modifiedUids.at(0)).identifier().toDisplayByteArray(); + const auto uid2 = Sink::Storage::Identifier::fromDisplayByteArray(testProcessor->modifiedUids.at(0)).toDisplayByteArray(); QCOMPARE(testProcessor->deletedUids.at(0), uid2); QCOMPARE(testProcessor->deletedSummaries.at(0), QByteArray("summary2")); } diff --git a/tests/storagetest.cpp b/tests/storagetest.cpp index d3f180a..2ddbebf 100644 --- a/tests/storagetest.cpp +++ b/tests/storagetest.cpp @@ -457,10 +457,11 @@ private slots: auto db = transaction.openDatabase("test", nullptr, false); const auto uid = "{c5d06a9f-1534-4c52-b8ea-415db68bdadf}"; //Ensure we can sort 1 and 10 properly (by default string comparison 10 comes before 6) - const auto key1 = Sink::Storage::Key(Sink::Storage::Identifier::fromDisplayByteArray(uid), 6); - db.write(key1.toInternalByteArray(), "value1"); - const auto key2 = Sink::Storage::Key(Sink::Storage::Identifier::fromDisplayByteArray(uid), 10); - db.write(key2.toInternalByteArray(), "value2"); + const auto id = Sink::Storage::Identifier::fromDisplayByteArray(uid); + auto key = Sink::Storage::Key(id, 6); + db.write(key.toInternalByteArray(), "value1"); + key.setRevision(10); + db.write(key.toInternalByteArray(), "value2"); db.findLatest(uid, [&](const QByteArray &key, const QByteArray &value) { result = value; }); QCOMPARE(result, QByteArray("value2")); } -- cgit v1.2.3