#include <ClientTest.h>
Public Types | |
typedef SyncSource *(*) | createsource_t (ClientTest &client, int source, bool isSourceA) |
A member function of a subclass which is called to create a sync source referencing the data. | |
Public Attributes | |
const char * | sourceName |
The name is used in test names and has to be set. | |
const char * | uri |
A default URI to be used when creating a client config. | |
createsource_t | createSourceA |
Creates a sync source which references the primary database; it may report the same changes as the sync source used during sync tests. | |
createsource_t | createSourceB |
A second sync source also referencing the primary data source, but configured so that it tracks changes independently from the the primary sync source. | |
const char * | templateItem |
The framework can generate vCard and vCalendar/iCalendar items automatically by copying a template item and modifying certain properties. | |
const char * | uniqueProperties |
This is a colon (:) separated list of properties which need to be modified in templateItem. | |
int | numItems |
the number of items to create during stress tests | |
const char * | sizeProperty |
This is a single property in templateItem which can be extended to increase the size of generated items. | |
const char * | insertItem |
A very simple item that is inserted during basic tests. | |
const char * | updateItem |
A slightly modified version of insertItem. | |
const char * | complexUpdateItem |
A more heavily modified version of insertItem. | |
const char * | mergeItem1 |
To test merge conflicts two different updates of insertItem are needed. | |
const char * | mergeItem2 |
The second merge update item. | |
int(* | dump )(ClientTest &client, SyncSource &source, const char *file) |
called to dump all items into a file, required by tests which need to compare items | |
int(* | import )(ClientTest &client, SyncSource &source, const char *file) |
import test items: which these are is determined entirely by the implementor, but tests work best if several complex items are imported | |
bool(* | compare )(ClientTest &client, const char *fileA, const char *fileB) |
a function which compares two files with items in the format used by "dump" | |
const char * | testcases |
a file with test cases in the format expected by import and compare | |
const char * | type |
the item type normally used by the source (not used by the tests themselves; client-test.cpp uses it to initialize source configs) |
For the sake of simplicity all items pointed to are owned by the ClientTest and must remain valid throughout a test session. Not setting a pointer is okay, but it will disable all tests that need the information.
typedef SyncSource*(*) ClientTest::Config::createsource_t(ClientTest &client, int source, bool isSourceA) |
A member function of a subclass which is called to create a sync source referencing the data.
This is used in tests of the SyncSource API itself as well as in tests which need to modify or check the data sources used during synchronization.
The test framework will call beginSync() and then some of the functions it wants to test. After a successful test it will call endSync() which is then expected to store all changes persistently. Creating a sync source again with the same call should not report any new/updated/deleted items until such changes are made via another sync source.
The instance will be deleted by the caller. Because this may be in the error case or in an exception handler, the sync source's desctructor should not thow exceptions.
client | the same instance to which this config belongs | |
source | index of the data source (from 0 to ClientTest::getNumSources() - 1) | |
isSourceA | true if the requested SyncSource is the first one accessing that data, otherwise the second |
A second sync source also referencing the primary data source, but configured so that it tracks changes independently from the the primary sync source.
In local tests the usage is like this:
In tests with a server the usage is:
const char* ClientTest::Config::templateItem |
The framework can generate vCard and vCalendar/iCalendar items automatically by copying a template item and modifying certain properties.
This is the template for these automatically generated items.
const char* ClientTest::Config::insertItem |
A very simple item that is inserted during basic tests.
Ideally it only contains properties supported by all servers.
const char* ClientTest::Config::updateItem |
A slightly modified version of insertItem.
If the source has UIDs embedded into the item data, then both must have the same UID. Again all servers should better support these modified properties.
const char* ClientTest::Config::complexUpdateItem |
A more heavily modified version of insertItem.
Same UID if necessary, but can test changes to items only supported by more advanced servers.
const char* ClientTest::Config::mergeItem1 |
To test merge conflicts two different updates of insertItem are needed.
This is the first such update.
const char* ClientTest::Config::mergeItem2 |
The second merge update item.
To avoid true conflicts it should update different properties than mergeItem1, but even then servers usually have problems perfectly merging items. Therefore the test is run without expecting a certain merge result.
int(* ClientTest::Config::dump)(ClientTest &client, SyncSource &source, const char *file) |
called to dump all items into a file, required by tests which need to compare items
ClientTest::dump can be used: it will simply dump all items of the source with a blank line as separator.
source | sync source A already created and with beginSync() called | |
file | a file name |
int(* ClientTest::Config::import)(ClientTest &client, SyncSource &source, const char *file) |
import test items: which these are is determined entirely by the implementor, but tests work best if several complex items are imported
ClientTest::import can be used if the file contains items separated by empty lines.
source | sync source A already created and with beginSync() called | |
file | the name of the file to import |
bool(* ClientTest::Config::compare)(ClientTest &client, const char *fileA, const char *fileB) |
a function which compares two files with items in the format used by "dump"
fileA | first file name | |
fileB | second file name |