summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-06-26 14:23:23 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-06-26 14:23:23 +0200
commitcb81ef8f69f6a48ed505f5aef50c62a10aa67283 (patch)
treee12b398c1a7f054d62bf3e9a26b8bb7b18b939f7
parentcf487248df311bd055844ce44786e28ea5aa7c2c (diff)
downloadsink-cb81ef8f69f6a48ed505f5aef50c62a10aa67283.tar.gz
sink-cb81ef8f69f6a48ed505f5aef50c62a10aa67283.zip
Remove the store from the resource side.
...and shutdown the resource after we removed all data.
-rw-r--r--common/listener.cpp5
-rw-r--r--examples/imapresource/tests/imapmailtest.cpp6
-rw-r--r--examples/maildirresource/tests/maildirmailtest.cpp6
-rw-r--r--tests/mailtest.cpp3
-rw-r--r--tests/mailtest.h1
5 files changed, 4 insertions, 17 deletions
diff --git a/common/listener.cpp b/common/listener.cpp
index cb974cf..84afe16 100644
--- a/common/listener.cpp
+++ b/common/listener.cpp
@@ -293,10 +293,11 @@ void Listener::processCommand(int commandId, uint messageId, const QByteArray &c
293 } break; 293 } break;
294 case Sink::Commands::RemoveFromDiskCommand: { 294 case Sink::Commands::RemoveFromDiskCommand: {
295 Log() << QString("Received a remove from disk command from %1").arg(client.name); 295 Log() << QString("Received a remove from disk command from %1").arg(client.name);
296 m_resource->removeDataFromDisk();
297 delete m_resource; 296 delete m_resource;
298 m_resource = nullptr; 297 m_resource = nullptr;
299 loadResource()->setLowerBoundRevision(0); 298 loadResource()->removeDataFromDisk();
299 m_server->close();
300 QTimer::singleShot(0, this, &Listener::quit);
300 } break; 301 } break;
301 default: 302 default:
302 if (commandId > Sink::Commands::CustomCommand) { 303 if (commandId > Sink::Commands::CustomCommand) {
diff --git a/examples/imapresource/tests/imapmailtest.cpp b/examples/imapresource/tests/imapmailtest.cpp
index d17d7da..c94a731 100644
--- a/examples/imapresource/tests/imapmailtest.cpp
+++ b/examples/imapresource/tests/imapmailtest.cpp
@@ -1,7 +1,6 @@
1#include <QtTest> 1#include <QtTest>
2 2
3#include <tests/mailtest.h> 3#include <tests/mailtest.h>
4#include "../imapresource.h"
5 4
6#include "common/test.h" 5#include "common/test.h"
7#include "common/domain/applicationdomaintype.h" 6#include "common/domain/applicationdomaintype.h"
@@ -33,11 +32,6 @@ protected:
33 resource.setProperty("password", "doe"); 32 resource.setProperty("password", "doe");
34 return resource; 33 return resource;
35 } 34 }
36
37 void removeResourceFromDisk(const QByteArray &identifier) Q_DECL_OVERRIDE
38 {
39 ::ImapResource::removeFromDisk(identifier);
40 }
41}; 35};
42 36
43QTEST_MAIN(ImapMailTest) 37QTEST_MAIN(ImapMailTest)
diff --git a/examples/maildirresource/tests/maildirmailtest.cpp b/examples/maildirresource/tests/maildirmailtest.cpp
index caaf552..a3fc772 100644
--- a/examples/maildirresource/tests/maildirmailtest.cpp
+++ b/examples/maildirresource/tests/maildirmailtest.cpp
@@ -1,7 +1,6 @@
1#include <QtTest> 1#include <QtTest>
2 2
3#include <tests/mailtest.h> 3#include <tests/mailtest.h>
4#include "../maildirresource.h"
5 4
6#include "common/test.h" 5#include "common/test.h"
7#include "common/domain/applicationdomaintype.h" 6#include "common/domain/applicationdomaintype.h"
@@ -33,11 +32,6 @@ protected:
33 resource.setProperty("path", targetPath); 32 resource.setProperty("path", targetPath);
34 return resource; 33 return resource;
35 } 34 }
36
37 void removeResourceFromDisk(const QByteArray &identifier) Q_DECL_OVERRIDE
38 {
39 ::MaildirResource::removeFromDisk(identifier);
40 }
41}; 35};
42 36
43QTEST_MAIN(MaildirMailTest) 37QTEST_MAIN(MaildirMailTest)
diff --git a/tests/mailtest.cpp b/tests/mailtest.cpp
index 541656f..b9d496d 100644
--- a/tests/mailtest.cpp
+++ b/tests/mailtest.cpp
@@ -47,8 +47,7 @@ void MailTest::initTestCase()
47 47
48void MailTest::cleanup() 48void MailTest::cleanup()
49{ 49{
50 VERIFYEXEC(ResourceControl::shutdown(mResourceInstanceIdentifier)); 50 VERIFYEXEC(Store::removeDataFromDisk(mResourceInstanceIdentifier));
51 removeResourceFromDisk(mResourceInstanceIdentifier);
52} 51}
53 52
54void MailTest::init() 53void MailTest::init()
diff --git a/tests/mailtest.h b/tests/mailtest.h
index 362e044..2144bf1 100644
--- a/tests/mailtest.h
+++ b/tests/mailtest.h
@@ -36,7 +36,6 @@ protected:
36 36
37 virtual void resetTestEnvironment() = 0; 37 virtual void resetTestEnvironment() = 0;
38 virtual Sink::ApplicationDomain::SinkResource createResource() = 0; 38 virtual Sink::ApplicationDomain::SinkResource createResource() = 0;
39 virtual void removeResourceFromDisk(const QByteArray &mResourceInstanceIdentifier) = 0;
40 39
41private slots: 40private slots:
42 void initTestCase(); 41 void initTestCase();