diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-26 14:47:15 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-26 14:47:15 +0200 |
commit | b86ffa5a6e7884fb7a25fa84358de3caaeff11e8 (patch) | |
tree | e27f9b024cc6115802b417c04f6a81f927c7c75a | |
parent | 874b0d2be32e2edffedd59ab17bf821456757e29 (diff) | |
download | sink-b86ffa5a6e7884fb7a25fa84358de3caaeff11e8.tar.gz sink-b86ffa5a6e7884fb7a25fa84358de3caaeff11e8.zip |
Dummyresource mailtest
-rw-r--r-- | common/domain/applicationdomaintype.cpp | 12 | ||||
-rw-r--r-- | common/domain/applicationdomaintype.h | 3 | ||||
-rw-r--r-- | examples/dummyresource/resourcefactory.cpp | 3 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/dummyresourcemailtest.cpp | 29 |
5 files changed, 47 insertions, 1 deletions
diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp index d1faf25..44eeb13 100644 --- a/common/domain/applicationdomaintype.cpp +++ b/common/domain/applicationdomaintype.cpp | |||
@@ -247,6 +247,18 @@ Identity::~Identity() | |||
247 | 247 | ||
248 | } | 248 | } |
249 | 249 | ||
250 | namespace DummyResource { | ||
251 | SinkResource create(const QByteArray &account) | ||
252 | { | ||
253 | auto &&resource = ApplicationDomainType::createEntity<SinkResource>(); | ||
254 | resource.setProperty("type", "org.kde.dummy"); | ||
255 | resource.setProperty("account", account); | ||
256 | resource.setProperty("capabilities", QVariant::fromValue(QByteArrayList() << ResourceCapabilities::Mail::storage << "-folder.rename")); | ||
257 | // resource.setProperty("capabilities", QVariant::fromValue(QByteArrayList() << ResourceCapabilities::Mail::storage << ResourceCapabilities::Mail::drafts << "-folder.rename" << ResourceCapabilities::Mail::trash)); | ||
258 | return resource; | ||
259 | } | ||
260 | } | ||
261 | |||
250 | namespace MaildirResource { | 262 | namespace MaildirResource { |
251 | SinkResource create(const QByteArray &account) | 263 | SinkResource create(const QByteArray &account) |
252 | { | 264 | { |
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h index 928ea58..849c3e2 100644 --- a/common/domain/applicationdomaintype.h +++ b/common/domain/applicationdomaintype.h | |||
@@ -244,6 +244,9 @@ struct SINK_EXPORT Identity : public ApplicationDomainType { | |||
244 | virtual ~Identity(); | 244 | virtual ~Identity(); |
245 | }; | 245 | }; |
246 | 246 | ||
247 | namespace DummyResource { | ||
248 | SinkResource SINK_EXPORT create(const QByteArray &account); | ||
249 | }; | ||
247 | namespace MaildirResource { | 250 | namespace MaildirResource { |
248 | SinkResource SINK_EXPORT create(const QByteArray &account); | 251 | SinkResource SINK_EXPORT create(const QByteArray &account); |
249 | }; | 252 | }; |
diff --git a/examples/dummyresource/resourcefactory.cpp b/examples/dummyresource/resourcefactory.cpp index a443581..2bd52cc 100644 --- a/examples/dummyresource/resourcefactory.cpp +++ b/examples/dummyresource/resourcefactory.cpp | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "indexupdater.h" | 37 | #include "indexupdater.h" |
38 | #include "adaptorfactoryregistry.h" | 38 | #include "adaptorfactoryregistry.h" |
39 | #include "synchronizer.h" | 39 | #include "synchronizer.h" |
40 | #include "mailpreprocessor.h" | ||
40 | #include "remoteidmap.h" | 41 | #include "remoteidmap.h" |
41 | #include <QDate> | 42 | #include <QDate> |
42 | #include <QUuid> | 43 | #include <QUuid> |
@@ -131,7 +132,7 @@ DummyResource::DummyResource(const QByteArray &instanceIdentifier, const QShared | |||
131 | setupSynchronizer(QSharedPointer<DummySynchronizer>::create(PLUGIN_NAME, instanceIdentifier)); | 132 | setupSynchronizer(QSharedPointer<DummySynchronizer>::create(PLUGIN_NAME, instanceIdentifier)); |
132 | setupChangereplay(QSharedPointer<Sink::NullChangeReplay>::create(instanceIdentifier)); | 133 | setupChangereplay(QSharedPointer<Sink::NullChangeReplay>::create(instanceIdentifier)); |
133 | setupPreprocessors(ENTITY_TYPE_MAIL, | 134 | setupPreprocessors(ENTITY_TYPE_MAIL, |
134 | QVector<Sink::Preprocessor*>() << new DefaultIndexUpdater<Sink::ApplicationDomain::Mail>); | 135 | QVector<Sink::Preprocessor*>() << new MailPropertyExtractor << new DefaultIndexUpdater<Sink::ApplicationDomain::Mail>); |
135 | setupPreprocessors(ENTITY_TYPE_FOLDER, | 136 | setupPreprocessors(ENTITY_TYPE_FOLDER, |
136 | QVector<Sink::Preprocessor*>() << new DefaultIndexUpdater<Sink::ApplicationDomain::Folder>); | 137 | QVector<Sink::Preprocessor*>() << new DefaultIndexUpdater<Sink::ApplicationDomain::Folder>); |
137 | setupPreprocessors(ENTITY_TYPE_EVENT, | 138 | setupPreprocessors(ENTITY_TYPE_EVENT, |
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0d45f3a..294cce2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt | |||
@@ -46,6 +46,7 @@ auto_tests ( | |||
46 | inspectiontest | 46 | inspectiontest |
47 | accountstest | 47 | accountstest |
48 | testaccounttest | 48 | testaccounttest |
49 | dummyresourcemailtest | ||
49 | ) | 50 | ) |
50 | generate_flatbuffers(dummyresourcetest calendar) | 51 | generate_flatbuffers(dummyresourcetest calendar) |
51 | target_link_libraries(dummyresourcetest sink_resource_dummy) | 52 | target_link_libraries(dummyresourcetest sink_resource_dummy) |
diff --git a/tests/dummyresourcemailtest.cpp b/tests/dummyresourcemailtest.cpp new file mode 100644 index 0000000..2de2902 --- /dev/null +++ b/tests/dummyresourcemailtest.cpp | |||
@@ -0,0 +1,29 @@ | |||
1 | #include <QtTest> | ||
2 | |||
3 | #include <tests/mailtest.h> | ||
4 | |||
5 | #include "common/test.h" | ||
6 | #include "common/domain/applicationdomaintype.h" | ||
7 | |||
8 | using namespace Sink; | ||
9 | using namespace Sink::ApplicationDomain; | ||
10 | |||
11 | class DummyMailTest : public Sink::MailTest | ||
12 | { | ||
13 | Q_OBJECT | ||
14 | |||
15 | protected: | ||
16 | void resetTestEnvironment() Q_DECL_OVERRIDE | ||
17 | { | ||
18 | } | ||
19 | |||
20 | Sink::ApplicationDomain::SinkResource createResource() Q_DECL_OVERRIDE | ||
21 | { | ||
22 | auto resource = ApplicationDomain::DummyResource::create("account1"); | ||
23 | return resource; | ||
24 | } | ||
25 | }; | ||
26 | |||
27 | QTEST_MAIN(DummyMailTest) | ||
28 | |||
29 | #include "dummyresourcemailtest.moc" | ||