From bf00b2c3a0fbfbdcbd7c5f4ab519049dc02c1263 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 30 Jan 2015 01:10:37 +0100 Subject: Shutdown command for synchronizers, used by the dummyresourcetest. Otherwise the synchronizer keeps a Storage object alive, while the tests deletes the db. This causes subsequent writes to fail in the next test. --- common/clientapi.cpp | 12 ++++++++++++ common/clientapi.h | 2 ++ common/commands.h | 1 + 3 files changed, 15 insertions(+) (limited to 'common') diff --git a/common/clientapi.cpp b/common/clientapi.cpp index 2a4b603..260b6b8 100644 --- a/common/clientapi.cpp +++ b/common/clientapi.cpp @@ -1,5 +1,7 @@ #include "clientapi.h" +#include "resourceaccess.h" +#include "commands.h" namespace async { @@ -35,4 +37,14 @@ QString getTypeName() } // namespace Domain +void Store::shutdown(const QString &identifier) +{ + Akonadi2::ResourceAccess resourceAccess(identifier); + resourceAccess.open(); + resourceAccess.sendCommand(Akonadi2::Commands::ShutdownCommand).then([](Async::Future &f){ + //TODO wait for disconnect + f.setFinished(); + }).exec().waitForFinished(); +} + } // namespace Akonadi2 diff --git a/common/clientapi.h b/common/clientapi.h index 542039e..71317a1 100644 --- a/common/clientapi.h +++ b/common/clientapi.h @@ -488,6 +488,8 @@ public: auto facade = FacadeFactory::instance().getFacade(resourceIdentifier); facade.remove(domainObject); } + + static void shutdown(const QString &resourceIdentifier); }; } diff --git a/common/commands.h b/common/commands.h index c63bb47..26729dc 100644 --- a/common/commands.h +++ b/common/commands.h @@ -42,6 +42,7 @@ enum CommandIds { ModifyEntityCommand, CreateEntityCommand, SearchSourceCommand, // need a buffer definition for this, but relies on Query API + ShutdownCommand, CustomCommand = 0xffff }; -- cgit v1.2.3