From a7c0cfc8ebcf109161e14de130f110d115a3ef31 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Sat, 2 Dec 2017 11:40:43 +0100 Subject: 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). --- test/testsyncjournaldb.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/testsyncjournaldb.cpp') 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; }; -- cgit v1.2.3