From b4df9eb5f1f4a0ac2b1272fc34d4b8aad473008b Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 5 Jul 2016 15:22:10 +0200 Subject: Prepare for making the resource status available --- tests/dummyresourcebenchmark.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/dummyresourcebenchmark.cpp b/tests/dummyresourcebenchmark.cpp index d5f98c3..7e334a6 100644 --- a/tests/dummyresourcebenchmark.cpp +++ b/tests/dummyresourcebenchmark.cpp @@ -90,7 +90,7 @@ private slots: bool gotNotification = false; int duration = 0; notifier->registerHandler([&gotNotification, &duration, &time](const Sink::Notification ¬ification) { - if (notification.type == Sink::Commands::NotificationType::NotificationType_RevisionUpdate) { + if (notification.type == Sink::Notification::RevisionUpdate) { gotNotification = true; duration = time.elapsed(); } -- cgit v1.2.3 From abc90b737074d93f73490a77e1eb1e1666dac375 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 6 Jul 2016 09:58:34 +0200 Subject: Test the resource status --- tests/resourceconfigtest.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'tests') diff --git a/tests/resourceconfigtest.cpp b/tests/resourceconfigtest.cpp index bebff50..42f8b70 100644 --- a/tests/resourceconfigtest.cpp +++ b/tests/resourceconfigtest.cpp @@ -8,6 +8,8 @@ #include "modelresult.h" #include "resultprovider.h" #include "facadefactory.h" +#include "test.h" +#include "testutils.h" /** * Test of the resource configuration. @@ -19,6 +21,7 @@ private slots: void initTestCase() { + Sink::Test::initTest(); Sink::FacadeFactory::instance().resetFactory(); ResourceConfig::clear(); Sink::Log::setDebugOutputLevel(Sink::Log::Trace); @@ -72,6 +75,34 @@ private slots: Sink::Store::remove(res).exec().waitForFinished(); } + void testLoadResourceStatus() + { + ResourceConfig::clear(); + Sink::FacadeFactory::instance().registerStaticFacades(); + + Sink::ApplicationDomain::SinkResource res("", "dummyresource.identifier1", 0, QSharedPointer::create()); + res.setProperty("identifier", "dummyresource.identifier1"); + res.setProperty("type", "org.kde.dummy"); + res.setProperty("capabilities", QVariant::fromValue(QByteArrayList() << "foo")); + + Sink::Store::create(res).exec().waitForFinished(); + { + Sink::Query query; + query.liveQuery = true; + query.request(); + auto model = Sink::Store::loadModel(Sink::Query::CapabilityFilter("foo")); + QTRY_COMPARE(model->rowCount(QModelIndex()), 1); + auto resource = model->data(model->index(0, 0, QModelIndex()), Sink::Store::DomainObjectRole).value(); + QCOMPARE(resource->getStatus(), static_cast(Sink::ApplicationDomain::OfflineStatus)); + + //Synchronize to connect + VERIFYEXEC(Sink::Store::synchronize(query)); + QTRY_COMPARE(model->data(model->index(0, 0, QModelIndex()), Sink::Store::DomainObjectRole).value()->getStatus(), static_cast(Sink::ApplicationDomain::ConnectedStatus)); + } + + VERIFYEXEC(Sink::Store::remove(res)); + } + }; QTEST_MAIN(ResourceConfigTest) -- cgit v1.2.3 From 9c50bfa96354f5e98375df3e89981f1e67a68cd8 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 6 Jul 2016 17:54:03 +0200 Subject: Test the resourcefactory --- tests/accountstest.cpp | 10 +++++----- tests/resourcecommunicationtest.cpp | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/accountstest.cpp b/tests/accountstest.cpp index be5e1a0..5a66305 100644 --- a/tests/accountstest.cpp +++ b/tests/accountstest.cpp @@ -94,8 +94,8 @@ private slots: using namespace Sink::ApplicationDomain; auto account = ApplicationDomainType::createEntity(); - account.setProperty("type", "maildir"); - account.setProperty("name", "name"); + account.setAccountType("maildir"); + account.setName("name"); Store::create(account).exec().waitForFinished(); Query query; @@ -104,14 +104,14 @@ private slots: QTRY_COMPARE(model->rowCount(QModelIndex()), 1); auto account2 = ApplicationDomainType::createEntity(); - account2.setProperty("type", "maildir"); - account2.setProperty("name", "name"); + account2.setAccountType("maildir"); + account2.setName("name"); Store::create(account2).exec().waitForFinished(); QTRY_COMPARE(model->rowCount(QModelIndex()), 2); //Ensure the notifier only affects one type auto resource = ApplicationDomainType::createEntity(); - resource.setProperty("type", "org.kde.mailtransport"); + resource.setResourceType("org.kde.mailtransport"); Store::create(resource).exec().waitForFinished(); QTRY_COMPARE(model->rowCount(QModelIndex()), 2); } 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: QTRY_COMPARE(complete, count); QVERIFY(!errors); } + + void testAccessFactory() + { + const QByteArray resourceIdentifier("test"); + Listener listener(resourceIdentifier, ""); + QWeakPointer weakRef; + QTime time; + time.start(); + { + auto resourceAccess = Sink::ResourceAccessFactory::instance().getAccess(resourceIdentifier, ""); + weakRef = resourceAccess.toWeakRef(); + resourceAccess->open(); + resourceAccess->sendCommand(Sink::Commands::PingCommand).then([resourceAccess]() { qDebug() << "Pind complete"; }).exec(); + } + QVERIFY(weakRef.toStrongRef()); + QTRY_VERIFY(!weakRef.toStrongRef()); + qDebug() << "time.elapsed " << time.elapsed(); + QVERIFY(time.elapsed() < 3500); + QVERIFY(time.elapsed() > 2500); + } }; QTEST_MAIN(ResourceCommunicationTest) -- cgit v1.2.3 From dd1364151f0f572091331dfb885225d2e3ab72c5 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 6 Jul 2016 19:24:51 +0200 Subject: Fixed tests --- tests/pipelinetest.cpp | 26 +++++++++++++------------- tests/resourceconfigtest.cpp | 10 +++------- 2 files changed, 16 insertions(+), 20 deletions(-) (limited to 'tests') diff --git a/tests/pipelinetest.cpp b/tests/pipelinetest.cpp index c6ee9ab..fc23cc9 100644 --- a/tests/pipelinetest.cpp +++ b/tests/pipelinetest.cpp @@ -349,11 +349,11 @@ private slots: { flatbuffers::FlatBufferBuilder entityFbb; - TestProcessor testProcessor; + auto testProcessor = new TestProcessor; Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); pipeline.setResourceType("test"); - pipeline.setPreprocessors("event", QVector() << &testProcessor); + pipeline.setPreprocessors("event", QVector() << testProcessor); pipeline.startTransaction(); // pipeline.setAdaptorFactory("event", QSharedPointer::create()); @@ -361,10 +361,10 @@ private slots: { auto command = createEntityCommand(createEvent(entityFbb)); pipeline.newEntity(command.constData(), command.size()); - QCOMPARE(testProcessor.newUids.size(), 1); - QCOMPARE(testProcessor.newRevisions.size(), 1); + QCOMPARE(testProcessor->newUids.size(), 1); + QCOMPARE(testProcessor->newRevisions.size(), 1); // Key doesn't contain revision and is just the uid - QCOMPARE(testProcessor.newUids.at(0), Sink::Storage::uidFromKey(testProcessor.newUids.at(0))); + QCOMPARE(testProcessor->newUids.at(0), Sink::Storage::uidFromKey(testProcessor->newUids.at(0))); } pipeline.commit(); entityFbb.Clear(); @@ -375,10 +375,10 @@ private slots: { auto modifyCommand = modifyEntityCommand(createEvent(entityFbb, "summary2"), uid, 1); pipeline.modifiedEntity(modifyCommand.constData(), modifyCommand.size()); - QCOMPARE(testProcessor.modifiedUids.size(), 1); - QCOMPARE(testProcessor.modifiedRevisions.size(), 1); + QCOMPARE(testProcessor->modifiedUids.size(), 1); + QCOMPARE(testProcessor->modifiedRevisions.size(), 1); // Key doesn't contain revision and is just the uid - QCOMPARE(testProcessor.modifiedUids.at(0), Sink::Storage::uidFromKey(testProcessor.modifiedUids.at(0))); + QCOMPARE(testProcessor->modifiedUids.at(0), Sink::Storage::uidFromKey(testProcessor->modifiedUids.at(0))); } pipeline.commit(); entityFbb.Clear(); @@ -386,12 +386,12 @@ private slots: { auto deleteCommand = deleteEntityCommand(uid, 1); pipeline.deletedEntity(deleteCommand.constData(), deleteCommand.size()); - QCOMPARE(testProcessor.deletedUids.size(), 1); - QCOMPARE(testProcessor.deletedUids.size(), 1); - QCOMPARE(testProcessor.deletedSummaries.size(), 1); + QCOMPARE(testProcessor->deletedUids.size(), 1); + QCOMPARE(testProcessor->deletedUids.size(), 1); + QCOMPARE(testProcessor->deletedSummaries.size(), 1); // Key doesn't contain revision and is just the uid - QCOMPARE(testProcessor.deletedUids.at(0), Sink::Storage::uidFromKey(testProcessor.deletedUids.at(0))); - QCOMPARE(testProcessor.deletedSummaries.at(0), QByteArray("summary2")); + QCOMPARE(testProcessor->deletedUids.at(0), Sink::Storage::uidFromKey(testProcessor->deletedUids.at(0))); + QCOMPARE(testProcessor->deletedSummaries.at(0), QByteArray("summary2")); } } }; diff --git a/tests/resourceconfigtest.cpp b/tests/resourceconfigtest.cpp index 42f8b70..d5f98d3 100644 --- a/tests/resourceconfigtest.cpp +++ b/tests/resourceconfigtest.cpp @@ -80,17 +80,13 @@ private slots: ResourceConfig::clear(); Sink::FacadeFactory::instance().registerStaticFacades(); - Sink::ApplicationDomain::SinkResource res("", "dummyresource.identifier1", 0, QSharedPointer::create()); - res.setProperty("identifier", "dummyresource.identifier1"); - res.setProperty("type", "org.kde.dummy"); - res.setProperty("capabilities", QVariant::fromValue(QByteArrayList() << "foo")); - - Sink::Store::create(res).exec().waitForFinished(); + auto res = Sink::ApplicationDomain::DummyResource::create(""); + VERIFYEXEC(Sink::Store::create(res)); { Sink::Query query; query.liveQuery = true; query.request(); - auto model = Sink::Store::loadModel(Sink::Query::CapabilityFilter("foo")); + auto model = Sink::Store::loadModel(query); QTRY_COMPARE(model->rowCount(QModelIndex()), 1); auto resource = model->data(model->index(0, 0, QModelIndex()), Sink::Store::DomainObjectRole).value(); QCOMPARE(resource->getStatus(), static_cast(Sink::ApplicationDomain::OfflineStatus)); -- cgit v1.2.3 From 8bc01b8494033919b0c9ed1aa35a94660ea7f46d Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 7 Jul 2016 09:15:46 +0200 Subject: Avoid an endless stream of errormessages in modelinteractivity test --- tests/modelinteractivitytest.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/modelinteractivitytest.cpp b/tests/modelinteractivitytest.cpp index d0a0920..c55a1db 100644 --- a/tests/modelinteractivitytest.cpp +++ b/tests/modelinteractivitytest.cpp @@ -10,6 +10,7 @@ #include "resourceconfig.h" #include "log.h" #include "modelresult.h" +#include "test.h" static int blockingTime; @@ -49,6 +50,7 @@ class ModelinteractivityTest : public QObject private slots: void initTestCase() { + Sink::Test::initTest(); Sink::Log::setDebugOutputLevel(Sink::Log::Warning); ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); Sink::Store::removeDataFromDisk(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); -- cgit v1.2.3 From e3da13d1fe9ad623e05aec1977c813e7da37cedd Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 7 Jul 2016 11:46:45 +0200 Subject: Fail quickly if the backend is not available --- tests/mailsynctest.cpp | 1 + tests/mailsynctest.h | 1 + tests/mailtest.cpp | 1 + tests/mailtest.h | 1 + 4 files changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/mailsynctest.cpp b/tests/mailsynctest.cpp index e70e34e..faaf003 100644 --- a/tests/mailsynctest.cpp +++ b/tests/mailsynctest.cpp @@ -34,6 +34,7 @@ using namespace Sink::ApplicationDomain; void MailSyncTest::initTestCase() { Test::initTest(); + QVERIFY(isBackendAvailable()); Log::setDebugOutputLevel(Sink::Log::Trace); resetTestEnvironment(); auto resource = createResource(); 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: QByteArray mResourceInstanceIdentifier; QByteArrayList mCapabilities; + virtual bool isBackendAvailable() { return true; } virtual void resetTestEnvironment() = 0; virtual Sink::ApplicationDomain::SinkResource createResource() = 0; virtual Sink::ApplicationDomain::SinkResource createFaultyResource() = 0; diff --git a/tests/mailtest.cpp b/tests/mailtest.cpp index b9d496d..8031cf1 100644 --- a/tests/mailtest.cpp +++ b/tests/mailtest.cpp @@ -34,6 +34,7 @@ using namespace Sink::ApplicationDomain; void MailTest::initTestCase() { Test::initTest(); + QVERIFY(isBackendAvailable()); Log::setDebugOutputLevel(Sink::Log::Trace); resetTestEnvironment(); auto resource = createResource(); 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: QByteArray mResourceInstanceIdentifier; QByteArrayList mCapabilities; + virtual bool isBackendAvailable() { return true; } virtual void resetTestEnvironment() = 0; virtual Sink::ApplicationDomain::SinkResource createResource() = 0; -- cgit v1.2.3 From 7ac1e222090ecfaa27ea8de2950e8c98a5033137 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 7 Jul 2016 11:57:43 +0200 Subject: Fix imap tests after trash addition --- tests/mailsynctest.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/mailsynctest.cpp b/tests/mailsynctest.cpp index faaf003..953adbf 100644 --- a/tests/mailsynctest.cpp +++ b/tests/mailsynctest.cpp @@ -197,6 +197,10 @@ void MailSyncTest::testListFolderHierarchy() QVERIFY(names.contains("Drafts")); names.removeAll("Drafts"); } + if (mCapabilities.contains(ResourceCapabilities::Mail::trash)) { + QVERIFY(names.contains("Trash")); + names.removeAll("Trash"); + } QCOMPARE(names.size(), 3); QCOMPARE(map.value("sub")->getParent(), map.value("test")->identifier()); }); -- cgit v1.2.3 From da2b049e248c1ad7efeb53685158a205335e4e36 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 7 Jul 2016 22:23:49 +0200 Subject: A new debug system. Instead of a single #define as debug area the new system allows for an identifier for each debug message with the structure component.area. The component is a dot separated identifier of the runtime component, such as the process or the plugin. The area is the code component, and can be as such defined at compiletime. The idea of this system is that it becomes possible to i.e. look at the output of all messages in the query subsystem of a specific resource (something that happens in the client process, but in the resource-specific subcomponent). The new macros are supposed to be less likely to clash with other names, hence the new names. --- tests/clientapitest.cpp | 10 ++++++---- tests/mailsynctest.cpp | 4 +++- tests/mailtest.cpp | 6 ++++-- tests/messagequeuetest.cpp | 4 +++- 4 files changed, 16 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp index 8c5866d..ec74cbd 100644 --- a/tests/clientapitest.cpp +++ b/tests/clientapitest.cpp @@ -9,6 +9,8 @@ #include "resultprovider.h" #include "facadefactory.h" +SINK_DEBUG_AREA("clientapitest") + template class TestDummyResourceFacade : public Sink::StoreFacade { @@ -44,7 +46,7 @@ public: { auto resultProvider = new Sink::ResultProvider(); resultProvider->onDone([resultProvider]() { - Trace() << "Result provider is done"; + SinkTrace() << "Result provider is done"; delete resultProvider; }); // We have to do it this way, otherwise we're not setting the fetcher right @@ -52,11 +54,11 @@ public: resultProvider->setFetcher([query, resultProvider, this](const typename T::Ptr &parent) { if (parent) { - Trace() << "Running the fetcher " << parent->identifier(); + SinkTrace() << "Running the fetcher " << parent->identifier(); } else { - Trace() << "Running the fetcher."; + SinkTrace() << "Running the fetcher."; } - Trace() << "-------------------------."; + SinkTrace() << "-------------------------."; for (const auto &res : results) { qDebug() << "Parent filter " << query.propertyFilter.value("parent").value.toByteArray() << res->identifier() << res->getProperty("parent").toByteArray(); auto parentProperty = res->getProperty("parent").toByteArray(); diff --git a/tests/mailsynctest.cpp b/tests/mailsynctest.cpp index 953adbf..4401f27 100644 --- a/tests/mailsynctest.cpp +++ b/tests/mailsynctest.cpp @@ -31,6 +31,8 @@ using namespace Sink; using namespace Sink::ApplicationDomain; +SINK_DEBUG_AREA("mailsynctest") + void MailSyncTest::initTestCase() { Test::initTest(); @@ -73,7 +75,7 @@ void MailSyncTest::testListFolders() for (const auto &folder : folders) { names << folder->getName(); } - Trace() << "base folder: " << names; + SinkTrace() << "base folder: " << names; baseCount = folders.size(); }); VERIFYEXEC(job); diff --git a/tests/mailtest.cpp b/tests/mailtest.cpp index 8031cf1..0537175 100644 --- a/tests/mailtest.cpp +++ b/tests/mailtest.cpp @@ -31,6 +31,8 @@ using namespace Sink; using namespace Sink::ApplicationDomain; +SINK_DEBUG_AREA("mailtest") + void MailTest::initTestCase() { Test::initTest(); @@ -251,7 +253,7 @@ void MailTest::testMoveMail() auto mail = *mails.first(); modifiedMail = mail; QCOMPARE(mail.getFolder(), folder.identifier()); - Warning() << "path: " << mail.getMimeMessagePath(); + SinkWarning() << "path: " << mail.getMimeMessagePath(); QVERIFY(QFile(mail.getMimeMessagePath()).exists()); }); VERIFYEXEC(job); @@ -270,7 +272,7 @@ void MailTest::testMoveMail() auto mail = *mails.first(); QCOMPARE(mail.getFolder(), folder1.identifier()); QVERIFY(QFile(mail.getMimeMessagePath()).exists()); - Trace() << "Mime message path: " << mail.getMimeMessagePath(); + SinkTrace() << "Mime message path: " << mail.getMimeMessagePath(); }); VERIFYEXEC(job); } diff --git a/tests/messagequeuetest.cpp b/tests/messagequeuetest.cpp index 484ff86..a8d0d4d 100644 --- a/tests/messagequeuetest.cpp +++ b/tests/messagequeuetest.cpp @@ -8,6 +8,8 @@ #include "messagequeue.h" #include "log.h" +SINK_DEBUG_AREA("messagequeuetest") + /** * Test of the messagequeue implementation. */ @@ -80,7 +82,7 @@ private slots: } while (!queue.isEmpty()) { - Log() << "start"; + SinkLog() << "start"; const auto expected = values.dequeue(); bool gotValue = false; bool gotError = false; -- cgit v1.2.3 From 9317fbffeab4a8c258acb1116eb12fbded7053d8 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 8 Jul 2016 11:01:48 +0200 Subject: Control debugoutput during tests with sinksh. --- tests/accountstest.cpp | 1 - tests/clientapitest.cpp | 1 - tests/dummyresourcetest.cpp | 1 - tests/genericfacadetest.cpp | 6 +++--- tests/genericresourcetest.cpp | 1 - tests/inspectiontest.cpp | 1 - tests/maildirsyncbenchmark.cpp | 1 - tests/mailsynctest.cpp | 1 - tests/mailtest.cpp | 1 - tests/messagequeuetest.cpp | 3 ++- tests/modelinteractivitytest.cpp | 1 - tests/pipelinetest.cpp | 1 - tests/querytest.cpp | 1 - tests/resourceconfigtest.cpp | 1 - tests/testaccounttest.cpp | 1 - 15 files changed, 5 insertions(+), 17 deletions(-) (limited to 'tests') diff --git a/tests/accountstest.cpp b/tests/accountstest.cpp index 5a66305..d12e7f4 100644 --- a/tests/accountstest.cpp +++ b/tests/accountstest.cpp @@ -17,7 +17,6 @@ private slots: void initTestCase() { Sink::Test::initTest(); - Sink::Log::setDebugOutputLevel(Sink::Log::Trace); } void init() diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp index ec74cbd..ed5a9b5 100644 --- a/tests/clientapitest.cpp +++ b/tests/clientapitest.cpp @@ -93,7 +93,6 @@ private slots: { Sink::FacadeFactory::instance().resetFactory(); ResourceConfig::clear(); - Sink::Log::setDebugOutputLevel(Sink::Log::Trace); } void testLoad() diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index d41f235..0907b1d 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp @@ -30,7 +30,6 @@ private slots: void initTestCase() { Sink::Test::initTest(); - Sink::Log::setDebugOutputLevel(Sink::Log::Trace); auto factory = Sink::ResourceFactory::load("org.kde.dummy"); QVERIFY(factory); DummyResource::removeFromDisk("org.kde.dummy.instance1"); 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 @@ #include #include #include +#include // Replace with something different #include "event_generated.h" @@ -23,10 +24,9 @@ class GenericFacadeTest : public QObject { Q_OBJECT private slots: - - void init() + void initTestCase() { - Sink::Log::setDebugOutputLevel(Sink::Log::Trace); + Sink::Test::initTest(); } void testLoad() diff --git a/tests/genericresourcetest.cpp b/tests/genericresourcetest.cpp index 7474cbf..fe2c146 100644 --- a/tests/genericresourcetest.cpp +++ b/tests/genericresourcetest.cpp @@ -27,7 +27,6 @@ private slots: void init() { Sink::GenericResource::removeFromDisk("org.kde.test.instance1"); - Sink::Log::setDebugOutputLevel(Sink::Log::Trace); } /// Ensure the resource can process messages diff --git a/tests/inspectiontest.cpp b/tests/inspectiontest.cpp index 38bf23d..8f2c50f 100644 --- a/tests/inspectiontest.cpp +++ b/tests/inspectiontest.cpp @@ -19,7 +19,6 @@ class InspectionTest : public QObject private slots: void initTestCase() { - Sink::Log::setDebugOutputLevel(Sink::Log::Trace); auto factory = Sink::ResourceFactory::load("org.kde.dummy"); QVERIFY(factory); ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); diff --git a/tests/maildirsyncbenchmark.cpp b/tests/maildirsyncbenchmark.cpp index 06c5ab1..8b1a9d7 100644 --- a/tests/maildirsyncbenchmark.cpp +++ b/tests/maildirsyncbenchmark.cpp @@ -61,7 +61,6 @@ private slots: { targetPath = tempDir.path() + "/maildir1"; - Sink::Log::setDebugOutputLevel(Sink::Log::Log); MaildirResource::removeFromDisk("org.kde.maildir.test1"); Sink::ApplicationDomain::SinkResource resource; resource.setProperty("identifier", "org.kde.maildir.test1"); diff --git a/tests/mailsynctest.cpp b/tests/mailsynctest.cpp index 4401f27..4b797c8 100644 --- a/tests/mailsynctest.cpp +++ b/tests/mailsynctest.cpp @@ -37,7 +37,6 @@ void MailSyncTest::initTestCase() { Test::initTest(); QVERIFY(isBackendAvailable()); - Log::setDebugOutputLevel(Sink::Log::Trace); resetTestEnvironment(); auto resource = createResource(); QVERIFY(!resource.identifier().isEmpty()); diff --git a/tests/mailtest.cpp b/tests/mailtest.cpp index 0537175..2547536 100644 --- a/tests/mailtest.cpp +++ b/tests/mailtest.cpp @@ -37,7 +37,6 @@ void MailTest::initTestCase() { Test::initTest(); QVERIFY(isBackendAvailable()); - Log::setDebugOutputLevel(Sink::Log::Trace); resetTestEnvironment(); auto resource = createResource(); QVERIFY(!resource.identifier().isEmpty()); diff --git a/tests/messagequeuetest.cpp b/tests/messagequeuetest.cpp index a8d0d4d..27dd12b 100644 --- a/tests/messagequeuetest.cpp +++ b/tests/messagequeuetest.cpp @@ -7,6 +7,7 @@ #include "storage.h" #include "messagequeue.h" #include "log.h" +#include "test.h" SINK_DEBUG_AREA("messagequeuetest") @@ -19,7 +20,7 @@ class MessageQueueTest : public QObject private slots: void initTestCase() { - Sink::Log::setDebugOutputLevel(Sink::Log::Trace); + Sink::Test::initTest(); Sink::Storage store(Sink::Store::storageLocation(), "org.kde.dummy.testqueue", Sink::Storage::ReadWrite); store.removeFromDisk(); } diff --git a/tests/modelinteractivitytest.cpp b/tests/modelinteractivitytest.cpp index c55a1db..d13cdf7 100644 --- a/tests/modelinteractivitytest.cpp +++ b/tests/modelinteractivitytest.cpp @@ -51,7 +51,6 @@ private slots: void initTestCase() { Sink::Test::initTest(); - Sink::Log::setDebugOutputLevel(Sink::Log::Warning); ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); Sink::Store::removeDataFromDisk(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); } diff --git a/tests/pipelinetest.cpp b/tests/pipelinetest.cpp index fc23cc9..65d4b49 100644 --- a/tests/pipelinetest.cpp +++ b/tests/pipelinetest.cpp @@ -190,7 +190,6 @@ class PipelineTest : public QObject private slots: void initTestCase() { - Sink::Log::setDebugOutputLevel(Sink::Log::Trace); Sink::AdaptorFactoryRegistry::instance().registerFactory("test"); } diff --git a/tests/querytest.cpp b/tests/querytest.cpp index 6d7746e..95c22b3 100644 --- a/tests/querytest.cpp +++ b/tests/querytest.cpp @@ -23,7 +23,6 @@ private slots: void initTestCase() { Sink::Test::initTest(); - Sink::Log::setDebugOutputLevel(Sink::Log::Trace); auto factory = Sink::ResourceFactory::load("org.kde.dummy"); QVERIFY(factory); ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); diff --git a/tests/resourceconfigtest.cpp b/tests/resourceconfigtest.cpp index d5f98d3..021d042 100644 --- a/tests/resourceconfigtest.cpp +++ b/tests/resourceconfigtest.cpp @@ -24,7 +24,6 @@ private slots: Sink::Test::initTest(); Sink::FacadeFactory::instance().resetFactory(); ResourceConfig::clear(); - Sink::Log::setDebugOutputLevel(Sink::Log::Trace); } void resourceManagement() 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: { // Sink::FacadeFactory::instance().resetFactory(); // ResourceConfig::clear(); - Log::setDebugOutputLevel(Sink::Log::Trace); Test::initTest(); } -- cgit v1.2.3 From 81fa4c3635a029b1c8f9cc3cd670f0b04f1c3f21 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 8 Jul 2016 11:22:40 +0200 Subject: Shorten the types to be more distinctive. The org.kde prefix is useless and possibly misleading. Simply prefixing with sink is more unique and shorter. --- tests/accountstest.cpp | 6 ++-- tests/dummyresourcebenchmark.cpp | 30 +++++++++--------- tests/dummyresourcetest.cpp | 36 +++++++++++----------- tests/dummyresourcewritebenchmark.cpp | 14 ++++----- tests/genericresourcebenchmark.cpp | 16 +++++----- tests/genericresourcetest.cpp | 6 ++-- tests/indextest.cpp | 6 ++-- tests/inspectiontest.cpp | 8 ++--- tests/maildirsyncbenchmark.cpp | 12 ++++---- tests/mailquerybenchmark.cpp | 2 +- tests/messagequeuetest.cpp | 22 ++++++------- tests/modelinteractivitytest.cpp | 10 +++--- tests/pipelinebenchmark.cpp | 2 +- tests/pipelinetest.cpp | 34 ++++++++++---------- tests/querytest.cpp | 58 +++++++++++++++++------------------ 15 files changed, 131 insertions(+), 131 deletions(-) (limited to 'tests') diff --git a/tests/accountstest.cpp b/tests/accountstest.cpp index d12e7f4..8d0f2e6 100644 --- a/tests/accountstest.cpp +++ b/tests/accountstest.cpp @@ -51,7 +51,7 @@ private slots: QString smtpUsername("smtpUsername"); QString smtpPassword("smtpPassword"); auto resource = ApplicationDomainType::createEntity(); - resource.setProperty("type", "org.kde.mailtransport"); + resource.setProperty("type", "sink.mailtransport"); resource.setProperty("account", account.identifier()); resource.setProperty("server", smtpServer); resource.setProperty("username", smtpUsername); @@ -62,7 +62,7 @@ private slots: Store::fetchAll(Query()).then>([&](const QList &resources) { QCOMPARE(resources.size(), 1); auto resource = resources.first(); - QCOMPARE(resource->getProperty("type").toString(), QString("org.kde.mailtransport")); + QCOMPARE(resource->getProperty("type").toString(), QString("sink.mailtransport")); QCOMPARE(resource->getProperty("server").toString(), smtpServer); }) .exec().waitForFinished(); @@ -110,7 +110,7 @@ private slots: //Ensure the notifier only affects one type auto resource = ApplicationDomainType::createEntity(); - resource.setResourceType("org.kde.mailtransport"); + resource.setResourceType("sink.mailtransport"); Store::create(resource).exec().waitForFinished(); QTRY_COMPARE(model->rowCount(QModelIndex()), 2); } diff --git a/tests/dummyresourcebenchmark.cpp b/tests/dummyresourcebenchmark.cpp index 7e334a6..72562c3 100644 --- a/tests/dummyresourcebenchmark.cpp +++ b/tests/dummyresourcebenchmark.cpp @@ -34,9 +34,9 @@ private slots: void initTestCase() { Sink::Log::setDebugOutputLevel(Sink::Log::Warning); - auto factory = Sink::ResourceFactory::load("org.kde.dummy"); + auto factory = Sink::ResourceFactory::load("sink.dummy"); QVERIFY(factory); - ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); + ResourceConfig::addResource("sink.dummy.instance1", "sink.dummy"); num = 5000; } @@ -76,17 +76,17 @@ private slots: void testCommandResponsiveness() { // Test responsiveness including starting the process. - Sink::Store::removeDataFromDisk("org.kde.dummy.instance1").exec().waitForFinished(); + Sink::Store::removeDataFromDisk("sink.dummy.instance1").exec().waitForFinished(); QTime time; time.start(); - Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Event event("sink.dummy.instance1"); event.setProperty("uid", "testuid"); QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); event.setProperty("summary", "summaryValue"); - auto notifier = QSharedPointer::create("org.kde.dummy.instance1", "org.kde.dummy"); + auto notifier = QSharedPointer::create("sink.dummy.instance1", "sink.dummy"); bool gotNotification = false; int duration = 0; notifier->registerHandler([&gotNotification, &duration, &time](const Sink::Notification ¬ification) { @@ -102,19 +102,19 @@ private slots: QTRY_VERIFY(gotNotification); QVERIFY2(duration < 100, QString::fromLatin1("Processing a create command took more than 100ms: %1").arg(duration).toLatin1()); - Sink::ResourceControl::shutdown("org.kde.dummy.instance1").exec().waitForFinished(); + Sink::ResourceControl::shutdown("sink.dummy.instance1").exec().waitForFinished(); qDebug() << "Single command took [ms]: " << duration; } void testWriteToFacade() { - Sink::Store::removeDataFromDisk("org.kde.dummy.instance1").exec().waitForFinished(); + Sink::Store::removeDataFromDisk("sink.dummy.instance1").exec().waitForFinished(); QTime time; time.start(); QList> waitCondition; for (int i = 0; i < num; i++) { - Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Event event("sink.dummy.instance1"); event.setProperty("uid", "testuid"); QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); event.setProperty("summary", "summaryValue"); @@ -126,7 +126,7 @@ private slots: // Ensure everything is processed { Sink::Query query; - query.resources << "org.kde.dummy.instance1"; + query.resources << "sink.dummy.instance1"; Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); } auto allProcessedTime = time.elapsed(); @@ -140,7 +140,7 @@ private slots: dataset.insertRow(row); HAWD::Formatter::print(dataset); - auto diskUsage = DummyResource::diskUsage("org.kde.dummy.instance1"); + auto diskUsage = DummyResource::diskUsage("sink.dummy.instance1"); qDebug() << "Database size [kb]: " << diskUsage / 1024; // Print memory layout, RSS is what is in memory @@ -155,7 +155,7 @@ private slots: { time.start(); Sink::Query query; - query.resources << "org.kde.dummy.instance1"; + query.resources << "sink.dummy.instance1"; query.propertyFilter.insert("uid", Sink::Query::Comparator("testuid")); auto model = Sink::Store::loadModel(query); @@ -173,12 +173,12 @@ private slots: void testWriteInProcess() { - Sink::Store::removeDataFromDisk("org.kde.dummy.instance1").exec().waitForFinished(); + Sink::Store::removeDataFromDisk("sink.dummy.instance1").exec().waitForFinished(); QTime time; time.start(); - auto pipeline = QSharedPointer::create("org.kde.dummy.instance1"); - DummyResource resource("org.kde.dummy.instance1", pipeline); + auto pipeline = QSharedPointer::create("sink.dummy.instance1"); + DummyResource resource("sink.dummy.instance1", pipeline); flatbuffers::FlatBufferBuilder eventFbb; eventFbb.Clear(); @@ -261,7 +261,7 @@ private slots: // This allows to run individual parts without doing a cleanup, but still cleaning up normally void testCleanupForCompleteTest() { - Sink::Store::removeDataFromDisk("org.kde.dummy.instance1").exec().waitForFinished(); + Sink::Store::removeDataFromDisk("sink.dummy.instance1").exec().waitForFinished(); } private: diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index 0907b1d..687a33b 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp @@ -30,10 +30,10 @@ private slots: void initTestCase() { Sink::Test::initTest(); - auto factory = Sink::ResourceFactory::load("org.kde.dummy"); + auto factory = Sink::ResourceFactory::load("sink.dummy"); QVERIFY(factory); - DummyResource::removeFromDisk("org.kde.dummy.instance1"); - ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); + DummyResource::removeFromDisk("sink.dummy.instance1"); + ResourceConfig::addResource("sink.dummy.instance1", "sink.dummy"); } void init() @@ -47,7 +47,7 @@ private slots: void cleanup() { qDebug() << "Test took " << time.elapsed(); - Sink::Store::removeDataFromDisk(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); + Sink::Store::removeDataFromDisk(QByteArray("sink.dummy.instance1")).exec().waitForFinished(); } void testProperty() @@ -59,13 +59,13 @@ private slots: void testWriteToFacadeAndQueryByUid() { - Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Event event("sink.dummy.instance1"); event.setProperty("uid", "testuid"); QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); event.setProperty("summary", "summaryValue"); Sink::Store::create(event).exec().waitForFinished(); - const auto query = Query::ResourceFilter("org.kde.dummy.instance1") ; + const auto query = Query::ResourceFilter("sink.dummy.instance1") ; // Ensure all local data is processed Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); @@ -78,7 +78,7 @@ private slots: void testWriteToFacadeAndQueryByUid2() { - Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Event event("sink.dummy.instance1"); event.setProperty("summary", "summaryValue"); event.setProperty("uid", "testuid"); @@ -87,7 +87,7 @@ private slots: event.setProperty("uid", "testuid2"); Sink::Store::create(event).exec().waitForFinished(); - const auto query = Query::ResourceFilter("org.kde.dummy.instance1") ; + const auto query = Query::ResourceFilter("sink.dummy.instance1") ; // Ensure all local data is processed Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); @@ -102,7 +102,7 @@ private slots: void testWriteToFacadeAndQueryBySummary() { - Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Event event("sink.dummy.instance1"); event.setProperty("uid", "testuid"); event.setProperty("summary", "summaryValue1"); @@ -112,7 +112,7 @@ private slots: event.setProperty("summary", "summaryValue2"); Sink::Store::create(event).exec().waitForFinished(); - const auto query = Query::ResourceFilter("org.kde.dummy.instance1") ; + const auto query = Query::ResourceFilter("sink.dummy.instance1") ; // Ensure all local data is processed Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); @@ -127,8 +127,8 @@ private slots: void testResourceSync() { - auto pipeline = QSharedPointer::create("org.kde.dummy.instance1"); - DummyResource resource("org.kde.dummy.instance1", pipeline); + auto pipeline = QSharedPointer::create("sink.dummy.instance1"); + DummyResource resource("sink.dummy.instance1", pipeline); auto job = resource.synchronizeWithSource(); // TODO pass in optional timeout? auto future = job.exec(); @@ -142,7 +142,7 @@ private slots: void testSyncAndFacade() { - const auto query = Query::ResourceFilter("org.kde.dummy.instance1"); + const auto query = Query::ResourceFilter("sink.dummy.instance1"); // Ensure all local data is processed Sink::Store::synchronize(query).exec().waitForFinished(); @@ -158,7 +158,7 @@ private slots: void testSyncAndFacadeMail() { - const auto query = Query::ResourceFilter("org.kde.dummy.instance1"); + const auto query = Query::ResourceFilter("sink.dummy.instance1"); // Ensure all local data is processed Sink::Store::synchronize(query).exec().waitForFinished(); @@ -174,13 +174,13 @@ private slots: void testWriteModifyDelete() { - Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Event event("sink.dummy.instance1"); event.setProperty("uid", "testuid"); QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); event.setProperty("summary", "summaryValue"); Sink::Store::create(event).exec().waitForFinished(); - const auto query = Query::ResourceFilter("org.kde.dummy.instance1") + Query::PropertyFilter("uid", "testuid"); + const auto query = Query::ResourceFilter("sink.dummy.instance1") + Query::PropertyFilter("uid", "testuid"); // Ensure all local data is processed Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); @@ -229,14 +229,14 @@ private slots: void testWriteModifyDeleteLive() { - auto query = Query::ResourceFilter("org.kde.dummy.instance1"); + auto query = Query::ResourceFilter("sink.dummy.instance1"); query.liveQuery = true; query += Query::PropertyFilter("uid", "testuid"); auto model = Sink::Store::loadModel(query); QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); - Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Event event("sink.dummy.instance1"); event.setProperty("uid", "testuid"); QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); 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 void writeInProcess(int num) { - DummyResource::removeFromDisk("org.kde.dummy.instance1"); + DummyResource::removeFromDisk("sink.dummy.instance1"); QTime time; time.start(); - auto pipeline = QSharedPointer::create("org.kde.dummy.instance1"); - DummyResource resource("org.kde.dummy.instance1", pipeline); + auto pipeline = QSharedPointer::create("sink.dummy.instance1"); + DummyResource resource("sink.dummy.instance1", pipeline); int bufferSize = 0; auto command = createEntityBuffer(bufferSize); @@ -131,7 +131,7 @@ class DummyResourceWriteBenchmark : public QObject const auto finalRss = getCurrentRSS(); const auto rssGrowth = finalRss - startingRss; // Since the database is memory mapped it is attributted to the resident set size. - const auto rssWithoutDb = finalRss - DummyResource::diskUsage("org.kde.dummy.instance1"); + const auto rssWithoutDb = finalRss - DummyResource::diskUsage("sink.dummy.instance1"); const auto peakRss = getPeakRSS(); // How much peak deviates from final rss in percent const auto percentageRssError = static_cast(peakRss - finalRss) * 100.0 / static_cast(finalRss); @@ -143,7 +143,7 @@ class DummyResourceWriteBenchmark : public QObject std::cout << "Rss without db [kb]: " << rssWithoutDb / 1024 << std::endl; std::cout << "Percentage peak rss error: " << percentageRssError << std::endl; - auto onDisk = DummyResource::diskUsage("org.kde.dummy.instance1"); + auto onDisk = DummyResource::diskUsage("sink.dummy.instance1"); auto writeAmplification = static_cast(onDisk) / static_cast(bufferSizeTotal); std::cout << "On disk [kb]: " << onDisk / 1024 << std::endl; std::cout << "Buffer size total [kb]: " << bufferSizeTotal / 1024 << std::endl; @@ -216,13 +216,13 @@ private slots: void getFreePages() { - std::system(QString("mdb_stat %1/%2 -ff").arg(Sink::storageLocation()).arg("org.kde.dummy.instance1").toLatin1().constData()); + std::system(QString("mdb_stat %1/%2 -ff").arg(Sink::storageLocation()).arg("sink.dummy.instance1").toLatin1().constData()); } // This allows to run individual parts without doing a cleanup, but still cleaning up normally void testCleanupForCompleteTest() { - DummyResource::removeFromDisk("org.kde.dummy.instance1"); + DummyResource::removeFromDisk("sink.dummy.instance1"); } private: 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: void initTestCase() { - removeFromDisk("org.kde.test.instance1"); - removeFromDisk("org.kde.test.instance1.userqueue"); - removeFromDisk("org.kde.test.instance1.synchronizerqueue"); + removeFromDisk("sink.test.instance1"); + removeFromDisk("sink.test.instance1.userqueue"); + removeFromDisk("sink.test.instance1.synchronizerqueue"); } @@ -106,8 +106,8 @@ private slots: { int num = 10000; - auto pipeline = QSharedPointer::create("org.kde.test.instance1"); - TestResource resource("org.kde.test.instance1", pipeline); + auto pipeline = QSharedPointer::create("sink.test.instance1"); + TestResource resource("sink.test.instance1", pipeline); auto command = createEntityBuffer(); @@ -141,16 +141,16 @@ private slots: { int num = 50000; - auto pipeline = QSharedPointer::create("org.kde.test.instance1"); + auto pipeline = QSharedPointer::create("sink.test.instance1"); auto eventFactory = QSharedPointer::create(); - const QByteArray resourceIdentifier = "org.kde.test.instance1"; + const QByteArray resourceIdentifier = "sink.test.instance1"; auto indexer = QSharedPointer::create(); pipeline->setPreprocessors("event", QVector() << indexer.data()); pipeline->setAdaptorFactory("event", eventFactory); - TestResource resource("org.kde.test.instance1", pipeline); + TestResource resource("sink.test.instance1", pipeline); auto command = createEntityBuffer(); diff --git a/tests/genericresourcetest.cpp b/tests/genericresourcetest.cpp index fe2c146..77a901d 100644 --- a/tests/genericresourcetest.cpp +++ b/tests/genericresourcetest.cpp @@ -26,7 +26,7 @@ private slots: void init() { - Sink::GenericResource::removeFromDisk("org.kde.test.instance1"); + Sink::GenericResource::removeFromDisk("sink.test.instance1"); } /// Ensure the resource can process messages @@ -70,10 +70,10 @@ private slots: } // Actual test - auto pipeline = QSharedPointer::create("org.kde.test.instance1"); + auto pipeline = QSharedPointer::create("sink.test.instance1"); QSignalSpy revisionSpy(pipeline.data(), SIGNAL(revisionUpdated(qint64))); QVERIFY(revisionSpy.isValid()); - TestResource resource("org.kde.test.instance1", pipeline); + TestResource resource("sink.test.instance1", pipeline); resource.processCommand(Sink::Commands::CreateEntityCommand, command); resource.processCommand(Sink::Commands::CreateEntityCommand, command); 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 private slots: void initTestCase() { - Sink::Storage store("./testindex", "org.kde.dummy.testindex", Sink::Storage::ReadWrite); + Sink::Storage store("./testindex", "sink.dummy.testindex", Sink::Storage::ReadWrite); store.removeFromDisk(); } void cleanup() { - Sink::Storage store("./testindex", "org.kde.dummy.testindex", Sink::Storage::ReadWrite); + Sink::Storage store("./testindex", "sink.dummy.testindex", Sink::Storage::ReadWrite); store.removeFromDisk(); } void testIndex() { - Index index("./testindex", "org.kde.dummy.testindex", Sink::Storage::ReadWrite); + Index index("./testindex", "sink.dummy.testindex", Sink::Storage::ReadWrite); // The first key is specifically a substring of the second key index.add("key", "value1"); index.add("keyFoo", "value2"); diff --git a/tests/inspectiontest.cpp b/tests/inspectiontest.cpp index 8f2c50f..3e8a103 100644 --- a/tests/inspectiontest.cpp +++ b/tests/inspectiontest.cpp @@ -19,10 +19,10 @@ class InspectionTest : public QObject private slots: void initTestCase() { - auto factory = Sink::ResourceFactory::load("org.kde.dummy"); + auto factory = Sink::ResourceFactory::load("sink.dummy"); QVERIFY(factory); - ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); - Sink::Store::removeDataFromDisk(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); + ResourceConfig::addResource("sink.dummy.instance1", "sink.dummy"); + Sink::Store::removeDataFromDisk(QByteArray("sink.dummy.instance1")).exec().waitForFinished(); } void testInspection_data() @@ -38,7 +38,7 @@ private slots: using namespace Sink; using namespace Sink::ApplicationDomain; - Mail mail(QByteArray("org.kde.dummy.instance1"), QByteArray("identifier"), 0, QSharedPointer::create()); + Mail mail(QByteArray("sink.dummy.instance1"), QByteArray("identifier"), 0, QSharedPointer::create()); // testInspection is a magic property that the dummyresource supports auto inspectionCommand = ResourceControl::Inspection::PropertyInspection(mail, "testInspection", success); diff --git a/tests/maildirsyncbenchmark.cpp b/tests/maildirsyncbenchmark.cpp index 8b1a9d7..d84c758 100644 --- a/tests/maildirsyncbenchmark.cpp +++ b/tests/maildirsyncbenchmark.cpp @@ -61,17 +61,17 @@ private slots: { targetPath = tempDir.path() + "/maildir1"; - MaildirResource::removeFromDisk("org.kde.maildir.test1"); + MaildirResource::removeFromDisk("sink.maildir.test1"); Sink::ApplicationDomain::SinkResource resource; - resource.setProperty("identifier", "org.kde.maildir.test1"); - resource.setProperty("type", "org.kde.maildir"); + resource.setProperty("identifier", "sink.maildir.test1"); + resource.setProperty("type", "sink.maildir"); resource.setProperty("path", targetPath); Sink::Store::create(resource).exec().waitForFinished(); } void cleanup() { - MaildirResource::removeFromDisk("org.kde.maildir.test1"); + MaildirResource::removeFromDisk("sink.maildir.test1"); QDir dir(targetPath); dir.removeRecursively(); } @@ -83,8 +83,8 @@ private slots: void testbench() { - auto pipeline = QSharedPointer::create("org.kde.maildir.test1"); - MaildirResource resource("org.kde.maildir.test1", pipeline); + auto pipeline = QSharedPointer::create("sink.maildir.test1"); + MaildirResource resource("sink.maildir.test1", pipeline); QTime time; time.start(); 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: void init() { - resourceIdentifier = "org.kde.test.instance1"; + resourceIdentifier = "sink.test.instance1"; Sink::AdaptorFactoryRegistry::instance().registerFactory("test"); } diff --git a/tests/messagequeuetest.cpp b/tests/messagequeuetest.cpp index 27dd12b..e79bba2 100644 --- a/tests/messagequeuetest.cpp +++ b/tests/messagequeuetest.cpp @@ -21,7 +21,7 @@ private slots: void initTestCase() { Sink::Test::initTest(); - Sink::Storage store(Sink::Store::storageLocation(), "org.kde.dummy.testqueue", Sink::Storage::ReadWrite); + Sink::Storage store(Sink::Store::storageLocation(), "sink.dummy.testqueue", Sink::Storage::ReadWrite); store.removeFromDisk(); } @@ -31,13 +31,13 @@ private slots: void cleanup() { - Sink::Storage store(Sink::Store::storageLocation(), "org.kde.dummy.testqueue", Sink::Storage::ReadWrite); + Sink::Storage store(Sink::Store::storageLocation(), "sink.dummy.testqueue", Sink::Storage::ReadWrite); store.removeFromDisk(); } void testEmpty() { - MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); + MessageQueue queue(Sink::Store::storageLocation(), "sink.dummy.testqueue"); QVERIFY(queue.isEmpty()); queue.enqueue("value"); QVERIFY(!queue.isEmpty()); @@ -45,7 +45,7 @@ private slots: void testDequeueEmpty() { - MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); + MessageQueue queue(Sink::Store::storageLocation(), "sink.dummy.testqueue"); bool gotValue = false; bool gotError = false; queue.dequeue([&](void *ptr, int size, std::function callback) { gotValue = true; }, [&](const MessageQueue::Error &error) { gotError = true; }); @@ -55,7 +55,7 @@ private slots: void testEnqueue() { - MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); + MessageQueue queue(Sink::Store::storageLocation(), "sink.dummy.testqueue"); QSignalSpy spy(&queue, SIGNAL(messageReady())); queue.enqueue("value1"); QCOMPARE(spy.size(), 1); @@ -63,7 +63,7 @@ private slots: void testDrained() { - MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); + MessageQueue queue(Sink::Store::storageLocation(), "sink.dummy.testqueue"); QSignalSpy spy(&queue, SIGNAL(drained())); queue.enqueue("value1"); @@ -77,7 +77,7 @@ private slots: values << "value1"; values << "value2"; - MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); + MessageQueue queue(Sink::Store::storageLocation(), "sink.dummy.testqueue"); for (const QByteArray &value : values) { queue.enqueue(value); } @@ -107,7 +107,7 @@ private slots: values << "value1"; values << "value2"; - MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); + MessageQueue queue(Sink::Store::storageLocation(), "sink.dummy.testqueue"); for (const QByteArray &value : values) { queue.enqueue(value); } @@ -145,7 +145,7 @@ private slots: */ void testNestedEnqueue() { - MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); + MessageQueue queue(Sink::Store::storageLocation(), "sink.dummy.testqueue"); queue.enqueue("value1"); bool gotError = false; @@ -160,7 +160,7 @@ private slots: void testBatchDequeue() { - MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); + MessageQueue queue(Sink::Store::storageLocation(), "sink.dummy.testqueue"); queue.enqueue("value1"); queue.enqueue("value2"); queue.enqueue("value3"); @@ -181,7 +181,7 @@ private slots: void testBatchEnqueue() { - MessageQueue queue(Sink::Store::storageLocation(), "org.kde.dummy.testqueue"); + MessageQueue queue(Sink::Store::storageLocation(), "sink.dummy.testqueue"); QSignalSpy spy(&queue, SIGNAL(messageReady())); queue.startTransaction(); queue.enqueue("value1"); diff --git a/tests/modelinteractivitytest.cpp b/tests/modelinteractivitytest.cpp index d13cdf7..4819ccc 100644 --- a/tests/modelinteractivitytest.cpp +++ b/tests/modelinteractivitytest.cpp @@ -51,13 +51,13 @@ private slots: void initTestCase() { Sink::Test::initTest(); - ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); - Sink::Store::removeDataFromDisk(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); + ResourceConfig::addResource("sink.dummy.instance1", "sink.dummy"); + Sink::Store::removeDataFromDisk(QByteArray("sink.dummy.instance1")).exec().waitForFinished(); } void cleanup() { - Sink::Store::removeDataFromDisk(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); + Sink::Store::removeDataFromDisk(QByteArray("sink.dummy.instance1")).exec().waitForFinished(); } void init() @@ -68,14 +68,14 @@ private slots: { // Setup { - Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Mail mail("sink.dummy.instance1"); for (int i = 0; i < 1000; i++) { Sink::Store::create(mail).exec().waitForFinished(); } } Sink::Query query; - query.resources << "org.kde.dummy.instance1"; + query.resources << "sink.dummy.instance1"; query.liveQuery = true; 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: { Sink::Log::setDebugOutputLevel(Sink::Log::Warning); Sink::AdaptorFactoryRegistry::instance().registerFactory("test"); - resourceIdentifier = "org.kde.test.instance1"; + resourceIdentifier = "sink.test.instance1"; } void testWithoutIndex() diff --git a/tests/pipelinetest.cpp b/tests/pipelinetest.cpp index 65d4b49..7216f62 100644 --- a/tests/pipelinetest.cpp +++ b/tests/pipelinetest.cpp @@ -195,7 +195,7 @@ private slots: void init() { - removeFromDisk("org.kde.pipelinetest.instance1"); + removeFromDisk("sink.pipelinetest.instance1"); } void testCreate() @@ -203,14 +203,14 @@ private slots: flatbuffers::FlatBufferBuilder entityFbb; auto command = createEntityCommand(createEvent(entityFbb)); - Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); + Sink::Pipeline pipeline("sink.pipelinetest.instance1"); pipeline.setResourceType("test"); pipeline.startTransaction(); pipeline.newEntity(command.constData(), command.size()); pipeline.commit(); - auto result = getKeys("org.kde.pipelinetest.instance1", "event.main"); + auto result = getKeys("sink.pipelinetest.instance1", "event.main"); qDebug() << result; QCOMPARE(result.size(), 1); } @@ -220,7 +220,7 @@ private slots: flatbuffers::FlatBufferBuilder entityFbb; auto command = createEntityCommand(createEvent(entityFbb, "summary", "description")); - Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); + Sink::Pipeline pipeline("sink.pipelinetest.instance1"); pipeline.setResourceType("test"); auto adaptorFactory = QSharedPointer::create(); @@ -231,7 +231,7 @@ private slots: pipeline.commit(); // Get uid of written entity - auto keys = getKeys("org.kde.pipelinetest.instance1", "event.main"); + auto keys = getKeys("sink.pipelinetest.instance1", "event.main"); QCOMPARE(keys.size(), 1); const auto key = keys.first(); const auto uid = Sink::Storage::uidFromKey(key); @@ -244,7 +244,7 @@ private slots: pipeline.commit(); // Ensure we've got the new revision with the modification - auto buffer = getEntity("org.kde.pipelinetest.instance1", "event.main", Sink::Storage::assembleKey(uid, 2)); + auto buffer = getEntity("sink.pipelinetest.instance1", "event.main", Sink::Storage::assembleKey(uid, 2)); QVERIFY(!buffer.isEmpty()); Sink::EntityBuffer entityBuffer(buffer.data(), buffer.size()); auto adaptor = adaptorFactory->createAdaptor(entityBuffer.entity()); @@ -253,7 +253,7 @@ private slots: QVERIFY2(adaptor->getProperty("description").toString() == QString("description"), "The modification has sideeffects."); // Both revisions are in the store at this point - QCOMPARE(getKeys("org.kde.pipelinetest.instance1", "event.main").size(), 2); + QCOMPARE(getKeys("sink.pipelinetest.instance1", "event.main").size(), 2); // Cleanup old revisions pipeline.startTransaction(); @@ -261,7 +261,7 @@ private slots: pipeline.commit(); // And now only the latest revision is left - QCOMPARE(getKeys("org.kde.pipelinetest.instance1", "event.main").size(), 1); + QCOMPARE(getKeys("sink.pipelinetest.instance1", "event.main").size(), 1); } void testModifyWithUnrelatedOperationInbetween() @@ -269,7 +269,7 @@ private slots: flatbuffers::FlatBufferBuilder entityFbb; auto command = createEntityCommand(createEvent(entityFbb)); - Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); + Sink::Pipeline pipeline("sink.pipelinetest.instance1"); pipeline.setResourceType("test"); auto adaptorFactory = QSharedPointer::create(); @@ -280,7 +280,7 @@ private slots: pipeline.commit(); // Get uid of written entity - auto keys = getKeys("org.kde.pipelinetest.instance1", "event.main"); + auto keys = getKeys("sink.pipelinetest.instance1", "event.main"); QCOMPARE(keys.size(), 1); const auto uid = Sink::Storage::uidFromKey(keys.first()); @@ -302,7 +302,7 @@ private slots: pipeline.commit(); // Ensure we've got the new revision with the modification - auto buffer = getEntity("org.kde.pipelinetest.instance1", "event.main", Sink::Storage::assembleKey(uid, 3)); + auto buffer = getEntity("sink.pipelinetest.instance1", "event.main", Sink::Storage::assembleKey(uid, 3)); QVERIFY(!buffer.isEmpty()); Sink::EntityBuffer entityBuffer(buffer.data(), buffer.size()); auto adaptor = adaptorFactory->createAdaptor(entityBuffer.entity()); @@ -313,7 +313,7 @@ private slots: { flatbuffers::FlatBufferBuilder entityFbb; auto command = createEntityCommand(createEvent(entityFbb)); - Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); + Sink::Pipeline pipeline("sink.pipelinetest.instance1"); pipeline.setResourceType("test"); // Create the initial revision @@ -321,7 +321,7 @@ private slots: pipeline.newEntity(command.constData(), command.size()); pipeline.commit(); - auto result = getKeys("org.kde.pipelinetest.instance1", "event.main"); + auto result = getKeys("sink.pipelinetest.instance1", "event.main"); QCOMPARE(result.size(), 1); const auto uid = Sink::Storage::uidFromKey(result.first()); @@ -333,7 +333,7 @@ private slots: pipeline.commit(); // We have a new revision that indicates the deletion - QCOMPARE(getKeys("org.kde.pipelinetest.instance1", "event.main").size(), 2); + QCOMPARE(getKeys("sink.pipelinetest.instance1", "event.main").size(), 2); // Cleanup old revisions pipeline.startTransaction(); @@ -341,7 +341,7 @@ private slots: pipeline.commit(); // And all revisions are gone - QCOMPARE(getKeys("org.kde.pipelinetest.instance1", "event.main").size(), 0); + QCOMPARE(getKeys("sink.pipelinetest.instance1", "event.main").size(), 0); } void testPreprocessor() @@ -350,7 +350,7 @@ private slots: auto testProcessor = new TestProcessor; - Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); + Sink::Pipeline pipeline("sink.pipelinetest.instance1"); pipeline.setResourceType("test"); pipeline.setPreprocessors("event", QVector() << testProcessor); pipeline.startTransaction(); @@ -368,7 +368,7 @@ private slots: pipeline.commit(); entityFbb.Clear(); pipeline.startTransaction(); - auto keys = getKeys("org.kde.pipelinetest.instance1", "event.main"); + auto keys = getKeys("sink.pipelinetest.instance1", "event.main"); QCOMPARE(keys.size(), 1); const auto uid = Sink::Storage::uidFromKey(keys.first()); { diff --git a/tests/querytest.cpp b/tests/querytest.cpp index 95c22b3..d3a97f6 100644 --- a/tests/querytest.cpp +++ b/tests/querytest.cpp @@ -23,15 +23,15 @@ private slots: void initTestCase() { Sink::Test::initTest(); - auto factory = Sink::ResourceFactory::load("org.kde.dummy"); + auto factory = Sink::ResourceFactory::load("sink.dummy"); QVERIFY(factory); - ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); - Sink::Store::removeDataFromDisk(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); + ResourceConfig::addResource("sink.dummy.instance1", "sink.dummy"); + Sink::Store::removeDataFromDisk(QByteArray("sink.dummy.instance1")).exec().waitForFinished(); } void cleanup() { - Sink::Store::removeDataFromDisk(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); + Sink::Store::removeDataFromDisk(QByteArray("sink.dummy.instance1")).exec().waitForFinished(); } void init() @@ -59,13 +59,13 @@ private slots: { // Setup { - Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Mail mail("sink.dummy.instance1"); Sink::Store::create(mail).exec().waitForFinished(); } // Test Sink::Query query; - query.resources << "org.kde.dummy.instance1"; + query.resources << "sink.dummy.instance1"; query.liveQuery = true; // We fetch before the data is available and rely on the live query mechanism to deliver the actual data @@ -77,13 +77,13 @@ private slots: { // Setup { - Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Mail mail("sink.dummy.instance1"); Sink::Store::create(mail).exec().waitForFinished(); } // Test Sink::Query query; - query.resources << "org.kde.dummy.instance1"; + query.resources << "sink.dummy.instance1"; query.liveQuery = false; // Ensure all local data is processed @@ -101,12 +101,12 @@ private slots: QByteArray id; // Setup { - Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Mail mail("sink.dummy.instance1"); Sink::Store::create(mail).exec().waitForFinished(); Sink::Store::create(mail).exec().waitForFinished(); Sink::Query query; - query.resources << "org.kde.dummy.instance1"; + query.resources << "sink.dummy.instance1"; // Ensure all local data is processed Sink::Store::synchronize(query).exec().waitForFinished(); @@ -120,7 +120,7 @@ private slots: // Test Sink::Query query; - query.resources << "org.kde.dummy.instance1"; + query.resources << "sink.dummy.instance1"; query.ids << id; auto model = Sink::Store::loadModel(query); QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); @@ -131,13 +131,13 @@ private slots: { // Setup { - Sink::ApplicationDomain::Folder folder("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Folder folder("sink.dummy.instance1"); Sink::Store::create(folder).exec().waitForFinished(); } // Test Sink::Query query; - query.resources << "org.kde.dummy.instance1"; + query.resources << "sink.dummy.instance1"; query.liveQuery = true; // We fetch before the data is available and rely on the live query mechanism to deliver the actual data @@ -151,11 +151,11 @@ private slots: { // Setup { - Sink::ApplicationDomain::Folder folder("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Folder folder("sink.dummy.instance1"); Sink::Store::create(folder).exec().waitForFinished(); Sink::Query query; - query.resources << "org.kde.dummy.instance1"; + query.resources << "sink.dummy.instance1"; // Ensure all local data is processed Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); @@ -167,14 +167,14 @@ private slots: auto folderEntity = model->index(0, 0).data(Sink::Store::DomainObjectRole).value(); QVERIFY(!folderEntity->identifier().isEmpty()); - Sink::ApplicationDomain::Folder subfolder("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Folder subfolder("sink.dummy.instance1"); subfolder.setProperty("parent", folderEntity->identifier()); Sink::Store::create(subfolder).exec().waitForFinished(); } // Test Sink::Query query; - query.resources << "org.kde.dummy.instance1"; + query.resources << "sink.dummy.instance1"; query.parentProperty = "parent"; // Ensure all local data is processed @@ -193,7 +193,7 @@ private slots: { // Setup { - Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Mail mail("sink.dummy.instance1"); mail.setProperty("uid", "test1"); mail.setProperty("sender", "doe@example.org"); Sink::Store::create(mail).exec().waitForFinished(); @@ -201,7 +201,7 @@ private slots: // Test Sink::Query query; - query.resources << "org.kde.dummy.instance1"; + query.resources << "sink.dummy.instance1"; query.liveQuery = false; query += Sink::Query::PropertyFilter("uid", "test1"); @@ -219,11 +219,11 @@ private slots: // Setup Sink::ApplicationDomain::Folder::Ptr folderEntity; { - Sink::ApplicationDomain::Folder folder("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Folder folder("sink.dummy.instance1"); Sink::Store::create(folder).exec().waitForFinished(); Sink::Query query; - query.resources << "org.kde.dummy.instance1"; + query.resources << "sink.dummy.instance1"; // Ensure all local data is processed Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); @@ -235,7 +235,7 @@ private slots: folderEntity = model->index(0, 0).data(Sink::Store::DomainObjectRole).value(); QVERIFY(!folderEntity->identifier().isEmpty()); - Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Mail mail("sink.dummy.instance1"); mail.setProperty("uid", "test1"); mail.setProperty("folder", folderEntity->identifier()); Sink::Store::create(mail).exec().waitForFinished(); @@ -243,7 +243,7 @@ private slots: // Test Sink::Query query; - query.resources << "org.kde.dummy.instance1"; + query.resources << "sink.dummy.instance1"; query += Sink::Query::PropertyFilter("folder", *folderEntity); // Ensure all local data is processed @@ -260,11 +260,11 @@ private slots: // Setup Sink::ApplicationDomain::Folder::Ptr folderEntity; { - Sink::ApplicationDomain::Folder folder("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Folder folder("sink.dummy.instance1"); Sink::Store::create(folder).exec().waitForFinished(); Sink::Query query; - query.resources << "org.kde.dummy.instance1"; + query.resources << "sink.dummy.instance1"; // Ensure all local data is processed Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); @@ -278,21 +278,21 @@ private slots: const auto date = QDateTime(QDate(2015, 7, 7), QTime(12, 0)); { - Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Mail mail("sink.dummy.instance1"); mail.setProperty("uid", "testSecond"); mail.setProperty("folder", folderEntity->identifier()); mail.setProperty("date", date.addDays(-1)); Sink::Store::create(mail).exec().waitForFinished(); } { - Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Mail mail("sink.dummy.instance1"); mail.setProperty("uid", "testLatest"); mail.setProperty("folder", folderEntity->identifier()); mail.setProperty("date", date); Sink::Store::create(mail).exec().waitForFinished(); } { - Sink::ApplicationDomain::Mail mail("org.kde.dummy.instance1"); + Sink::ApplicationDomain::Mail mail("sink.dummy.instance1"); mail.setProperty("uid", "testLast"); mail.setProperty("folder", folderEntity->identifier()); mail.setProperty("date", date.addDays(-2)); @@ -302,7 +302,7 @@ private slots: // Test Sink::Query query; - query.resources << "org.kde.dummy.instance1"; + query.resources << "sink.dummy.instance1"; query += Sink::Query::PropertyFilter("folder", *folderEntity); query.sortProperty = "date"; query.limit = 1; -- cgit v1.2.3 From ac67eb1a3baa93cfd494ee5461b1b9bb9b304aa8 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 8 Jul 2016 11:51:24 +0200 Subject: Print where the notification is coming from. --- tests/modelinteractivitytest.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/modelinteractivitytest.cpp b/tests/modelinteractivitytest.cpp index 4819ccc..1ac0e2d 100644 --- a/tests/modelinteractivitytest.cpp +++ b/tests/modelinteractivitytest.cpp @@ -30,10 +30,11 @@ public: { t.start(); const bool ret = QCoreApplication::notify(receiver, event); - if (t.elapsed() > 1) + if (t.elapsed() > 1) { std::cout - << QString("processing event type %1 for object %2 took %3ms").arg((int)event->type()).arg("" /* receiver->objectName().toLocal8Bit().data()*/).arg((int)t.elapsed()).toStdString() + << QString("processing event type %1 for object %2 took %3ms").arg((int)event->type()).arg(receiver->metaObject()->className()).arg((int)t.elapsed()).toStdString() << std::endl; + } blockingTime += t.elapsed(); return ret; } -- cgit v1.2.3 From db8f328bde01d24bf9271638f8295fc70c68cdd4 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 8 Jul 2016 14:30:37 +0200 Subject: Account status --- tests/accountstest.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests') diff --git a/tests/accountstest.cpp b/tests/accountstest.cpp index 8d0f2e6..4be8bd6 100644 --- a/tests/accountstest.cpp +++ b/tests/accountstest.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "testutils.h" class AccountsTest : public QObject { @@ -115,6 +116,35 @@ private slots: QTRY_COMPARE(model->rowCount(QModelIndex()), 2); } + void testLoadAccountStatus() + { + using namespace Sink; + using namespace Sink::ApplicationDomain; + + auto account = ApplicationDomainType::createEntity(); + account.setAccountType("dummy"); + account.setName("name"); + VERIFYEXEC(Store::create(account)); + + auto res = Sink::ApplicationDomain::DummyResource::create(account.identifier()); + VERIFYEXEC(Sink::Store::create(res)); + { + Sink::Query query; + query.liveQuery = true; + query.request(); + + auto model = Sink::Store::loadModel(query); + QTRY_COMPARE(model->rowCount(QModelIndex()), 1); + auto account = model->data(model->index(0, 0, QModelIndex()), Sink::Store::DomainObjectRole).value(); + QCOMPARE(account->getStatus(), static_cast(Sink::ApplicationDomain::OfflineStatus)); + + //Synchronize to connect + VERIFYEXEC(Sink::Store::synchronize(Query::ResourceFilter(res))); + + QTRY_COMPARE_WITH_TIMEOUT(model->data(model->index(0, 0, QModelIndex()), Sink::Store::DomainObjectRole).value()->getStatus(), static_cast(Sink::ApplicationDomain::ConnectedStatus), 1000); + } + } + }; QTEST_GUILESS_MAIN(AccountsTest) -- cgit v1.2.3