Commit f0cf6696 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Allow to test override in import calendar too

parent 58d38f97
Pipeline #26385 failed with stage
in 13 minutes and 56 seconds
......@@ -47,14 +47,17 @@ void ImportCalendarJobInterfaceTest::importCalendar()
QFETCH(QString, zipFilePath);
QFETCH(QString, testPath);
QFETCH(Utils::StoredTypes, options);
TestImportFile *file = new TestImportFile(zipFilePath + testPath, this);
file->setPathConfig(zipFilePath + testPath);
const QString fullTestPath = zipFilePath + testPath;
TestImportFile *file = new TestImportFile(fullTestPath, this);
file->setPathConfig(fullTestPath);
file->setExtractPath(QDir::tempPath() + testPath);
file->setExcludePath(Utils::calendarPath());
ImportCalendarJobInterfaceTestImpl *impl = new ImportCalendarJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
impl->setPathConfig(file->pathConfig());
impl->setExtractPath(file->extractPath());
impl->setTempDirName(file->extractPath());
impl->setExistingPathConfig(fullTestPath + QStringLiteral("/existingconfig/"));
file->setAbstractImportExportJob(impl);
file->setLoggingFilePath(impl->loggingFilePath());
file->start();
......
......@@ -65,3 +65,13 @@ QString ImportCalendarJobInterfaceTestImpl::adaptNewResourceUrl(bool overwriteRe
resourceConverterTest.setTestPath(mPathConfig);
return resourceConverterTest.adaptNewResourceUrl(overwriteResources, resourceConfig, storePath);
}
QString ImportCalendarJobInterfaceTestImpl::configLocation() const
{
return mExistingPathConfig;
}
void ImportCalendarJobInterfaceTestImpl::setExistingPathConfig(const QString &path)
{
mExistingPathConfig = path;
}
......@@ -31,12 +31,16 @@ public:
explicit ImportCalendarJobInterfaceTestImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep);
~ImportCalendarJobInterfaceTestImpl();
void setExistingPathConfig(const QString &path);
protected:
Q_REQUIRED_RESULT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) override;
Q_REQUIRED_RESULT QString createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree = false) override;
void synchronizeResource(const QStringList &lst) override;
Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) override;
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
Q_REQUIRED_RESULT QString configLocation() const override;
private:
QString mExistingPathConfig;
};
#endif // IMPORTCALENDARJOBINTERFACETESTIMPL_H
......@@ -33,10 +33,7 @@ ImportNotesJobInterfaceTestImpl::~ImportNotesJobInterfaceTestImpl()
QVERIFY(QDir(QDir::tempPath() + QLatin1Char('/') + Utils::backupnote()).removeRecursively());
}
void ImportNotesJobInterfaceTestImpl::setExistingPathConfig(const QString &path)
{
mExistingPathConfig = path;
}
Akonadi::Collection::Id ImportNotesJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path)
{
......@@ -74,3 +71,8 @@ QString ImportNotesJobInterfaceTestImpl::configLocation() const
{
return mExistingPathConfig;
}
void ImportNotesJobInterfaceTestImpl::setExistingPathConfig(const QString &path)
{
mExistingPathConfig = path;
}
......@@ -311,3 +311,13 @@ void ImportCalendarJobInterface::restoreResources()
//It's maildir support. Need to add support
synchronizeResource(listResource);
}
QString ImportCalendarJobInterface::configLocation() const
{
return installConfigLocation();
}
QString ImportCalendarJobInterface::installConfigLocation() const
{
return QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/');
}
......@@ -39,6 +39,7 @@ protected:
virtual void synchronizeResource(const QStringList &lst) = 0;
virtual Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) = 0;
virtual Q_REQUIRED_RESULT QString configLocation() const;
private:
Q_REQUIRED_RESULT bool isAConfigFile(const QString &name) const override;
void importkorganizerConfig(const KArchiveFile *file, const QString &config, const QString &filename, const QString &prefix);
......@@ -46,6 +47,7 @@ private:
void restoreResources();
void restoreConfig();
void addSpecificResourceSettings(const KSharedConfig::Ptr &resourceConfig, const QString &resourceName, QMap<QString, QVariant> &settings) override;
Q_REQUIRED_RESULT QString installConfigLocation() const;
};
#endif // IMPORTCALENDARJOBINTERFACE_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment