diff --git a/core/autotests/mail/CMakeLists.txt b/core/autotests/mail/CMakeLists.txt index 2fc3b45..668dbad 100644 --- a/core/autotests/mail/CMakeLists.txt +++ b/core/autotests/mail/CMakeLists.txt @@ -1,17 +1,17 @@ add_definitions( -DPIMDATAEXPORTER_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data" ) set( exportmailjobinterfacetest_SRCS exportmailjobinterfacetest.cpp exportmailjobinterfacetestimpl.cpp) add_executable( exportmailjobinterfacetest ${exportmailjobinterfacetest_SRCS}) add_test(NAME exportmailjobinterfacetest COMMAND exportmailjobinterfacetest) ecm_mark_as_test(exportmailjobinterfacetest) -target_link_libraries(exportmailjobinterfacetest Qt5::Test pimdataexporterprivate KF5::ConfigCore test_resourceconverter) +target_link_libraries(exportmailjobinterfacetest Qt5::Test pimdataexporterprivate KF5::ConfigCore test_resourceconverter KF5::Mime) ##### set( importmailjobinterfacetest_SRCS importmailjobinterfacetest.cpp importmailjobinterfacetestimpl.cpp) add_executable( importmailjobinterfacetest ${importmailjobinterfacetest_SRCS}) add_test(NAME importmailjobinterfacetest COMMAND importmailjobinterfacetest) ecm_mark_as_test(importmailjobinterfacetest) -target_link_libraries(importmailjobinterfacetest Qt5::Test pimdataexporterprivate KF5::ConfigCore KF5::AkonadiMime test_resourceconverter KF5::IdentityManagement) +target_link_libraries(importmailjobinterfacetest Qt5::Test pimdataexporterprivate KF5::ConfigCore KF5::AkonadiMime test_resourceconverter KF5::IdentityManagement KF5::Mime) diff --git a/core/autotests/mail/data/export/identitiesandconfigandmailtransportandresources/config/akonadi_maildir_resource_1rc b/core/autotests/mail/data/export/identitiesandconfigandmailtransportandresources/config/akonadi_maildir_resource_1rc new file mode 100644 index 0000000..fa2885d --- /dev/null +++ b/core/autotests/mail/data/export/identitiesandconfigandmailtransportandresources/config/akonadi_maildir_resource_1rc @@ -0,0 +1,3 @@ +[General] +Path[$e]=$[TEST_PATH]/resources/akonadi_maildir_resource_1/ +TopLevelIsContainer=true diff --git a/core/autotests/mail/data/export/identitiesandconfigandmailtransportandresources/config/akonadi_mbox_resource_1rc b/core/autotests/mail/data/export/identitiesandconfigandmailtransportandresources/config/akonadi_mbox_resource_1rc new file mode 100644 index 0000000..954a014 --- /dev/null +++ b/core/autotests/mail/data/export/identitiesandconfigandmailtransportandresources/config/akonadi_mbox_resource_1rc @@ -0,0 +1,2 @@ +[General] +Path[$e]=$[TEST_PATH]/resources/akonadi_mbox_resource_1/akonadi_mbox_resource_1.mbox diff --git a/core/autotests/mail/exportmailjobinterfacetest.cpp b/core/autotests/mail/exportmailjobinterfacetest.cpp index 12d3eee..0a47f90 100644 --- a/core/autotests/mail/exportmailjobinterfacetest.cpp +++ b/core/autotests/mail/exportmailjobinterfacetest.cpp @@ -1,79 +1,88 @@ /* Copyright (C) 2020 Laurent Montel This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "exportmailjobinterfacetest.h" #include "exportmailjobinterfacetestimpl.h" #include "archivestorage.h" #include "testexportfile.h" +#include #include QTEST_MAIN(ExportMailJobInterfaceTest) ExportMailJobInterfaceTest::ExportMailJobInterfaceTest(QObject *parent) : QObject(parent) { } void ExportMailJobInterfaceTest::exportMail_data() { QTest::addColumn("configpath"); QTest::addColumn("options"); const QByteArray pathConfig(QByteArray(PIMDATAEXPORTER_DIR) + "/export/"); Utils::StoredTypes options = {Utils::StoredType::Config}; QTest::newRow("mailonlyconfig") << pathConfig + QByteArray("mailonlyconfig/") << options; options = {Utils::StoredType::Config|Utils::StoredType::Resources}; QTest::newRow("mailconfigandresource") << pathConfig + QByteArray("mailconfigandresource/") << options; options = {Utils::StoredType::MailTransport}; QTest::newRow("mailtransport") << pathConfig + QByteArray("mailtransport/") << options; options = {Utils::StoredType::Identity}; QTest::newRow("identities") << pathConfig + QByteArray("identities/") << options; options = {Utils::StoredType::Identity|Utils::StoredType::Config}; QTest::newRow("identitiesandconfig") << pathConfig + QByteArray("identitiesandconfig/") << options; options = {Utils::StoredType::Config|Utils::StoredType::Identity|Utils::StoredType::MailTransport}; QTest::newRow("identitiesandconfigandmailtransport") << pathConfig + QByteArray("identitiesandconfigandmailtransport/") << options; - options = {Utils::StoredType::Config|Utils::StoredType::Identity|Utils::StoredType::MailTransport|Utils::StoredType::Resources}; + options = {Utils::StoredType::Config|Utils::StoredType::Identity|Utils::StoredType::MailTransport|Utils::StoredType::Resources|Utils::StoredType::Mails}; QTest::newRow("identitiesandconfigandmailtransportandresources") << pathConfig + QByteArray("identitiesandconfigandmailtransportandresources/") << options; } void ExportMailJobInterfaceTest::exportMail() { QFETCH(QByteArray, configpath); QFETCH(Utils::StoredTypes, options); TestExportFile *file = new TestExportFile(this); file->setPathConfig(configpath); QVector lstInfo; Utils::AkonadiInstanceInfo info; info.identifier = QLatin1String("akonadi_mbox_resource_1"); + info.mimeTypes = QStringList() << KMime::Message::mimeType(); + info.capabilities = QStringList() << QLatin1String("Resource"); lstInfo << info; info.identifier = QLatin1String("akonadi_maildir_resource_1"); + info.mimeTypes = QStringList() << KMime::Message::mimeType(); + info.capabilities = QStringList() << QLatin1String("Resource"); lstInfo << info; info.identifier = QLatin1String("akonadi_mixedmaildir_resource_1"); + info.mimeTypes = QStringList() << KMime::Message::mimeType(); + info.capabilities = QStringList() << QLatin1String("Resource"); lstInfo << info; + //TODO add kolab and other + //Add extra resource. - info.identifier = QStringLiteral("akonadi_kolab_resource_2"); + info.identifier = QStringLiteral("akonadi_kalarm_dir_resource_2"); lstInfo << info; ExportMailJobInterfaceTestImpl *exportMail = new ExportMailJobInterfaceTestImpl(this, options, file->archiveStorage(), 1); exportMail->setListOfResource(lstInfo); exportMail->setPathConfig(QLatin1String(configpath)); file->setAbstractImportExportJob(exportMail); file->start(); delete exportMail; }