summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Mollekopf <mollekopf@kolabsys.com>2012-10-17 12:51:54 (GMT)
committerChristian Mollekopf <mollekopf@kolabsys.com>2012-10-17 12:51:54 (GMT)
commit5aaed0a7f3b8cd8791438572aa4ad167135fa7bd (patch)
treed7ecc4c89e4fbf935e821820a0d40846953daca4
parent43fb2f8088ac74c99f029644e5e3400af8e26035 (diff)
downloadkolab-utils-5aaed0a7f3b8cd8791438572aa4ad167135fa7bd.tar.gz
Check that objects and flags are migrated.
-rw-r--r--migrationutility/tests/migrationscenariotest.cpp39
1 files changed, 25 insertions, 14 deletions
diff --git a/migrationutility/tests/migrationscenariotest.cpp b/migrationutility/tests/migrationscenariotest.cpp
index 8f604a4..f952e45 100644
--- a/migrationutility/tests/migrationscenariotest.cpp
+++ b/migrationutility/tests/migrationscenariotest.cpp
@@ -37,7 +37,8 @@ struct Folder
* This test simulates an entier migration scenario.
*
* It requires two Kolab Servers, with all the required users already setup (ideally two local virtual machines, which are used for testing only)
- * So this is really a rather complex integration test and not a unittest which has to be executed all the time.
+ * So this is really a complex integration test, which involves all parts of the system, and not a unittest which has to be executed all the time.
+ * On the other hand it should come quite close to a real world migration scenario and can also show problems with specific imap servers.
*
*/
class MigrationScenarioTest: public QObject
@@ -52,6 +53,17 @@ class MigrationScenarioTest: public QObject
qint16 port;
QList<Folder> folders;
+ Object createEvent(const QString &uid)
+ {
+ Object calObj1;
+ KCalCore::Event::Ptr event(new KCalCore::Event());
+ event->setUid(uid);
+ calObj1.message = Kolab::KolabObjectWriter::writeEvent(event, Kolab::KolabV2, "migrationtest");
+ calObj1.flags << QByteArray("\\Seen");
+ return calObj1;
+
+ }
+
public:
explicit MigrationScenarioTest(QObject* parent = 0)
: QObject(parent),
@@ -63,13 +75,8 @@ public:
port(143)
{
folders << Folder("INBOX");
- folders << Folder("Calendar", Kolab::EventType);
- Object calObj1;
- KCalCore::Event::Ptr event(new KCalCore::Event());
- event->setUid("uid");
- calObj1.message = Kolab::KolabObjectWriter::writeEvent(event, Kolab::KolabV2, "migrationtest");
- calObj1.flags << QByteArray("\\Seen");
- folders << Folder("Calendar/Personal Calendar", Kolab::EventType, QList<Object>() << calObj1);
+ folders << Folder("Calendar", Kolab::EventType, QList<Object>() << createEvent("uid1"));
+ folders << Folder("Calendar/Personal Calendar", Kolab::EventType, QList<Object>() << createEvent("uid2"));
folders << Folder("Configuration", Kolab::ConfigurationType);
folders << Folder("Contacts", Kolab::ContactType);
folders << Folder("Drafts");
@@ -109,8 +116,6 @@ private:
kolabServer->setAdminCredentials(admin, adminpw);
KolabAccount *account = kolabServer->getAccount(user);
account->cleanAccount();
-// account->setupFolders();
-// account->createFolder();
createFolders(account, folders);
}
@@ -141,16 +146,22 @@ private:
const QStringList &receivedFolders = account->lookupFolderList();
QStringList::const_iterator recIt = receivedFolders.constBegin();
QList<Folder>::const_iterator foldersIt = folders.constBegin();
+ QCOMPARE(receivedFolders.size(), folders.size());
for (;foldersIt != folders.constEnd() && recIt != receivedFolders.constEnd(); ++foldersIt, ++recIt) {
qDebug() << "Folder: " << *recIt;
QCOMPARE(*recIt, foldersIt->name);
- //Check folder annotations
+ //TODO Check folder annotations
const QList<Object> &objects = account->getObjects(foldersIt->name);
QCOMPARE(objects.size(), foldersIt->objects.size());
- //Check converted messages
- foreach(const Object &obj, objects) {
- qDebug() << "Object: " << obj.flags;
+
+ QList<Object>::const_iterator recObjIt = objects.constBegin();
+ QList<Object>::const_iterator objIt = foldersIt->objects.constBegin();
+ for (;objIt != foldersIt->objects.constEnd() && recObjIt != objects.constEnd(); ++objIt, ++recObjIt) {
+ //TODO Check converted messages
+ foreach (const QByteArray &flag, objIt->flags) {
+ QVERIFY(recObjIt->flags.contains(flag));
+ }
}
}
}