diff options
author | Jocelyn Turcotte <jturcotte@woboq.com> | 2017-09-14 16:50:13 +0300 |
---|---|---|
committer | Olivier Goffart <olivier@woboq.com> | 2017-09-26 12:03:23 +0300 |
commit | a034ee894ccfbab5164ed2800e511fbb7c0fbe70 (patch) | |
tree | f11b0733aa8f70e5f4bcb19c9bae2623378ac77b /test/testsyncengine.cpp | |
parent | 6f46764daa59460a4cbdc7327255a6dc4d631590 (diff) |
Use SyncJournalDb in csync
This gets rid of the csync_statedb sqlite layer and use
the same code and same connection as the rest of the SyncEngine.
Missing functions are added to SyncJournalDb and change a few minor
things (like changing SyncJournalFileRecord::_modtime to be an int64
instead of a QDateTime, like it was in csync).
Diffstat (limited to 'test/testsyncengine.cpp')
-rw-r--r-- | test/testsyncengine.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp index 032937b62..a4c4c5be4 100644 --- a/test/testsyncengine.cpp +++ b/test/testsyncengine.cpp @@ -183,7 +183,7 @@ private slots: // Remove subFolderA with selectiveSync: fakeFolder.syncEngine().journal()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, {"parentFolder/subFolderA/"}); - fakeFolder.syncEngine().journal()->avoidReadFromDbOnNextSync("parentFolder/subFolderA/"); + fakeFolder.syncEngine().journal()->avoidReadFromDbOnNextSync(QByteArrayLiteral("parentFolder/subFolderA/")); fakeFolder.syncOnce(); @@ -238,7 +238,7 @@ private slots: // folders are uploaded anyway is some circumstances. FakeFolder fakeFolder{FileInfo{ QString(), { FileInfo { QStringLiteral("parentFolder"), { - FileInfo{ QStringLiteral("subFolder"), { + FileInfo{ QStringLiteral("subFolderA"), { { QStringLiteral("fileA.txt"), 400 }, { QStringLiteral("fileB.txt"), 400, 'o' }, FileInfo { QStringLiteral("subsubFolder"), { @@ -252,23 +252,24 @@ private slots: { QStringLiteral("fileF.txt"), 400, 'o' } }} }} - }} + }}, + FileInfo{ QStringLiteral("subFolderB"), {} } }} }}}; QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); auto expectedServerState = fakeFolder.currentRemoteState(); - // Remove subFolder with selectiveSync: + // Remove subFolderA with selectiveSync: fakeFolder.syncEngine().journal()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, - {"parentFolder/subFolder/"}); - fakeFolder.syncEngine().journal()->avoidReadFromDbOnNextSync("parentFolder/subFolder/"); + {"parentFolder/subFolderA/"}); + fakeFolder.syncEngine().journal()->avoidReadFromDbOnNextSync(QByteArrayLiteral("parentFolder/subFolderA/")); // But touch local file before the next sync, such that the local folder // can't be removed - fakeFolder.localModifier().setContents("parentFolder/subFolder/fileB.txt", 'n'); - fakeFolder.localModifier().setContents("parentFolder/subFolder/subsubFolder/fileD.txt", 'n'); - fakeFolder.localModifier().setContents("parentFolder/subFolder/anotherFolder/subsubFolder/fileF.txt", 'n'); + fakeFolder.localModifier().setContents("parentFolder/subFolderA/fileB.txt", 'n'); + fakeFolder.localModifier().setContents("parentFolder/subFolderA/subsubFolder/fileD.txt", 'n'); + fakeFolder.localModifier().setContents("parentFolder/subFolderA/anotherFolder/subsubFolder/fileF.txt", 'n'); // Several follow-up syncs don't change the state at all, // in particular the remote state doesn't change and fileB.txt @@ -282,14 +283,15 @@ private slots: QCOMPARE(fakeFolder.currentRemoteState(), expectedServerState); // The local state should still have subFolderA auto local = fakeFolder.currentLocalState(); - QVERIFY(local.find("parentFolder/subFolder")); - QVERIFY(!local.find("parentFolder/subFolder/fileA.txt")); - QVERIFY(local.find("parentFolder/subFolder/fileB.txt")); - QVERIFY(!local.find("parentFolder/subFolder/subsubFolder/fileC.txt")); - QVERIFY(local.find("parentFolder/subFolder/subsubFolder/fileD.txt")); - QVERIFY(!local.find("parentFolder/subFolder/anotherFolder/subsubFolder/fileE.txt")); - QVERIFY(local.find("parentFolder/subFolder/anotherFolder/subsubFolder/fileF.txt")); - QVERIFY(!local.find("parentFolder/subFolder/anotherFolder/emptyFolder")); + QVERIFY(local.find("parentFolder/subFolderA")); + QVERIFY(!local.find("parentFolder/subFolderA/fileA.txt")); + QVERIFY(local.find("parentFolder/subFolderA/fileB.txt")); + QVERIFY(!local.find("parentFolder/subFolderA/subsubFolder/fileC.txt")); + QVERIFY(local.find("parentFolder/subFolderA/subsubFolder/fileD.txt")); + QVERIFY(!local.find("parentFolder/subFolderA/anotherFolder/subsubFolder/fileE.txt")); + QVERIFY(local.find("parentFolder/subFolderA/anotherFolder/subsubFolder/fileF.txt")); + QVERIFY(!local.find("parentFolder/subFolderA/anotherFolder/emptyFolder")); + QVERIFY(local.find("parentFolder/subFolderB")); } } } |