WebDAV file sync overhaul for 5.0

Also:

- Remove last-sync-time mechanism for both WebDAV and ZFS, since it can
  be determined by storage properties (mtime/md5) in data sync
- Add option to include synced storage properties in item toJSON()
  instead of local file properties
- Set "Fake-Server-Match" header in setHTTPResponse() test support
  function, which can be used for request count assertions -- see
  resetRequestCount() and assertRequestCount() in webdavTest.js
- Allow string (e.g., 'to_download') instead of constant in
  Zotero.Sync.Data.Local.setSyncState()
- Misc storage tweaks
This commit is contained in:
Dan Stillman 2015-12-23 04:52:09 -05:00
parent 6844deba60
commit c5a9987f37
32 changed files with 3182 additions and 2789 deletions

View file

@ -149,7 +149,7 @@ describe("Zotero.Sync.Data.Local", function() {
var id = Zotero.Items.getIDFromLibraryAndKey(libraryID, key);
assert.equal(
(yield Zotero.Sync.Storage.Local.getSyncState(id)),
Zotero.Sync.Storage.SYNC_STATE_TO_DOWNLOAD
Zotero.Sync.Storage.Local.SYNC_STATE_TO_DOWNLOAD
);
})
@ -170,9 +170,7 @@ describe("Zotero.Sync.Data.Local", function() {
yield Zotero.Sync.Storage.Local.setSyncedHash(
item.id, (yield item.attachmentHash)
);
yield Zotero.Sync.Storage.Local.setSyncState(
item.id, Zotero.Sync.Storage.SYNC_STATE_IN_SYNC
);
yield Zotero.Sync.Storage.Local.setSyncState(item.id, "in_sync");
});
// Simulate download of version with updated attachment
@ -191,7 +189,7 @@ describe("Zotero.Sync.Data.Local", function() {
assert.equal(
(yield Zotero.Sync.Storage.Local.getSyncState(item.id)),
Zotero.Sync.Storage.SYNC_STATE_TO_DOWNLOAD
Zotero.Sync.Storage.Local.SYNC_STATE_TO_DOWNLOAD
);
})
@ -213,9 +211,7 @@ describe("Zotero.Sync.Data.Local", function() {
yield Zotero.Sync.Storage.Local.setSyncedHash(
item.id, (yield item.attachmentHash)
);
yield Zotero.Sync.Storage.Local.setSyncState(
item.id, Zotero.Sync.Storage.SYNC_STATE_IN_SYNC
);
yield Zotero.Sync.Storage.Local.setSyncState(item.id, "in_sync");
});
// Modify title locally, leaving item unsynced
@ -237,7 +233,7 @@ describe("Zotero.Sync.Data.Local", function() {
assert.equal(item.getField('title'), newTitle);
assert.equal(
(yield Zotero.Sync.Storage.Local.getSyncState(item.id)),
Zotero.Sync.Storage.SYNC_STATE_TO_DOWNLOAD
Zotero.Sync.Storage.Local.SYNC_STATE_TO_DOWNLOAD
);
})
})