Commit graph

3980 commits

Author SHA1 Message Date
Patrick Ohly d5119ef386 CardDAV: fixed line end after UID
The vCard standard requires \r\n, so use that when embedding
UID. Didn't matter in practice.
2011-10-17 13:17:41 +02:00
Patrick Ohly 6a9b906b35 WebDAV: infinite loop during collection scan
When testing against a server which has an at sign in the principal,
the principal was checked over and over again, because the "already
seen" comparison failed for foo@bar != foo%40bar.

Fixed by pushing normalization into the "tried" instance and doing the
normalization in all cases.
2011-10-17 13:17:41 +02:00
Patrick Ohly d03e6583fc WebDAV: better logging of scanning
Added additional logging of collection search. The fallback if the
display name is not found is changed to an empty string, instead of
using a non-translated string.
2011-10-17 13:17:41 +02:00
Patrick Ohly 9581bab44e WebDAV: increased number of queries while scanning for collections
The initial limit of checking 10 candidates was too restrictive. Now
increased to 1000. It's unsure whether it is small enough to be
useful, but at least it shouldn't trigger unexpectedly anymore.
2011-10-17 13:17:41 +02:00
Patrick Ohly 77b586eb72 WebDAV: ignore props of a found collection
When a collection was identified as one we searched for, then don't
look at its properties. If the search started with the principal, then
we are not going to learn more from the collection's properties. If
the search starts with a specific collection, then the search will stop
after reporting that collection.

Not listing further collections when searching for all databases is
probably what the user wants. Otherwise he should have used the
principal or simple the host name.
2011-10-17 13:17:41 +02:00
Patrick Ohly 7cf726d7c9 WebDAV: handle more than one entry in calendar/addresbook-home-set
These properties may contain more than one href. eGroupware does for
address books when the user configures to expose more than one address
book in the web interface for GroupDAV.

Now SyncEvolution adds all of these URLs as candidates. Ordering is
preserved, so the first URL in the property is also visited first (=
becomes the default).
2011-10-17 13:17:41 +02:00
Patrick Ohly 40bf05f6f1 WebDAV: allow relative redirects (eGroupware)
eGroupware gives just a path as Location for a redirect. Accept that
by copying the missing pieces of information (scheme, host, port) from
the current session.
2011-10-17 13:17:41 +02:00
Patrick Ohly 162aa96125 WebDAV: more resilient code
Typically all locations which add to the candidates list check first
whether the candidate was already visited before. This is useful
because it avoids growing that list unnecessarily and makes logging
slightly more informative (shows skipped candidates at the time when
they are found).

But if a candidate was accidentally added twice, it would be used
twice. So let's check again when picking a candidate from the list,
just to be sure.
2011-10-17 13:17:41 +02:00
Patrick Ohly 18c8f23f85 WebDAV: fallback to .well-known URLs for hostname as syncURL
When given just the host name and thus starting with the / path, also
look at .well-known URLs inside that host. Previously the code relied
on a redirect at that path, which happened to work for eGroupware but
isn't standardized.
2011-10-17 13:17:41 +02:00
Patrick Ohly a91ad04861 WebDAV: ignore certain collections
Typically calendar/addressbook-home-set points to a collection which
contains calendar and addressbook collections. When scanning for one
kind of collection it is possible to ignore all collections of the
other kind, because those are guaranteed to not contain anything not
related to them.

This patch does that by accepting the right kind of collection and
those which cannot be ruled out for sure, which currently are CalDAV
and CardDAV collections.

The patch also scans sub-collections in alphabetical order, which
makes the result more deterministic.
2011-10-17 13:17:41 +02:00
Patrick Ohly 6fa5cc30c3 WebDAV: initial support for listing databases
Based on the previous code, which stopped when finding the first
collection. Now that code is an utility function which reports all
resources to a callback until told to stop by that callback.
2011-10-17 13:17:41 +02:00
Patrick Ohly bf6bab8f03 command line: introduced --print-databases
Listing databases is now a dedicated operation, instead of being done
whenever syncevolution was invoked without parameters.

Advantages:
- can be combined with property assignments for backends
  which do not work without that additional information
- can be done for configured sources
2011-10-17 13:17:41 +02:00
Patrick Ohly 765ed0f833 TestingSyncSource+CalDAV: added "delete all" API call
During testing, removing all items is done via a special call in
TestingSyncSource. It used to be an utility method which fell back to
the normal SyncSource API.

This patch changes several things
- Reversed order in which items are deleted in that utility method,
  because removing children (= longer IDs) first tends to be supported
  better by servers (bug in CalDAV server, but still...).
- Allow backends to implement their own removeAllItems().
- Implement that in CalDAV + MapSyncSource as removing the merged
  items directly, instead of using a sequence of PUT+final DELETE.

Found while testing with Bedework CalDAV server. Makes testing more
robust and efficient.
2011-10-17 13:17:40 +02:00
Patrick Ohly a7f7c8eacf Merge remote branch 'origin/syncevolution-1-2-branch'
Conflicts:
	configure.ac
	test/ClientTest.cpp
	test/testcases/eds_event.ics.funambol.tem.patch

Conflicts because of version number and updated test cases resp. local
delete optimization.

ActiveSync backend had to be adapted to modified InsertItemResult: now
it requests a merge when it detects duplicates, like the CalDAV backend
already did on the 1.2 branch.
2011-10-17 13:16:33 +02:00
Patrick Ohly 1138f4fb7e Google CalDAV testing: ignore Google bug #61: cannot remove detached recurrence
Somehow a PUT which removes the detached recurrence from a meeting has
no effect. Looks like a Google server bug. Keep testing, but ignore
the failure.
2011-10-17 08:45:31 +00:00
Patrick Ohly 31841b85b1 Google CalDAV testing: avoid multiple detached recurrences
Because of Google issue with detached recurrences without parent
(http://code.google.com/p/google-caldav-issues/issues/detail?id=58)
and the SyncEvolution workaround (replacing RECURRENCE-ID with
X-SYNCEVOLUTION-RECURRENCE-ID) only one detached recurrence per UID
can be stored.

Removing the second modified recurrence from the test cases for
Google.
2011-10-17 08:45:31 +00:00
Patrick Ohly 3f37dbe84e testing: avoid anchor dependencies between tests
TestingSyncSourcePtr manages anchors for all sources
created via it. These anchors used to be reused when
running multiple tests, which may have led to different
results compared to running tests by themselves. So now
the anchors get reset at the start of each test, detected
by the changed getCurrentTest() name.

This change was triggered by the observation that combining
Client::Sync::eds_event::testItems with Client::Source::google_caldav
failed in Client::Source::google_caldav::testChanges around
change tracking. The reason was that the anchor for an EDS source in
eds_event::testItems was reused as the anchor for a CalDAV source
in google_caldav::testChanges, which prevented a slow item scan
when it would have been needed.
2011-10-17 08:42:54 +00:00
Patrick Ohly 3789bc9eb8 NEWS + autotools: updated to 1.2
Summarized changes in 1.1.99.x series. Depend on latest libsynthesis.
2011-10-13 11:32:44 +02:00
Patrick Ohly 0886ceb71a testing: added more valgrind suppressions for ASN encoding
gnutls + ASN encoding also showed up in the context of libneon.
2011-10-12 12:53:05 +00:00
Patrick Ohly d3d14544f1 autotools: depend on libsynthesis 3.4.0.16.3
We want the latest version with "newest wins" in add<->add conflict
resolution.
2011-10-10 10:08:02 +02:00
Patrick Ohly 01519b1204 testing: avoid add<->add tests for Funambol, Memotoo, Mobical
All of these servers do not use the UID to find duplicates and
thus duplicate items in these tests, in contrast to what the test
expects.
2011-10-10 08:00:34 +00:00
Patrick Ohly ee882ca895 Apple testing: no need to avoid complex UID
The VEVENT UID with lots of special characters was unnecessarily
avoided, recent (all?) Apple Calendar Server handles that fine.
2011-10-10 08:00:10 +00:00
Patrick Ohly 0aa156a7fd README: moved warning about sync direction
The warning about reversed data direction in local sync also applies
to syncing with a phone. Therefore the warning is now listed more
prominently below the "--sync" command line option and was extended to
also cover direct syncing.
2011-10-10 09:39:22 +02:00
Patrick Ohly df108b9729 vCard extensions + Apple: avoid problematic quoted PARAMETER2
Apple (correctly?!) sends back the X-TEST PARAMETER2 without quotation
marks around the value, despite it containing spaces. This confuses
the EDS vCard parser. To get the test to pass let's avoid this
particular aspect when talking to Apple Calendar Server.
2011-10-10 09:39:10 +02:00
Patrick Ohly 4baa3c989e vCard extensions: \; instead of ;
vCard 3.0 explicitly says that text-value must have semicolon
escaped. Do it like that in our base test case.
2011-10-10 09:39:09 +02:00
Patrick Ohly 7fda0169f3 eds_contact: specify all N components
Not exactly required by vCard 3.0, but expected by some peers: N must
contain five components (= four semicolons) even if components are
empty.
2011-10-10 09:39:09 +02:00
Patrick Ohly 75a8abed99 EDS calendar: fixed memory leak
Affects SyncEvolution 1.2: when bailing out of
EvolutionCalendarSource::retrieveItem() when EDS returned the wrong
component, that component wasn't freed (recent change). Fixed by
making it owned by a smart pointer as soon as possible.
2011-10-10 09:39:09 +02:00
Patrick Ohly 63768f3df8 WebDAV: strip quotes from ETag only if present
eGroupware does not include ETags in quotes. SyncEvolution
unconditionally stripped the first and last character, making ETags
shorter than they really were. Now it strips them only if both are
quotation marks.
2011-10-10 09:39:09 +02:00
Patrick Ohly 25889a544c testing: avoid redundant insert session in some tests
Replaced testLocalDeleteAll() with direct delete, because
testLocalDeleteAll() first does an insert which is just causing extra
traffic in tests which are meant to test something else.
2011-10-10 09:39:09 +02:00
Chris Kühl 5c2e0c0503 dbus: Added device id for Nokia 3720 Classic 2011-10-04 10:16:04 +02:00
Chris Kühl 29451e5b64 dbus: Added user submitted device ids 2011-10-03 00:43:02 +02:00
Patrick Ohly 739920c59e testing: improved tests for add<->add conflicts (BMC #22783)
When avoiding conflicting properties with merge=lines, items are
completely replaced as originally expected. This allows testing the
"server avoids unnecessary updates" aspect of add<->add conflict
resolution.

With an up-to-date libsynthesis (age comparison fixed, COMPARESCRIPT()
fixed, suppress unneeded local and remote updates, fix statistics in
server mode) these tests pass in server (local sync/CalDAV) and
client mode (with SyncEvolution as server).

Thus BMC #22783 is almost resolved, except for the open question
whether merge=lines is desirable in this case.
2011-09-30 18:27:50 +02:00
Patrick Ohly 1c86dd68eb bumped version to 1.1.99.7 2011-09-15 10:30:16 +02:00
Patrick Ohly d5a6ebbd66 testing: relaxed add<->add tests
Several open issues break the original tests:
- merging conflicting data is server-dependendant and even with
  SyncEvolution as server wasn't done as expected (merge=lines causes
  DESCRIPTION and LOCATION to get concatenated)
- as a result, updates are sent when none should be necessary
- in server mode (= CalDAV), the Synthesis engine always counts the Add
  commands as "added item" even if it ends up being an updated item

These needs further investigations. In the meantime make the tests pass
by using the same test item in all syncs and relaxing the statistics checking.
2011-09-15 09:52:51 +02:00
Patrick Ohly 0b8a15362f command line: also check password for --import/export/delete-items and the source (BMC #21311, #22937)
The previous commit 7411f7e had the password check in the code branch
for --print-items. --import/export/delete-items still had the same
problem. Moved the code.

Source passwords must also be checked, in case that "backendPassword"
is set. Added.
2011-09-14 15:07:31 +02:00
Patrick Ohly 5c31de0812 source passwords: password lookup failed in HTTP server mode (BMC #22937)
When configuring sources for an HTTP server, the config name typically
is just the context (@foo). When using the config in the HTTP server,
the config name is the peer inside that context (client@foo). Because
the GNOME keyring lookup keys for the "databasePassword" (more
specifically, the object name) contained the full config name which
was different in both cases, looking up the saved password failed.

The solution is to normalize the config name (to accomodate for
different ways of spelling it) and use only the context, with @ as
before. This will break existing setups where the object name in the
keyring (incorrectly) includes the full config name. In that case just
configure the source again to set the password anew.
2011-09-14 15:07:31 +02:00
Patrick Ohly ad9876beec Evolution Calendar: fixed detached recurrence support (BMC #22940)
e_cal_create_object() of a detached recurrence fails with "UID already
exists" if there is any other event with that UID, regardless whether
it is the parent or another detached recurrence.

When adding new items, SyncEvolution did not handle the case were
another detached recurrence, but not the parent, already existed. The
check for "UID used" must check for any item with that UID, not just
the parent.

When removing the parent, SyncEvolution temporarily removes detached
recurrences and recreates them later (can't be done differently with
older EDS). Recreating a second detached recurrence with
e_cal_create_object() then failed, must use e_cal_modify_object() for
it and all following recurrences.

Finally, EDS itself is confused when asked for a UID without
RECURRENCE-ID, as it happens during such a removal: instead of
returning the information that the parent doesn't exist (which
SyncEvolution handles), it returns the first child (which broke change
tracking by adding an entry for the non-existant parent). Worked
around by doing a sanity check on the returned data.

Because these additional changes would have been very slow with the
list of luid strings, m_allLUIDs is now a more complex map from UID to
set of RECURRENCE-IDs. This also makes some other code more
efficient (O(log n) instead of O(n), less parsing of luid strings).
2011-09-14 15:07:31 +02:00
Patrick Ohly 532c4478d9 iCalendar 2.0: must set VALUE in EXDATE (part of BMC #22940)
EXDATE has a VALUE parameter, which wasn't defined in the XML
profile. Didn't seem to matter at all in practice, but wasn't
standard-compliant. Noticed while working on BMC #22940.
2011-09-14 15:07:31 +02:00
Patrick Ohly e2687b98a9 Memotoo testing: added EXDATEs
Memotoo does detect RECURRENCE-ID/UID when importing events during a
sync, it just doesn't store it. It uses that information to add an
EXDATE to the recurring event.

Adapted the test data so that it has RECURRENCE-ID (lost, but that is
ignored by synccompare) and EXDATE (checked by synccompare). A real
test would be to not have EXDATE and check that they get added, but
this kind of semantic transformation currently cannot be tested
automatically.
2011-09-14 15:07:31 +02:00
Patrick Ohly 74f525428b testing: extended detached recurrence test cases (triggers BMC #22940)
The parent with single detached recurrence was too simplistic. More
than one detached recurrence is necessary to trigger a problem in the
EDS calendar backend.

Because the "parent + single detached recurrence" may also be a relevant
special case, it is also still covered.

Finally, importing multiple detached recurrences without parent also
needs to be covered.

Missing is importing of a single detached recurrence. This should
be covered by importing the first of the two detached recurrences.
2011-09-14 15:07:31 +02:00
Alban Crequy 6498092e58 GTK sync-ui: wrap sync service descriptions (BMC #7199)
Descriptions of different sync services are not fully visible unless
word-wrapping gets enabled.
2011-09-14 15:07:31 +02:00
Patrick Ohly cb6ed94a7e autotools: depend on libsynthesis with DB_DataMerged/Replaced/Conflict support
Bumped minimum version to one which has the necessary support.
2011-09-14 15:07:30 +02:00
Patrick Ohly 8a640d2ae2 SyncSource API: support and use Synthesis DB_DataMerged/Replace/Conflict result codes (BMC #22783)
Returning 207 = DB_DataMerged when an item replaced an existing one
wasn't correct (the data wasn't really merged) and also wasn't handled
as intended by the Synthesis engine. Now a backend can properly report what it did:
- data fully replaced
- data was merged
- data needs to be merged by engine

The last option is used by EDS and CalDAV when an add<->add conflict
is detected by the backends. In that case the Synthesis engine will
read the local item, merge it with the incoming item and write back
the result.

At the moment the tests assume that the more recent item wins
completely. But our field list config specifies a merge=lines mode for
some fields, which results in concatenating these fields in the merged
item. Thus the tests currently fail. Need to decide which behavior is
desired.
2011-09-14 15:07:30 +02:00
Patrick Ohly 5e88021226 testing: added another add<->add test
testAddBothSidesRefresh() changes the order of data modifications
and syncs so that the sync where the conflict is detected has to
send back an update.
2011-09-14 15:07:30 +02:00
Patrick Ohly 2773dfe47d testing: added test case for add<->add conflict (part of BMC #22783)
The test can be used in combination with a SyncEvolution HTTP server
or local sync. Currently doesn't pass because a libsynthesis with
support for DB_DataMerged is needed.
2011-09-14 15:07:30 +02:00
Patrick Ohly 263f45ebb6 source configs: don't check "backend" unless it is needed
When using a config which has sources with a backend type set which is
not currently available, an error was thrown even if those sources
weren't even part of the current operation (for example, syncing
another source which is currently supported).

Fixed by checking for "source active" before checking its backend.
2011-09-14 15:07:12 +02:00
Patrick Ohly e30dbcc3a3 dbus-session: adapted EDS startup to 3.2
EDS 3.2 introduces --keep-running, which we need to avoid premature
shutdown of the EDS daemons while the test still runs. One harmless
return code encountered was 137; can ignore it.
(cherry picked from commit 8512b5daa0)
2011-09-13 08:43:56 +00:00
Patrick Ohly f987c4dc1d client-test: remove duplicate CLIENT_TEST_LOG support code
CLIENT_TEST_LOG was handled both in client-test-app.cpp via
ClientTest::postSync() and in SyncTests::postSync(). The code in
client-test-app.cpp is better (also works with files that are
kept open by the writer, via truncation), so let's keep that
and remove the copy in SyncTests::postSync().
(cherry picked from commit 81bbe38d4e)
2011-09-13 08:43:56 +00:00
Patrick Ohly 2da7439686 testing: fix Client::Sync::*::testLinkedItemsChildParent
There was indeed on place in testLinkedItemsChildParent where insert()
had to be called with relaxed=true (as done accidentally earlier):
inserting the parent updates the child, which confuses the change
checks in insert() when relaxed=false.
(cherry picked from commit a6c8ae83fe)
2011-09-13 08:43:56 +00:00
Patrick Ohly 41616d1722 testing: fix m_uniqueProperties check
The "m_uniqueProperties not empty" check in the last commit was too
restrictive. The old "char *" pointer must not be NULL, but the new
std::string may be empty.
(cherry picked from commit 88332eae2d)
2011-09-13 08:43:56 +00:00