Commit graph

69 commits

Author SHA1 Message Date
Patrick Ohly
19f703588f nightly testing: avoid shutdown issues due to caching Evolution sources (BMC #5864)
Destroying ORBit based Evolution backends at the very end of the
process life time caused assertions in ORBit. Added explicit cleanup
code which is called before triggering the normal library shutdown by
leaving main().
2010-09-01 18:01:19 +02:00
Patrick Ohly
ea43ed0625 client-test: check that suspend tests really suspend
The suspend tests would have passed even if the client never really
executed the suspend request. Now the tests verify whether the next
session really resumes. It does that except for some corner cases
(first message, last message), which is acceptable. When multiple
sources are involved, first and last message of each source
cannot be identified reliably, so in that case suspend is not checked.

The SyncReport must be available for this checking. The check() method
was made virtual to implement such checks in a derived class, but that
is neither convenient nor does it currently work because SyncOptions
copies the CheckSyncReport instance.
2010-03-18 18:37:39 +01:00
Patrick Ohly
6e187b0229 client-test: added "big" variant also to suspend tests
The variant of the tests which transfer big items also make
sense for the suspend tests which request a suspension of the
session.

Now they are only missing from the resend tests where running
larger sessions doesn't make that much sense, at least not
for SyncEvolution and Synthesis servers.
2010-03-18 18:37:39 +01:00
Patrick Ohly
62921bd1c9 client-test: speed up interrupt tests
The testInterrupt* tests simulate a hard transport failure. Each time
that happened, SyncContext would retry at least once after the default
retry period (1 minute) before giving up, slowing down the testing
considerably.

With the new SyncOptions "retryInterval" set to zero, retrying is
disabled. This must not be done when testing the resending itself.
2010-03-18 18:37:38 +01:00
Patrick Ohly
446b5bfbd1 client-test: added interrupted sync tests with split items
The tests are expected to run with a maximum message size of 20000
used by both client *and* server - server must be configured
accordingly.

Then the Add and Update operations in the interrupted sync with
client B are done with an item that is larger than the message size
and thus depends on <MoreData> support. On resume, only the second
half is sent and the recipient must assemble the complete item.
2010-03-18 18:37:38 +01:00
Chen Congwu
426526e496 ClientTest: enabling the test with virtual syncsource
Virtual syncsource should be viewed as a single source by the synccontext while
as a list of sub datasources for the LocalTest.
2009-12-17 10:18:18 +08:00
Zhu, Yongsheng
7f17cc02e6 client-test+ZYB: set maxMsgSize and maxObjSize as default value (MB#2424)
For ZYB, the client-test sets different maxMsgsize and
maxObjSize in two times sync and this causes server
initializing a slow-sync mode.
See detail:
http://bugzilla.moblin.org/show_bug.cgi?id=2424#c13
2009-12-01 21:45:42 +01:00
Chen Congwu
49cf52ed25 ClienTest: Fix a resource leak
The wrapped transport agent instance was not reset
2009-11-16 23:09:24 +01:00
Patrick Ohly
607b54860d Merge branch 'master' into dbus-api 2009-10-20 14:32:40 +02:00
Patrick Ohly
8d0f6dca03 client-test: added testManyDeletes, improved testManyItems
testManyItems now checks that the statistics are correct. This
is based on the assumption that all active sources use the same
number of test items.

The new testManyDeletes triggers a problem with 222 loop detection:
when the message to the server contains many deletes, the server
may require so many reply messages, that the client has to send
5 Alert 222 messages in a row and incorrectly treats this as a loop
that has to be aborted.
2009-10-16 18:16:46 +02:00
Patrick Ohly
18a0d2ad3d TransportAgent: added shutdown(), moved HTTP setup out of core engine
This TransportAgent API revision was done in preparation for transport
agents which do not support HTTP. Forcing them to provide HTTP specific
methods is unnecessary, so now setting things like proxy is done when
constructing an HTTP-based agent in the createTransport() call.
So now the result of createTransport() must be ready for sending messages.

setURL() is still part of the API, because it provides message-specific
information. Perhaps it should be renamed when it is clearer what
the corresponding information in other transports is.

For connection oriented agents a new shutdown() call was introduced.
This gives them a chance to close the connection and inform the
engine about errors during that shutdown.

For servers (which send the last message without expecting a reply),
wait(noReply=true) was added.
2009-10-07 18:10:55 +02:00
Patrick Ohly
71fbf32c94 files and classes renamed, include statements cleaned up
The intention is to get rid of the historic and inconsistent
naming of some classes and their corresponding files:
* EvolutionSyncClient = class derived from Funambol's SyncClient,
* SyncEvolutionConfig = SyncEvolution's config

With the strict 'namespace SyncEvo' and the syncevo/ path prefix for
most header files it is no longer necessary to have "SyncEvolution" or
"Evolution" in the names. This patch thus renames as follows:
  EvolutionSyncClient => SyncContext
  EvolutionSmartPtr => SmartPtr
  SyncEvolutionCmdline => Cmdline
  SyncEvolutionConfig => SyncConfig
  SyncEvolutionUtil => util

The former EvolutionSyncClient always had a role that went beyond just
running a sync, for example it also provided config access. With the
upcoming server support it also won't be just a client. Thus the new
name "SyncContext".

The 'syncevo/' prefix is used throughout the code now.

removed whenever the prefix made it clear that the file belongs
to SyncEvolution. This helps finding incorrect include paths.

Quotes should be used exclusively for SyncEvolution files which don't
have a specific prefix yet (test.h, config.h) to help identifying
them.
2009-10-05 14:49:32 +02:00
Patrick Ohly
f87ffd682d introduced "namespace SyncEvo" consistently
Added syncevo/declarations.h, which has

This is now used for all SyncEvolution source files, except
for the GTK UI, which is written in plain C. In the library
it helps to avoid name clashes.

The reason for using defines instead of spelling out "namespace SyncEvo"
is twofold:
1. if that should ever become necessary, it is easier to
   rename the namespace via configure options by changing
   the define
2. editors don't indent the whole file content
2009-10-02 17:27:45 +02:00
Chen Congwu
35ee636619 Dynamic loadable backends: repackage libsyncevolution to enable dynamic loadable backends
Install head files to a standard path, the remaining dependencies are
synthesis and boost
client-test is portable when ENABLE_MODULES is defined, no longer link to
backends libraries.

Add --enable-developer-mode, in which mode the backend scan path will be
under current build directory for development purposes.
2009-09-23 07:35:25 +02:00
Chen Congwu
af45449f35 Testing: disable retry,suspend,resend tests by default
Use CLIENT_TEST_RESEND=t, CLIENT_TEST_RETRY=t, CLIENT_TEST_SUSPEND=t to enable
them.
2009-08-31 09:54:36 +08:00
Patrick Ohly
d5961f8d8f redesigned SyncSource base class + API
The main motivation for this change is that it allows the implementor
of a backend to choose the implementations for the different aspects
of a datasource (change tracking, item import/export, logging, ...)
independently of each other. For example, change tracking via revision
strings can now be combined with exchanging data with the Synthesis
engine via a single string (the traditional method in SyncEvolution)
and with direct access to the Synthesis field list (now possible for
the first time).

The new backend API is based on the concept of providing
implementations for certain functionality via function objects instead
of implementing certain virtual methods. The advantage is that
implementors can define their own, custom interfaces and mix and match
implementations of the different groups of functionality.

Logging (see SyncSourceLogging in a later commit) can be done by
wrapping some arbitrary other item import/export function objects
(decorator design pattern).

The class hierarchy is now this:
- SyncSourceBase: interface for common utility code, all other
  classes are derived from it and thus can use that code
- SyncSource: base class which implements SyncSourceBase and
  hooks a datasource into the SyncEvolution core;
  its "struct Operations" holds the function objects which
  can be implemented in different ways
- TestingSyncSource: combines some of the following classes
  into an interface that is expected by the client-test
  program; backends only have to derive from (and implement this)
  if they want to use the automated testing
- TrackingSyncSource: provides the same functionality as
  before (change tracking via revision strings, item import/export
  as string) in a single interface; the description of the pure
  virtual methods are duplicated so that developers can go through
  this class and find everything they need to know to implement
  it

The following classes contain the code that was previously
found in the EvolutionSyncSource base class. Implementors
can derive from them and call the init() methods to inherit
and activate the functionality:
- SyncSourceSession: binds Synthesis session callbacks to
  virtual methods beginSync(), endSync()
- SyncSourceChanges: implements Synthesis item tracking callbacks
  with set of LUIDs that the user of the class has to fill
- SyncSourceDelete: binds Synthesis delete callback to
  virtual method
- SyncSourceRaw: read and write items in the backends format,
  used for testing and backup/restore
- SyncSourceSerialize: exchanges items with Synthesis engine
  using a string representation of the data; this is how
  EvolutionSyncSource has traditionally worked, so much of the
  same virtual methods are now in this class
- SyncSourceRevisions: utility class which does change tracking
  via some kind of "revision" string which changes each time
  an item is modified; this code was previously in the
  TrackingSyncSource
2009-08-26 15:41:51 +02:00
Chen Congwu
ec9941ece5 Transport: bug#3427, transport will retry send after long waiting and will stop retring finally if all fails.
After a http request is sent out, while the client is waiting for response,
the server found client is unreacheable (client side network down temporarily or
intermidate router down), so the server stops sending and closed the tcp
conenction, causing a half closed connection at client side.

To fix this, client side will timeout (60 seconds) during wating and will
resend previous request to retry. After 3 failed retries, it will finally
give up leading to an abort. The timeout and retry count can be customized
in server config file.
2009-08-25 15:57:25 +08:00
Chen Congwu
fb13c0711c Testing: use server default configuration when init test configs.
When test configuration is inited, currently it is stick to scheduleworld
while it should be generated differently accoring to the CLIENT_TEST_SERVER.
2009-08-07 11:48:10 +02:00
Patrick Ohly
56cf08e4bf sync statistics: count items deleted during refresh-from-server (Bugzilla #3314)
The Synthesis Engine doesn't count these items because Synthesis wants
the engine to count only items deleted by the remote side. For our
statistics this looks a bit unrealistic (items before sync + added - deleted
does not add up to items after sync), so we now track items deleted
locally and use that number instead of the Synthesis statistics for deleted
items when we know that it is not complete.

In the command line, we show detailed statistics. In the GUI, it shows
up as part of the locally applied changes.

The new testComplexRefreshFromServerSemantic test covers this particular
aspect of the statistics.
2009-07-30 17:19:46 +02:00
Patrick Ohly
f22c4b0494 testing: added testSlowSyncSemantic
This test checks whether the server a) creates no duplicates
during a slow sync (also covered by testManyItems) and b) correctly
associates the client's item with its own copy.

As described in Bugzilla #4703, the ScheduleWorld server currently
has a problem with the later (for contacts) and fails to delete
the item on the client, apparently because it doesn't remember the
LUID correctly. It also fails this test for text because it creates
duplicates.
2009-07-25 23:00:21 +02:00
Patrick Ohly
c602de1c3e testing: skip certain tests by listing them in CLIENT_TEST_SKIP
The only way that I found not to execute a test was not to register
it in CPPUnit. FilterTest() does this by replacing a valid test
or test group with a dummy one, SkipTest, which just prints the
test name and that it is skipped.

Registering tests has to be intercepted at multiple levels:
- CPPUNIT_TEST in test suites
- ADD_TEST in ClientTest
- addTest in ClientTest

Not currently intercepted are complete test suites (CPPUNIT_TEST_SUITE).

The main purpose of this patch is to avoid running the time consuming
suspend and interrupt tests, but this feature might also be useful for
other tests, which is why it was implemented in a more general way.
2009-07-13 18:31:48 +02:00
Patrick Ohly
f9da1b8f84 HTTPS transport: added SSL certificate checking
- when libsoup is used (as on Moblin), the configure script sets
  a default search for the SSLServerCertificates option which works
  on Debian and Red Hat:
  /etc/ssl/certs/ca-certificates.crt:/usr/share/ssl/certs/ca-bundle.crt
- with libcurl the library's own default is used; SSLServerCertificates
  is empty, but can be set to override the default
- libsoup enables checking when either SSLVerifyServer or SSLVerifyHost
  is on (does not support more control over checking), refuses to work
  if no CA certificates file was found
- libcurl supports both strict checking (both options on) and less
  strict checking (only check certificate, but not hostname)
2009-07-10 13:44:42 +02:00
Patrick Ohly
2ae283ee2c testing: callers of getItems() need to know which file was used (Bugzilla #2421)
Without that information, the wrong files are compared, leading to false
test failures. Because getItems() is also called indirectly via import(),
this change ripples through several functions.
2009-07-08 18:38:58 +02:00
Chen Congwu
b3296d6241 Test cases: Enable Interrupt* test, add suspend test 2009-07-01 14:45:47 +02:00
Patrick Ohly
bf198f4975 testing: message and object size was too small
When working with the Funambol engine, 0 meant "default values",
which were reasonably large for message size and unlimited for object
size.

After migrating to Synthesis and enabling these limits again, 0 has
no special meaning and is rounded up to some very small numbers. These
limits were too small for some items, therefore the settings used by
tests by default were bumped up to 128KB for message size (should
keep the overall message number fairly small) and 1GB for individual
items (basically unlimited again).
2009-06-24 10:35:42 +02:00
Patrick Ohly
ef335cd8d4 testing: removed code which wasn't needed anymore
Config::testcases_server had no useful purpose. The extra dump()
method became redundant because the EvolutionSyncSource API *always*
returns "native" items and thus the generic method works fine.
2009-05-14 19:51:58 +02:00
Patrick Ohly
513a58c004 testing: check for correct server behavior during refresh-from-client
During a refresh-from-client sync, the server has to delete all items
that it currently has before adding those sent by the client. This
new test covers that. It complements the testRefreshSemantic test,
which did that for the other direction and thus was renamed to
testRefreshFromClientSemantic.

The server also needs to tell other clients to delete the items
that were deleted this way during a refresh-from-client. This is
not currently tested.
2009-05-02 11:32:18 +02:00
Patrick Ohly
3217ac8630 license: merged LGPL v2.1 -> LGPL v2.1 + v3 change
Followed the license change applied to the upstream content
and applied the same LGPL v2.1 + v3 license to content
created at Intel.
2009-04-30 18:35:56 +02:00
Patrick Ohly
82debf7326 license: changed to LGPL v2.1 + v3
As with the previous change from AGPLv3 to LGPL v2.1, this is covered
by copyright ownership and/or the Funambol contributor agreement.

The motivation for adding v3 is greater flexibility regarding
reusing the code in other places and relicensing it.
2009-04-30 18:26:27 +02:00
Patrick Ohly
ef11945687 testing: 'text' was incomplete
Comparison was missing altogether. Items were not imported as text/calendar
because the type wasn't set. Creating new items didn't work because <<REVISION>>
was in the wrong place: it needs to be in the DESCRIPTION, so that SUMMARY and first
line of DESCRIPTION remain identical (expected by some peers and our own sync source).
2009-04-01 16:46:55 +02:00
Patrick Ohly
25a8502a4b copyright updated
update-copyright.sh can be used to add copyright remarks for the current
year. It finds the authors who made a change in each file and adds/updates
their copyright remark. Intel employees are grouped under "Intel Corporation".
2009-03-25 15:21:04 +01:00
Patrick Ohly
dae1b8854d testing: relicensed as LGPL v2.1, like the rest of the code
This is permitted by the Funambol contributor agreement (copy
is in doc/Sync4jContribution.pdf). It reduces the license mix
and allows distributing synccompare without special precautions.
2009-03-25 14:43:54 +01:00
Patrick Ohly
bd1d2d01ef vcard testing: use the right testcases for vcard21 conversion tests
Evolution vcard21 source defines testcases/vcard30.vcf as its native
test case file. For vcard21::testConversion we must use vcard21.vcf instead
because that is the format used for encoding the items.

Note that the test doesn't pass because synccompare does not support
old-style vcard and vcalendar encoding: line breaks aren't handled
correctly etc.
2009-03-25 14:43:51 +01:00
Patrick Ohly
4ae40026a4 configuration: removed obsolete config options and added WBXML
Removed the "encoding" source option. It was of dubious usefulness
with Funambol and has meaning with Synthesis at all.

Removed dead code in EvolutionSyncConfig.

Added "enableWBXML" sync option. WBXML is used by default, but for
debugging disabling it might be useful: dumping WBXML doesn't seem
to work reliably.

Most Client::Sync tests use the default encoding, usually WBXML unless
changed via CLIENT_TEST_XML=1. Client::Sync::*::testItemsXML always
uses XML and Client::Sync::*::testItems always WBXML.
2009-03-25 14:43:49 +01:00
Patrick Ohly
11e10f2556 testing: added Client::Sync::*::testConversion
The conversion test checks whether information is lost and/or modified
when converting the test items into the field list defined in the Synthesis
XML config. For that it converts into the field list and back, then compares
against the original test item file with synccompare.

Because a valid Synthesis session is necessary, this test hooks into
running a sync session via a callback that is triggered by the first
Synthesis progress event. It then aborts the session without contacting
the server.

boost::bind() with a reference should have worked (?), but didn't:
the bound function did not update the variable it was bound to.
Using a pointer worked.
2009-03-25 14:43:48 +01:00
Patrick Ohly
5aaf6a1a24 testing: pass parameters for syncing as struct, renamed function
Passing as struct makes it easier to extend. doSync() instead of just sync() is easier to search for.
2009-03-25 14:43:48 +01:00
Patrick Ohly
875704832a testing: added checking of sync source result and sync mode 2009-03-25 14:43:38 +01:00
Patrick Ohly
de2cc3c0f5 testing: re-enabled SyncReport and checking it 2009-03-25 14:43:38 +01:00
Patrick Ohly
8e9512cd20 testing: fixed log handling during Client::Sync
The logdir is now overridden so that all files (client.log, message
dumps, Synthesis logs) are written in a subdirectory names after
the current test. A <test>.log file captures all output written
outside of the sync itself.
2009-03-25 14:43:37 +01:00
Patrick Ohly
41aaec7eb2 testing: compiles and runs again, but output redirection is not working yet 2009-03-25 14:43:36 +01:00
Patrick Ohly
1170ba8b38 ClientTest: better infrastructure for data file comparisons
File names now only contain a single underscore instead of
multiple ones. The compare functions can be called so that they
return the result instead of throwing an assertion (useful for
doing multiple comparisons and then checking the result).
The synccompare Perl script is told to print the file names
that it is comparing.
2009-03-25 14:43:31 +01:00
Patrick Ohly
c74a620257 ClientTest: infrastructure for removing and updating specific items 2009-03-25 14:43:31 +01:00
Patrick Ohly
beb9d7887f ClientTest: test resuming a synchronization after a disconnect
Works for different situations (client has changes, server has
changes, both have changes) as well as for disconnects after every
single message in the synchronization. Uses the same infrastructure
as the other Client::Sync tests and therefore can be used to test
normal clients.

Only adding new items on client or server is currently implemented:
Client::Sync::vcard21::Retry::testInterruptResumeServerAdd
Client::Sync::vcard21::Retry::testInterruptResumeClientAdd

Results are not yet compared against outcome of uninterrupted
sync.
2009-03-25 14:43:30 +01:00
Patrick Ohly
3489ad43af testing: allow accumulating log prefixes dynamically 2009-03-25 14:43:30 +01:00
Patrick Ohly
6869110b3d testing: enhanced infrastructure (LUIDs)
Changed the utility functions so that they pass around and use
LUIDs. This allows building more complex tests which need to
modify specific items.
2009-03-25 14:43:30 +01:00
Patrick Ohly
807c835ccf tests: split big test into smaller ones
This helps g++ to complete compilation without requiring huge amount of memory.

git-svn-id: https://core.forge.funambol.org/svn/core/top-level/trunk/3x/client-api/native@26637 e8e8ed6c-164c-0410-afcf-9e9a7c7d8c10
2009-03-25 14:43:29 +01:00
Patrick Ohly
c344d25d8d fixed some (incorrect) gcc warnings about uninitialized vars, relaxed semantic checks in testLinkedItems
In testLinkedItems the SyncSource is now allowed to list a linked item as update
when the peer item (parent of child or child of parent) is
deleted/modified/added in the wrong order.

git-svn-id: https://core.forge.funambol.org/svn/core/top-level/trunk/3x/client-api/native@25760 e8e8ed6c-164c-0410-afcf-9e9a7c7d8c10
2009-03-25 14:43:29 +01:00
Patrick Ohly
22101a83d0 fixed detached event testing (ical20)
- the parent events accidentally had a RECURRENCE-ID, which turned them into
  specific instances
- clarified that some of the tests are too strict: child items without a parent
  are problematic and not necessarily supported by client (Evolution) and server
  (ScheduleWorld) => these tests can be disabled via -DLINKED_ITEMS_RELAXED_SEMANTIC=0

git-svn-id: https://core.forge.funambol.org/svn/core/top-level/trunk/3x/client-api/native@25438 e8e8ed6c-164c-0410-afcf-9e9a7c7d8c10
2009-03-25 14:43:29 +01:00
Patrick Ohly
7bcb8f00ca ical20: added testing of detached recurrences
Two VEVENTs were added to ical20.ics where one represents
the main event with recurrence rule and the other an exception
from the meeting series.

The new Sync::Source::ical20::testLinkedItems test covers
various different operations involving such two related VEVENTs
(adding in arbitrary order, updating/deleting one or both events, etc.).

git-svn-id: https://core.forge.funambol.org/svn/core/top-level/trunk/3x/client-api/native@24122 e8e8ed6c-164c-0410-afcf-9e9a7c7d8c10
2009-03-25 14:43:28 +01:00
Patrick Ohly
693e226f3f fixed compiler warnings in header files (found by g++ -Wall when compiling client)
git-svn-id: https://core.forge.funambol.org/svn/core/top-level/trunk/3x/client-api/native@23258 e8e8ed6c-164c-0410-afcf-9e9a7c7d8c10
2009-03-25 14:43:28 +01:00