diff options
author | Christian Kamm <mail@ckamm.de> | 2017-12-02 13:40:43 +0300 |
---|---|---|
committer | ckamm <mail@ckamm.de> | 2017-12-15 20:03:53 +0300 |
commit | a7c0cfc8ebcf109161e14de130f110d115a3ef31 (patch) | |
tree | eda389d6b0ea95bd3269358f61d8d0963caf6c23 /test/testsyncjournaldb.cpp | |
parent | 7ae8ba35de0ce5977c0a5cb65e8d52ead8518081 (diff) |
Upload conflict files #4557
If the server has the 'uploadConflictFiles' capability conflict
files will be uploaded instead of ignored.
Uploaded conflict files have the following headers set during upload
OC-Conflict: 1
OC-ConflictBaseFileId: 172489174instanceid
OC-ConflictBaseMtime: 1235789213
OC-ConflictBaseEtag: myetag
when the data is available. Downloads accept the same headers in return
when downloading a conflict file.
In the absence of server support clients will identify conflict files
through the file name pattern and attempt to deduce the base fileid.
Base etag and mtime can't be deduced though.
The upload job for a new conflict file will be triggered directly from
the job that created the conflict file now. No second sync run is
necessary anymore.
This commit does not yet introduce a 'username' like identifier that
automatically gets added to conflict file filenames (to name the files
foo_conflict-Fred-1345.txt instead of just foo_conflict-1345.txt).
Diffstat (limited to 'test/testsyncjournaldb.cpp')
-rw-r--r-- | test/testsyncjournaldb.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/testsyncjournaldb.cpp b/test/testsyncjournaldb.cpp index 389dcec5d..389330ffa 100644 --- a/test/testsyncjournaldb.cpp +++ b/test/testsyncjournaldb.cpp @@ -183,6 +183,28 @@ private slots: QCOMPARE(record.numericFileId(), QByteArray("123456789")); } + void testConflictRecord() + { + ConflictRecord record; + record.path = "abc"; + record.baseFileId = "def"; + record.baseModtime = 1234; + record.baseEtag = "ghi"; + + QVERIFY(!_db.conflictRecord(record.path).isValid()); + + _db.setConflictRecord(record); + auto newRecord = _db.conflictRecord(record.path); + QVERIFY(newRecord.isValid()); + QCOMPARE(newRecord.path, record.path); + QCOMPARE(newRecord.baseFileId, record.baseFileId); + QCOMPARE(newRecord.baseModtime, record.baseModtime); + QCOMPARE(newRecord.baseEtag, record.baseEtag); + + _db.deleteConflictRecord(record.path); + QVERIFY(!_db.conflictRecord(record.path).isValid()); + } + private: SyncJournalDb _db; }; |