summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/accountstest.cpp45
-rw-r--r--tests/clientapitest.cpp11
-rw-r--r--tests/dummyresourcebenchmark.cpp32
-rw-r--r--tests/dummyresourcetest.cpp37
-rw-r--r--tests/dummyresourcewritebenchmark.cpp14
-rw-r--r--tests/genericfacadetest.cpp6
-rw-r--r--tests/genericresourcebenchmark.cpp16
-rw-r--r--tests/genericresourcetest.cpp7
-rw-r--r--tests/indextest.cpp6
-rw-r--r--tests/inspectiontest.cpp9
-rw-r--r--tests/maildirsyncbenchmark.cpp13
-rw-r--r--tests/mailquerybenchmark.cpp2
-rw-r--r--tests/mailsynctest.cpp10
-rw-r--r--tests/mailsynctest.h1
-rw-r--r--tests/mailtest.cpp8
-rw-r--r--tests/mailtest.h1
-rw-r--r--tests/messagequeuetest.cpp29
-rw-r--r--tests/modelinteractivitytest.cpp18
-rw-r--r--tests/pipelinebenchmark.cpp2
-rw-r--r--tests/pipelinetest.cpp61
-rw-r--r--tests/querytest.cpp59
-rw-r--r--tests/resourcecommunicationtest.cpp20
-rw-r--r--tests/resourceconfigtest.cpp28
-rw-r--r--tests/testaccounttest.cpp1
24 files changed, 260 insertions, 176 deletions
diff --git a/tests/accountstest.cpp b/tests/accountstest.cpp
index be5e1a0..4be8bd6 100644
--- a/tests/accountstest.cpp
+++ b/tests/accountstest.cpp
@@ -8,6 +8,7 @@
8#include <store.h> 8#include <store.h>
9#include <log.h> 9#include <log.h>
10#include <configstore.h> 10#include <configstore.h>
11#include "testutils.h"
11 12
12class AccountsTest : public QObject 13class AccountsTest : public QObject
13{ 14{
@@ -17,7 +18,6 @@ private slots:
17 void initTestCase() 18 void initTestCase()
18 { 19 {
19 Sink::Test::initTest(); 20 Sink::Test::initTest();
20 Sink::Log::setDebugOutputLevel(Sink::Log::Trace);
21 } 21 }
22 22
23 void init() 23 void init()
@@ -52,7 +52,7 @@ private slots:
52 QString smtpUsername("smtpUsername"); 52 QString smtpUsername("smtpUsername");
53 QString smtpPassword("smtpPassword"); 53 QString smtpPassword("smtpPassword");
54 auto resource = ApplicationDomainType::createEntity<SinkResource>(); 54 auto resource = ApplicationDomainType::createEntity<SinkResource>();
55 resource.setProperty("type", "org.kde.mailtransport"); 55 resource.setProperty("type", "sink.mailtransport");
56 resource.setProperty("account", account.identifier()); 56 resource.setProperty("account", account.identifier());
57 resource.setProperty("server", smtpServer); 57 resource.setProperty("server", smtpServer);
58 resource.setProperty("username", smtpUsername); 58 resource.setProperty("username", smtpUsername);
@@ -63,7 +63,7 @@ private slots:
63 Store::fetchAll<SinkResource>(Query()).then<void, QList<SinkResource::Ptr>>([&](const QList<SinkResource::Ptr> &resources) { 63 Store::fetchAll<SinkResource>(Query()).then<void, QList<SinkResource::Ptr>>([&](const QList<SinkResource::Ptr> &resources) {
64 QCOMPARE(resources.size(), 1); 64 QCOMPARE(resources.size(), 1);
65 auto resource = resources.first(); 65 auto resource = resources.first();
66 QCOMPARE(resource->getProperty("type").toString(), QString("org.kde.mailtransport")); 66 QCOMPARE(resource->getProperty("type").toString(), QString("sink.mailtransport"));
67 QCOMPARE(resource->getProperty("server").toString(), smtpServer); 67 QCOMPARE(resource->getProperty("server").toString(), smtpServer);
68 }) 68 })
69 .exec().waitForFinished(); 69 .exec().waitForFinished();
@@ -94,8 +94,8 @@ private slots:
94 using namespace Sink::ApplicationDomain; 94 using namespace Sink::ApplicationDomain;
95 95
96 auto account = ApplicationDomainType::createEntity<SinkAccount>(); 96 auto account = ApplicationDomainType::createEntity<SinkAccount>();
97 account.setProperty("type", "maildir"); 97 account.setAccountType("maildir");
98 account.setProperty("name", "name"); 98 account.setName("name");
99 Store::create(account).exec().waitForFinished(); 99 Store::create(account).exec().waitForFinished();
100 100
101 Query query; 101 Query query;
@@ -104,18 +104,47 @@ private slots:
104 QTRY_COMPARE(model->rowCount(QModelIndex()), 1); 104 QTRY_COMPARE(model->rowCount(QModelIndex()), 1);
105 105
106 auto account2 = ApplicationDomainType::createEntity<SinkAccount>(); 106 auto account2 = ApplicationDomainType::createEntity<SinkAccount>();
107 account2.setProperty("type", "maildir"); 107 account2.setAccountType("maildir");
108 account2.setProperty("name", "name"); 108 account2.setName("name");
109 Store::create(account2).exec().waitForFinished(); 109 Store::create(account2).exec().waitForFinished();
110 QTRY_COMPARE(model->rowCount(QModelIndex()), 2); 110 QTRY_COMPARE(model->rowCount(QModelIndex()), 2);
111 111
112 //Ensure the notifier only affects one type 112 //Ensure the notifier only affects one type
113 auto resource = ApplicationDomainType::createEntity<SinkResource>(); 113 auto resource = ApplicationDomainType::createEntity<SinkResource>();
114 resource.setProperty("type", "org.kde.mailtransport"); 114 resource.setResourceType("sink.mailtransport");
115 Store::create(resource).exec().waitForFinished(); 115 Store::create(resource).exec().waitForFinished();
116 QTRY_COMPARE(model->rowCount(QModelIndex()), 2); 116 QTRY_COMPARE(model->rowCount(QModelIndex()), 2);
117 } 117 }
118 118
119 void testLoadAccountStatus()
120 {
121 using namespace Sink;
122 using namespace Sink::ApplicationDomain;
123
124 auto account = ApplicationDomainType::createEntity<SinkAccount>();
125 account.setAccountType("dummy");
126 account.setName("name");
127 VERIFYEXEC(Store::create(account));
128
129 auto res = Sink::ApplicationDomain::DummyResource::create(account.identifier());
130 VERIFYEXEC(Sink::Store::create(res));
131 {
132 Sink::Query query;
133 query.liveQuery = true;
134 query.request<Sink::ApplicationDomain::SinkAccount::Status>();
135
136 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::SinkAccount>(query);
137 QTRY_COMPARE(model->rowCount(QModelIndex()), 1);
138 auto account = model->data(model->index(0, 0, QModelIndex()), Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::SinkAccount::Ptr>();
139 QCOMPARE(account->getStatus(), static_cast<int>(Sink::ApplicationDomain::OfflineStatus));
140
141 //Synchronize to connect
142 VERIFYEXEC(Sink::Store::synchronize(Query::ResourceFilter(res)));
143
144 QTRY_COMPARE_WITH_TIMEOUT(model->data(model->index(0, 0, QModelIndex()), Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::SinkAccount::Ptr>()->getStatus(), static_cast<int>(Sink::ApplicationDomain::ConnectedStatus), 1000);
145 }
146 }
147
119}; 148};
120 149
121QTEST_GUILESS_MAIN(AccountsTest) 150QTEST_GUILESS_MAIN(AccountsTest)
diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp
index 8c5866d..ed5a9b5 100644
--- a/tests/clientapitest.cpp
+++ b/tests/clientapitest.cpp
@@ -9,6 +9,8 @@
9#include "resultprovider.h" 9#include "resultprovider.h"
10#include "facadefactory.h" 10#include "facadefactory.h"
11 11
12SINK_DEBUG_AREA("clientapitest")
13
12template <typename T> 14template <typename T>
13class TestDummyResourceFacade : public Sink::StoreFacade<T> 15class TestDummyResourceFacade : public Sink::StoreFacade<T>
14{ 16{
@@ -44,7 +46,7 @@ public:
44 { 46 {
45 auto resultProvider = new Sink::ResultProvider<typename T::Ptr>(); 47 auto resultProvider = new Sink::ResultProvider<typename T::Ptr>();
46 resultProvider->onDone([resultProvider]() { 48 resultProvider->onDone([resultProvider]() {
47 Trace() << "Result provider is done"; 49 SinkTrace() << "Result provider is done";
48 delete resultProvider; 50 delete resultProvider;
49 }); 51 });
50 // We have to do it this way, otherwise we're not setting the fetcher right 52 // We have to do it this way, otherwise we're not setting the fetcher right
@@ -52,11 +54,11 @@ public:
52 54
53 resultProvider->setFetcher([query, resultProvider, this](const typename T::Ptr &parent) { 55 resultProvider->setFetcher([query, resultProvider, this](const typename T::Ptr &parent) {
54 if (parent) { 56 if (parent) {
55 Trace() << "Running the fetcher " << parent->identifier(); 57 SinkTrace() << "Running the fetcher " << parent->identifier();
56 } else { 58 } else {
57 Trace() << "Running the fetcher."; 59 SinkTrace() << "Running the fetcher.";
58 } 60 }
59 Trace() << "-------------------------."; 61 SinkTrace() << "-------------------------.";
60 for (const auto &res : results) { 62 for (const auto &res : results) {
61 qDebug() << "Parent filter " << query.propertyFilter.value("parent").value.toByteArray() << res->identifier() << res->getProperty("parent").toByteArray(); 63 qDebug() << "Parent filter " << query.propertyFilter.value("parent").value.toByteArray() << res->identifier() << res->getProperty("parent").toByteArray();
62 auto parentProperty = res->getProperty("parent").toByteArray(); 64 auto parentProperty = res->getProperty("parent").toByteArray();
@@ -91,7 +93,6 @@ private slots:
91 { 93 {
92 Sink::FacadeFactory::instance().resetFactory(); 94 Sink::FacadeFactory::instance().resetFactory();
93 ResourceConfig::clear(); 95 ResourceConfig::clear();
94 Sink::Log::setDebugOutputLevel(Sink::Log::Trace);
95 } 96 }
96 97
97 void testLoad() 98 void testLoad()
diff --git a/tests/dummyresourcebenchmark.cpp b/tests/dummyresourcebenchmark.cpp
index d5f98c3..72562c3 100644
--- a/tests/dummyresourcebenchmark.cpp
+++ b/tests/dummyresourcebenchmark.cpp
@@ -34,9 +34,9 @@ private slots:
34 void initTestCase() 34 void initTestCase()
35 { 35 {
36 Sink::Log::setDebugOutputLevel(Sink::Log::Warning); 36 Sink::Log::setDebugOutputLevel(Sink::Log::Warning);
37 auto factory = Sink::ResourceFactory::load("org.kde.dummy"); 37 auto factory = Sink::ResourceFactory::load("sink.dummy");
38 QVERIFY(factory); 38 QVERIFY(factory);
39 ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); 39 ResourceConfig::addResource("sink.dummy.instance1", "sink.dummy");
40 num = 5000; 40 num = 5000;
41 } 41 }
42 42
@@ -76,21 +76,21 @@ private slots:
76 void testCommandResponsiveness() 76 void testCommandResponsiveness()
77 { 77 {
78 // Test responsiveness including starting the process. 78 // Test responsiveness including starting the process.
79 Sink::Store::removeDataFromDisk("org.kde.dummy.instance1").exec().waitForFinished(); 79 Sink::Store::removeDataFromDisk("sink.dummy.instance1").exec().waitForFinished();
80 80
81 QTime time; 81 QTime time;
82 time.start(); 82 time.start();
83 83
84 Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); 84 Sink::ApplicationDomain::Event event("sink.dummy.instance1");
85 event.setProperty("uid", "testuid"); 85 event.setProperty("uid", "testuid");
86 QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); 86 QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid"));
87 event.setProperty("summary", "summaryValue"); 87 event.setProperty("summary", "summaryValue");
88 88
89 auto notifier = QSharedPointer<Sink::Notifier>::create("org.kde.dummy.instance1", "org.kde.dummy"); 89 auto notifier = QSharedPointer<Sink::Notifier>::create("sink.dummy.instance1", "sink.dummy");
90 bool gotNotification = false; 90 bool gotNotification = false;
91 int duration = 0; 91 int duration = 0;
92 notifier->registerHandler([&gotNotification, &duration, &time](const Sink::Notification &notification) { 92 notifier->registerHandler([&gotNotification, &duration, &time](const Sink::Notification &notification) {
93 if (notification.type == Sink::Commands::NotificationType::NotificationType_RevisionUpdate) { 93 if (notification.type == Sink::Notification::RevisionUpdate) {
94 gotNotification = true; 94 gotNotification = true;
95 duration = time.elapsed(); 95 duration = time.elapsed();
96 } 96 }
@@ -102,19 +102,19 @@ private slots:
102 QTRY_VERIFY(gotNotification); 102 QTRY_VERIFY(gotNotification);
103 103
104 QVERIFY2(duration < 100, QString::fromLatin1("Processing a create command took more than 100ms: %1").arg(duration).toLatin1()); 104 QVERIFY2(duration < 100, QString::fromLatin1("Processing a create command took more than 100ms: %1").arg(duration).toLatin1());
105 Sink::ResourceControl::shutdown("org.kde.dummy.instance1").exec().waitForFinished(); 105 Sink::ResourceControl::shutdown("sink.dummy.instance1").exec().waitForFinished();
106 qDebug() << "Single command took [ms]: " << duration; 106 qDebug() << "Single command took [ms]: " << duration;
107 } 107 }
108 108
109 void testWriteToFacade() 109 void testWriteToFacade()
110 { 110 {
111 Sink::Store::removeDataFromDisk("org.kde.dummy.instance1").exec().waitForFinished(); 111 Sink::Store::removeDataFromDisk("sink.dummy.instance1").exec().waitForFinished();
112 112
113 QTime time; 113 QTime time;
114 time.start(); 114 time.start();
115 QList<KAsync::Future<void>> waitCondition; 115 QList<KAsync::Future<void>> waitCondition;
116 for (int i = 0; i < num; i++) { 116 for (int i = 0; i < num; i++) {
117 Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); 117 Sink::ApplicationDomain::Event event("sink.dummy.instance1");
118 event.setProperty("uid", "testuid"); 118 event.setProperty("uid", "testuid");
119 QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); 119 QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid"));
120 event.setProperty("summary", "summaryValue"); 120 event.setProperty("summary", "summaryValue");
@@ -126,7 +126,7 @@ private slots:
126 // Ensure everything is processed 126 // Ensure everything is processed
127 { 127 {
128 Sink::Query query; 128 Sink::Query query;
129 query.resources << "org.kde.dummy.instance1"; 129 query.resources << "sink.dummy.instance1";
130 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); 130 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished();
131 } 131 }
132 auto allProcessedTime = time.elapsed(); 132 auto allProcessedTime = time.elapsed();
@@ -140,7 +140,7 @@ private slots:
140 dataset.insertRow(row); 140 dataset.insertRow(row);
141 HAWD::Formatter::print(dataset); 141 HAWD::Formatter::print(dataset);
142 142
143 auto diskUsage = DummyResource::diskUsage("org.kde.dummy.instance1"); 143 auto diskUsage = DummyResource::diskUsage("sink.dummy.instance1");
144 qDebug() << "Database size [kb]: " << diskUsage / 1024; 144 qDebug() << "Database size [kb]: " << diskUsage / 1024;
145 145
146 // Print memory layout, RSS is what is in memory 146 // Print memory layout, RSS is what is in memory
@@ -155,7 +155,7 @@ private slots:
155 { 155 {
156 time.start(); 156 time.start();
157 Sink::Query query; 157 Sink::Query query;
158 query.resources << "org.kde.dummy.instance1"; 158 query.resources << "sink.dummy.instance1";
159 159
160 query.propertyFilter.insert("uid", Sink::Query::Comparator("testuid")); 160 query.propertyFilter.insert("uid", Sink::Query::Comparator("testuid"));
161 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); 161 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query);
@@ -173,12 +173,12 @@ private slots:
173 173
174 void testWriteInProcess() 174 void testWriteInProcess()
175 { 175 {
176 Sink::Store::removeDataFromDisk("org.kde.dummy.instance1").exec().waitForFinished(); 176 Sink::Store::removeDataFromDisk("sink.dummy.instance1").exec().waitForFinished();
177 QTime time; 177 QTime time;
178 time.start(); 178 time.start();
179 179
180 auto pipeline = QSharedPointer<Sink::Pipeline>::create("org.kde.dummy.instance1"); 180 auto pipeline = QSharedPointer<Sink::Pipeline>::create("sink.dummy.instance1");
181 DummyResource resource("org.kde.dummy.instance1", pipeline); 181 DummyResource resource("sink.dummy.instance1", pipeline);
182 182
183 flatbuffers::FlatBufferBuilder eventFbb; 183 flatbuffers::FlatBufferBuilder eventFbb;
184 eventFbb.Clear(); 184 eventFbb.Clear();
@@ -261,7 +261,7 @@ private slots:
261 // This allows to run individual parts without doing a cleanup, but still cleaning up normally 261 // This allows to run individual parts without doing a cleanup, but still cleaning up normally
262 void testCleanupForCompleteTest() 262 void testCleanupForCompleteTest()
263 { 263 {
264 Sink::Store::removeDataFromDisk("org.kde.dummy.instance1").exec().waitForFinished(); 264 Sink::Store::removeDataFromDisk("sink.dummy.instance1").exec().waitForFinished();
265 } 265 }
266 266
267private: 267private:
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp
index d41f235..687a33b 100644
--- a/tests/dummyresourcetest.cpp
+++ b/tests/dummyresourcetest.cpp
@@ -30,11 +30,10 @@ private slots:
30 void initTestCase() 30 void initTestCase()
31 { 31 {
32 Sink::Test::initTest(); 32 Sink::Test::initTest();
33 Sink::Log::setDebugOutputLevel(Sink::Log::Trace); 33 auto factory = Sink::ResourceFactory::load("sink.dummy");
34 auto factory = Sink::ResourceFactory::load("org.kde.dummy");
35 QVERIFY(factory); 34 QVERIFY(factory);
36 DummyResource::removeFromDisk("org.kde.dummy.instance1"); 35 DummyResource::removeFromDisk("sink.dummy.instance1");
37 ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); 36 ResourceConfig::addResource("sink.dummy.instance1", "sink.dummy");
38 } 37 }
39 38
40 void init() 39 void init()
@@ -48,7 +47,7 @@ private slots:
48 void cleanup() 47 void cleanup()
49 { 48 {
50 qDebug() << "Test took " << time.elapsed(); 49 qDebug() << "Test took " << time.elapsed();
51 Sink::Store::removeDataFromDisk(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); 50 Sink::Store::removeDataFromDisk(QByteArray("sink.dummy.instance1")).exec().waitForFinished();
52 } 51 }
53 52
54 void testProperty() 53 void testProperty()
@@ -60,13 +59,13 @@ private slots:
60 59
61 void testWriteToFacadeAndQueryByUid() 60 void testWriteToFacadeAndQueryByUid()
62 { 61 {
63 Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); 62 Sink::ApplicationDomain::Event event("sink.dummy.instance1");
64 event.setProperty("uid", "testuid"); 63 event.setProperty("uid", "testuid");
65 QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); 64 QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid"));
66 event.setProperty("summary", "summaryValue"); 65 event.setProperty("summary", "summaryValue");
67 Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); 66 Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished();
68 67
69 const auto query = Query::ResourceFilter("org.kde.dummy.instance1") ; 68 const auto query = Query::ResourceFilter("sink.dummy.instance1") ;
70 69
71 // Ensure all local data is processed 70 // Ensure all local data is processed
72 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); 71 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished();
@@ -79,7 +78,7 @@ private slots:
79 78
80 void testWriteToFacadeAndQueryByUid2() 79 void testWriteToFacadeAndQueryByUid2()
81 { 80 {
82 Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); 81 Sink::ApplicationDomain::Event event("sink.dummy.instance1");
83 event.setProperty("summary", "summaryValue"); 82 event.setProperty("summary", "summaryValue");
84 83
85 event.setProperty("uid", "testuid"); 84 event.setProperty("uid", "testuid");
@@ -88,7 +87,7 @@ private slots:
88 event.setProperty("uid", "testuid2"); 87 event.setProperty("uid", "testuid2");
89 Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); 88 Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished();
90 89
91 const auto query = Query::ResourceFilter("org.kde.dummy.instance1") ; 90 const auto query = Query::ResourceFilter("sink.dummy.instance1") ;
92 91
93 // Ensure all local data is processed 92 // Ensure all local data is processed
94 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); 93 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished();
@@ -103,7 +102,7 @@ private slots:
103 102
104 void testWriteToFacadeAndQueryBySummary() 103 void testWriteToFacadeAndQueryBySummary()
105 { 104 {
106 Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); 105 Sink::ApplicationDomain::Event event("sink.dummy.instance1");
107 106
108 event.setProperty("uid", "testuid"); 107 event.setProperty("uid", "testuid");
109 event.setProperty("summary", "summaryValue1"); 108 event.setProperty("summary", "summaryValue1");
@@ -113,7 +112,7 @@ private slots:
113 event.setProperty("summary", "summaryValue2"); 112 event.setProperty("summary", "summaryValue2");
114 Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); 113 Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished();
115 114
116 const auto query = Query::ResourceFilter("org.kde.dummy.instance1") ; 115 const auto query = Query::ResourceFilter("sink.dummy.instance1") ;
117 116
118 // Ensure all local data is processed 117 // Ensure all local data is processed
119 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); 118 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished();
@@ -128,8 +127,8 @@ private slots:
128 127
129 void testResourceSync() 128 void testResourceSync()
130 { 129 {
131 auto pipeline = QSharedPointer<Sink::Pipeline>::create("org.kde.dummy.instance1"); 130 auto pipeline = QSharedPointer<Sink::Pipeline>::create("sink.dummy.instance1");
132 DummyResource resource("org.kde.dummy.instance1", pipeline); 131 DummyResource resource("sink.dummy.instance1", pipeline);
133 auto job = resource.synchronizeWithSource(); 132 auto job = resource.synchronizeWithSource();
134 // TODO pass in optional timeout? 133 // TODO pass in optional timeout?
135 auto future = job.exec(); 134 auto future = job.exec();
@@ -143,7 +142,7 @@ private slots:
143 142
144 void testSyncAndFacade() 143 void testSyncAndFacade()
145 { 144 {
146 const auto query = Query::ResourceFilter("org.kde.dummy.instance1"); 145 const auto query = Query::ResourceFilter("sink.dummy.instance1");
147 146
148 // Ensure all local data is processed 147 // Ensure all local data is processed
149 Sink::Store::synchronize(query).exec().waitForFinished(); 148 Sink::Store::synchronize(query).exec().waitForFinished();
@@ -159,7 +158,7 @@ private slots:
159 158
160 void testSyncAndFacadeMail() 159 void testSyncAndFacadeMail()
161 { 160 {
162 const auto query = Query::ResourceFilter("org.kde.dummy.instance1"); 161 const auto query = Query::ResourceFilter("sink.dummy.instance1");
163 162
164 // Ensure all local data is processed 163 // Ensure all local data is processed
165 Sink::Store::synchronize(query).exec().waitForFinished(); 164 Sink::Store::synchronize(query).exec().waitForFinished();
@@ -175,13 +174,13 @@ private slots:
175 174
176 void testWriteModifyDelete() 175 void testWriteModifyDelete()
177 { 176 {
178 Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); 177 Sink::ApplicationDomain::Event event("sink.dummy.instance1");
179 event.setProperty("uid", "testuid"); 178 event.setProperty("uid", "testuid");
180 QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); 179 QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid"));
181 event.setProperty("summary", "summaryValue"); 180 event.setProperty("summary", "summaryValue");
182 Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished(); 181 Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec().waitForFinished();
183 182
184 const auto query = Query::ResourceFilter("org.kde.dummy.instance1") + Query::PropertyFilter("uid", "testuid"); 183 const auto query = Query::ResourceFilter("sink.dummy.instance1") + Query::PropertyFilter("uid", "testuid");
185 184
186 // Ensure all local data is processed 185 // Ensure all local data is processed
187 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); 186 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished();
@@ -230,14 +229,14 @@ private slots:
230 229
231 void testWriteModifyDeleteLive() 230 void testWriteModifyDeleteLive()
232 { 231 {
233 auto query = Query::ResourceFilter("org.kde.dummy.instance1"); 232 auto query = Query::ResourceFilter("sink.dummy.instance1");
234 query.liveQuery = true; 233 query.liveQuery = true;
235 query += Query::PropertyFilter("uid", "testuid"); 234 query += Query::PropertyFilter("uid", "testuid");
236 235
237 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); 236 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query);
238 QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); 237 QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool());
239 238
240 Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); 239 Sink::ApplicationDomain::Event event("sink.dummy.instance1");
241 event.setProperty("uid", "testuid"); 240 event.setProperty("uid", "testuid");
242 QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); 241 QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid"));
243 event.setProperty("summary", "summaryValue"); 242 event.setProperty("summary", "summaryValue");
diff --git a/tests/dummyresourcewritebenchmark.cpp b/tests/dummyresourcewritebenchmark.cpp
index b4ab438..5cd7007 100644
--- a/tests/dummyresourcewritebenchmark.cpp
+++ b/tests/dummyresourcewritebenchmark.cpp
@@ -103,14 +103,14 @@ class DummyResourceWriteBenchmark : public QObject
103 103
104 void writeInProcess(int num) 104 void writeInProcess(int num)
105 { 105 {
106 DummyResource::removeFromDisk("org.kde.dummy.instance1"); 106 DummyResource::removeFromDisk("sink.dummy.instance1");
107 107
108 108
109 QTime time; 109 QTime time;
110 time.start(); 110 time.start();
111 111
112 auto pipeline = QSharedPointer<Sink::Pipeline>::create("org.kde.dummy.instance1"); 112 auto pipeline = QSharedPointer<Sink::Pipeline>::create("sink.dummy.instance1");
113 DummyResource resource("org.kde.dummy.instance1", pipeline); 113 DummyResource resource("sink.dummy.instance1", pipeline);
114 114
115 int bufferSize = 0; 115 int bufferSize = 0;
116 auto command = createEntityBuffer(bufferSize); 116 auto command = createEntityBuffer(bufferSize);
@@ -131,7 +131,7 @@ class DummyResourceWriteBenchmark : public QObject
131 const auto finalRss = getCurrentRSS(); 131 const auto finalRss = getCurrentRSS();
132 const auto rssGrowth = finalRss - startingRss; 132 const auto rssGrowth = finalRss - startingRss;
133 // Since the database is memory mapped it is attributted to the resident set size. 133 // Since the database is memory mapped it is attributted to the resident set size.
134 const auto rssWithoutDb = finalRss - DummyResource::diskUsage("org.kde.dummy.instance1"); 134 const auto rssWithoutDb = finalRss - DummyResource::diskUsage("sink.dummy.instance1");
135 const auto peakRss = getPeakRSS(); 135 const auto peakRss = getPeakRSS();
136 // How much peak deviates from final rss in percent 136 // How much peak deviates from final rss in percent
137 const auto percentageRssError = static_cast<double>(peakRss - finalRss) * 100.0 / static_cast<double>(finalRss); 137 const auto percentageRssError = static_cast<double>(peakRss - finalRss) * 100.0 / static_cast<double>(finalRss);
@@ -143,7 +143,7 @@ class DummyResourceWriteBenchmark : public QObject
143 std::cout << "Rss without db [kb]: " << rssWithoutDb / 1024 << std::endl; 143 std::cout << "Rss without db [kb]: " << rssWithoutDb / 1024 << std::endl;
144 std::cout << "Percentage peak rss error: " << percentageRssError << std::endl; 144 std::cout << "Percentage peak rss error: " << percentageRssError << std::endl;
145 145
146 auto onDisk = DummyResource::diskUsage("org.kde.dummy.instance1"); 146 auto onDisk = DummyResource::diskUsage("sink.dummy.instance1");
147 auto writeAmplification = static_cast<double>(onDisk) / static_cast<double>(bufferSizeTotal); 147 auto writeAmplification = static_cast<double>(onDisk) / static_cast<double>(bufferSizeTotal);
148 std::cout << "On disk [kb]: " << onDisk / 1024 << std::endl; 148 std::cout << "On disk [kb]: " << onDisk / 1024 << std::endl;
149 std::cout << "Buffer size total [kb]: " << bufferSizeTotal / 1024 << std::endl; 149 std::cout << "Buffer size total [kb]: " << bufferSizeTotal / 1024 << std::endl;
@@ -216,13 +216,13 @@ private slots:
216 216
217 void getFreePages() 217 void getFreePages()
218 { 218 {
219 std::system(QString("mdb_stat %1/%2 -ff").arg(Sink::storageLocation()).arg("org.kde.dummy.instance1").toLatin1().constData()); 219 std::system(QString("mdb_stat %1/%2 -ff").arg(Sink::storageLocation()).arg("sink.dummy.instance1").toLatin1().constData());
220 } 220 }
221 221
222 // This allows to run individual parts without doing a cleanup, but still cleaning up normally 222 // This allows to run individual parts without doing a cleanup, but still cleaning up normally
223 void testCleanupForCompleteTest() 223 void testCleanupForCompleteTest()
224 { 224 {
225 DummyResource::removeFromDisk("org.kde.dummy.instance1"); 225 DummyResource::removeFromDisk("sink.dummy.instance1");
226 } 226 }
227 227
228private: 228private:
diff --git a/tests/genericfacadetest.cpp b/tests/genericfacadetest.cpp
index 8336875..0267dac 100644
--- a/tests/genericfacadetest.cpp
+++ b/tests/genericfacadetest.cpp
@@ -8,6 +8,7 @@
8#include <common/domainadaptor.h> 8#include <common/domainadaptor.h>
9#include <common/resultprovider.h> 9#include <common/resultprovider.h>
10#include <common/synclistresult.h> 10#include <common/synclistresult.h>
11#include <common/test.h>
11 12
12// Replace with something different 13// Replace with something different
13#include "event_generated.h" 14#include "event_generated.h"
@@ -23,10 +24,9 @@ class GenericFacadeTest : public QObject
23{ 24{
24 Q_OBJECT 25 Q_OBJECT
25private slots: 26private slots:
26 27 void initTestCase()
27 void init()
28 { 28 {
29 Sink::Log::setDebugOutputLevel(Sink::Log::Trace); 29 Sink::Test::initTest();
30 } 30 }
31 31
32 void testLoad() 32 void testLoad()
diff --git a/tests/genericresourcebenchmark.cpp b/tests/genericresourcebenchmark.cpp
index a0a368c..2315d0b 100644
--- a/tests/genericresourcebenchmark.cpp
+++ b/tests/genericresourcebenchmark.cpp
@@ -96,9 +96,9 @@ private slots:
96 96
97 void initTestCase() 97 void initTestCase()
98 { 98 {
99 removeFromDisk("org.kde.test.instance1"); 99 removeFromDisk("sink.test.instance1");
100 removeFromDisk("org.kde.test.instance1.userqueue"); 100 removeFromDisk("sink.test.instance1.userqueue");
101 removeFromDisk("org.kde.test.instance1.synchronizerqueue"); 101 removeFromDisk("sink.test.instance1.synchronizerqueue");
102 } 102 }
103 103
104 104
@@ -106,8 +106,8 @@ private slots:
106 { 106 {
107 int num = 10000; 107 int num = 10000;
108 108
109 auto pipeline = QSharedPointer<Sink::Pipeline>::create("org.kde.test.instance1"); 109 auto pipeline = QSharedPointer<Sink::Pipeline>::create("sink.test.instance1");
110 TestResource resource("org.kde.test.instance1", pipeline); 110 TestResource resource("sink.test.instance1", pipeline);
111 111
112 auto command = createEntityBuffer(); 112 auto command = createEntityBuffer();
113 113
@@ -141,16 +141,16 @@ private slots:
141 { 141 {
142 int num = 50000; 142 int num = 50000;
143 143
144 auto pipeline = QSharedPointer<Sink::Pipeline>::create("org.kde.test.instance1"); 144 auto pipeline = QSharedPointer<Sink::Pipeline>::create("sink.test.instance1");
145 145
146 auto eventFactory = QSharedPointer<TestEventAdaptorFactory>::create(); 146 auto eventFactory = QSharedPointer<TestEventAdaptorFactory>::create();
147 const QByteArray resourceIdentifier = "org.kde.test.instance1"; 147 const QByteArray resourceIdentifier = "sink.test.instance1";
148 auto indexer = QSharedPointer<IndexUpdater>::create(); 148 auto indexer = QSharedPointer<IndexUpdater>::create();
149 149
150 pipeline->setPreprocessors("event", QVector<Sink::Preprocessor *>() << indexer.data()); 150 pipeline->setPreprocessors("event", QVector<Sink::Preprocessor *>() << indexer.data());
151 pipeline->setAdaptorFactory("event", eventFactory); 151 pipeline->setAdaptorFactory("event", eventFactory);
152 152
153 TestResource resource("org.kde.test.instance1", pipeline); 153 TestResource resource("sink.test.instance1", pipeline);
154 154
155 auto command = createEntityBuffer(); 155 auto command = createEntityBuffer();
156 156
diff --git a/tests/genericresourcetest.cpp b/tests/genericresourcetest.cpp
index 7474cbf..77a901d 100644
--- a/tests/genericresourcetest.cpp
+++ b/tests/genericresourcetest.cpp
@@ -26,8 +26,7 @@ private slots:
26 26
27 void init() 27 void init()
28 { 28 {
29 Sink::GenericResource::removeFromDisk("org.kde.test.instance1"); 29 Sink::GenericResource::removeFromDisk("sink.test.instance1");
30 Sink::Log::setDebugOutputLevel(Sink::Log::Trace);
31 } 30 }
32 31
33 /// Ensure the resource can process messages 32 /// Ensure the resource can process messages
@@ -71,10 +70,10 @@ private slots:
71 } 70 }
72 71
73 // Actual test 72 // Actual test
74 auto pipeline = QSharedPointer<Sink::Pipeline>::create("org.kde.test.instance1"); 73 auto pipeline = QSharedPointer<Sink::Pipeline>::create("sink.test.instance1");
75 QSignalSpy revisionSpy(pipeline.data(), SIGNAL(revisionUpdated(qint64))); 74 QSignalSpy revisionSpy(pipeline.data(), SIGNAL(revisionUpdated(qint64)));
76 QVERIFY(revisionSpy.isValid()); 75 QVERIFY(revisionSpy.isValid());
77 TestResource resource("org.kde.test.instance1", pipeline); 76 TestResource resource("sink.test.instance1", pipeline);
78 resource.processCommand(Sink::Commands::CreateEntityCommand, command); 77 resource.processCommand(Sink::Commands::CreateEntityCommand, command);
79 resource.processCommand(Sink::Commands::CreateEntityCommand, command); 78 resource.processCommand(Sink::Commands::CreateEntityCommand, command);
80 resource.processAllMessages().exec().waitForFinished(); 79 resource.processAllMessages().exec().waitForFinished();
diff --git a/tests/indextest.cpp b/tests/indextest.cpp
index fa3ace4..8566803 100644
--- a/tests/indextest.cpp
+++ b/tests/indextest.cpp
@@ -16,19 +16,19 @@ class IndexTest : public QObject
16private slots: 16private slots:
17 void initTestCase() 17 void initTestCase()
18 { 18 {
19 Sink::Storage store("./testindex", "org.kde.dummy.testindex", Sink::Storage::ReadWrite); 19 Sink::Storage store("./testindex", "sink.dummy.testindex", Sink::Storage::ReadWrite);
20 store.removeFromDisk(); 20 store.removeFromDisk();
21 } 21 }
22 22
23 void cleanup() 23 void cleanup()
24 { 24 {
25 Sink::Storage store("./testindex", "org.kde.dummy.testindex", Sink::Storage::ReadWrite); 25 Sink::Storage store("./testindex", "sink.dummy.testindex", Sink::Storage::ReadWrite);
26 store.removeFromDisk(); 26 store.removeFromDisk();
27 } 27 }
28 28
29 void testIndex() 29 void testIndex()
30 { 30 {
31 Index index("./testindex", "org.kde.dummy.testindex", Sink::Storage::ReadWrite); 31 Index index("./testindex", "sink.dummy.testindex", Sink::Storage::ReadWrite);
32 // The first key is specifically a substring of the second key 32 // The first key is specifically a substring of the second key
33 index.add("key", "value1"); 33 index.add("key", "value1");
34 index.add("keyFoo", "value2"); 34 index.add("keyFoo", "value2");
diff --git a/tests/inspectiontest.cpp b/tests/inspectiontest.cpp
index 38bf23d..3e8a103 100644
--- a/tests/inspectiontest.cpp
+++ b/tests/inspectiontest.cpp
@@ -19,11 +19,10 @@ class InspectionTest : public QObject
19private slots: 19private slots:
20 void initTestCase() 20 void initTestCase()
21 { 21 {
22 Sink::Log::setDebugOutputLevel(Sink::Log::Trace); 22 auto factory = Sink::ResourceFactory::load("sink.dummy");
23 auto factory = Sink::ResourceFactory::load("org.kde.dummy");
24 QVERIFY(factory); 23 QVERIFY(factory);
25 ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); 24 ResourceConfig::addResource("sink.dummy.instance1", "sink.dummy");
26 Sink::Store::removeDataFromDisk(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); 25 Sink::Store::removeDataFromDisk(QByteArray("sink.dummy.instance1")).exec().waitForFinished();
27 } 26 }
28 27
29 void testInspection_data() 28 void testInspection_data()
@@ -39,7 +38,7 @@ private slots:
39 using namespace Sink; 38 using namespace Sink;
40 using namespace Sink::ApplicationDomain; 39 using namespace Sink::ApplicationDomain;
41 40
42 Mail mail(QByteArray("org.kde.dummy.instance1"), QByteArray("identifier"), 0, QSharedPointer<MemoryBufferAdaptor::MemoryBufferAdaptor>::create()); 41 Mail mail(QByteArray("sink.dummy.instance1"), QByteArray("identifier"), 0, QSharedPointer<MemoryBufferAdaptor::MemoryBufferAdaptor>::create());
43 42
44 // testInspection is a magic property that the dummyresource supports 43 // testInspection is a magic property that the dummyresource supports
45 auto inspectionCommand = ResourceControl::Inspection::PropertyInspection(mail, "testInspection", success); 44 auto inspectionCommand = ResourceControl::Inspection::PropertyInspection(mail, "testInspection", success);
diff --git a/tests/maildirsyncbenchmark.cpp b/tests/maildirsyncbenchmark.cpp
index 06c5ab1..d84c758 100644
--- a/tests/maildirsyncbenchmark.cpp
+++ b/tests/maildirsyncbenchmark.cpp
@@ -61,18 +61,17 @@ private slots:
61 { 61 {
62 targetPath = tempDir.path() + "/maildir1"; 62 targetPath = tempDir.path() + "/maildir1";
63 63
64 Sink::Log::setDebugOutputLevel(Sink::Log::Log); 64 MaildirResource::removeFromDisk("sink.maildir.test1");
65 MaildirResource::removeFromDisk("org.kde.maildir.test1");
66 Sink::ApplicationDomain::SinkResource resource; 65 Sink::ApplicationDomain::SinkResource resource;
67 resource.setProperty("identifier", "org.kde.maildir.test1"); 66 resource.setProperty("identifier", "sink.maildir.test1");
68 resource.setProperty("type", "org.kde.maildir"); 67 resource.setProperty("type", "sink.maildir");
69 resource.setProperty("path", targetPath); 68 resource.setProperty("path", targetPath);
70 Sink::Store::create(resource).exec().waitForFinished(); 69 Sink::Store::create(resource).exec().waitForFinished();
71 } 70 }
72 71
73 void cleanup() 72 void cleanup()
74 { 73 {
75 MaildirResource::removeFromDisk("org.kde.maildir.test1"); 74 MaildirResource::removeFromDisk("sink.maildir.test1");
76 QDir dir(targetPath); 75 QDir dir(targetPath);
77 dir.removeRecursively(); 76 dir.removeRecursively();
78 } 77 }
@@ -84,8 +83,8 @@ private slots:
84 83
85 void testbench() 84 void testbench()
86 { 85 {
87 auto pipeline = QSharedPointer<Sink::Pipeline>::create("org.kde.maildir.test1"); 86 auto pipeline = QSharedPointer<Sink::Pipeline>::create("sink.maildir.test1");
88 MaildirResource resource("org.kde.maildir.test1", pipeline); 87 MaildirResource resource("sink.maildir.test1", pipeline);
89 QTime time; 88 QTime time;
90 time.start(); 89 time.start();
91 resource.Sink::GenericResource::synchronizeWithSource().exec().waitForFinished(); 90 resource.Sink::GenericResource::synchronizeWithSource().exec().waitForFinished();
diff --git a/tests/mailquerybenchmark.cpp b/tests/mailquerybenchmark.cpp
index 4e58899..450955f 100644
--- a/tests/mailquerybenchmark.cpp
+++ b/tests/mailquerybenchmark.cpp
@@ -148,7 +148,7 @@ private slots:
148 148
149 void init() 149 void init()
150 { 150 {
151 resourceIdentifier = "org.kde.test.instance1"; 151 resourceIdentifier = "sink.test.instance1";
152 Sink::AdaptorFactoryRegistry::instance().registerFactory<Sink::ApplicationDomain::Mail, TestMailAdaptorFactory>("test"); 152 Sink::AdaptorFactoryRegistry::instance().registerFactory<Sink::ApplicationDomain::Mail, TestMailAdaptorFactory>("test");
153 } 153 }
154 154
diff --git a/tests/mailsynctest.cpp b/tests/mailsynctest.cpp
index e70e34e..4b797c8 100644
--- a/tests/mailsynctest.cpp
+++ b/tests/mailsynctest.cpp
@@ -31,10 +31,12 @@
31using namespace Sink; 31using namespace Sink;
32using namespace Sink::ApplicationDomain; 32using namespace Sink::ApplicationDomain;
33 33
34SINK_DEBUG_AREA("mailsynctest")
35
34void MailSyncTest::initTestCase() 36void MailSyncTest::initTestCase()
35{ 37{
36 Test::initTest(); 38 Test::initTest();
37 Log::setDebugOutputLevel(Sink::Log::Trace); 39 QVERIFY(isBackendAvailable());
38 resetTestEnvironment(); 40 resetTestEnvironment();
39 auto resource = createResource(); 41 auto resource = createResource();
40 QVERIFY(!resource.identifier().isEmpty()); 42 QVERIFY(!resource.identifier().isEmpty());
@@ -72,7 +74,7 @@ void MailSyncTest::testListFolders()
72 for (const auto &folder : folders) { 74 for (const auto &folder : folders) {
73 names << folder->getName(); 75 names << folder->getName();
74 } 76 }
75 Trace() << "base folder: " << names; 77 SinkTrace() << "base folder: " << names;
76 baseCount = folders.size(); 78 baseCount = folders.size();
77 }); 79 });
78 VERIFYEXEC(job); 80 VERIFYEXEC(job);
@@ -196,6 +198,10 @@ void MailSyncTest::testListFolderHierarchy()
196 QVERIFY(names.contains("Drafts")); 198 QVERIFY(names.contains("Drafts"));
197 names.removeAll("Drafts"); 199 names.removeAll("Drafts");
198 } 200 }
201 if (mCapabilities.contains(ResourceCapabilities::Mail::trash)) {
202 QVERIFY(names.contains("Trash"));
203 names.removeAll("Trash");
204 }
199 QCOMPARE(names.size(), 3); 205 QCOMPARE(names.size(), 3);
200 QCOMPARE(map.value("sub")->getParent(), map.value("test")->identifier()); 206 QCOMPARE(map.value("sub")->getParent(), map.value("test")->identifier());
201 }); 207 });
diff --git a/tests/mailsynctest.h b/tests/mailsynctest.h
index a21335b..31d3f03 100644
--- a/tests/mailsynctest.h
+++ b/tests/mailsynctest.h
@@ -41,6 +41,7 @@ protected:
41 QByteArray mResourceInstanceIdentifier; 41 QByteArray mResourceInstanceIdentifier;
42 QByteArrayList mCapabilities; 42 QByteArrayList mCapabilities;
43 43
44 virtual bool isBackendAvailable() { return true; }
44 virtual void resetTestEnvironment() = 0; 45 virtual void resetTestEnvironment() = 0;
45 virtual Sink::ApplicationDomain::SinkResource createResource() = 0; 46 virtual Sink::ApplicationDomain::SinkResource createResource() = 0;
46 virtual Sink::ApplicationDomain::SinkResource createFaultyResource() = 0; 47 virtual Sink::ApplicationDomain::SinkResource createFaultyResource() = 0;
diff --git a/tests/mailtest.cpp b/tests/mailtest.cpp
index b9d496d..2547536 100644
--- a/tests/mailtest.cpp
+++ b/tests/mailtest.cpp
@@ -31,10 +31,12 @@
31using namespace Sink; 31using namespace Sink;
32using namespace Sink::ApplicationDomain; 32using namespace Sink::ApplicationDomain;
33 33
34SINK_DEBUG_AREA("mailtest")
35
34void MailTest::initTestCase() 36void MailTest::initTestCase()
35{ 37{
36 Test::initTest(); 38 Test::initTest();
37 Log::setDebugOutputLevel(Sink::Log::Trace); 39 QVERIFY(isBackendAvailable());
38 resetTestEnvironment(); 40 resetTestEnvironment();
39 auto resource = createResource(); 41 auto resource = createResource();
40 QVERIFY(!resource.identifier().isEmpty()); 42 QVERIFY(!resource.identifier().isEmpty());
@@ -250,7 +252,7 @@ void MailTest::testMoveMail()
250 auto mail = *mails.first(); 252 auto mail = *mails.first();
251 modifiedMail = mail; 253 modifiedMail = mail;
252 QCOMPARE(mail.getFolder(), folder.identifier()); 254 QCOMPARE(mail.getFolder(), folder.identifier());
253 Warning() << "path: " << mail.getMimeMessagePath(); 255 SinkWarning() << "path: " << mail.getMimeMessagePath();
254 QVERIFY(QFile(mail.getMimeMessagePath()).exists()); 256 QVERIFY(QFile(mail.getMimeMessagePath()).exists());
255 }); 257 });
256 VERIFYEXEC(job); 258 VERIFYEXEC(job);
@@ -269,7 +271,7 @@ void MailTest::testMoveMail()
269 auto mail = *mails.first(); 271 auto mail = *mails.first();
270 QCOMPARE(mail.getFolder(), folder1.identifier()); 272 QCOMPARE(mail.getFolder(), folder1.identifier());
271 QVERIFY(QFile(mail.getMimeMessagePath()).exists()); 273 QVERIFY(QFile(mail.getMimeMessagePath()).exists());
272 Trace() << "Mime message path: " << mail.getMimeMessagePath(); 274 SinkTrace() << "Mime message path: " << mail.getMimeMessagePath();
273 }); 275 });
274 VERIFYEXEC(job); 276 VERIFYEXEC(job);
275 } 277 }
diff --git a/tests/mailtest.h b/tests/mailtest.h
index 2144bf1..cba623d 100644
--- a/tests/mailtest.h
+++ b/tests/mailtest.h
@@ -34,6 +34,7 @@ protected:
34 QByteArray mResourceInstanceIdentifier; 34 QByteArray mResourceInstanceIdentifier;
35 QByteArrayList mCapabilities; 35 QByteArrayList mCapabilities;
36 36
37 virtual bool isBackendAvailable() { return true; }
37 virtual void resetTestEnvironment() = 0; 38 virtual void resetTestEnvironment() = 0;
38 virtual Sink::ApplicationDomain::SinkResource createResource() = 0; 39 virtual Sink::ApplicationDomain::SinkResource createResource() = 0;
39 40
diff --git a/tests/messagequeuetest.cpp b/tests/messagequeuetest.cpp
index 484ff86..e79bba2 100644
--- a/tests/messagequeuetest.cpp
+++ b/tests/messagequeuetest.cpp
@@ -7,6 +7,9 @@
7#include "storage.h" 7#include "storage.h"
8#include "messagequeue.h" 8#include "messagequeue.h"
9#include "log.h" 9#include "log.h"
10#include "test.h"
11
12SINK_DEBUG_AREA("messagequeuetest")
10 13
11/** 14/**
12 * Test of the messagequeue implementation. 15 * Test of the messagequeue implementation.
@@ -17,8 +20,8 @@ class MessageQueueTest : public QObject
17private slots: 20private slots:
18 void initTestCase() 21 void initTestCase()
19 { 22 {
20 Sink::Log::setDebugOutputLevel(Sink::Log::Trace); 23 Sink::Test::initTest();
21 Sink::Storage store(Sink::Store::storageLocation(), "org.kde.dummy.testqueue", Sink::Storage::ReadWrite); 24 Sink::Storage store(Sink::Store::storageLocation(), "sink.dummy.testqueue", Sink::Storage::ReadWrite);
22 store.removeFromDisk(); 25 store.removeFromDisk();
23 } 26 }
24 27
@@ -28,13 +31,13 @@ private slots:
28 31
29 void cleanup() 32 void cleanup()
30 { 33 {
31 Sink::Storage store(Sink::Store::storageLocation(), "org.kde.dummy.testqueue", Sink::Storage::ReadWrite); 34 Sink::Storage store(Sink::Store::storageLocation(), "sink.dummy.testqueue", Sink::Storage::ReadWrite);
32 store.removeFromDisk(); 35 store.removeFromDisk();
33 } 36 }
34 37
35 void testEmpty() 38 void testEmpty()
36 { 39 {
37 MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); 40 MessageQueue queue(Sink::Store::storageLocation(), "sink.dummy.testqueue");
38 QVERIFY(queue.isEmpty()); 41 QVERIFY(queue.isEmpty());
39 queue.enqueue("value"); 42 queue.enqueue("value");
40 QVERIFY(!queue.isEmpty()); 43 QVERIFY(!queue.isEmpty());
@@ -42,7 +45,7 @@ private slots:
42 45
43 void testDequeueEmpty() 46 void testDequeueEmpty()
44 { 47 {
45 MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); 48 MessageQueue queue(Sink::Store::storageLocation(), "sink.dummy.testqueue");
46 bool gotValue = false; 49 bool gotValue = false;
47 bool gotError = false; 50 bool gotError = false;
48 queue.dequeue([&](void *ptr, int size, std::function<void(bool success)> callback) { gotValue = true; }, [&](const MessageQueue::Error &error) { gotError = true; }); 51 queue.dequeue([&](void *ptr, int size, std::function<void(bool success)> callback) { gotValue = true; }, [&](const MessageQueue::Error &error) { gotError = true; });
@@ -52,7 +55,7 @@ private slots:
52 55
53 void testEnqueue() 56 void testEnqueue()
54 { 57 {
55 MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); 58 MessageQueue queue(Sink::Store::storageLocation(), "sink.dummy.testqueue");
56 QSignalSpy spy(&queue, SIGNAL(messageReady())); 59 QSignalSpy spy(&queue, SIGNAL(messageReady()));
57 queue.enqueue("value1"); 60 queue.enqueue("value1");
58 QCOMPARE(spy.size(), 1); 61 QCOMPARE(spy.size(), 1);
@@ -60,7 +63,7 @@ private slots:
60 63
61 void testDrained() 64 void testDrained()
62 { 65 {
63 MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); 66 MessageQueue queue(Sink::Store::storageLocation(), "sink.dummy.testqueue");
64 QSignalSpy spy(&queue, SIGNAL(drained())); 67 QSignalSpy spy(&queue, SIGNAL(drained()));
65 queue.enqueue("value1"); 68 queue.enqueue("value1");
66 69
@@ -74,13 +77,13 @@ private slots:
74 values << "value1"; 77 values << "value1";
75 values << "value2"; 78 values << "value2";
76 79
77 MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); 80 MessageQueue queue(Sink::Store::storageLocation(), "sink.dummy.testqueue");
78 for (const QByteArray &value : values) { 81 for (const QByteArray &value : values) {
79 queue.enqueue(value); 82 queue.enqueue(value);
80 } 83 }
81 84
82 while (!queue.isEmpty()) { 85 while (!queue.isEmpty()) {
83 Log() << "start"; 86 SinkLog() << "start";
84 const auto expected = values.dequeue(); 87 const auto expected = values.dequeue();
85 bool gotValue = false; 88 bool gotValue = false;
86 bool gotError = false; 89 bool gotError = false;
@@ -104,7 +107,7 @@ private slots:
104 values << "value1"; 107 values << "value1";
105 values << "value2"; 108 values << "value2";
106 109
107 MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); 110 MessageQueue queue(Sink::Store::storageLocation(), "sink.dummy.testqueue");
108 for (const QByteArray &value : values) { 111 for (const QByteArray &value : values) {
109 queue.enqueue(value); 112 queue.enqueue(value);
110 } 113 }
@@ -142,7 +145,7 @@ private slots:
142 */ 145 */
143 void testNestedEnqueue() 146 void testNestedEnqueue()
144 { 147 {
145 MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); 148 MessageQueue queue(Sink::Store::storageLocation(), "sink.dummy.testqueue");
146 queue.enqueue("value1"); 149 queue.enqueue("value1");
147 150
148 bool gotError = false; 151 bool gotError = false;
@@ -157,7 +160,7 @@ private slots:
157 160
158 void testBatchDequeue() 161 void testBatchDequeue()
159 { 162 {
160 MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); 163 MessageQueue queue(Sink::Store::storageLocation(), "sink.dummy.testqueue");
161 queue.enqueue("value1"); 164 queue.enqueue("value1");
162 queue.enqueue("value2"); 165 queue.enqueue("value2");
163 queue.enqueue("value3"); 166 queue.enqueue("value3");
@@ -178,7 +181,7 @@ private slots:
178 181
179 void testBatchEnqueue() 182 void testBatchEnqueue()
180 { 183 {
181 MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); 184 MessageQueue queue(Sink::Store::storageLocation(), "sink.dummy.testqueue");
182 QSignalSpy spy(&queue, SIGNAL(messageReady())); 185 QSignalSpy spy(&queue, SIGNAL(messageReady()));
183 queue.startTransaction(); 186 queue.startTransaction();
184 queue.enqueue("value1"); 187 queue.enqueue("value1");
diff --git a/tests/modelinteractivitytest.cpp b/tests/modelinteractivitytest.cpp
index d0a0920..1ac0e2d 100644
--- a/tests/modelinteractivitytest.cpp
+++ b/tests/modelinteractivitytest.cpp
@@ -10,6 +10,7 @@
10#include "resourceconfig.h" 10#include "resourceconfig.h"
11#include "log.h" 11#include "log.h"
12#include "modelresult.h" 12#include "modelresult.h"
13#include "test.h"
13 14
14static int blockingTime; 15static int blockingTime;
15 16
@@ -29,10 +30,11 @@ public:
29 { 30 {
30 t.start(); 31 t.start();
31 const bool ret = QCoreApplication::notify(receiver, event); 32 const bool ret = QCoreApplication::notify(receiver, event);
32 if (t.elapsed() > 1) 33 if (t.elapsed() > 1) {
33 std::cout 34 std::cout
34 << QString("processing event type %1 for object %2 took %3ms").arg((int)event->type()).arg("" /* receiver->objectName().toLocal8Bit().data()*/).arg((int)t.elapsed()).toStdString() 35 << QString("processing event type %1 for object %2 took %3ms").arg((int)event->type()).arg(receiver->metaObject()->className()).arg((int)t.elapsed()).toStdString()
35 << std::endl; 36 << std::endl;
37 }
36 blockingTime += t.elapsed(); 38 blockingTime += t.elapsed();
37 return ret; 39 return ret;
38 } 40 }
@@ -49,14 +51,14 @@ class ModelinteractivityTest : public QObject
49private slots: 51private slots:
50 void initTestCase() 52 void initTestCase()
51 { 53 {
52 Sink::Log::setDebugOutputLevel(Sink::Log::Warning); 54 Sink::Test::initTest();
53 ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); 55 ResourceConfig::addResource("sink.dummy.instance1", "sink.dummy");
54 Sink::Store::removeDataFromDisk(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); 56 Sink::Store::removeDataFromDisk(QByteArray("sink.dummy.instance1")).exec().waitForFinished();
55 } 57 }
56 58
57 void cleanup() 59 void cleanup()
58 { 60 {
59 Sink::Store::removeDataFromDisk(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); 61 Sink::Store::removeDataFromDisk(QByteArray("sink.dummy.instance1")).exec().waitForFinished();
60 } 62 }
61 63
62 void init() 64 void init()
@@ -67,14 +69,14 @@ private slots:
67 { 69 {
68 // Setup 70 // Setup
69 { 71 {
70 Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); 72 Sink::ApplicationDomain::Mail mail("sink.dummy.instance1");
71 for (int i = 0; i < 1000; i++) { 73 for (int i = 0; i < 1000; i++) {
72 Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished(); 74 Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished();
73 } 75 }
74 } 76 }
75 77
76 Sink::Query query; 78 Sink::Query query;
77 query.resources << "org.kde.dummy.instance1"; 79 query.resources << "sink.dummy.instance1";
78 query.liveQuery = true; 80 query.liveQuery = true;
79 81
80 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); 82 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished();
diff --git a/tests/pipelinebenchmark.cpp b/tests/pipelinebenchmark.cpp
index 51481fd..0c0b9e6 100644
--- a/tests/pipelinebenchmark.cpp
+++ b/tests/pipelinebenchmark.cpp
@@ -131,7 +131,7 @@ private slots:
131 { 131 {
132 Sink::Log::setDebugOutputLevel(Sink::Log::Warning); 132 Sink::Log::setDebugOutputLevel(Sink::Log::Warning);
133 Sink::AdaptorFactoryRegistry::instance().registerFactory<Sink::ApplicationDomain::Mail, TestMailAdaptorFactory>("test"); 133 Sink::AdaptorFactoryRegistry::instance().registerFactory<Sink::ApplicationDomain::Mail, TestMailAdaptorFactory>("test");
134 resourceIdentifier = "org.kde.test.instance1"; 134 resourceIdentifier = "sink.test.instance1";
135 } 135 }
136 136
137 void testWithoutIndex() 137 void testWithoutIndex()
diff --git a/tests/pipelinetest.cpp b/tests/pipelinetest.cpp
index c6ee9ab..7216f62 100644
--- a/tests/pipelinetest.cpp
+++ b/tests/pipelinetest.cpp
@@ -190,13 +190,12 @@ class PipelineTest : public QObject
190private slots: 190private slots:
191 void initTestCase() 191 void initTestCase()
192 { 192 {
193 Sink::Log::setDebugOutputLevel(Sink::Log::Trace);
194 Sink::AdaptorFactoryRegistry::instance().registerFactory<Sink::ApplicationDomain::Event, TestEventAdaptorFactory>("test"); 193 Sink::AdaptorFactoryRegistry::instance().registerFactory<Sink::ApplicationDomain::Event, TestEventAdaptorFactory>("test");
195 } 194 }
196 195
197 void init() 196 void init()
198 { 197 {
199 removeFromDisk("org.kde.pipelinetest.instance1"); 198 removeFromDisk("sink.pipelinetest.instance1");
200 } 199 }
201 200
202 void testCreate() 201 void testCreate()
@@ -204,14 +203,14 @@ private slots:
204 flatbuffers::FlatBufferBuilder entityFbb; 203 flatbuffers::FlatBufferBuilder entityFbb;
205 auto command = createEntityCommand(createEvent(entityFbb)); 204 auto command = createEntityCommand(createEvent(entityFbb));
206 205
207 Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); 206 Sink::Pipeline pipeline("sink.pipelinetest.instance1");
208 pipeline.setResourceType("test"); 207 pipeline.setResourceType("test");
209 208
210 pipeline.startTransaction(); 209 pipeline.startTransaction();
211 pipeline.newEntity(command.constData(), command.size()); 210 pipeline.newEntity(command.constData(), command.size());
212 pipeline.commit(); 211 pipeline.commit();
213 212
214 auto result = getKeys("org.kde.pipelinetest.instance1", "event.main"); 213 auto result = getKeys("sink.pipelinetest.instance1", "event.main");
215 qDebug() << result; 214 qDebug() << result;
216 QCOMPARE(result.size(), 1); 215 QCOMPARE(result.size(), 1);
217 } 216 }
@@ -221,7 +220,7 @@ private slots:
221 flatbuffers::FlatBufferBuilder entityFbb; 220 flatbuffers::FlatBufferBuilder entityFbb;
222 auto command = createEntityCommand(createEvent(entityFbb, "summary", "description")); 221 auto command = createEntityCommand(createEvent(entityFbb, "summary", "description"));
223 222
224 Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); 223 Sink::Pipeline pipeline("sink.pipelinetest.instance1");
225 pipeline.setResourceType("test"); 224 pipeline.setResourceType("test");
226 225
227 auto adaptorFactory = QSharedPointer<TestEventAdaptorFactory>::create(); 226 auto adaptorFactory = QSharedPointer<TestEventAdaptorFactory>::create();
@@ -232,7 +231,7 @@ private slots:
232 pipeline.commit(); 231 pipeline.commit();
233 232
234 // Get uid of written entity 233 // Get uid of written entity
235 auto keys = getKeys("org.kde.pipelinetest.instance1", "event.main"); 234 auto keys = getKeys("sink.pipelinetest.instance1", "event.main");
236 QCOMPARE(keys.size(), 1); 235 QCOMPARE(keys.size(), 1);
237 const auto key = keys.first(); 236 const auto key = keys.first();
238 const auto uid = Sink::Storage::uidFromKey(key); 237 const auto uid = Sink::Storage::uidFromKey(key);
@@ -245,7 +244,7 @@ private slots:
245 pipeline.commit(); 244 pipeline.commit();
246 245
247 // Ensure we've got the new revision with the modification 246 // Ensure we've got the new revision with the modification
248 auto buffer = getEntity("org.kde.pipelinetest.instance1", "event.main", Sink::Storage::assembleKey(uid, 2)); 247 auto buffer = getEntity("sink.pipelinetest.instance1", "event.main", Sink::Storage::assembleKey(uid, 2));
249 QVERIFY(!buffer.isEmpty()); 248 QVERIFY(!buffer.isEmpty());
250 Sink::EntityBuffer entityBuffer(buffer.data(), buffer.size()); 249 Sink::EntityBuffer entityBuffer(buffer.data(), buffer.size());
251 auto adaptor = adaptorFactory->createAdaptor(entityBuffer.entity()); 250 auto adaptor = adaptorFactory->createAdaptor(entityBuffer.entity());
@@ -254,7 +253,7 @@ private slots:
254 QVERIFY2(adaptor->getProperty("description").toString() == QString("description"), "The modification has sideeffects."); 253 QVERIFY2(adaptor->getProperty("description").toString() == QString("description"), "The modification has sideeffects.");
255 254
256 // Both revisions are in the store at this point 255 // Both revisions are in the store at this point
257 QCOMPARE(getKeys("org.kde.pipelinetest.instance1", "event.main").size(), 2); 256 QCOMPARE(getKeys("sink.pipelinetest.instance1", "event.main").size(), 2);
258 257
259 // Cleanup old revisions 258 // Cleanup old revisions
260 pipeline.startTransaction(); 259 pipeline.startTransaction();
@@ -262,7 +261,7 @@ private slots:
262 pipeline.commit(); 261 pipeline.commit();
263 262
264 // And now only the latest revision is left 263 // And now only the latest revision is left
265 QCOMPARE(getKeys("org.kde.pipelinetest.instance1", "event.main").size(), 1); 264 QCOMPARE(getKeys("sink.pipelinetest.instance1", "event.main").size(), 1);
266 } 265 }
267 266
268 void testModifyWithUnrelatedOperationInbetween() 267 void testModifyWithUnrelatedOperationInbetween()
@@ -270,7 +269,7 @@ private slots:
270 flatbuffers::FlatBufferBuilder entityFbb; 269 flatbuffers::FlatBufferBuilder entityFbb;
271 auto command = createEntityCommand(createEvent(entityFbb)); 270 auto command = createEntityCommand(createEvent(entityFbb));
272 271
273 Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); 272 Sink::Pipeline pipeline("sink.pipelinetest.instance1");
274 pipeline.setResourceType("test"); 273 pipeline.setResourceType("test");
275 274
276 auto adaptorFactory = QSharedPointer<TestEventAdaptorFactory>::create(); 275 auto adaptorFactory = QSharedPointer<TestEventAdaptorFactory>::create();
@@ -281,7 +280,7 @@ private slots:
281 pipeline.commit(); 280 pipeline.commit();
282 281
283 // Get uid of written entity 282 // Get uid of written entity
284 auto keys = getKeys("org.kde.pipelinetest.instance1", "event.main"); 283 auto keys = getKeys("sink.pipelinetest.instance1", "event.main");
285 QCOMPARE(keys.size(), 1); 284 QCOMPARE(keys.size(), 1);
286 const auto uid = Sink::Storage::uidFromKey(keys.first()); 285 const auto uid = Sink::Storage::uidFromKey(keys.first());
287 286
@@ -303,7 +302,7 @@ private slots:
303 pipeline.commit(); 302 pipeline.commit();
304 303
305 // Ensure we've got the new revision with the modification 304 // Ensure we've got the new revision with the modification
306 auto buffer = getEntity("org.kde.pipelinetest.instance1", "event.main", Sink::Storage::assembleKey(uid, 3)); 305 auto buffer = getEntity("sink.pipelinetest.instance1", "event.main", Sink::Storage::assembleKey(uid, 3));
307 QVERIFY(!buffer.isEmpty()); 306 QVERIFY(!buffer.isEmpty());
308 Sink::EntityBuffer entityBuffer(buffer.data(), buffer.size()); 307 Sink::EntityBuffer entityBuffer(buffer.data(), buffer.size());
309 auto adaptor = adaptorFactory->createAdaptor(entityBuffer.entity()); 308 auto adaptor = adaptorFactory->createAdaptor(entityBuffer.entity());
@@ -314,7 +313,7 @@ private slots:
314 { 313 {
315 flatbuffers::FlatBufferBuilder entityFbb; 314 flatbuffers::FlatBufferBuilder entityFbb;
316 auto command = createEntityCommand(createEvent(entityFbb)); 315 auto command = createEntityCommand(createEvent(entityFbb));
317 Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); 316 Sink::Pipeline pipeline("sink.pipelinetest.instance1");
318 pipeline.setResourceType("test"); 317 pipeline.setResourceType("test");
319 318
320 // Create the initial revision 319 // Create the initial revision
@@ -322,7 +321,7 @@ private slots:
322 pipeline.newEntity(command.constData(), command.size()); 321 pipeline.newEntity(command.constData(), command.size());
323 pipeline.commit(); 322 pipeline.commit();
324 323
325 auto result = getKeys("org.kde.pipelinetest.instance1", "event.main"); 324 auto result = getKeys("sink.pipelinetest.instance1", "event.main");
326 QCOMPARE(result.size(), 1); 325 QCOMPARE(result.size(), 1);
327 326
328 const auto uid = Sink::Storage::uidFromKey(result.first()); 327 const auto uid = Sink::Storage::uidFromKey(result.first());
@@ -334,7 +333,7 @@ private slots:
334 pipeline.commit(); 333 pipeline.commit();
335 334
336 // We have a new revision that indicates the deletion 335 // We have a new revision that indicates the deletion
337 QCOMPARE(getKeys("org.kde.pipelinetest.instance1", "event.main").size(), 2); 336 QCOMPARE(getKeys("sink.pipelinetest.instance1", "event.main").size(), 2);
338 337
339 // Cleanup old revisions 338 // Cleanup old revisions
340 pipeline.startTransaction(); 339 pipeline.startTransaction();
@@ -342,18 +341,18 @@ private slots:
342 pipeline.commit(); 341 pipeline.commit();
343 342
344 // And all revisions are gone 343 // And all revisions are gone
345 QCOMPARE(getKeys("org.kde.pipelinetest.instance1", "event.main").size(), 0); 344 QCOMPARE(getKeys("sink.pipelinetest.instance1", "event.main").size(), 0);
346 } 345 }
347 346
348 void testPreprocessor() 347 void testPreprocessor()
349 { 348 {
350 flatbuffers::FlatBufferBuilder entityFbb; 349 flatbuffers::FlatBufferBuilder entityFbb;
351 350
352 TestProcessor testProcessor; 351 auto testProcessor = new TestProcessor;
353 352
354 Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); 353 Sink::Pipeline pipeline("sink.pipelinetest.instance1");
355 pipeline.setResourceType("test"); 354 pipeline.setResourceType("test");
356 pipeline.setPreprocessors("event", QVector<Sink::Preprocessor *>() << &testProcessor); 355 pipeline.setPreprocessors("event", QVector<Sink::Preprocessor *>() << testProcessor);
357 pipeline.startTransaction(); 356 pipeline.startTransaction();
358 // pipeline.setAdaptorFactory("event", QSharedPointer<TestEventAdaptorFactory>::create()); 357 // pipeline.setAdaptorFactory("event", QSharedPointer<TestEventAdaptorFactory>::create());
359 358
@@ -361,24 +360,24 @@ private slots:
361 { 360 {
362 auto command = createEntityCommand(createEvent(entityFbb)); 361 auto command = createEntityCommand(createEvent(entityFbb));
363 pipeline.newEntity(command.constData(), command.size()); 362 pipeline.newEntity(command.constData(), command.size());
364 QCOMPARE(testProcessor.newUids.size(), 1); 363 QCOMPARE(testProcessor->newUids.size(), 1);
365 QCOMPARE(testProcessor.newRevisions.size(), 1); 364 QCOMPARE(testProcessor->newRevisions.size(), 1);
366 // Key doesn't contain revision and is just the uid 365 // Key doesn't contain revision and is just the uid
367 QCOMPARE(testProcessor.newUids.at(0), Sink::Storage::uidFromKey(testProcessor.newUids.at(0))); 366 QCOMPARE(testProcessor->newUids.at(0), Sink::Storage::uidFromKey(testProcessor->newUids.at(0)));
368 } 367 }
369 pipeline.commit(); 368 pipeline.commit();
370 entityFbb.Clear(); 369 entityFbb.Clear();
371 pipeline.startTransaction(); 370 pipeline.startTransaction();
372 auto keys = getKeys("org.kde.pipelinetest.instance1", "event.main"); 371 auto keys = getKeys("sink.pipelinetest.instance1", "event.main");
373 QCOMPARE(keys.size(), 1); 372 QCOMPARE(keys.size(), 1);
374 const auto uid = Sink::Storage::uidFromKey(keys.first()); 373 const auto uid = Sink::Storage::uidFromKey(keys.first());
375 { 374 {
376 auto modifyCommand = modifyEntityCommand(createEvent(entityFbb, "summary2"), uid, 1); 375 auto modifyCommand = modifyEntityCommand(createEvent(entityFbb, "summary2"), uid, 1);
377 pipeline.modifiedEntity(modifyCommand.constData(), modifyCommand.size()); 376 pipeline.modifiedEntity(modifyCommand.constData(), modifyCommand.size());
378 QCOMPARE(testProcessor.modifiedUids.size(), 1); 377 QCOMPARE(testProcessor->modifiedUids.size(), 1);
379 QCOMPARE(testProcessor.modifiedRevisions.size(), 1); 378 QCOMPARE(testProcessor->modifiedRevisions.size(), 1);
380 // Key doesn't contain revision and is just the uid 379 // Key doesn't contain revision and is just the uid
381 QCOMPARE(testProcessor.modifiedUids.at(0), Sink::Storage::uidFromKey(testProcessor.modifiedUids.at(0))); 380 QCOMPARE(testProcessor->modifiedUids.at(0), Sink::Storage::uidFromKey(testProcessor->modifiedUids.at(0)));
382 } 381 }
383 pipeline.commit(); 382 pipeline.commit();
384 entityFbb.Clear(); 383 entityFbb.Clear();
@@ -386,12 +385,12 @@ private slots:
386 { 385 {
387 auto deleteCommand = deleteEntityCommand(uid, 1); 386 auto deleteCommand = deleteEntityCommand(uid, 1);
388 pipeline.deletedEntity(deleteCommand.constData(), deleteCommand.size()); 387 pipeline.deletedEntity(deleteCommand.constData(), deleteCommand.size());
389 QCOMPARE(testProcessor.deletedUids.size(), 1); 388 QCOMPARE(testProcessor->deletedUids.size(), 1);
390 QCOMPARE(testProcessor.deletedUids.size(), 1); 389 QCOMPARE(testProcessor->deletedUids.size(), 1);
391 QCOMPARE(testProcessor.deletedSummaries.size(), 1); 390 QCOMPARE(testProcessor->deletedSummaries.size(), 1);
392 // Key doesn't contain revision and is just the uid 391 // Key doesn't contain revision and is just the uid
393 QCOMPARE(testProcessor.deletedUids.at(0), Sink::Storage::uidFromKey(testProcessor.deletedUids.at(0))); 392 QCOMPARE(testProcessor->deletedUids.at(0), Sink::Storage::uidFromKey(testProcessor->deletedUids.at(0)));
394 QCOMPARE(testProcessor.deletedSummaries.at(0), QByteArray("summary2")); 393 QCOMPARE(testProcessor->deletedSummaries.at(0), QByteArray("summary2"));
395 } 394 }
396 } 395 }
397}; 396};
diff --git a/tests/querytest.cpp b/tests/querytest.cpp
index 6d7746e..d3a97f6 100644
--- a/tests/querytest.cpp
+++ b/tests/querytest.cpp
@@ -23,16 +23,15 @@ private slots:
23 void initTestCase() 23 void initTestCase()
24 { 24 {
25 Sink::Test::initTest(); 25 Sink::Test::initTest();
26 Sink::Log::setDebugOutputLevel(Sink::Log::Trace); 26 auto factory = Sink::ResourceFactory::load("sink.dummy");
27 auto factory = Sink::ResourceFactory::load("org.kde.dummy");
28 QVERIFY(factory); 27 QVERIFY(factory);
29 ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); 28 ResourceConfig::addResource("sink.dummy.instance1", "sink.dummy");
30 Sink::Store::removeDataFromDisk(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); 29 Sink::Store::removeDataFromDisk(QByteArray("sink.dummy.instance1")).exec().waitForFinished();
31 } 30 }
32 31
33 void cleanup() 32 void cleanup()
34 { 33 {
35 Sink::Store::removeDataFromDisk(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); 34 Sink::Store::removeDataFromDisk(QByteArray("sink.dummy.instance1")).exec().waitForFinished();
36 } 35 }
37 36
38 void init() 37 void init()
@@ -60,13 +59,13 @@ private slots:
60 { 59 {
61 // Setup 60 // Setup
62 { 61 {
63 Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); 62 Sink::ApplicationDomain::Mail mail("sink.dummy.instance1");
64 Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished(); 63 Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished();
65 } 64 }
66 65
67 // Test 66 // Test
68 Sink::Query query; 67 Sink::Query query;
69 query.resources << "org.kde.dummy.instance1"; 68 query.resources << "sink.dummy.instance1";
70 query.liveQuery = true; 69 query.liveQuery = true;
71 70
72 // We fetch before the data is available and rely on the live query mechanism to deliver the actual data 71 // We fetch before the data is available and rely on the live query mechanism to deliver the actual data
@@ -78,13 +77,13 @@ private slots:
78 { 77 {
79 // Setup 78 // Setup
80 { 79 {
81 Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); 80 Sink::ApplicationDomain::Mail mail("sink.dummy.instance1");
82 Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished(); 81 Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished();
83 } 82 }
84 83
85 // Test 84 // Test
86 Sink::Query query; 85 Sink::Query query;
87 query.resources << "org.kde.dummy.instance1"; 86 query.resources << "sink.dummy.instance1";
88 query.liveQuery = false; 87 query.liveQuery = false;
89 88
90 // Ensure all local data is processed 89 // Ensure all local data is processed
@@ -102,12 +101,12 @@ private slots:
102 QByteArray id; 101 QByteArray id;
103 // Setup 102 // Setup
104 { 103 {
105 Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); 104 Sink::ApplicationDomain::Mail mail("sink.dummy.instance1");
106 Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished(); 105 Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished();
107 Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished(); 106 Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished();
108 107
109 Sink::Query query; 108 Sink::Query query;
110 query.resources << "org.kde.dummy.instance1"; 109 query.resources << "sink.dummy.instance1";
111 110
112 // Ensure all local data is processed 111 // Ensure all local data is processed
113 Sink::Store::synchronize(query).exec().waitForFinished(); 112 Sink::Store::synchronize(query).exec().waitForFinished();
@@ -121,7 +120,7 @@ private slots:
121 120
122 // Test 121 // Test
123 Sink::Query query; 122 Sink::Query query;
124 query.resources << "org.kde.dummy.instance1"; 123 query.resources << "sink.dummy.instance1";
125 query.ids << id; 124 query.ids << id;
126 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); 125 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query);
127 QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); 126 QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool());
@@ -132,13 +131,13 @@ private slots:
132 { 131 {
133 // Setup 132 // Setup
134 { 133 {
135 Sink::ApplicationDomain::Folder folder("org.kde.dummy.instance1"); 134 Sink::ApplicationDomain::Folder folder("sink.dummy.instance1");
136 Sink::Store::create<Sink::ApplicationDomain::Folder>(folder).exec().waitForFinished(); 135 Sink::Store::create<Sink::ApplicationDomain::Folder>(folder).exec().waitForFinished();
137 } 136 }
138 137
139 // Test 138 // Test
140 Sink::Query query; 139 Sink::Query query;
141 query.resources << "org.kde.dummy.instance1"; 140 query.resources << "sink.dummy.instance1";
142 query.liveQuery = true; 141 query.liveQuery = true;
143 142
144 // We fetch before the data is available and rely on the live query mechanism to deliver the actual data 143 // We fetch before the data is available and rely on the live query mechanism to deliver the actual data
@@ -152,11 +151,11 @@ private slots:
152 { 151 {
153 // Setup 152 // Setup
154 { 153 {
155 Sink::ApplicationDomain::Folder folder("org.kde.dummy.instance1"); 154 Sink::ApplicationDomain::Folder folder("sink.dummy.instance1");
156 Sink::Store::create<Sink::ApplicationDomain::Folder>(folder).exec().waitForFinished(); 155 Sink::Store::create<Sink::ApplicationDomain::Folder>(folder).exec().waitForFinished();
157 156
158 Sink::Query query; 157 Sink::Query query;
159 query.resources << "org.kde.dummy.instance1"; 158 query.resources << "sink.dummy.instance1";
160 159
161 // Ensure all local data is processed 160 // Ensure all local data is processed
162 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); 161 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished();
@@ -168,14 +167,14 @@ private slots:
168 auto folderEntity = model->index(0, 0).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Folder::Ptr>(); 167 auto folderEntity = model->index(0, 0).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Folder::Ptr>();
169 QVERIFY(!folderEntity->identifier().isEmpty()); 168 QVERIFY(!folderEntity->identifier().isEmpty());
170 169
171 Sink::ApplicationDomain::Folder subfolder("org.kde.dummy.instance1"); 170 Sink::ApplicationDomain::Folder subfolder("sink.dummy.instance1");
172 subfolder.setProperty("parent", folderEntity->identifier()); 171 subfolder.setProperty("parent", folderEntity->identifier());
173 Sink::Store::create<Sink::ApplicationDomain::Folder>(subfolder).exec().waitForFinished(); 172 Sink::Store::create<Sink::ApplicationDomain::Folder>(subfolder).exec().waitForFinished();
174 } 173 }
175 174
176 // Test 175 // Test
177 Sink::Query query; 176 Sink::Query query;
178 query.resources << "org.kde.dummy.instance1"; 177 query.resources << "sink.dummy.instance1";
179 query.parentProperty = "parent"; 178 query.parentProperty = "parent";
180 179
181 // Ensure all local data is processed 180 // Ensure all local data is processed
@@ -194,7 +193,7 @@ private slots:
194 { 193 {
195 // Setup 194 // Setup
196 { 195 {
197 Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); 196 Sink::ApplicationDomain::Mail mail("sink.dummy.instance1");
198 mail.setProperty("uid", "test1"); 197 mail.setProperty("uid", "test1");
199 mail.setProperty("sender", "doe@example.org"); 198 mail.setProperty("sender", "doe@example.org");
200 Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished(); 199 Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished();
@@ -202,7 +201,7 @@ private slots:
202 201
203 // Test 202 // Test
204 Sink::Query query; 203 Sink::Query query;
205 query.resources << "org.kde.dummy.instance1"; 204 query.resources << "sink.dummy.instance1";
206 query.liveQuery = false; 205 query.liveQuery = false;
207 query += Sink::Query::PropertyFilter("uid", "test1"); 206 query += Sink::Query::PropertyFilter("uid", "test1");
208 207
@@ -220,11 +219,11 @@ private slots:
220 // Setup 219 // Setup
221 Sink::ApplicationDomain::Folder::Ptr folderEntity; 220 Sink::ApplicationDomain::Folder::Ptr folderEntity;
222 { 221 {
223 Sink::ApplicationDomain::Folder folder("org.kde.dummy.instance1"); 222 Sink::ApplicationDomain::Folder folder("sink.dummy.instance1");
224 Sink::Store::create<Sink::ApplicationDomain::Folder>(folder).exec().waitForFinished(); 223 Sink::Store::create<Sink::ApplicationDomain::Folder>(folder).exec().waitForFinished();
225 224
226 Sink::Query query; 225 Sink::Query query;
227 query.resources << "org.kde.dummy.instance1"; 226 query.resources << "sink.dummy.instance1";
228 227
229 // Ensure all local data is processed 228 // Ensure all local data is processed
230 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); 229 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished();
@@ -236,7 +235,7 @@ private slots:
236 folderEntity = model->index(0, 0).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Folder::Ptr>(); 235 folderEntity = model->index(0, 0).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Folder::Ptr>();
237 QVERIFY(!folderEntity->identifier().isEmpty()); 236 QVERIFY(!folderEntity->identifier().isEmpty());
238 237
239 Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); 238 Sink::ApplicationDomain::Mail mail("sink.dummy.instance1");
240 mail.setProperty("uid", "test1"); 239 mail.setProperty("uid", "test1");
241 mail.setProperty("folder", folderEntity->identifier()); 240 mail.setProperty("folder", folderEntity->identifier());
242 Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished(); 241 Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished();
@@ -244,7 +243,7 @@ private slots:
244 243
245 // Test 244 // Test
246 Sink::Query query; 245 Sink::Query query;
247 query.resources << "org.kde.dummy.instance1"; 246 query.resources << "sink.dummy.instance1";
248 query += Sink::Query::PropertyFilter("folder", *folderEntity); 247 query += Sink::Query::PropertyFilter("folder", *folderEntity);
249 248
250 // Ensure all local data is processed 249 // Ensure all local data is processed
@@ -261,11 +260,11 @@ private slots:
261 // Setup 260 // Setup
262 Sink::ApplicationDomain::Folder::Ptr folderEntity; 261 Sink::ApplicationDomain::Folder::Ptr folderEntity;
263 { 262 {
264 Sink::ApplicationDomain::Folder folder("org.kde.dummy.instance1"); 263 Sink::ApplicationDomain::Folder folder("sink.dummy.instance1");
265 Sink::Store::create<Sink::ApplicationDomain::Folder>(folder).exec().waitForFinished(); 264 Sink::Store::create<Sink::ApplicationDomain::Folder>(folder).exec().waitForFinished();
266 265
267 Sink::Query query; 266 Sink::Query query;
268 query.resources << "org.kde.dummy.instance1"; 267 query.resources << "sink.dummy.instance1";
269 268
270 // Ensure all local data is processed 269 // Ensure all local data is processed
271 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); 270 Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished();
@@ -279,21 +278,21 @@ private slots:
279 278
280 const auto date = QDateTime(QDate(2015, 7, 7), QTime(12, 0)); 279 const auto date = QDateTime(QDate(2015, 7, 7), QTime(12, 0));
281 { 280 {
282 Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); 281 Sink::ApplicationDomain::Mail mail("sink.dummy.instance1");
283 mail.setProperty("uid", "testSecond"); 282 mail.setProperty("uid", "testSecond");
284 mail.setProperty("folder", folderEntity->identifier()); 283 mail.setProperty("folder", folderEntity->identifier());
285 mail.setProperty("date", date.addDays(-1)); 284 mail.setProperty("date", date.addDays(-1));
286 Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished(); 285 Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished();
287 } 286 }
288 { 287 {
289 Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); 288 Sink::ApplicationDomain::Mail mail("sink.dummy.instance1");
290 mail.setProperty("uid", "testLatest"); 289 mail.setProperty("uid", "testLatest");
291 mail.setProperty("folder", folderEntity->identifier()); 290 mail.setProperty("folder", folderEntity->identifier());
292 mail.setProperty("date", date); 291 mail.setProperty("date", date);
293 Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished(); 292 Sink::Store::create<Sink::ApplicationDomain::Mail>(mail).exec().waitForFinished();
294 } 293 }
295 { 294 {
296 Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); 295 Sink::ApplicationDomain::Mail mail("sink.dummy.instance1");
297 mail.setProperty("uid", "testLast"); 296 mail.setProperty("uid", "testLast");
298 mail.setProperty("folder", folderEntity->identifier()); 297 mail.setProperty("folder", folderEntity->identifier());
299 mail.setProperty("date", date.addDays(-2)); 298 mail.setProperty("date", date.addDays(-2));
@@ -303,7 +302,7 @@ private slots:
303 302
304 // Test 303 // Test
305 Sink::Query query; 304 Sink::Query query;
306 query.resources << "org.kde.dummy.instance1"; 305 query.resources << "sink.dummy.instance1";
307 query += Sink::Query::PropertyFilter("folder", *folderEntity); 306 query += Sink::Query::PropertyFilter("folder", *folderEntity);
308 query.sortProperty = "date"; 307 query.sortProperty = "date";
309 query.limit = 1; 308 query.limit = 1;
diff --git a/tests/resourcecommunicationtest.cpp b/tests/resourcecommunicationtest.cpp
index 2874457..1530f63 100644
--- a/tests/resourcecommunicationtest.cpp
+++ b/tests/resourcecommunicationtest.cpp
@@ -92,6 +92,26 @@ private slots:
92 QTRY_COMPARE(complete, count); 92 QTRY_COMPARE(complete, count);
93 QVERIFY(!errors); 93 QVERIFY(!errors);
94 } 94 }
95
96 void testAccessFactory()
97 {
98 const QByteArray resourceIdentifier("test");
99 Listener listener(resourceIdentifier, "");
100 QWeakPointer<Sink::ResourceAccess> weakRef;
101 QTime time;
102 time.start();
103 {
104 auto resourceAccess = Sink::ResourceAccessFactory::instance().getAccess(resourceIdentifier, "");
105 weakRef = resourceAccess.toWeakRef();
106 resourceAccess->open();
107 resourceAccess->sendCommand(Sink::Commands::PingCommand).then<void>([resourceAccess]() { qDebug() << "Pind complete"; }).exec();
108 }
109 QVERIFY(weakRef.toStrongRef());
110 QTRY_VERIFY(!weakRef.toStrongRef());
111 qDebug() << "time.elapsed " << time.elapsed();
112 QVERIFY(time.elapsed() < 3500);
113 QVERIFY(time.elapsed() > 2500);
114 }
95}; 115};
96 116
97QTEST_MAIN(ResourceCommunicationTest) 117QTEST_MAIN(ResourceCommunicationTest)
diff --git a/tests/resourceconfigtest.cpp b/tests/resourceconfigtest.cpp
index bebff50..021d042 100644
--- a/tests/resourceconfigtest.cpp
+++ b/tests/resourceconfigtest.cpp
@@ -8,6 +8,8 @@
8#include "modelresult.h" 8#include "modelresult.h"
9#include "resultprovider.h" 9#include "resultprovider.h"
10#include "facadefactory.h" 10#include "facadefactory.h"
11#include "test.h"
12#include "testutils.h"
11 13
12/** 14/**
13 * Test of the resource configuration. 15 * Test of the resource configuration.
@@ -19,9 +21,9 @@ private slots:
19 21
20 void initTestCase() 22 void initTestCase()
21 { 23 {
24 Sink::Test::initTest();
22 Sink::FacadeFactory::instance().resetFactory(); 25 Sink::FacadeFactory::instance().resetFactory();
23 ResourceConfig::clear(); 26 ResourceConfig::clear();
24 Sink::Log::setDebugOutputLevel(Sink::Log::Trace);
25 } 27 }
26 28
27 void resourceManagement() 29 void resourceManagement()
@@ -72,6 +74,30 @@ private slots:
72 Sink::Store::remove(res).exec().waitForFinished(); 74 Sink::Store::remove(res).exec().waitForFinished();
73 } 75 }
74 76
77 void testLoadResourceStatus()
78 {
79 ResourceConfig::clear();
80 Sink::FacadeFactory::instance().registerStaticFacades();
81
82 auto res = Sink::ApplicationDomain::DummyResource::create("");
83 VERIFYEXEC(Sink::Store::create(res));
84 {
85 Sink::Query query;
86 query.liveQuery = true;
87 query.request<Sink::ApplicationDomain::SinkResource::Status>();
88 auto model = Sink::Store::loadModel<Sink::ApplicationDomain::SinkResource>(query);
89 QTRY_COMPARE(model->rowCount(QModelIndex()), 1);
90 auto resource = model->data(model->index(0, 0, QModelIndex()), Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::SinkResource::Ptr>();
91 QCOMPARE(resource->getStatus(), static_cast<int>(Sink::ApplicationDomain::OfflineStatus));
92
93 //Synchronize to connect
94 VERIFYEXEC(Sink::Store::synchronize(query));
95 QTRY_COMPARE(model->data(model->index(0, 0, QModelIndex()), Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::SinkResource::Ptr>()->getStatus(), static_cast<int>(Sink::ApplicationDomain::ConnectedStatus));
96 }
97
98 VERIFYEXEC(Sink::Store::remove(res));
99 }
100
75}; 101};
76 102
77QTEST_MAIN(ResourceConfigTest) 103QTEST_MAIN(ResourceConfigTest)
diff --git a/tests/testaccounttest.cpp b/tests/testaccounttest.cpp
index c630846..078e7a0 100644
--- a/tests/testaccounttest.cpp
+++ b/tests/testaccounttest.cpp
@@ -20,7 +20,6 @@ private slots:
20 { 20 {
21 // Sink::FacadeFactory::instance().resetFactory(); 21 // Sink::FacadeFactory::instance().resetFactory();
22 // ResourceConfig::clear(); 22 // ResourceConfig::clear();
23 Log::setDebugOutputLevel(Sink::Log::Trace);
24 Test::initTest(); 23 Test::initTest();
25 } 24 }
26 25