D-Bus testing: start with auto sync on, auto terminate once it is off

Not sure how this worked with SyncEvolution 1.2. Acccording to the code,
this test should have failed because auto-termination was turned off
forever when there was an auto sync config.
This commit is contained in:
Patrick Ohly 2012-03-19 13:17:33 +01:00
parent 18a4e2ea01
commit b71a1ccd07
7 changed files with 356 additions and 0 deletions

View File

@ -417,6 +417,11 @@ class DBusUtil(Timeout):
if own_home:
env["HOME"] = xdg_root
# populate xdg_root
snapshot = self.getTestProperty("snapshot", None)
if snapshot:
self.setUpFiles(snapshot)
# set additional environment variables for the test run,
# as defined by @property("ENV", "foo=bar x=y")
for assignment in self.getTestProperty("ENV", "").split():
@ -1217,6 +1222,27 @@ class TestDBusServerTerm(unittest.TestCase, DBusUtil):
else:
self.fail("no exception thrown")
# configure server with files in test/test-dbus/auto-sync before starting it
@property("snapshot", "auto-sync")
@timeout(100)
def testAutoSyncOff3(self):
"""TestDBusServerTerm.testAutoSyncOff3 - start with auto-syncing on, D-Bus server must terminate after disabling auto syncing"""
# wait until -d 10 second timeout has triggered in syncevo-dbus-server,
# should not shut down because of auto sync
time.sleep(11)
self.assertTrue(self.isServerRunning())
self.setUpSession("scheduleworld")
config = self.session.GetConfig(False)
config[""]["autoSync"] = "0"
self.session.SetConfig(False, False, config)
self.session.Detach()
# should shut down after the 10 second idle period
time.sleep(16)
self.assertFalse(self.isServerRunning())
class TestNamedConfig(unittest.TestCase, DBusUtil):
"""Tests for Set/GetNamedConfig"""

View File

@ -0,0 +1,2 @@
rootMinVersion = 0
rootCurVersion = 0

View File

@ -0,0 +1,2 @@
# the peer which is used by default in some frontends, like the sync-UI
# defaultPeer =

View File

@ -0,0 +1,2 @@
contextMinVersion = 1
contextCurVersion = 1

View File

@ -0,0 +1,22 @@
# full path to directory where automatic backups and logs
# are stored for all synchronizations; if unset, then
# "${XDG_CACHE_HOME}/syncevolution/<server>" (which
# usually expands to ${HOME}/.cache/...) will be used;
# if "none", then no backups of the databases are made and any
# output is printed directly to the screen
# logdir =
# Unless this option is set, SyncEvolution will never delete
# anything in the "logdir". If set, the oldest directories and
# all their content will be removed after a successful sync
# to prevent the number of log directories from growing beyond
# the given limit.
# maxlogdirs = 10
# The SyncML server gets this string and will use it to keep track of
# changes that still need to be synchronized with this particular
# client; it must be set to something unique (like the pseudo-random
# string created automatically for new configurations) among all clients
# accessing the same server.
# myFUNAMBOL also requires that the string starts with sc-pim-
deviceId = syncevolution-23bb8f00-a3e7-46d2-84f9-33e97b413832

View File

@ -0,0 +1,18 @@
peerMinVersion = 1
peerCurVersion = 1
# used by the SyncML library internally; do not modify
# HashCode = 0
# used by the SyncML library internally; do not modify
# ConfigDate =
# MD5 nonce of our peer, empty if not set yet; do not edit, used internally
# lastNonce =
# information about the peer in the format described in the
# Synthesis SDK manual under 'Session_SaveDeviceInfo'
# deviceData =
# credentials were accepted before
# webDAVCredentialsOkay = 0

View File

@ -0,0 +1,284 @@
# Identifies how to contact the peer,
# best explained with some examples.
#
# HTTP(S) SyncML servers::
#
# http://my.funambol.com/sync
# http://sync.scheduleworld.com/funambol/ds
# https://m.google.com/syncml
#
# OBEX over Bluetooth uses the MAC address, with
# the channel chosen automatically::
#
# obex-bt://00:0A:94:03:F3:7E
#
# If the automatism fails, the channel can also be specified::
#
# obex-bt://00:0A:94:03:F3:7E+16
#
# For peers contacting us via Bluetooth, the MAC address is
# used to identify it before the sync starts. Multiple
# urls can be specified in one syncURL property::
#
# obex-bt://00:0A:94:03:F3:7E obex-bt://00:01:02:03:04:05
#
# In the future this might be used to contact the peer
# via one of several transports; right now, only the first
# one is tried.
syncURL = http://sync.scheduleworld.com/funambol/ds
# user name used for authorization with the SyncML server
# username =
# password used for authorization with the peer;
# in addition to specifying it directly as plain text, it can
# also be read from the standard input or from an environment
# variable of your choice::
#
# plain text : password = <insert your password here>
# ask : password = -
# env variable: password = ${<name of environment variable>}
# password =
# level of detail for log messages:
# - 0 (or unset) = INFO messages without log file, DEBUG with log file
# - 1 = only ERROR messages
# - 2 = also INFO messages
# - 3 = also DEBUG messages
# > 3 = increasing amounts of debug messages for developers
# loglevel = 0
# enables or disables the detailed (and sometimes slow) comparison
# of database content before and after a sync session
# printChanges = 1
# enables or disables the automatic backup of database content
# before and after a sync session (always enabled if printChanges is enabled)
# dumpData = 1
# Controls automatic synchronization. Currently,
# automatic synchronization is done by running
# a synchronization at regular intervals. This
# may drain the battery, in particular when
# using Bluetooth!
# Because a peer might be reachable via different
# transports at some point, this option provides
# detailed control over which transports may
# be used for automatic synchronization:
#
# 0
# don't do auto sync
# 1
# do automatic sync, using whatever transport
# is available
# http
# only via HTTP transport
# obex-bt
# only via Bluetooth transport
# http,obex-bt
# pick one of these
autoSync = 1
# This is the minimum number of seconds between two
# synchronizations that has to pass before starting
# an automatic synchronization. Can be specified using
# a 1h30m5s format.
#
# Before reducing this interval, consider that it will
# increase resource consumption on the local and remote
# side. Some SyncML server operators only allow a
# certain number of sessions per day.
# The value 0 has the effect of only running automatic
# synchronization when changes are detected (not
# implemented yet, therefore it basically disables
# automatic synchronization).
autoSyncInterval = 60m
# An automatic sync will not be started unless the peer
# has been available for this duration, specified in seconds
# or 1h30m5s format.
#
# This prevents running a sync when network connectivity
# is unreliable or was recently established for some
# other purpose. It is also a heuristic that attempts
# to predict how long connectivity be available in the
# future, because it should better be available long
# enough to complete the synchronization.
# autoSyncDelay = 5M
# During a slow sync, the SyncML server must match all items
# of the client with its own items and detect which ones it
# already has based on properties of the items. This is slow
# (client must send all its data) and can lead to duplicates
# (when the server fails to match correctly).
# It is therefore sometimes desirable to wipe out data on one
# side with a refresh-from-client/server sync instead of doing
# a slow sync.
# When this option is enabled, slow syncs that could cause problems
# are not allowed to proceed. Instead, the affected sources are
# skipped, allowing the user to choose a suitable sync mode in
# the next run (slow sync selected explicitly, refresh sync).
# The following situations are handled:
#
# - running as client with no local data => unproblematic,
# slow sync is allowed to proceed automatically
# - running as client with local data => client has no
# information about server, so slow sync might be problematic
# and is prevented
# - client has data, server asks for slow sync because all its data
# was deleted (done by Memotoo and Mobical, because they treat
# this as 'user wants to start from scratch') => the sync would
# recreate all the client's data, even if the user really wanted
# to have it deleted, therefore slow sync is prevented
# preventSlowSync = 1
# set to T to choose an HTTP proxy explicitly; otherwise the default
# proxy settings of the underlying HTTP transport mechanism are used;
# only relevant when contacting the peer via HTTP
# useProxy = 0
# proxy URL (``http://<host>:<port>``)
# proxyHost =
# authentication for proxy: username
# proxyUsername =
# proxy password, can be specified in different ways,
# see SyncML server password for details
# proxyPassword =
# - empty or "md5" for secure method (recommended)
# - "basic" for insecure method
#
# This setting is only for debugging purpose and only
# has an effect during the initial sync of a client.
# Later it remembers the method that was supported by
# the server and uses that. When acting as server,
# clients contacting us can use both basic and md5
# authentication.
# clientAuthType = md5
# The total amount of time in seconds in which the SyncML
# client tries to get a response from the server.
# During this time, the client will resend messages
# in regular intervals (RetryInterval) if no response
# is received or the message could not be delivered due
# to transport problems. When this time is exceeded
# without a response, the synchronization aborts without
# sending further messages to the server.
#
# When acting as server, this setting controls how long
# a client is allowed to not send a message before the
# synchronization is aborted.
# RetryDuration = 5M
# The number of seconds between the start of SyncML message sending
# and the start of the retransmission. If the interval has
# already passed when a message send returns, the
# message is resent immediately. Resending without
# any delay will never succeed and therefore specifying 0
# disables retries.
#
# Servers cannot resend messages, so this setting has no
# effect in that case.
#
# The WebDAV backend also resends messages after a temporary
# network error. It uses exponential backoff to determine when
# the server is available again. This setting is divided by 24
# to obtain the initial delay (default: 2m => 5s), which is then
# doubled for each retry.
# RetryInterval = 2M
# the identifier sent to the remote peer for a server initiated sync.
# if not set, deviceId will be used instead
# remoteIdentifier =
# Indicates whether this configuration is about a
# client peer or server peer.
# PeerIsClient = 0
# On a client, the latest commonly supported SyncML version
# is used when contacting a server. one of '1.0/1.1/1.2' can
# be used to pick a specific version explicitly.
#
# On a server, this option controls what kind of Server Alerted
# Notification is sent to the client to start a synchronization.
# By default, first the format from 1.2 is tried, then in case
# of failure, the older one from 1.1. 1.2/1.1 can be choosen
# explictely which disables the automatism
# SyncMLVersion =
# An arbitrary name for the peer referenced by this config.
# Might be used by a GUI. The command line tool always uses the
# the configuration name.
PeerName = ScheduleWorld
# SyncML ID of our peer, empty if unknown; must be set only when
# the peer is a SyncML client contacting us via HTTP.
# Clients contacting us via OBEX/Bluetooth can be identified
# either via this remoteDeviceId property or by their MAC
# address, if that was set in the syncURL property.
#
# If this property is empty and the peer synchronizes with
# this configuration chosen by some other means, then its ID
# is recorded here automatically and later used to verify that
# the configuration is not accidentally used by a different
# peer.
# remoteDeviceId =
# use the more compact binary XML (WBXML) for messages between client and server;
# not applicable when the peer is a SyncML client, because then the client
# chooses the encoding
# enableWBXML = 1
# The maximum size of each message can be set (maxMsgSize) and the
# peer can be told to never sent items larger than a certain
# threshold (maxObjSize). Presumably the peer has to truncate or
# skip larger items. Sizes are specified as number of bytes.
# maxMsgSize = 150000
# maxObjSize = 4000000
# A string specifying the location of the certificates
# used to authenticate the server. When empty, the
# system's default location will be searched.
#
# SSL support when acting as HTTP server is implemented
# by the HTTP server frontend, not with these properties.
# SSLServerCertificates = /etc/ssl/certs/ca-certificates.crt:/etc/pki/tls/certs/ca-bundle.crt:/usr/share/ssl/certs/ca-bundle.crt
# The client refuses to establish the connection unless
# the server presents a valid certificate. Disabling this
# option considerably reduces the security of SSL
# (man-in-the-middle attacks become possible) and is not
# recommended.
# SSLVerifyServer = 1
# The client refuses to establish the connection unless the
# server's certificate matches its host name. In cases where
# the certificate still seems to be valid it might make sense
# to disable this option and allow such connections.
# SSLVerifyHost = 1
# The URL of a web page with further information about the server.
# Used only by the GUI.
WebURL = http://www.scheduleworld.com
# The URI of an icon representing the server graphically.
# Should be a 48x48 pixmap or a SVG (preferred).
# Used only by the GUI.
IconURI = image://themedimage/icons/services/scheduleworld
# Set to true in a configuration template to indicate
# that the server works well enough and is available
# for normal users. Used by the GUI to limit the choice
# of configurations offered to users.
# Has no effect in a user's server configuration.
# ConsumerReady = 0
# Defines what a configuration is meant to be used for.
# Used in templates and the resulting configs to tell a GUI
# that special handling may be necessary. GUIs should ignore
# unknown types.
# The traditional SyncML configs use an empty value.
# "WebDAV" is used for the WebDAV side in a local synchronization.
# peerType =