Commit 20842a12 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Allow to log file

parent 5d0d7f3a
......@@ -18,6 +18,7 @@ add_library(test_resourceconverter STATIC
comparefilehelper.cpp
exportimportutil.cpp
saveresourceconfigtest.cpp
compareloggingfile.cpp
)
target_link_libraries(test_resourceconverter PUBLIC KF5::ConfigCore pimdataexporterprivate KF5::Archive Qt5::Test KF5::AkonadiCore)
......
/*
Copyright (C) 2020 Laurent Montel <montel@kde.org>
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 "compareloggingfile.h"
#include "comparefilehelper.h"
#include <QDebug>
CompareLoggingFile::CompareLoggingFile()
{
}
void CompareLoggingFile::compare()
{
qDebug() << " mListFilePath " << mListFilePath << " mLoggingFilePath " << mLoggingFilePath;
CompareFileHelper::compareFile(mListFilePath + QStringLiteral("/references/loggingfile.txt"), mLoggingFilePath);
}
QString CompareLoggingFile::loggingFilePath() const
{
return mLoggingFilePath;
}
void CompareLoggingFile::setLoggingFilePath(const QString &loggingFilePath)
{
mLoggingFilePath = loggingFilePath;
}
QString CompareLoggingFile::listFilePath() const
{
return mListFilePath;
}
void CompareLoggingFile::setListFilePath(const QString &listFilePath)
{
mListFilePath = listFilePath;
}
/*
Copyright (C) 2020 Laurent Montel <montel@kde.org>
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.
*/
#ifndef COMPARELOGGINGFILE_H
#define COMPARELOGGINGFILE_H
#include <QString>
class CompareLoggingFile
{
public:
CompareLoggingFile();
~CompareLoggingFile() = default;
void compare();
Q_REQUIRED_RESULT QString loggingFilePath() const;
void setLoggingFilePath(const QString &loggingFilePath);
Q_REQUIRED_RESULT QString listFilePath() const;
void setListFilePath(const QString &listFilePath);
private:
QString mLoggingFilePath;
QString mListFilePath;
};
#endif // COMPARELOGGINGFILE_H
......@@ -28,6 +28,7 @@ LogCreatingResource::LogCreatingResource(QObject *parent)
{
mTmpLogFile = new QTemporaryFile(this);
mTmpLogFile->open();
qDebug() << " mTmpLogFile "<< mTmpLogFile->fileName();
}
LogCreatingResource::~LogCreatingResource()
......
akonadi_akonotes_resource
Notes
Path /tmp/backupnote//0/
1
......@@ -33,6 +33,8 @@ ImportNotesJobInterfaceTestImpl::ImportNotesJobInterfaceTestImpl(QObject *parent
ImportNotesJobInterfaceTestImpl::~ImportNotesJobInterfaceTestImpl()
{
//Clean up temp repo
QVERIFY(QDir(QDir::tempPath() + QStringLiteral("/backupnote/")).removeRecursively());
}
Akonadi::Collection::Id ImportNotesJobInterfaceTestImpl::convertFolderPathToCollectionId(const QString &path)
......@@ -110,6 +112,7 @@ void ImportNotesJobInterfaceTest::importNoteConfigAndResources()
file->setExcludePath(Utils::notePath());
ImportNotesJobInterfaceTestImpl *impl = new ImportNotesJobInterfaceTestImpl(this, {Utils::StoredType::Config|Utils::StoredType::Resources}, file->archiveStorage(), 1);
file->setAbstractImportExportJob(impl);
file->setLoggingFilePath(impl->loggingFilePath());
file->start();
delete impl;
delete file;
......
......@@ -22,6 +22,7 @@
#include "utils.h"
#include "abstractimportexportjob.h"
#include "compareimportfile.h"
#include "compareloggingfile.h"
#include <QSignalSpy>
#include <QTest>
......@@ -76,6 +77,12 @@ void TestImportFile::start()
compareExportFile.setExcludePath(mExcludePath);
compareExportFile.compareFile();
CompareLoggingFile file;
file.setLoggingFilePath(mLoggingFilePath);
file.setListFilePath(mPathConfig);
file.compare();
#ifdef REMOVE_TEMPORARY_DIR
QVERIFY(QDir(mExtractPath).removeRecursively());
#endif
......
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