From c3f6e72c2d46906a4699127b558ca248729ce577 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 29 Sep 2015 00:52:07 +0200 Subject: Revision cleanup --- tests/pipelinetest.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/pipelinetest.cpp b/tests/pipelinetest.cpp index 96448e2..5dede64 100644 --- a/tests/pipelinetest.cpp +++ b/tests/pipelinetest.cpp @@ -210,6 +210,17 @@ private Q_SLOTS: Akonadi2::EntityBuffer entityBuffer(buffer.data(), buffer.size()); auto adaptor = adaptorFactory->createAdaptor(entityBuffer.entity()); QCOMPARE(adaptor->getProperty("summary").toString(), QString("summary2")); + + //Both revisions are in the store at this point + QCOMPARE(getKeys("org.kde.pipelinetest.instance1", "event.main").size(), 2); + + //Cleanup old revisions + pipeline.startTransaction(); + pipeline.cleanupRevision(2); + pipeline.commit(); + + //And now only the latest revision is left + QCOMPARE(getKeys("org.kde.pipelinetest.instance1", "event.main").size(), 1); } void testDelete() @@ -230,10 +241,18 @@ private Q_SLOTS: const auto uid = Akonadi2::Storage::uidFromKey(result.first()); //Delete entity - auto deleteCommand = deleteEntityCommand(uid,1); + auto deleteCommand = deleteEntityCommand(uid, 1); pipeline.startTransaction(); pipeline.deletedEntity(deleteCommand.constData(), deleteCommand.size()); pipeline.commit(); + + //Cleanup old revisions + pipeline.startTransaction(); + pipeline.cleanupRevision(2); + pipeline.commit(); + + //And all revisions are gone + QCOMPARE(getKeys("org.kde.pipelinetest.instance1", "event.main").size(), 0); } }; -- cgit v1.2.3