From 4d89be0c8ed4a9b33d44f9782e93709be8fc8042 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 31 May 2016 17:24:40 +0200 Subject: Got rid of the maildirresourcetest --- tests/CMakeLists.txt | 11 - .../cur/1365777830.R28.localhost.localdomain:2,S | 72 ------ .../cur/1365777829.R28.localhost.localdomain:2,S | 72 ------ .../new/1365777840.R28.localhost.localdomain:2 | 72 ------ tests/maildirresourcetest.cpp | 251 --------------------- tests/mailsynctest.cpp | 24 +- tests/mailsynctest.h | 1 + 7 files changed, 23 insertions(+), 480 deletions(-) delete mode 100644 tests/data/maildir1/cur/1365777830.R28.localhost.localdomain:2,S delete mode 100644 tests/data/maildir1/inbox/cur/1365777829.R28.localhost.localdomain:2,S delete mode 100644 tests/data/maildir1/inbox/new/1365777840.R28.localhost.localdomain:2 delete mode 100644 tests/maildirresourcetest.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c9ad41f..0d45f3a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -54,14 +54,3 @@ target_link_libraries(dummyresourcewritebenchmark sink_resource_dummy) target_link_libraries(querytest sink_resource_dummy) target_link_libraries(modelinteractivitytest sink_resource_dummy) target_link_libraries(inspectiontest sink_resource_dummy) - -if (BUILD_MAILDIR) - auto_tests ( - maildirresourcetest - ) - manual_tests ( - maildirsyncbenchmark - ) - target_link_libraries(maildirresourcetest sink_resource_maildir) - target_link_libraries(maildirsyncbenchmark sink_resource_maildir) -endif() diff --git a/tests/data/maildir1/cur/1365777830.R28.localhost.localdomain:2,S b/tests/data/maildir1/cur/1365777830.R28.localhost.localdomain:2,S deleted file mode 100644 index 91231b5..0000000 --- a/tests/data/maildir1/cur/1365777830.R28.localhost.localdomain:2,S +++ /dev/null @@ -1,72 +0,0 @@ -Return-Path: -Received: from compute4.internal (compute4.nyi.mail.srv.osa [10.202.2.44]) - by slots3a1p1 (Cyrus git2.5+0-git-fastmail-8998) with LMTPA; - Mon, 11 Mar 2013 14:28:42 -0400 -X-Sieve: CMU Sieve 2.4 -X-Spam-score: 0.0 -X-Spam-hits: BAYES_00 -1.9, RCVD_IN_DNSWL_MED -2.3, RP_MATCHES_RCVD -0.704, - LANGUAGES unknown, BAYES_USED global, SA_VERSION 3.3.1 -X-Spam-source: IP='46.4.96.248', Host='postbox.kde.org', Country='unk', FromHeader='org', - MailFrom='org' -X-Spam-charsets: plain='us-ascii' -X-Resolved-to: chrigi_1@fastmail.fm -X-Delivered-to: chrigi_1@fastmail.fm -X-Mail-from: nepomuk-bounces@kde.org -Received: from mx4.nyi.mail.srv.osa ([10.202.2.203]) - by compute4.internal (LMTPProxy); Mon, 11 Mar 2013 14:28:42 -0400 -Received: from postbox.kde.org (postbox.kde.org [46.4.96.248]) - by mx4.messagingengine.com (Postfix) with ESMTP id 1C9D2440F88 - for ; Mon, 11 Mar 2013 14:28:42 -0400 (EDT) -Received: from postbox.kde.org (localhost [IPv6:::1]) - by postbox.kde.org (Postfix) with ESMTP id 00FFEB3732B; - Mon, 11 Mar 2013 18:28:40 +0000 (UTC) -DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=kde.org; s=default; - t=1363026520; bh=cOdvyBAJJ8ho64q0H7rxkl+cB2y6TiyVOX0fO3yZ64U=; - h=Date:From:To:Message-ID:In-Reply-To:References:MIME-Version: - Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: - List-Subscribe:Content-Type:Content-Transfer-Encoding:Sender; b=dv - dJAFu+6JCuNun5WIuP4ysfKpLh0DeuhEEfy2cQavUGMICJ27k7tI73x6gN37V5Q/evJ - NDFna3/IhNBsAQeLiXs28HKxzcVhbnq5jdFR6fbyo6k1fOKt5vTT1GTDZ+3zIGPD1CU - ioDBGxPb/Ds6gee90tjadOj6o+Oc+2ZSq94= -X-Original-To: nepomuk@kde.org -X-Remote-Delivered-To: nepomuk@localhost.kde.org -Received: from build.kde.org (build.kde.org [IPv6:2a01:4f8:160:9363::5]) - by postbox.kde.org (Postfix) with ESMTP id 4491CB3732B - for ; Mon, 11 Mar 2013 18:28:27 +0000 (UTC) -Received: from localhost ([127.0.0.1]) by build.kde.org with esmtp (Exim 4.72) - (envelope-from ) id 1UF7SV-0000gs-11 - for nepomuk@kde.org; Mon, 11 Mar 2013 18:28:27 +0000 -Date: Mon, 11 Mar 2013 18:28:27 +0000 (UTC) -From: KDE CI System -To: nepomuk@kde.org -Message-ID: <1977027405.27.1363026507008.JavaMail.jenkins@build> -In-Reply-To: <880663748.26.1363026023717.JavaMail.jenkins@build> -References: <880663748.26.1363026023717.JavaMail.jenkins@build> -MIME-Version: 1.0 -X-Jenkins-Job: nepomuk-core_stable -X-Jenkins-Result: UNSTABLE -X-Scanned-By: MIMEDefang 2.71 on 46.4.96.248 -Subject: [Nepomuk] Jenkins build is still unstable: nepomuk-core_stable #158 -X-BeenThere: nepomuk@kde.org -X-Mailman-Version: 2.1.14 -Precedence: list -List-Id: The Semantic KDE -List-Unsubscribe: , - -List-Archive: -List-Post: -List-Help: -List-Subscribe: , - -Content-Type: text/plain; charset="us-ascii" -Content-Transfer-Encoding: 7bit -Errors-To: nepomuk-bounces@kde.org -Sender: nepomuk-bounces@kde.org -X-Truedomain: NotChecked - -See - -_______________________________________________ -Nepomuk mailing list -Nepomuk@kde.org -https://mail.kde.org/mailman/listinfo/nepomuk diff --git a/tests/data/maildir1/inbox/cur/1365777829.R28.localhost.localdomain:2,S b/tests/data/maildir1/inbox/cur/1365777829.R28.localhost.localdomain:2,S deleted file mode 100644 index 91231b5..0000000 --- a/tests/data/maildir1/inbox/cur/1365777829.R28.localhost.localdomain:2,S +++ /dev/null @@ -1,72 +0,0 @@ -Return-Path: -Received: from compute4.internal (compute4.nyi.mail.srv.osa [10.202.2.44]) - by slots3a1p1 (Cyrus git2.5+0-git-fastmail-8998) with LMTPA; - Mon, 11 Mar 2013 14:28:42 -0400 -X-Sieve: CMU Sieve 2.4 -X-Spam-score: 0.0 -X-Spam-hits: BAYES_00 -1.9, RCVD_IN_DNSWL_MED -2.3, RP_MATCHES_RCVD -0.704, - LANGUAGES unknown, BAYES_USED global, SA_VERSION 3.3.1 -X-Spam-source: IP='46.4.96.248', Host='postbox.kde.org', Country='unk', FromHeader='org', - MailFrom='org' -X-Spam-charsets: plain='us-ascii' -X-Resolved-to: chrigi_1@fastmail.fm -X-Delivered-to: chrigi_1@fastmail.fm -X-Mail-from: nepomuk-bounces@kde.org -Received: from mx4.nyi.mail.srv.osa ([10.202.2.203]) - by compute4.internal (LMTPProxy); Mon, 11 Mar 2013 14:28:42 -0400 -Received: from postbox.kde.org (postbox.kde.org [46.4.96.248]) - by mx4.messagingengine.com (Postfix) with ESMTP id 1C9D2440F88 - for ; Mon, 11 Mar 2013 14:28:42 -0400 (EDT) -Received: from postbox.kde.org (localhost [IPv6:::1]) - by postbox.kde.org (Postfix) with ESMTP id 00FFEB3732B; - Mon, 11 Mar 2013 18:28:40 +0000 (UTC) -DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=kde.org; s=default; - t=1363026520; bh=cOdvyBAJJ8ho64q0H7rxkl+cB2y6TiyVOX0fO3yZ64U=; - h=Date:From:To:Message-ID:In-Reply-To:References:MIME-Version: - Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: - List-Subscribe:Content-Type:Content-Transfer-Encoding:Sender; b=dv - dJAFu+6JCuNun5WIuP4ysfKpLh0DeuhEEfy2cQavUGMICJ27k7tI73x6gN37V5Q/evJ - NDFna3/IhNBsAQeLiXs28HKxzcVhbnq5jdFR6fbyo6k1fOKt5vTT1GTDZ+3zIGPD1CU - ioDBGxPb/Ds6gee90tjadOj6o+Oc+2ZSq94= -X-Original-To: nepomuk@kde.org -X-Remote-Delivered-To: nepomuk@localhost.kde.org -Received: from build.kde.org (build.kde.org [IPv6:2a01:4f8:160:9363::5]) - by postbox.kde.org (Postfix) with ESMTP id 4491CB3732B - for ; Mon, 11 Mar 2013 18:28:27 +0000 (UTC) -Received: from localhost ([127.0.0.1]) by build.kde.org with esmtp (Exim 4.72) - (envelope-from ) id 1UF7SV-0000gs-11 - for nepomuk@kde.org; Mon, 11 Mar 2013 18:28:27 +0000 -Date: Mon, 11 Mar 2013 18:28:27 +0000 (UTC) -From: KDE CI System -To: nepomuk@kde.org -Message-ID: <1977027405.27.1363026507008.JavaMail.jenkins@build> -In-Reply-To: <880663748.26.1363026023717.JavaMail.jenkins@build> -References: <880663748.26.1363026023717.JavaMail.jenkins@build> -MIME-Version: 1.0 -X-Jenkins-Job: nepomuk-core_stable -X-Jenkins-Result: UNSTABLE -X-Scanned-By: MIMEDefang 2.71 on 46.4.96.248 -Subject: [Nepomuk] Jenkins build is still unstable: nepomuk-core_stable #158 -X-BeenThere: nepomuk@kde.org -X-Mailman-Version: 2.1.14 -Precedence: list -List-Id: The Semantic KDE -List-Unsubscribe: , - -List-Archive: -List-Post: -List-Help: -List-Subscribe: , - -Content-Type: text/plain; charset="us-ascii" -Content-Transfer-Encoding: 7bit -Errors-To: nepomuk-bounces@kde.org -Sender: nepomuk-bounces@kde.org -X-Truedomain: NotChecked - -See - -_______________________________________________ -Nepomuk mailing list -Nepomuk@kde.org -https://mail.kde.org/mailman/listinfo/nepomuk diff --git a/tests/data/maildir1/inbox/new/1365777840.R28.localhost.localdomain:2 b/tests/data/maildir1/inbox/new/1365777840.R28.localhost.localdomain:2 deleted file mode 100644 index 91231b5..0000000 --- a/tests/data/maildir1/inbox/new/1365777840.R28.localhost.localdomain:2 +++ /dev/null @@ -1,72 +0,0 @@ -Return-Path: -Received: from compute4.internal (compute4.nyi.mail.srv.osa [10.202.2.44]) - by slots3a1p1 (Cyrus git2.5+0-git-fastmail-8998) with LMTPA; - Mon, 11 Mar 2013 14:28:42 -0400 -X-Sieve: CMU Sieve 2.4 -X-Spam-score: 0.0 -X-Spam-hits: BAYES_00 -1.9, RCVD_IN_DNSWL_MED -2.3, RP_MATCHES_RCVD -0.704, - LANGUAGES unknown, BAYES_USED global, SA_VERSION 3.3.1 -X-Spam-source: IP='46.4.96.248', Host='postbox.kde.org', Country='unk', FromHeader='org', - MailFrom='org' -X-Spam-charsets: plain='us-ascii' -X-Resolved-to: chrigi_1@fastmail.fm -X-Delivered-to: chrigi_1@fastmail.fm -X-Mail-from: nepomuk-bounces@kde.org -Received: from mx4.nyi.mail.srv.osa ([10.202.2.203]) - by compute4.internal (LMTPProxy); Mon, 11 Mar 2013 14:28:42 -0400 -Received: from postbox.kde.org (postbox.kde.org [46.4.96.248]) - by mx4.messagingengine.com (Postfix) with ESMTP id 1C9D2440F88 - for ; Mon, 11 Mar 2013 14:28:42 -0400 (EDT) -Received: from postbox.kde.org (localhost [IPv6:::1]) - by postbox.kde.org (Postfix) with ESMTP id 00FFEB3732B; - Mon, 11 Mar 2013 18:28:40 +0000 (UTC) -DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=kde.org; s=default; - t=1363026520; bh=cOdvyBAJJ8ho64q0H7rxkl+cB2y6TiyVOX0fO3yZ64U=; - h=Date:From:To:Message-ID:In-Reply-To:References:MIME-Version: - Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: - List-Subscribe:Content-Type:Content-Transfer-Encoding:Sender; b=dv - dJAFu+6JCuNun5WIuP4ysfKpLh0DeuhEEfy2cQavUGMICJ27k7tI73x6gN37V5Q/evJ - NDFna3/IhNBsAQeLiXs28HKxzcVhbnq5jdFR6fbyo6k1fOKt5vTT1GTDZ+3zIGPD1CU - ioDBGxPb/Ds6gee90tjadOj6o+Oc+2ZSq94= -X-Original-To: nepomuk@kde.org -X-Remote-Delivered-To: nepomuk@localhost.kde.org -Received: from build.kde.org (build.kde.org [IPv6:2a01:4f8:160:9363::5]) - by postbox.kde.org (Postfix) with ESMTP id 4491CB3732B - for ; Mon, 11 Mar 2013 18:28:27 +0000 (UTC) -Received: from localhost ([127.0.0.1]) by build.kde.org with esmtp (Exim 4.72) - (envelope-from ) id 1UF7SV-0000gs-11 - for nepomuk@kde.org; Mon, 11 Mar 2013 18:28:27 +0000 -Date: Mon, 11 Mar 2013 18:28:27 +0000 (UTC) -From: KDE CI System -To: nepomuk@kde.org -Message-ID: <1977027405.27.1363026507008.JavaMail.jenkins@build> -In-Reply-To: <880663748.26.1363026023717.JavaMail.jenkins@build> -References: <880663748.26.1363026023717.JavaMail.jenkins@build> -MIME-Version: 1.0 -X-Jenkins-Job: nepomuk-core_stable -X-Jenkins-Result: UNSTABLE -X-Scanned-By: MIMEDefang 2.71 on 46.4.96.248 -Subject: [Nepomuk] Jenkins build is still unstable: nepomuk-core_stable #158 -X-BeenThere: nepomuk@kde.org -X-Mailman-Version: 2.1.14 -Precedence: list -List-Id: The Semantic KDE -List-Unsubscribe: , - -List-Archive: -List-Post: -List-Help: -List-Subscribe: , - -Content-Type: text/plain; charset="us-ascii" -Content-Transfer-Encoding: 7bit -Errors-To: nepomuk-bounces@kde.org -Sender: nepomuk-bounces@kde.org -X-Truedomain: NotChecked - -See - -_______________________________________________ -Nepomuk mailing list -Nepomuk@kde.org -https://mail.kde.org/mailman/listinfo/nepomuk diff --git a/tests/maildirresourcetest.cpp b/tests/maildirresourcetest.cpp deleted file mode 100644 index 0a32000..0000000 --- a/tests/maildirresourcetest.cpp +++ /dev/null @@ -1,251 +0,0 @@ -#include - -#include -#include - -#include "maildirresource/maildirresource.h" -#include "store.h" -#include "resourcecontrol.h" -#include "commands.h" -#include "entitybuffer.h" -#include "resourceconfig.h" -#include "modelresult.h" -#include "pipeline.h" -#include "log.h" -#include "test.h" - -#define ASYNCCOMPARE(actual, expected) \ -do {\ - if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__))\ - return KAsync::error(1, "Comparison failed.");\ -} while (0) - -#define ASYNCVERIFY(statement) \ -do {\ - if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__))\ - return KAsync::error(1, "Verify failed.");\ -} while (0) - -using namespace Sink; - -static bool copyRecursively(const QString &srcFilePath, const QString &tgtFilePath) -{ - QFileInfo srcFileInfo(srcFilePath); - if (srcFileInfo.isDir()) { - QDir targetDir(tgtFilePath); - targetDir.cdUp(); - if (!targetDir.mkdir(QFileInfo(srcFilePath).fileName())) { - qWarning() << "Failed to create directory " << tgtFilePath; - return false; - } - QDir sourceDir(srcFilePath); - QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System); - foreach (const QString &fileName, fileNames) { - const QString newSrcFilePath = srcFilePath + QLatin1Char('/') + fileName; - const QString newTgtFilePath = tgtFilePath + QLatin1Char('/') + fileName; - if (!copyRecursively(newSrcFilePath, newTgtFilePath)) - return false; - } - } else { - if (!QFile::copy(srcFilePath, tgtFilePath)) { - qWarning() << "Failed to copy file " << tgtFilePath; - return false; - } - } - return true; -} - -/** - * Test of complete system using the maildir resource. - * - * This test requires the maildir resource installed. - */ -class MaildirResourceTest : public QObject -{ - Q_OBJECT - - QTemporaryDir tempDir; - QString targetPath; -private slots: - void initTestCase() - { - targetPath = tempDir.path() + "/maildir1/"; - - Sink::Test::initTest(); - Sink::Log::setDebugOutputLevel(Sink::Log::Trace); - MaildirResource::removeFromDisk("org.kde.maildir.instance1"); - Sink::ApplicationDomain::SinkResource resource; - resource.setProperty("identifier", "org.kde.maildir.instance1"); - resource.setProperty("type", "org.kde.maildir"); - resource.setProperty("path", targetPath); - Sink::Store::create(resource).exec().waitForFinished(); - } - - void cleanup() - { - Sink::ResourceControl::shutdown(QByteArray("org.kde.maildir.instance1")).exec().waitForFinished(); - MaildirResource::removeFromDisk("org.kde.maildir.instance1"); - QDir dir(targetPath); - dir.removeRecursively(); - } - - void init() - { - qDebug(); - qDebug() << "-----------------------------------------"; - qDebug(); - copyRecursively(TESTDATAPATH "/maildir1", targetPath); - Sink::ResourceControl::start(QByteArray("org.kde.maildir.instance1")).exec().waitForFinished(); - } - - void testListFolders() - { - Sink::Query query; - query.resources << "org.kde.maildir.instance1"; - - // Ensure all local data is processed - Sink::Store::synchronize(query).exec().waitForFinished(); - Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); - - auto model = Sink::Store::loadModel(query); - QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); - QCOMPARE(model->rowCount(QModelIndex()), 3); - } - - void testListFolderTree() - { - Sink::Query query; - query.resources << "org.kde.maildir.instance1"; - query.parentProperty = "parent"; - - // Ensure all local data is processed - Sink::Store::synchronize(query).exec().waitForFinished(); - Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); - - auto model = Sink::Store::loadModel(query); - QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); - QCOMPARE(model->rowCount(QModelIndex()), 1); - auto parentIndex = model->index(0, 0, QModelIndex()); - model->fetchMore(parentIndex); - QTRY_VERIFY(model->data(parentIndex, Sink::Store::ChildrenFetchedRole).toBool()); - QCOMPARE(model->rowCount(parentIndex), 2); - } - - void testListMailsOfFolder() - { - using namespace Sink; - using namespace Sink::ApplicationDomain; - // Ensure all local data is processed - auto query = Query::ResourceFilter("org.kde.maildir.instance1"); - Store::synchronize(query).exec().waitForFinished(); - ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); - auto result = Store::fetchOne(Query::ResourceFilter("org.kde.maildir.instance1") + Query::RequestedProperties(QByteArrayList() << "name")) - .then, Folder>([](const Folder &folder) { - Trace() << "Found a folder" << folder.identifier(); - return Store::fetchAll(Query::PropertyFilter("folder", folder) + Query::RequestedProperties(QByteArrayList() << "folder" - << "subject")); - }) - .then>([](const QList &mails) { QVERIFY(mails.size() >= 1); }) - .exec(); - result.waitForFinished(); - QVERIFY(!result.errorCode()); - } - - void testMailContent() - { - Sink::Query query; - query.resources << "org.kde.maildir.instance1"; - query.requestedProperties << "folder" - << "subject" - << "mimeMessage" - << "date"; - - // Ensure all local data is processed - Sink::Store::synchronize(query).exec().waitForFinished(); - Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); - - auto mailModel = Sink::Store::loadModel(query); - QTRY_VERIFY(mailModel->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); - QVERIFY(mailModel->rowCount(QModelIndex()) >= 1); - auto mail = mailModel->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value(); - QVERIFY(!mail->getProperty("subject").toString().isEmpty()); - QVERIFY(!mail->getProperty("mimeMessage").toString().isEmpty()); - QVERIFY(mail->getProperty("date").toDateTime().isValid()); - - QFileInfo info(mail->getProperty("mimeMessage").toString()); - QVERIFY(info.exists()); - } - - - void testSyncFolderMove() - { - Sink::Query query; - query.resources << "org.kde.maildir.instance1"; - query.requestedProperties << "name"; - - // Ensure all local data is processed - Sink::Store::synchronize(query).exec().waitForFinished(); - Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); - - auto targetPath = tempDir.path() + "/maildir1/"; - QDir dir(targetPath); - QVERIFY(dir.rename("inbox", "newbox")); - - // Ensure all local data is processed - Sink::Store::synchronize(query).exec().waitForFinished(); - Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); - - auto model = Sink::Store::loadModel(query); - QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); - QCOMPARE(model->rowCount(QModelIndex()), 4); - QCOMPARE(model->match(model->index(0, 0, QModelIndex()), Qt::DisplayRole, QStringLiteral("newbox"), 1).size(), 1); - } - - void testReSyncMail() - { - Sink::Query query; - query.resources << "org.kde.maildir.instance1"; - query.requestedProperties << "folder" - << "subject"; - - // Ensure all local data is processed - Sink::Store::synchronize(query).exec().waitForFinished(); - Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); - - // Ensure all local data is processed - Sink::Store::synchronize(query).exec().waitForFinished(); - Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); - - auto mailModel = Sink::Store::loadModel(query); - QTRY_VERIFY(mailModel->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); - QCOMPARE(mailModel->rowCount(QModelIndex()), 3); - } - - void testSyncMailRemoval() - { - Sink::Query query; - query.resources << "org.kde.maildir.instance1"; - query.requestedProperties << "folder" - << "subject"; - - // Ensure all local data is processed - Sink::Store::synchronize(query).exec().waitForFinished(); - Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); - - auto targetPath = tempDir.path() + "/maildir1/cur/1365777830.R28.localhost.localdomain:2,S"; - QFile file(targetPath); - QVERIFY(file.remove()); - - // Ensure all local data is processed - Sink::Store::synchronize(query).exec().waitForFinished(); - Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); - - auto mailModel = Sink::Store::loadModel(query); - QTRY_VERIFY(mailModel->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); - QCOMPARE(mailModel->rowCount(QModelIndex()), 2); - } - -}; - -QTEST_MAIN(MaildirResourceTest) -#include "maildirresourcetest.moc" diff --git a/tests/mailsynctest.cpp b/tests/mailsynctest.cpp index 2fc8568..4f0b9bb 100644 --- a/tests/mailsynctest.cpp +++ b/tests/mailsynctest.cpp @@ -249,7 +249,7 @@ void MailSyncTest::testListMails() { Sink::Query query; query.resources << mResourceInstanceIdentifier; - query.request().request(); + query.request().request().request().request(); // Ensure all local data is processed VERIFYEXEC(Store::synchronize(query)); @@ -265,6 +265,27 @@ void MailSyncTest::testListMails() m.setContent(data); m.parse(); QCOMPARE(mails.first()->getSubject(), m.subject(true)->asUnicodeString()); + QVERIFY(!mails.first()->getFolder().isEmpty()); + QVERIFY(mails.first()->getDate().isValid()); + }); + VERIFYEXEC(job); +} + +void MailSyncTest::testResyncMails() +{ + Sink::Query query; + query.resources << mResourceInstanceIdentifier; + + // Ensure all local data is processed + VERIFYEXEC(Store::synchronize(query)); + ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); + + // Ensure all local data is processed + VERIFYEXEC(Store::synchronize(query)); + ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); + + auto job = Store::fetchAll(query).then>([](const QList &mails) { + QCOMPARE(mails.size(), 1); }); VERIFYEXEC(job); } @@ -294,7 +315,6 @@ void MailSyncTest::testFetchNewRemovedMessages() VERIFYEXEC(job); } - removeMessage(QStringList() << "test", messageIdentifier); Store::synchronize(query).exec().waitForFinished(); diff --git a/tests/mailsynctest.h b/tests/mailsynctest.h index b0fda7c..ec40f33 100644 --- a/tests/mailsynctest.h +++ b/tests/mailsynctest.h @@ -82,6 +82,7 @@ private slots: void testListRemovedSubFolder(); void testListMails(); + void testResyncMails(); void testFetchNewRemovedMessages(); void testFailingSync(); -- cgit v1.2.3