Commit graph

3860 commits

Author SHA1 Message Date
Gabriel Schulhof
78e6df73eb Fixes: BMC#19587 (Tapping on Sync notification should open Sync settings in Tablet UX) 2011-07-13 12:26:01 +03:00
Patrick Ohly
84eb04d291 config templates: added IconURI to all templates (BMC #20750)
Most of the selected theme icons don't exist, so adding these values
only provides the possibility to add icons later on.

For Google Contacts, the existing gmail icon is used as a short-term
solution until the theme gets a proper google-contacts icon.
2011-07-12 18:30:02 +02:00
Patrick Ohly
68b61edd6e auto sync: support local sync configs (BMC #20970)
Due to too restrictive checking of the syncURL, configs without http
or obex-bt were never executed automatically. This commit adds a
fallback which enables "other" configs to run without checking for
peer presence.

In addition it marks all "local" syncs as needing HTTP
connectivity. This is a simplification that fits the current use
cases, but needs to be enhanced later on.
2011-07-12 16:26:35 +02:00
Patrick Ohly
f47d31580d auto syncing: fix D-Bus API violations (part of BMC #20966)
Auto-sync sessions did not properly activate their D-Bus support and
thus couldn't be accessed via the Session D-Bus API. Must have
affected showing progress of such sessions in the GTK sync-ui.

They also weren't kept around for one minute, like the sessions
started by a client. Therefore UIs which need to retrieve information
about a completed session failed for a second reason.

Fixed by adding the necessary "activate()" and use "addTimeout()"
trick for session expiry also in the AutoSyncManager. The later was
moved into DBusServer for that.

These issues were found with the new
TestSessionAPIsDummy.testAutoSyncFailure D-Bus test.
2011-07-12 12:46:47 +02:00
Patrick Ohly
77bf1f3b4e Memotoo testing: ignore HTML entities problem
Memotoo incorrectly replaces HTML entities in plain text with
the corresponding characters. Reported to Memotoo admin via
email. In the meantime, make tests work again by simplifying
the test data.
2011-07-12 11:43:07 +02:00
Patrick Ohly
ced2190670 syncevo-dbus-server: fixed compiler warning
The last commit introduced a compiler warning in debug output: %ld != size_t
2011-07-12 11:41:05 +02:00
Patrick Ohly
11b322b5ee D-Bus server: avoid shutting down while auto-sync is active (BMC #20885)
When a config was set to "auto-sync on", the AutoSyncManager added it
to a list, but did not prevent the server from shutting down. Not sure
how this was meant to work or when it broke.

Fixing it is easy: as long as AutoSyncManager has at least one config
lined up for auto-syncing, it holds a reference on the AutoTerm
instance and thus prevents shutting down.

This commit also adds test cases for various situations:
- prevent shutdown while auto-sync on
- re-enable shutdown while timer is running
- re-enable shutdown while timer is off
2011-07-11 22:42:01 +02:00
Patrick Ohly
d8a8c161bb D-Bus testing: enable syncevo-dbus-server debug logging
Set SYNCEVOLUTION_DEBUG=1 before starting syncevo-dbus-log so that we
get a higher log level and the output into the regular stdout of the
process.
2011-07-11 22:20:22 +02:00
Patrick Ohly
0d4226c60b testing: report source initialization errors inside test*() methods
TestingSyncSourcePtr used to catch all exceptions thrown while
constructing and opening the source. This had the negative effect that
errors logged contained the source code line inside
TestingSyncSourcePtr instead of the line where the test itself asks
for the source, which is much more important for debugging the
problem.

This commit thus removes the CPPUnit assertion which catches
exceptions and adds them in all locations inside test*() methods
which, directly or indirectly, create sources.

It is not essential to find all of these places. CPPUnit will report
uncaught exceptions in a test without including a source code
location, which is as good (or bad) as the information reported
previously.
2011-07-11 18:09:59 +02:00
Patrick Ohly
0852e0ad1f testing: relax requirements for ActiveSync backend
In an incremental sync, the ActiveSync backend is only able to provide
data for updated or new items. This is sufficient, other items will
not be read during such a sync and item access doesn't use incremental
sync mode.

Therefore this commit relaxes the testChanges test by removing the
reading of an unmodified item.
2011-07-11 18:05:19 +02:00
Patrick Ohly
e0883e4c92 SyncConfig: fixed compiler problem with C++ initialization order (BMC #19464)
g++ 4.6 and ld 2.21.52.20110707 (Debian Unstable) led to a different
order of global instance construction:
1. WebDAV constructor calls SyncConfig::getRegistry()
2. getRegistry() adds the (uninitialized!) property instances
   and modifies them
3. SyncConfig.cpp instances are initializes, which resets
   some of the values modified by getRegistry()

The result was that, for example, the "defaultPeer" property was
treated like an unshared property and written into the wrong config
file.

The assumption that variables in a compilation unit are initialized
before methods in that unit can be called is not based on anything in
the C++ standard. Therefore this commit rewrites the code so that
properties are not added/updated inside the getRegistry()
methods. Instead this is done in separate classes which (and that is
guaranteed by the C++ standard) are constructed after the properties
defined earlier in the compilation unit.
2011-07-11 11:37:09 +02:00
Patrick Ohly
3fca0be2fe GDBus: removed dead code
g++ 4.6 complains about the unused assignment. Probably this boolean
result needs to be checked. But as GDBus will be replaced soon anyway,
don't bother now.
2011-07-11 11:25:33 +02:00
Patrick Ohly
0963cb0809 nightly testing: minor code cleanup
Setting a Boost function doesn't depend on boost::bind(). A direct
assignment also works in simple cases, like createSource().
2011-07-11 11:22:33 +02:00
Patrick Ohly
9f4c1af434 nightly testing: join multiple CATEGORIES
As per RFC 2445, CATEGORIES:1,2 and CATEGORIES:1\nCATEGORIES:2 is
same. We need to pick one normal form. This commit ensures that all
categories are listed in a single CATEGORIES properties. This was both
easier to implement (splitting at a comma while not splitting at a \,
is tricky) and leads to a shorter normal form (less lines).

The reason for making this change now is that with Evolution 2.32.2
and libical 0.44-3, categories end up being stored with one entry per
CATEGORIES property. That by itself is okay and thus our tests should
pass, which they don't without this change to synccompare.

The only problem is that Evolution doesn't seem to handle it (breaks
setting categories in the UI even without syncing). That's something which
needs to be fixed in Evolution.
2011-07-08 10:33:15 +02:00
Patrick Ohly
3d20ede9a6 templates: added generic WebDAV template
In contrast to the Yahoo template, this one doesn't mention
a specific service and enables both contact and calendar sync.
To be used with a service that supports auto-discovery.
2011-07-06 19:47:07 +02:00
Patrick Ohly
1a9489b662 autotools: support detached HEAD (BMC #20093)
A detached HEAD has a hash in .git/HEAD. This confused
gen-autotools.sh which tried to resolve it via "git show-ref", which
in turn only works for refs.

Now gen-autotools.sh checks for real hashes in .git/HEAD and truncates
them directly, without involving show-ref in this case.
2011-07-06 16:33:50 +02:00
Patrick Ohly
210b2dca66 autotools: handle situation where qmake is not installed
The previous commit added a check for qmake, but then used QMAKE
without checking whether qmake was found at all. This caused configure
problems on systems where qmake wasn't available.

The error handling also wasn't correct. A "test" was missing in front
of the comparison.
2011-07-06 16:08:50 +02:00
Chris Kühl
97fff9b4be autotools: check for alternative names to the qmake binary (BMC #17704)
On some distros, such as Fedora, qmake is called qmake-qt4. This is currently
hardcoded to qmake in syncevolution. Better use AC_CHECK_PROGS().
2011-07-05 16:03:29 +02:00
Patrick Ohly
ad003c6fc2 nightly testing: must set install env variables also for setup command
The setup command may also depend on correct paths, for example to
find specific backends.
2011-07-05 21:15:12 +08:00
Patrick Ohly
ce9a77ee5a nightly testing: test-dbus.py + valgrind
Just like resultchecker.py, test-dbus.py also shouldn't be run
under valgrind. In fact, this segfaults under Debian Testing...
2011-07-05 21:15:12 +08:00
Patrick Ohly
956fa25590 nightly testing: resultchecker.py + valgrind fix
resultchecker.py still run under valgrind because valgrindcheck.sh is
part of the test prefix, not the shell. Clean both variables now.
2011-07-05 21:15:12 +08:00
Patrick Ohly
5bcb6e4827 D-Bus testing: fixed TestSessionAPIsDummy.testCheckSourceInvalidType
The test was meant to check the error triggered by setting an
invalid backend value. Instead it checked the usability of such
a source and thus duplicated the (badly named) testCheckSourceNoType.

testCheckSourceInvalidType itself failed to pass when SyncEvolution
was compiled with modules, because then the "apple-contacts" backend
wasn't installed and SetConfig() failed with an unexpected error.

Now the test triggers that error in call cases with "backend = no-such-backend"
and checks that the right error is reported.
2011-07-05 21:15:12 +08:00
Patrick Ohly
03a2b875a9 D-Bus Testing: fixed TestDBusServerPresence + TestDBusSession.testSecondSession
TestDBusSession.testSecondSession failed when TestDBusPresence tests
had been run before. The reason is apparently the mock Connman object
and its calls to loop.quit(): that causes the testSecondSession test
to stop before it has seen all the expected reasons for quitting the
main loop.

This commit changes TestDBusServerPresence so that the Connman object
is added and removed as part of setUp() and testDown(). This seems to fix
the problem.

Connman.GetProperties() now also returns something valid in the final
else clause. Previously Python recorded a lot of "'None' not iterable"
errors when Connman.GetProperties() was called more often than
expected and returned None.
2011-07-05 14:02:40 +02:00
Patrick Ohly
083984b1cf D-Bus testing: removed invalid TestLocalSync.testTimeout
Commit 1a40a29 (added after 1.1.99.4) removed timeouts in the local
transport, reasoning that such timeouts only make sense in unreliable
transports and only cause problems (like premature aborts).

Therefore the TestLocalSync.testTimeout which tested the old behavior
became invalid. Removed completely.
2011-07-04 21:25:23 +02:00
Patrick Ohly
cb9b7c3e2b error handling: recognize local errors again
Commit 3f1185, contained in 1.1.99.3, changed
SyncContext::throwError() so that it throws a StatusException with
STATUS_FATAL. Previously a runtime exception was thrown, which
Exception::handle() recorded as a local error.

This commit fixes that regression by throwing a STATUS_FATAL +
LOCAL_STATUS_CODE, which restores the traditional result of
throwError().

Found by test-dbus.py TestDBusSyncError.testSyncNoConfig.
2011-07-04 21:05:52 +02:00
Patrick Ohly
3d461623d0 D-Bus testing: fixed wrong check in TestConnection.testStartSync
The test checked for zero status for inactive sources, whereas the
current implementation doesn't report anything for these sources at
all. Both is acceptable, but let's keep the test strict and check for
the current behavior.
2011-07-04 17:31:22 +02:00
Patrick Ohly
be08788419 D-Bus testing: avoid dependency on default backend and its databases
TestConnection and TestSessionAPIsDummy used configs with
backend=addressbook/calendar/todo/memo which had to have databases
with a name derived from CLIENT_TEST_EVOLUTION_SOURCE and the source
name. This was neither documented nor did the required databases match
the ones used by the client-test programs anymore.

For the sake of making the test setup easier, this commit changes
these tests so that they use the file backend (always available) and
file://temp-test-dbus/<source name> databases (created if needed by
the backend). In other words, the tests now run without manual setup
of the host.

The downside is that D-Bus testing no longer covers the real
sources. That's okay, client-test covers that, whereas test-dbus.py
should focus on the D-Bus API itself.
2011-07-04 17:31:22 +02:00
Patrick Ohly
32c78d4d81 D-Bus testing: use 'temp-test-dbus' as name of directory created for testing
'temp-test-dbus' is a bit more suitable than 'xdg-root' because
* it ties the directory to the script which creates it
* 'temp' implies that it holds no important data
* it is used for various files ('xdg_root' in the Python source
  is a bit misleading)
2011-07-04 17:31:11 +02:00
Chris Kühl
8933a59595 test-dbus: Change default fr xdg_root
The default value of 'test-dbus' is the same name as the directory
holding the source files used for testing. In the DBusUtil.runTest the
xdg_root directory is removed. So, when running test-dbus-py from the
test directory it deletes the directory in which the source file
reside.
2011-07-04 17:25:50 +02:00
Murray Cumming
bd8820bcbd Update m4-repo/ files from upstream
These files have changed slightly since they were last copied.
See https://bugs.meego.com/show_bug.cgi?id=17649#c6
2011-07-04 14:43:03 +02:00
Patrick Ohly
024418a00b D-Bus testing: also create logs for successful tests
Successful tests don't have output. At least record the
full test function description. Avoids dangling links
in the .html output.
2011-06-30 17:09:17 -07:00
Patrick Ohly
5cd6c39890 D-Bus testing: integrated into nightly testing (BMC #5609)
runtests.py - made the SyncEvolutionTest class configurable so that it
can run test-bus.py, added "--enable=dbus" with it.

resultchecker.py - parse the output of test-dbus.py and split out the
failure reports for linking.
2011-06-30 16:50:36 -07:00
Patrick Ohly
8e9de50143 D-Bus testing: added class and function to all test doc strings
The purpose is two-fold:
- tell a user of test-dbus.py what he has to put on the command
  line to run a failing test
- produce output that can be parsed more easily by resultchecker.py
2011-06-30 16:25:57 -07:00
Patrick Ohly
62aab267d4 nightly testing: slightly nicer output
Avoid Python warning when destructing the Python file runs into the
already closed fd by closing the file instead of the low-level fd.
Print some information about the current action.
2011-06-30 15:17:17 -07:00
Patrick Ohly
62239e5c90 CalDAV + MapSyncSource: fixed off-by-one error in change tracking (BMC #20393)
Parsing the revision map extracted the wrong subset of the string. As
a result, the revision comparison was broken and reported more changes
than really existed. Showed up as a failure in
Client::Sync::eds_event::testOneWayFromClient and requests for items
in a multiget when it wasn't needed.
2011-06-30 07:56:15 -07:00
Patrick Ohly
45a9070bf4 test-dbus.py: use 'dbus_unittest' config as it is
The script used to override the "database" property of
all configured sources in the "dbus_unittest" config.
That is confusing and wasn't documented.

Now the comment for TestSessionAPIsReal describes how to
set up a working config and then doesn't touch it.
2011-06-29 15:48:04 -07:00
Chris Kühl
6f0d3c3aa8 test-dbus: Update testGetConfigsTemplates with new templates 2011-06-29 14:34:29 -07:00
Patrick Ohly
e7aff9c6a2 WebDAV: fixed compiler warning
g++ warns about using strstream instead of sstream - fixed.
2011-06-29 11:49:21 -07:00
Patrick Ohly
067f93d336 autotools: support out-of-tree ActiveSync backend
Set "syncevo_backenddir" in addition to "backenddir", because
the ActiveSync backend's Makefile.am expects it.
2011-06-29 10:57:10 -07:00
Patrick Ohly
487c105a15 WebDAV: fixed Google throttling workaround during initial sync
The "retry on 401" code wasn't active during the initial sync
because the fact that the credentials had been accepted before
was only recorded on disk, but not in memory.
2011-06-29 07:12:47 -07:00
Patrick Ohly
3f6fa1a502 CalDAV: handle response with no data (Google)
Moving the response handling from the data element to the response
element caused problems with Google, because it sends a 404 status for
the collection with no data. Apple Calendar Server didn't do that when
testing the change manually, so the problem only showed up in the
nightly testing.

This patch restores the previous behavior of simply ignoring responses
with no data. Some better error handling might be useful.
2011-06-29 07:10:17 -07:00
Patrick Ohly
8032247a5a local sync: renamed "source-config" to "target-config"
As discussed on the mailing list, "source-config" is ambiguous because
the "addressbook/calendar/..." configs are also called "source
configs".

Now the naming is "sync" config (for the config with syncURL=local://,
because it is used for syncing) and "target" config (because it is
used as target in a sync config's syncURL).

Rejected:
"local" config - because the databases are not necessarily local
"source" config - see above
"client" or "server" config - because both sides might use local data
                              and/or client/server could refer to the role
                              of the peer or the SyncML client/server model
                              used internally
2011-06-28 18:42:43 -07:00
Patrick Ohly
34e6667e14 templates: Add PeerName field, part II
The Funambol template hadn't been updated and the command line
tests failed because the didn't expect the PeerName to be set.

The normalization of "= F" to "= 0" broke the "= Funambol" peer name.
Doesn't seem to server any useful purpose anymore, so removed.
2011-06-28 18:38:38 -07:00
Patrick Ohly
edaa1562b5 WebDAV: fixed regression caused by 404->401 patch (BMC #17862)
The code which caught the 404 status had the unintended side effect of
also catching 401 errors and then not reporting them. Fixed by
handling the exception as in the default "Exception" case if it does
not fit the 404 special case.
2011-06-28 17:57:38 -07:00
Patrick Ohly
11ddebdb08 WebDAV: added some debug logging for credentials
Saw an unexpected 401 error in the middle of a sync. At that point
the credentials should have been recognized as valid, but somehow
weren't added debug output to track down the problem.
2011-06-28 16:41:11 -07:00
Patrick Ohly
e111963a4a syncevolution.pc: added path variables
Added a way how users of the libs can determine the install path:
pkg-config --variable=[backenddir|templatedir] syncevolution
2011-06-28 16:37:56 -07:00
Patrick Ohly
5b14e9bd11 CalDAV: ensure that UID is set during update
Updating an item must be done with the same UID that was originally
set by the server. The Maemo 5 backend replaces the UID received from
the server with its own sequential numbering of events in the SQLite
database.

This commit is an attempt to catch this situation and restore the
correct the UID before sending the update item content to the server.
2011-06-28 11:28:45 -07:00
Patrick Ohly
c40826005e MapSyncSource: make tracking node content extensible
The value in the key/value pairs now start with a slash. The intention
is that if the content ever has to be extended, it can be done by
adding a version number or something like that in front of the
slash. Right now, that version is implicitly empty. Without the slash
it wouldn't be possible to distinguish to distinguish the future
version number from the revision.
2011-06-28 11:28:45 -07:00
Patrick Ohly
b5012604b9 Neon::URI: fixed initialization
All members except for the integer port were auto-initialized.
This commit fixes valgrind warnings in WebDAV in isEmpty()
by initializing the port in a new constructor.
2011-06-28 11:28:45 -07:00
Patrick Ohly
ff80b4a241 CalDAV + MapSyncSource: rewrote change tracking
Trying to reuse the TrackingSyncSource change tracking was a dead-end
that just led to horribly complex scaffolding classes (like the key/value
node which had to keep revisions synchronized and mix in UID).

This is a complete rewrite where change detection is done in
MapSyncSource, using a similar approach as in TrackingSyncSource. Some
of the session life cycle is now cut-and-pasted from
TrackingSyncSource (primarily checking the overall database
revision). Eventually this common logic might get refactored into a
SyncSource utility class, but for now let's keep it separate.

This solution is much cleaner and uses simpler key/value storage
with one item-<mainid> entry for each merged item, mapping to the
revision, UID, and list of subids.
2011-06-28 11:28:45 -07:00