Commit graph

86 commits

Author SHA1 Message Date
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
Chen Congwu
9fb601d387 ClientTest: rename 'super' to 'calendar+todo' 2010-03-09 10:00:31 -08:00
Chen Congwu
d71aa7b2ac Configuration templates matching: match templates based on metadata
Introduced TemplateConfig to abstracting the template configuration structure,
the template metadata used for matching is also parsed here.
The fields introduced in the metadata are:
PeerIsClient: identify whether this is a server side configuration or a client
side configuration.
Fingerprint: the matching string for this template, it is a comma separated string
with each string modeled as: "Manufacture_Model". The first substring is also
used as the name to identify this template so that user can select the template
by this name.
eg:
Nokia 7210c: Nokia_7210c
SyncEvolution server: SyncEvolutionServer, SyncEvolution
ScheduleWorld: ScheduleWorld,default
SyncEvolution client: SyncEvolutionClient, SyncEvolution

Description: this is a just a descriptive string not used for matching.

GetServerTemplates is changed to add another "devices" parameter to identify
it is asking for templates for a list of "devices". Each device is a tuple
<matchstring (devicename), matchMode (server/client/all)>.
TemplateList as the return type, which is a list of class TemplateDescription
so that we can also return enough information for corresponding templates. This
list is sorted by the 3-tuple <finger, rank, name>.

Add MatchServerTemplates method which will iterating all templates inside the
folder and match against the input parameter and finally return a sorted
list of matched templates.

The atcually fuzzy match algorithm is based on a LCS (added in the following
commit).

Cmdline interface is changed accordingly:
--template ? is changed to --template ?[string], so that user use the former
case to match all templates for a tradiontial SyncML client and the latter case
to match templates related to an input string.

SyncConfig API is also renamed (Server -> Peer) because both server/client
configuration/template are handled.

The original configuration template (Funambol and ScheduleWorld) has been moved
to the new template structure (under servers), they also have a .template.ini
file added so that they can be matched and picked up. All templates for
supported servers still have built-in template support in the code as before.
Templates for SyncEvolution based server is also added.

Server side templates are added (Nokia default, Nokia_7210c and SyncEvolutionServer).

Add unit test for the new template match use case.
2010-01-19 18:06:20 +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
Chen Congwu
fac80c4041 ClientTest: enabling super datastore testing
Enabling only the super datastore to SyncContext.
Avoid changing the databaseid automatically for super source as it has special
meaning.
There are a later commit fixing the LocalTest problem for super datastore.
2009-12-16 14:55:27 +08:00
Patrick Ohly
e09fafbf50 client-test: create new configs in @client-test-[12]
This is necessary because the two virtual clients need their own
deviceId and evolutionsource properties. Existing old-style
configs are used automatically because the configs are searched
first without the explicit context.
2009-11-25 17:19:41 +01:00
Patrick Ohly
5f61785608 config: reorganized for shared config layout (MB#7707)
This patch introduces code changes for the new layout without actually
using it yet. Therefore all existing tests for the older layout
still pass. The new meaning of the former "server name" is introduced:
- A plain string now refers to a peer configuration (can be client
  or server).
- The @ sign allows selecting a specific context. Different contexts
  have independent sets of local sources and peer definitions.
- An empty peer name selects a view on the configuration which contains
  no peer-specific properties. Not fully implemented yet.

The FileConfigTree is instantiated with a root which is one level high
up compare to before this patch (for example,
"~/.config/syncevolution" instead of
"./config/syncevolution/scheduleworld") and then config files include
that dropped level in their relative path name
("scheduleworld/config.ini" instead of "config.ini"). This allows
accessing the global properties in
"~/.config/syncevolution/config.ini" and will be used to move peers
further down the hierarchy
("~/.config/syncevolution/peers/scheduleworld/config.ini").

To keep the output of "--print-servers" consistent, the FileConfigTree
gets another parameter which identifies the subset of the larger tree
that is referenced by this FileConfigTree instance.

One side effect of this change is that FileConfigTree instances are no
longer completely separate. Something to keep in mind when
instantiating SyncContext multiple times (MB#8006).

Code may no longer make assumptions in which config node a property is
stored. This is determined by the new getNode() calls based on the
property attributes (hidden, sharing). The new layout is represented as
a set of config nodes. Older layouts use the same set of nodes with
identical instances assigned to them, if they don't really have separate
files for each of them.

SyncSourceNodes no longer grants direct access to the nodes, to catch
code which incorrectly access a specific node directly. For the same
reason the name of the nodes changed.

Code which needs access to all hidden or all visible properties now
does this via a config node returned by getProperties(). Currently
this is identical to the underlying nodes. Once the new layout is
active, this node will act as a multiplexer which gathers properties
from all underlying nodes when reading and picks the right one when
writing.

The "change ID" parameter for sources has been obsolete for a while
and was removed.

Reorganized the property registration so that it is a bit easier
to see which properties are hidden and which use non-default sharing.
The default sharing is "no sharing".

Some other code was improved while touching it:
- removed useless visibility[] array in favor of a i != 0 check in
  SyncConfig::copy()
- added default parameters to save/checkPassword() methods
- some constness definition changes
- Property::getProperty() is a virtual call which could only be
  overloaded in one case because the constness was wrong; now
  getProperty() always returns the string value and getPropertyValue()
  some other kind of representation of it, depending on the
  class.
- ConstSyncSourceNodes is based on SyncSourceNodes instead of duplicating
  it, which simplifies the implementation.

The simplified SyncSourceAdmin API changed slightly: instead of passing
a pointer to the source's SyncSourceNodes, the default nodes are now
found via the SyncSource pointer. For callers this is a bit less
work and it is more general.
2009-11-25 16:57:50 +01:00
Patrick Ohly
807212d7b6 testing: Client::Sync broke when removing the source array in the sync() method
The active sources must be set before calling sync(), doing it in
prepare() is too late. The right way to do it with the revised
API is via source filters: disable all sources with a filter that
applies to all sources, then enable the desired one(s) with the
right mode with a more specific filter.
2009-10-29 16:08:57 +01:00
Patrick Ohly
d8283ba873 sync source handling: implemented per-source property filtering, Cmdline uses it
Selecting active sources during a sync or status check was done with a
combination of setting a sync mode via a source config filter and
setting a list of active sources. Now the SyncConfig supports a source
filter which is applied to all sources and source filters for each
source. The latter override the former.

This is powerful enough to start syncs with full control over which
sources are active in which mode, as described in the new D-Bus API.
As part of this patch, the command line semantic is implemented
entirely using a combination of different source filters.
2009-10-07 18:10:00 +02:00
Patrick Ohly
7e4eb2e93d more classes renamed
EvolutionSyncConfig => SyncConfig
SyncEvolutionException => Exception
EvolutionUnref* => Unref*
2009-10-06 17:22:47 +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
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
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
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
Chen Congwu
b3296d6241 Test cases: Enable Interrupt* test, add suspend test 2009-07-01 14:45:47 +02:00
Patrick Ohly
e2b5af8f14 extracting items: EvolutionMemoSource needs information about expected format
Both EvolutionSyncSource::backupData() (implemented for the memo source
in the TrackingSyncSource base class) and Client::Source::text::testImport
must dump items in the native format, the one which is used for restore
and for the test cases. See Bugzilla #3967 and #3929.

This broke during the 0.9 development cycle, but wasn't detected during
automated testing because the necessary tests weren't enabled for
the "text" source until recently.

Now createItem() is passed a hint what the desired format is. "raw"
is used for backup and testing.

Also removed obsolete exportData() call in EvolutionCalendarSource.
This was used before introducing the newer backupData() call.
2009-07-01 14:10:59 +02:00
Patrick Ohly
0a5ded00cf config: enabled maxMsgSize/maxObjSize, removed obsolete loSupport (Bugzilla #2784)
The two size options are now copied into the Synthesis XML configuration.
Large object support is always on, so the setting was removed.

Note that the Synthesis engine allocates twice the amount specified in
the configuration and then uses that amount if the server allows it.
That explains why outgoing messages where twice as large as specified.
Incoming messages where inside the size limit.
2009-06-10 13:32:49 +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
50fca4dae0 testing: fix for database comparison
When changing from flat file to directory for database dumps the necessary directory wasn't created for some test cases.
2009-05-08 15:12:20 +02:00
Patrick Ohly
d7a2d4ce8e Merge branch 'master' into ui 2009-04-30 18:44:59 +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
d5778457da license: changed to LGPL v2.1 + v3
As with the previous change from GPL 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.

Also, now the license and disclaimer are mentioned at the start
of the source files. That is not strictly necessary, but more
explicit.
2009-04-30 18:14:03 +02:00
Patrick Ohly
492e236b24 added/improved reporting of local changes
EvolutionSyncClient::getChanges() can be used to query whether
items were changed locally. Added/updated/deleted/total number
of items are reported, plus the time needed to collect that information.
The information is stored in a SyncReport, with ITEM_ANY used
for the total item count.

--status now also does this check and prints the information.

Printing a SyncReport as an ASCII table was considerably
improved for this: columns which are known to be irrelevant
can be suppressed. The layout is a lot more dynamic with
(so I hope) nicer alignment: text related to a source name
is aligned with that name, which itself is flushed to the
right of the name column.
2009-04-29 16:55:31 +02:00
Patrick Ohly
5057c38364 removed obsolete EvolutionSyncSource::get*ItemKey() methods 2009-04-29 16:54:32 +02:00
Patrick Ohly
ad774d0b29 added --restore and fixed --status
--status was broken by the last commit: XDG_DATA_DIR was not
expanded. Fixed it as part of the improvements for printing
changes in --restore. Also made some other minor changes
to utility classes as part of these improvements.

The new --restore option can restore data from a data dump,
identified by the directory and a before/after flag. The
corresponding API is EvolutionSyncClient::restore().
2009-04-23 16:47:07 +02:00
Patrick Ohly
7a0c625327 log dir handling: changed backup files from single file to directory, remember number of items in backup
Using the directory format will make restoring items easier because
there is no need to break one file with unknown content into single
items.

The SyncSourceReport now contains information about the backups
made before and after a sync; the only useful information right
now is the number of items.
2009-04-22 17:53:04 +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
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
73afb09d76 SyncModes + EvolutionSyncClient::setSyncModes(): utility code to set the sync mode per source in the current session 2009-03-25 14:43:49 +01:00
Patrick Ohly
92d6ac11aa testing: nicer printing of before/after comparison
Use the ClientTest::compare() helper function and change it so that
it invokes "synccompare", as needed when using it in SyncEvolution.
Improved it so that it prints the synccompare command after a failure
and adds a line break before it.
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
edf1d6864c glib: g_type_init() and g_thread_init() are needed to use libsoup
Probably wasn't a problem before when libebook/ecal were used; failed without those.
2009-03-25 14:43:47 +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
6f729542e6 license: changed to LGPL v2.1
This relicensing is possible despite the Funambol Contributor
Agreement (included as 'doc/Sync4jContribution.pdf') under which the
0.7 release was contributed to Funambol because among the broad range
of rights granted back by that agreement is the right to sublicense.

Furthermore, Patrick Ohly is still the copyright holder because
that moral right is not transferable in Germany.
2009-03-25 14:42:43 +01:00
Patrick Ohly
3d5749df17 hard dependencies on specific Evolution libs can be avoided with --enable-evolution-compatibility
This works by mapping all EDS symbols to pointers initialized via dlopen/dlsym.
Avoids version checks as intented, but might lead to runtime crashes if the ABI
of the required symbols really changes...

Currently the binaries refuses to start when any of the EDS libs is not found.
Need to make it work again so that libecal and libebook are optional (Maemo!).


git-svn-id: https://zeitsenke.de/svn/SyncEvolution/trunk@747 15ad00c4-1369-45f4-8270-35d70d36bdcd
2008-10-08 21:30:06 +00:00
Patrick Ohly
5fa63c04a6 license and copyright clarification
The source was always meant to be GPL v2 or later, but wasn't marked
consistently as such. Copyright belongs to Patrick Ohly, with all
code up to 0.7 also owned by Funambol due to a copyright transfer
at that time.


git-svn-id: https://zeitsenke.de/svn/SyncEvolution/trunk@739 15ad00c4-1369-45f4-8270-35d70d36bdcd
2008-08-26 17:45:28 +00:00
Patrick Ohly
4903ca6918 fixed issue with inconsistent use of ClientTest.h after copying it to SyncEvolution
git-svn-id: https://zeitsenke.de/svn/SyncEvolution/trunk@725 15ad00c4-1369-45f4-8270-35d70d36bdcd
2008-08-16 10:02:41 +00:00
Patrick Ohly
4b55adf5e9 evo user/passwd must always be set for Client::Sync
git-svn-id: https://zeitsenke.de/svn/SyncEvolution/trunk@721 15ad00c4-1369-45f4-8270-35d70d36bdcd
2008-08-16 07:36:55 +00:00
Patrick Ohly
9a1c64df48 added CLIENT_TEST_EVOLUTION_USER/PASSWORD so that backends which require authentication can now also be tested
git-svn-id: https://zeitsenke.de/svn/SyncEvolution/trunk@714 15ad00c4-1369-45f4-8270-35d70d36bdcd
2008-08-09 08:57:30 +00:00
Patrick Ohly
2bc796ef09 added documentation for client-test env variables and usage
git-svn-id: https://zeitsenke.de/svn/SyncEvolution/trunk@704 15ad00c4-1369-45f4-8270-35d70d36bdcd
2008-08-03 20:26:06 +00:00
Patrick Ohly
d08d1f7e88 added automatic registration of test
git-svn-id: https://zeitsenke.de/svn/SyncEvolution/trunk@692 15ad00c4-1369-45f4-8270-35d70d36bdcd
2008-08-02 15:46:23 +00:00
Patrick Ohly
f9e0745e72 unit tests in Register.cpp files not active without --enable-unit-tests
git-svn-id: https://zeitsenke.de/svn/SyncEvolution/trunk@688 15ad00c4-1369-45f4-8270-35d70d36bdcd
2008-07-30 20:31:27 +00:00
Patrick Ohly
880202e609 fixed typo (evolution-todo -> evolution-tasks)
git-svn-id: https://zeitsenke.de/svn/SyncEvolution/trunk@628 15ad00c4-1369-45f4-8270-35d70d36bdcd
2008-06-25 18:51:07 +00:00
Patrick Ohly
db81cd3dce adding SyncEvolution test target in all cases, take II
git-svn-id: https://zeitsenke.de/svn/SyncEvolution/trunk@596 15ad00c4-1369-45f4-8270-35d70d36bdcd
2008-04-19 08:02:42 +00:00
Patrick Ohly
22e4e59e65 adapted to new removeAllItems() prototype
git-svn-id: https://zeitsenke.de/svn/SyncEvolution/trunk@578 15ad00c4-1369-45f4-8270-35d70d36bdcd
2008-04-08 19:43:41 +00:00