Commit graph

186 commits

Author SHA1 Message Date
Olivier Goffart
2d6e473a40 Discovery: consider also the "shared by me" as shared
The "S" in the permission is only for the "Shared with me" files.
It is only used to show the shared status in the overlay icons.
But we also wish to show the shared status for files that are shared
"by" the users. We can find that out using the 'share-types' webdav
property. If set, then we are sharing the object.
We fake a 'S' in the permission as for our purpose, they mean the same.

Issue #4788
2016-11-15 14:32:20 +01:00
Christian Kamm
b0c45cfc89 Test: Don't fail when DST change is near #5284 2016-11-08 11:13:19 +01:00
Christian Kamm
10644d3568 Move concatUrl and settingsWithGroup to Utility
There was little reason to keep them cluttering Account.
2016-10-25 12:05:28 +02:00
Christian Kamm
cf48ea2e00 Remove unused functions
Account::changed and AbstractCredentials::changed have not been needed
in a long while.
2016-10-25 11:33:38 +02:00
Olivier Goffart
766d9ae1ac QProgressIndicator: update copy from upstream
Update from commit 05ce8a23cdc12e825532dc6de06c267fb8d48b4f from
https://github.com/dragotin/QProgressIndicator
Which itself is forked from commit e5ba0fd09bfd43b067ee3646d70b294c7efcb558 from
upstream, with additional license header.

It was relicensed to MIT according to
14bb9d10e2

Relates to issues #5180 and #5184
2016-10-13 12:05:59 +02:00
Olivier Goffart
d80d5a8ee4 SyncEngine: Fix renaming a folder should keep the selective sync state
Issue #5224

Two problems:

 - In the discovery phase, we need to check the selective sync entries of
   the source path in case of renames.

 - When the rename is done, we need to actually update the black list in the
   database.
2016-10-11 14:38:25 +02:00
Olivier Goffart
e0a36ab313 TestFolderMan: don't pollute user's settings 2016-10-11 14:27:14 +02:00
Olivier Goffart
85b8ab178e SyncEngine: Fix renaming of folder when file are changed (#5195)
Two bugs:
 - The change filed are not considered as move, they are re-downloaded
   but the old file was not removed from the database. The change in
   owncloudpropagator.cpp takes care of removing the old entries.

 - Next sync would then remove the file in the server in the old folder
   This was not a problem until we start reusing the sync engine, and
   that the _renamedFolders map is not cleared. We were before deleting
   a non-existing file. But now we delete the actual file.

Also improve the tests to be able to do move on the server.
This include support for file id.

Issue #5192
2016-09-22 09:02:47 +02:00
Jocelyn Turcotte
a221ac1e4d Fix unit testing build warning on Linux
The compiler complained about the PathComponent reference on the lambdas comes from the anonymous namespace.
2016-09-16 17:55:28 +02:00
Jocelyn Turcotte
b28123bed9 Fix the Qt4 unit testing build 2016-08-18 10:34:07 +02:00
Jocelyn Turcotte
efb6b8c2c9 [overlays] Fix folders appearing as OK even though children are still syncing #4797
This would happen if the directory would first need to be created
through an mkdir propagation job. This job's itemCompleted signal
would trigger the directory to show as SYNC even though its children
are still propagating.

Fix the issue by tracking the sync count for each file, affecting
its parents. This allows us to get rid of the O(n) vector lookup
for each status query, and properly track the hierachical sync
status of a directory.

This also removes the itemCompleted signal emission from the
PropagateDirectory job. Since we only needed for overlay icons, and
since this job doesn't do any direct propagation, we can remove it
to ensure that we won't call itemCompleted twice for the item attached
to Propagate*Mkdir jobs (since the PropagateDirectory is backed by
the same SyncFileItem, instruction and status).
2016-08-17 15:40:02 +02:00
Jocelyn Turcotte
82ef1bcfe0 Make sure that we invalidate parents on blacklisted items
Add a missing call that we currently only do in slotItemCompleted.
This would normally only affect the first sync and would have
gotten properly update at the end of the sync anyway.
2016-08-17 15:39:30 +02:00
Jocelyn Turcotte
b7ff4a76e8 Add TestSyncEngine and TestSyncFileStatusTracker auto tests
To be able to test the SyncEngine efficiently, a set of server
mocking classes have been implemented on top of QNetworkAccessManager.

The local disk side hasn't been mocked since this would require adding
a large abstraction layer in csync. The SyncEngine is instead pointed
to a different temporary dir in each test and we test by interacting
with files in this directory instead.

The FakeFolder object wraps the SyncEngine with those abstractions
and allow controlling the local files, and the fake remote state
through the FileModifier interface, using a FileInfo tree structure
for the remote-side implementation as well as feeding and comparing
the states on both side in tests.

Tests run fast and require no setup to be run, but each server feature
that we want to test on the client side needs to be implemented in
this fake objects library. For example, the OC-FileId header isn't
set as of this commit, and we can't test the file move logic properly
without implementing it first.

The TestSyncFileStatusTracker tests already contain a few QEXPECT_FAIL
for what I esteem being issues that need to be fixed in order to catch
up on our test coverage without making this patch too huge.
2016-08-17 15:39:30 +02:00
Olivier Goffart
927a8b5071 Qt4: don't require a X server in the tests
Previous commit was not enough
2016-07-12 11:07:12 +02:00
Olivier Goffart
a4310f0f5c Qt4: don't require a X server in the tests 2016-07-11 14:04:58 +02:00
Christian Kamm
6d02d76cfd Fix compile warnings in tests 2016-06-07 09:43:04 +02:00
hefee
669a72f0e1 A final release version number breaks this regex (#4835)
f.ex. a valid verson nr: 2.2.0
-> fist \d+ = 2
-> second \d+ = 2
-> the last \d+ = 0
-> .+ in not matching, because there is nothing to match
2016-05-13 16:55:11 +02:00
Hefee
edb3759684 For tests we do not need a xserver running.
Use for tests QTEST_GUILESS_MAIN and QTEST_APPLESS_MAIN.
2016-05-12 11:34:21 +02:00
Christian Kamm
8934979ba1 timeAgo test: Fix for qt4, clean up 2016-05-12 09:25:15 +02:00
Klaas Freitag
9b1f46e560 Fix exclude unit test, adopt to new Iface of isExcluded. 2016-05-10 16:46:08 +02:00
Klaas Freitag
9e7a8e619b Fix utility test: Pass a command name to do the version check. 2016-05-10 16:26:42 +02:00
ckamm
e6b937f508 LockWatcher: Keep an eye on Windows file locks (#4758)
When a conflict-rename or a temporary-rename fails, notify the
LockWatcher. It'll regularly check whether the file has become
accesible again. When it has, another sync is triggered.

owncloud/enterprise#1288
2016-04-29 16:14:18 +02:00
Daniel Molkentin
e29d7e0128 Use QTokenizer to properly parse netrc
Addresses #4691
2016-04-21 12:46:03 +02:00
Christian Kamm
844777d43f Fix unit test build 2016-04-12 13:43:17 +02:00
Jocelyn Turcotte
f427955512 Simplify the build of auto tests
Remove all configure_files:
- Move all tests to cpp files
- Use the QTEST_MAIN macro instead of a generated main.cpp
- Include test*.moc in the cpp to let CMAKE_AUTOMOC call moc
- Pass info through add_definitions instead of generating oc_bin.h with them

This makes sure that build errors points to the original test source
file instead of the generated one in the build directory to be able to
jump and fix errors directly from the IDE's error pane.
2016-03-30 18:00:22 +02:00
Olivier Goffart
cdbc25ede8 Merge pull request #4615 from owncloud/socketApiRefactor
Socket API refactor
2016-03-30 13:24:10 +02:00
Christian Kamm
41f43feecf Add utility function for shorter time duration strings #3403 2016-03-29 12:26:09 +02:00
Christian Kamm
4915bbf8f3 Adjust size description strings #3403
@jancorchardt suggested to not have decimal places on file
sizes, except for GB.
2016-03-29 12:26:09 +02:00
Jocelyn Turcotte
df386b64ba Make the AccountState a construction argument of the Folder
This will help moving the SyncEngine construction in the constructor
and allow moving functionalities from Folder to SyncEngine or its
delegated objects.
2016-03-28 13:07:28 +02:00
Olivier Goffart
54612455e6 Merge pull request #4513 from owncloud/csyncContextToSyncEngine
Move the csync_context creation in SyncEngine
2016-03-08 18:12:31 +01:00
Christian Kamm
d521232587 AccountState: Allow storing state in settings
This will be useful if we ever want to store account-level gui state.
I built this originally because I thought a paused account would be
this kind of state.
2016-03-01 16:08:23 +01:00
Jocelyn Turcotte
75c99bf2b1 Fix TestXmlParse::testParser1 2016-02-25 20:53:13 +01:00
Klaas Freitag
e846b36bf6 Tests: Add a test for the timeAgoInWords function 2016-02-15 17:59:24 +01:00
Klaas Freitag
e3a846bb1f SyncJournalTest: Use valid time for the tests. 2015-11-25 22:16:29 +01:00
Klaas Freitag
aaa5c1bc5f Test syncjournaldb: Fix comparison of two QDateTime objects.
Only compare full seconds as milliseconds may float.
2015-11-25 21:13:50 +01:00
Christian Kamm
10db6cee6c Rename files 2015-11-23 12:09:25 +01:00
Christian Kamm
a25f094c4c Checksums: Don't reupload if size and checksum are unchanged #3235
* Compute the content checksum (in addition to the optional
  transmission checksum) during upload (.eml files only)

* Add hook to compute and compare the checksum in csync_update

* Add content checksum to database, remove transmission checksum
2015-11-23 11:59:56 +01:00
Christian Kamm
eb3388de68 Fix OwnSql test
3993a7f636 added asserts for failing
prepare() calls
2015-11-11 09:42:31 +01:00
Christian Kamm
25c177ca3b SyncJournalFileRecord: Remove unused mode field 2015-11-11 09:42:31 +01:00
Christian Kamm
17dd199cba Checksums: Treat more carefully in db #4034
In particular, preserve them on local rename or remote move.
2015-11-10 15:05:00 +01:00
ckamm
251679253a Merge pull request #3951 from ckamm/checksum
Checksums stored in database #3735
2015-10-29 10:40:24 +01:00
Christian Kamm
496b1e907d Checksum: Don't lose it on metadata update #3735
Also improve tests.
2015-10-28 14:49:55 +01:00
Christian Kamm
b7823dc648 Checksum: Put checksum type into separate column #3735 2015-10-28 14:46:20 +01:00
Markus Goetz
a6c9e8c5b4 Merge branch 'kill_legacy_propagator' 2015-10-28 11:06:50 +01:00
Christian Kamm
0354289795 Checksums: Improvement in async computation and validation #3735 2015-10-28 09:56:39 +01:00
Olivier Goffart
455c3ae57d test/CMakeLists.txt: remove comments 2015-10-22 12:32:53 +02:00
Olivier Goffart
9c388787bb csync_update: Don't fetch the etag in the local discovery from the DB
We don't need it, and it's slow.
This saves a lot of DB queries

(Also replaced a strlen>0 with a faster check)
2015-10-21 16:38:26 +02:00
Markus Goetz
c8590c4468 Remove legacy propagator and neon
The code was already uneeded/unbuilt on Windows and OS X.
2015-10-20 17:57:43 +02:00
Christian Kamm
6e09e3af86 Fix test compile
I regularly fix errors in the copies of the test sources that are
made in build/. Refactoring how these tests work could be worthwhile.
2015-10-15 15:52:58 +02:00
Christian Kamm
abd63035c1 ETag: Allow parsing of weak tags #3946 2015-10-15 14:57:34 +02:00