Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
PIM Data Exporter
Commits
0436a755
Commit
0436a755
authored
May 02, 2020
by
Laurent Montel
Browse files
Remove duplicate method
parent
e984449a
Changes
5
Hide whitespace changes
Inline
Side-by-side
core/autotests/addressbook/exportaddressbookjobinterfacetest.cpp
View file @
0436a755
...
...
@@ -19,11 +19,10 @@
#include
"exportaddressbookjobinterfacetest.h"
#include
"archivestorage.h"
#include
"
compare
exportfile.h"
#include
"
test
exportfile.h"
#include
"resourceconvertertest.h"
#include
<QDebug>
#include
<QTest>
#include
<QSignalSpy>
QTEST_MAIN
(
ExportAddressbookJobInterfaceTest
)
...
...
@@ -41,6 +40,12 @@ void ExportAddressbookJobInterfaceTestImpl::exportArchiveResource()
qDebug
()
<<
" not implement yet"
;
}
Akonadi
::
Collection
::
Id
ExportAddressbookJobInterfaceTestImpl
::
convertFolderPathToCollectionId
(
const
QString
&
path
)
{
ResourceConverterTest
resourceConverterTest
;
return
resourceConverterTest
.
convertFolderPathToCollectionId
(
path
);
}
void
ExportAddressbookJobInterfaceTestImpl
::
convertCollectionToRealPath
(
KConfigGroup
&
group
,
const
QString
&
currentKey
)
{
ResourceConverterTest
resourceConverter
;
...
...
@@ -60,36 +65,13 @@ ExportAddressbookJobInterfaceTest::ExportAddressbookJobInterfaceTest(QObject *pa
void
ExportAddressbookJobInterfaceTest
::
exportAddressBookConfigTest1
()
{
//Don't use setTestModeEnabled otherwise we can set env
//QStandardPaths::setTestModeEnabled(true);
qputenv
(
"XDG_DATA_HOME"
,
PIMDATAEXPORTER_DIR
"/export/test1/share"
);
qputenv
(
"XDG_CONFIG_HOME"
,
PIMDATAEXPORTER_DIR
"/export/test1/config"
);
//TODO fix file name.
const
QString
temporaryFile
=
QStringLiteral
(
"/tmp/foo.zip"
);
const
QString
storeArchivePath
(
temporaryFile
);
ArchiveStorage
*
archiveStorage
=
new
ArchiveStorage
(
storeArchivePath
,
this
);
Q_ASSERT
(
archiveStorage
->
openArchive
(
true
));
Utils
::
addVersion
(
archiveStorage
->
archive
());
Utils
::
storeDataExportInfo
(
archiveStorage
->
archive
());
ExportAddressbookJobInterfaceTestImpl
*
exportNote
=
new
ExportAddressbookJobInterfaceTestImpl
(
this
,
{
Utils
::
StoredType
::
Config
},
archiveStorage
,
1
);
QSignalSpy
finish
(
exportNote
,
&
ExportAddressbookJobInterfaceTestImpl
::
jobFinished
);
QSignalSpy
error
(
exportNote
,
&
ExportAddressbookJobInterfaceTestImpl
::
error
);
exportNote
->
start
();
QVERIFY
(
finish
.
wait
());
QCOMPARE
(
error
.
count
(),
0
);
delete
exportNote
;
delete
archiveStorage
;
CompareExportFile
compareExportFile
;
compareExportFile
.
setTempFilePath
(
temporaryFile
);
compareExportFile
.
setListFilePath
(
QStringLiteral
(
PIMDATAEXPORTER_DIR
"/export/test1"
));
compareExportFile
.
compareFiles
();
TestExportFile
*
file
=
new
TestExportFile
(
this
);
const
QByteArray
pathConfig
(
"/export/test1/"
);
file
->
setPathConfig
(
QByteArray
(
PIMDATAEXPORTER_DIR
)
+
pathConfig
);
ExportAddressbookJobInterfaceTestImpl
*
impl
=
new
ExportAddressbookJobInterfaceTestImpl
(
this
,
{
Utils
::
StoredType
::
Config
},
file
->
archiveStorage
(),
1
);
file
->
setAbstractImportExportJob
(
impl
);
file
->
start
();
delete
impl
;
}
Akonadi
::
Collection
::
Id
ExportAddressbookJobInterfaceTestImpl
::
convertFolderPathToCollectionId
(
const
QString
&
path
)
{
ResourceConverterTest
resourceConverterTest
;
return
resourceConverterTest
.
convertFolderPathToCollectionId
(
path
);
}
core/autotests/akregator/exportakregatorjobinterfacetest.cpp
View file @
0436a755
...
...
@@ -20,6 +20,7 @@
#include
"exportakregatorjobinterfacetest.h"
#include
"archivestorage.h"
#include
"resourceconvertertest.h"
#include
"testexportfile.h"
#include
"compareexportfile.h"
#include
<QDebug>
#include
<QTest>
...
...
@@ -43,30 +44,11 @@ ExportAkregatorJobInterfaceTest::ExportAkregatorJobInterfaceTest(QObject *parent
void
ExportAkregatorJobInterfaceTest
::
exportAkregatorConfigTest1
()
{
//Don't use setTestModeEnabled otherwise we can set env
//QStandardPaths::setTestModeEnabled(true);
qputenv
(
"XDG_DATA_HOME"
,
PIMDATAEXPORTER_DIR
"/export/test1/share"
);
qputenv
(
"XDG_CONFIG_HOME"
,
PIMDATAEXPORTER_DIR
"/export/test1/config"
);
//TODO fix file name.
const
QString
temporaryFile
=
QStringLiteral
(
"/tmp/foo.zip"
);
const
QString
storeArchivePath
(
temporaryFile
);
ArchiveStorage
*
archiveStorage
=
new
ArchiveStorage
(
storeArchivePath
,
this
);
Q_ASSERT
(
archiveStorage
->
openArchive
(
true
));
Utils
::
addVersion
(
archiveStorage
->
archive
());
Utils
::
storeDataExportInfo
(
archiveStorage
->
archive
());
ExportAkregatorJobInterfaceTestImpl
*
exportNote
=
new
ExportAkregatorJobInterfaceTestImpl
(
this
,
{
Utils
::
StoredType
::
Config
},
archiveStorage
,
1
);
QSignalSpy
finish
(
exportNote
,
&
ExportAkregatorJobInterfaceTestImpl
::
jobFinished
);
QSignalSpy
error
(
exportNote
,
&
ExportAkregatorJobInterfaceTestImpl
::
error
);
exportNote
->
start
();
QVERIFY
(
finish
.
wait
());
QCOMPARE
(
error
.
count
(),
0
);
TestExportFile
*
file
=
new
TestExportFile
(
this
);
const
QByteArray
pathConfig
(
"/export/test1/"
);
file
->
setPathConfig
(
QByteArray
(
PIMDATAEXPORTER_DIR
)
+
pathConfig
);
ExportAkregatorJobInterfaceTestImpl
*
exportNote
=
new
ExportAkregatorJobInterfaceTestImpl
(
this
,
{
Utils
::
StoredType
::
Config
},
file
->
archiveStorage
(),
1
);
file
->
setAbstractImportExportJob
(
exportNote
);
file
->
start
();
delete
exportNote
;
delete
archiveStorage
;
CompareExportFile
compareExportFile
;
compareExportFile
.
setTempFilePath
(
temporaryFile
);
compareExportFile
.
setListFilePath
(
QStringLiteral
(
PIMDATAEXPORTER_DIR
"/export/test1"
));
compareExportFile
.
compareFiles
();
}
core/autotests/alarm/exportalarmjobinterfacetest.cpp
View file @
0436a755
...
...
@@ -19,7 +19,7 @@
#include
"exportalarmjobinterfacetest.h"
#include
"archivestorage.h"
#include
"
compare
exportfile.h"
#include
"
test
exportfile.h"
#include
"resourceconvertertest.h"
#include
<QDebug>
#include
<QTest>
...
...
@@ -41,6 +41,12 @@ void ExportAlarmJobInterfaceTestImpl::exportArchiveResource()
qDebug
()
<<
" not implement yet"
;
}
Akonadi
::
Collection
::
Id
ExportAlarmJobInterfaceTestImpl
::
convertFolderPathToCollectionId
(
const
QString
&
path
)
{
ResourceConverterTest
resourceConverterTest
;
return
resourceConverterTest
.
convertFolderPathToCollectionId
(
path
);
}
ExportAlarmJobInterfaceTest
::
ExportAlarmJobInterfaceTest
(
QObject
*
parent
)
:
QObject
(
parent
)
{
...
...
@@ -48,37 +54,13 @@ ExportAlarmJobInterfaceTest::ExportAlarmJobInterfaceTest(QObject *parent)
void
ExportAlarmJobInterfaceTest
::
exportAlarmConfigTest1
()
{
//Don't use setTestModeEnabled otherwise we can set env
//QStandardPaths::setTestModeEnabled(true);
qputenv
(
"XDG_DATA_HOME"
,
PIMDATAEXPORTER_DIR
"/export/test1/share"
);
qputenv
(
"XDG_CONFIG_HOME"
,
PIMDATAEXPORTER_DIR
"/export/test1/config"
);
//TODO fix file name.
const
QString
temporaryFile
=
QStringLiteral
(
"/tmp/foo.zip"
);
const
QString
storeArchivePath
(
temporaryFile
);
ArchiveStorage
*
archiveStorage
=
new
ArchiveStorage
(
storeArchivePath
,
this
);
Q_ASSERT
(
archiveStorage
->
openArchive
(
true
));
Utils
::
addVersion
(
archiveStorage
->
archive
());
Utils
::
storeDataExportInfo
(
archiveStorage
->
archive
());
ExportAlarmJobInterfaceTestImpl
*
exportNote
=
new
ExportAlarmJobInterfaceTestImpl
(
this
,
{
Utils
::
StoredType
::
Config
},
archiveStorage
,
1
);
QSignalSpy
finish
(
exportNote
,
&
ExportAlarmJobInterfaceTestImpl
::
jobFinished
);
QSignalSpy
error
(
exportNote
,
&
ExportAlarmJobInterfaceTestImpl
::
error
);
exportNote
->
start
();
QVERIFY
(
finish
.
wait
());
QCOMPARE
(
error
.
count
(),
0
);
TestExportFile
*
file
=
new
TestExportFile
(
this
);
const
QByteArray
pathConfig
(
"/export/test1/"
);
file
->
setPathConfig
(
QByteArray
(
PIMDATAEXPORTER_DIR
)
+
pathConfig
);
ExportAlarmJobInterfaceTestImpl
*
exportNote
=
new
ExportAlarmJobInterfaceTestImpl
(
this
,
{
Utils
::
StoredType
::
Config
},
file
->
archiveStorage
(),
1
);
file
->
setAbstractImportExportJob
(
exportNote
);
file
->
start
();
delete
exportNote
;
delete
archiveStorage
;
CompareExportFile
compareExportFile
;
compareExportFile
.
setTempFilePath
(
temporaryFile
);
compareExportFile
.
setListFilePath
(
QStringLiteral
(
PIMDATAEXPORTER_DIR
"/export/test1"
));
compareExportFile
.
compareFiles
();
}
Akonadi
::
Collection
::
Id
ExportAlarmJobInterfaceTestImpl
::
convertFolderPathToCollectionId
(
const
QString
&
path
)
{
ResourceConverterTest
resourceConverterTest
;
return
resourceConverterTest
.
convertFolderPathToCollectionId
(
path
);
}
core/autotests/calendar/exportcalendarsjobinterfacetest.cpp
View file @
0436a755
...
...
@@ -19,11 +19,10 @@
#include
"exportcalendarsjobinterfacetest.h"
#include
"archivestorage.h"
#include
"compareexportfile.h"
#include
"resourceconvertertest.h"
#include
"testexportfile.h"
#include
<QDebug>
#include
<QTest>
#include
<QSignalSpy>
QTEST_MAIN
(
ExportCalendarsJobInterfaceTest
)
...
...
@@ -41,44 +40,24 @@ void ExportCalendarsJobInterfaceTestImpl::exportArchiveResource()
qDebug
()
<<
" not implement yet"
;
}
ExportCalendarsJobInterfaceTest
::
ExportCalendarsJobInterfaceTest
(
QObject
*
parent
)
:
QObject
(
parent
)
Akonadi
::
Collection
::
Id
ExportCalendarsJobInterfaceTestImpl
::
convertFolderPathToCollectionId
(
const
QString
&
path
)
{
ResourceConverterTest
resourceConverterTest
;
return
resourceConverterTest
.
convertFolderPathToCollectionId
(
path
);
}
void
ExportCalendarsJobInterfaceTest
::
exportCalendarConfigTest1
()
ExportCalendarsJobInterfaceTest
::
ExportCalendarsJobInterfaceTest
(
QObject
*
parent
)
:
QObject
(
parent
)
{
//Don't use setTestModeEnabled otherwise we can set env
//QStandardPaths::setTestModeEnabled(true);
qputenv
(
"XDG_DATA_HOME"
,
PIMDATAEXPORTER_DIR
"/export/test1/share"
);
qputenv
(
"XDG_CONFIG_HOME"
,
PIMDATAEXPORTER_DIR
"/export/test1/config"
);
//TODO fix file name.
const
QString
temporaryFile
=
QStringLiteral
(
"/tmp/foo.zip"
);
const
QString
storeArchivePath
(
temporaryFile
);
ArchiveStorage
*
archiveStorage
=
new
ArchiveStorage
(
storeArchivePath
,
this
);
Q_ASSERT
(
archiveStorage
->
openArchive
(
true
));
Utils
::
addVersion
(
archiveStorage
->
archive
());
Utils
::
storeDataExportInfo
(
archiveStorage
->
archive
());
ExportCalendarsJobInterfaceTestImpl
*
exportNote
=
new
ExportCalendarsJobInterfaceTestImpl
(
this
,
{
Utils
::
StoredType
::
Config
},
archiveStorage
,
1
);
QSignalSpy
finish
(
exportNote
,
&
ExportCalendarsJobInterfaceTestImpl
::
jobFinished
);
QSignalSpy
error
(
exportNote
,
&
ExportCalendarsJobInterfaceTestImpl
::
error
);
exportNote
->
start
();
QVERIFY
(
finish
.
wait
());
QCOMPARE
(
error
.
count
(),
0
);
delete
exportNote
;
delete
archiveStorage
;
CompareExportFile
compareExportFile
;
compareExportFile
.
setTempFilePath
(
temporaryFile
);
compareExportFile
.
setListFilePath
(
QStringLiteral
(
PIMDATAEXPORTER_DIR
"/export/test1"
));
compareExportFile
.
compareFiles
();
}
Akonadi
::
Collection
::
Id
ExportCalendarsJobInterfaceTestImpl
::
convertFolderPathToCollectionId
(
const
QString
&
path
)
void
ExportCalendarsJobInterfaceTest
::
exportCalendarConfigTest1
()
{
ResourceConverterTest
resourceConverterTest
;
return
resourceConverterTest
.
convertFolderPathToCollectionId
(
path
);
TestExportFile
*
file
=
new
TestExportFile
(
this
);
const
QByteArray
pathConfig
(
"/export/test1/"
);
file
->
setPathConfig
(
QByteArray
(
PIMDATAEXPORTER_DIR
)
+
pathConfig
);
ExportCalendarsJobInterfaceTestImpl
*
impl
=
new
ExportCalendarsJobInterfaceTestImpl
(
this
,
{
Utils
::
StoredType
::
Config
},
file
->
archiveStorage
(),
1
);
file
->
setAbstractImportExportJob
(
impl
);
file
->
start
();
delete
impl
;
}
core/autotests/mail/exportmailjobinterfacetest.cpp
View file @
0436a755
...
...
@@ -20,10 +20,9 @@
#include
"exportmailjobinterfacetest.h"
#include
"archivestorage.h"
#include
"resourceconvertertest.h"
#include
"
compare
exportfile.h"
#include
"
test
exportfile.h"
#include
<QDebug>
#include
<QTest>
#include
<QSignalSpy>
QTEST_MAIN
(
ExportMailJobInterfaceTest
)
...
...
@@ -59,6 +58,12 @@ void ExportMailJobInterfaceTestImpl::convertCollectionIdsToRealPath(KConfigGroup
resourceConverter
.
convertCollectionIdsToRealPath
(
group
,
currentKey
,
prefixCollection
);
}
Akonadi
::
Collection
::
Id
ExportMailJobInterfaceTestImpl
::
convertFolderPathToCollectionId
(
const
QString
&
path
)
{
ResourceConverterTest
resourceConverterTest
;
return
resourceConverterTest
.
convertFolderPathToCollectionId
(
path
);
}
void
ExportMailJobInterfaceTestImpl
::
backupResources
()
{
qDebug
()
<<
" not implement yet"
;
...
...
@@ -71,37 +76,12 @@ ExportMailJobInterfaceTest::ExportMailJobInterfaceTest(QObject *parent)
void
ExportMailJobInterfaceTest
::
exportMailConfigTest1
()
{
//Don't use setTestModeEnabled otherwise we can set env
//QStandardPaths::setTestModeEnabled(true);
qputenv
(
"XDG_DATA_HOME"
,
PIMDATAEXPORTER_DIR
"/export/test1/share"
);
qputenv
(
"XDG_CONFIG_HOME"
,
PIMDATAEXPORTER_DIR
"/export/test1/config"
);
//TODO fix file name.
const
QString
temporaryFile
=
QStringLiteral
(
"/tmp/foo.zip"
);
const
QString
storeArchivePath
(
temporaryFile
);
ArchiveStorage
*
archiveStorage
=
new
ArchiveStorage
(
storeArchivePath
,
this
);
Q_ASSERT
(
archiveStorage
->
openArchive
(
true
));
Utils
::
addVersion
(
archiveStorage
->
archive
());
Utils
::
storeDataExportInfo
(
archiveStorage
->
archive
());
ExportMailJobInterfaceTestImpl
*
exportNote
=
new
ExportMailJobInterfaceTestImpl
(
this
,
{
Utils
::
StoredType
::
Config
},
archiveStorage
,
1
);
QSignalSpy
finish
(
exportNote
,
&
ExportMailJobInterfaceTestImpl
::
jobFinished
);
QSignalSpy
error
(
exportNote
,
&
ExportMailJobInterfaceTestImpl
::
error
);
exportNote
->
start
();
QVERIFY
(
finish
.
wait
());
QCOMPARE
(
error
.
count
(),
0
);
delete
exportNote
;
delete
archiveStorage
;
CompareExportFile
compareExportFile
;
compareExportFile
.
setTempFilePath
(
temporaryFile
);
compareExportFile
.
setListFilePath
(
QStringLiteral
(
PIMDATAEXPORTER_DIR
"/export/test1"
));
compareExportFile
.
compareFiles
();
TestExportFile
*
file
=
new
TestExportFile
(
this
);
const
QByteArray
pathConfig
(
"/export/test1/"
);
file
->
setPathConfig
(
QByteArray
(
PIMDATAEXPORTER_DIR
)
+
pathConfig
);
ExportMailJobInterfaceTestImpl
*
impl
=
new
ExportMailJobInterfaceTestImpl
(
this
,
{
Utils
::
StoredType
::
Config
},
file
->
archiveStorage
(),
1
);
file
->
setAbstractImportExportJob
(
impl
);
file
->
start
();
delete
impl
;
}
Akonadi
::
Collection
::
Id
ExportMailJobInterfaceTestImpl
::
convertFolderPathToCollectionId
(
const
QString
&
path
)
{
ResourceConverterTest
resourceConverterTest
;
return
resourceConverterTest
.
convertFolderPathToCollectionId
(
path
);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment