ClientTest


Classes

class  ClientTestFactory
class  ClientOutputter
class  ClientListener

Functions

template<class T , class V >
int countEqual (const T &container, const V &value)
void simplifyFilename (string &filename)
const string & getCurrentTest ()
int main (int argc, char *argv[])
virtual void LocalTests::addTests ()
virtual std::string LocalTests::insert (CreateSource createSource, const char *data, bool relaxed=false)
virtual void LocalTests::update (CreateSource createSource, const char *data, bool check=true)
virtual void LocalTests::deleteAll (CreateSource createSource)
virtual void LocalTests::compareDatabases (const char *refFile, SyncSource &copy, bool raiseAssert=true)
virtual int LocalTests::insertManyItems (CreateSource createSource, int startIndex=1, int numItems=0, int size=-1)
virtual void LocalTests::testOpen ()
virtual void LocalTests::testIterateTwice ()
virtual void LocalTests::testSimpleInsert ()
virtual void LocalTests::testLocalDeleteAll ()
virtual void LocalTests::testComplexInsert ()
virtual void LocalTests::testLocalUpdate ()
virtual void LocalTests::testChanges ()
virtual void LocalTests::testImport ()
virtual void LocalTests::testImportDelete ()
virtual void LocalTests::testManyChanges ()
virtual void LocalTests::testLinkedItemsParent ()
virtual void LocalTests::testLinkedItemsChild ()
virtual void LocalTests::testLinkedItemsParentChild ()
virtual void LocalTests::testLinkedItemsChildParent ()
virtual void LocalTests::testLinkedItemsChildChangesParent ()
virtual void LocalTests::testLinkedItemsRemoveParentFirst ()
virtual void LocalTests::testLinkedItemsRemoveNormal ()
virtual void LocalTests::testLinkedItemsInsertParentTwice ()
virtual void LocalTests::testLinkedItemsInsertChildTwice ()
virtual void LocalTests::testLinkedItemsParentUpdate ()
virtual void LocalTests::testLinkedItemsUpdateChild ()
virtual void LocalTests::testLinkedItemsInsertBothUpdateChild ()
virtual void LocalTests::testLinkedItemsInsertBothUpdateParent ()
 SyncTests::SyncTests (const std::string &name, ClientTest &cl, std::vector< int > sourceIndices, bool isClientA=true)
 SyncTests::~SyncTests ()
virtual void SyncTests::addTests ()
virtual void SyncTests::compareDatabases ()
virtual void SyncTests::deleteAll (DeleteAllMode mode=DELETE_ALL_SYNC)
virtual void SyncTests::doCopy ()
virtual void SyncTests::refreshClient ()
virtual void SyncTests::testDeleteAllRefresh ()
virtual void SyncTests::testRefreshSemantic ()
virtual void SyncTests::testRefreshStatus ()
virtual void SyncTests::testUpdate ()
virtual void SyncTests::testComplexUpdate ()
virtual void SyncTests::testDelete ()
virtual void SyncTests::testMerge ()
virtual void SyncTests::testTwinning ()
virtual void SyncTests::testOneWayFromServer ()
virtual void SyncTests::testOneWayFromClient ()
virtual void SyncTests::testItems ()
virtual void SyncTests::testAddUpdate ()
virtual void SyncTests::testManyItems ()
virtual void SyncTests::doVarSizes (bool withMaxMsgSize, bool withLargeObject, const char *encoding)
virtual void SyncTests::sync (SyncMode syncMode, const std::string &logprefix="", CheckSyncReport checkReport=CheckSyncReport(), long maxMsgSize=0, long maxObjSize=0, bool loSupport=false, const char *encoding="")
virtual void ClientTest::registerTests ()
 ClientTest::ClientTest (int serverSleepSec=0, const std::string &serverLog="")
virtual ClientTest::~ClientTest ()
virtual LocalTestsClientTest::createLocalTests (const std::string &name, int sourceParam, ClientTest::Config &co)
virtual SyncTestsClientTest::createSyncTests (const std::string &name, std::vector< int > sourceIndices, bool isClientA=true)
static int ClientTest::dump (ClientTest &client, SyncSource &source, const char *file)
static int ClientTest::import (ClientTest &client, SyncSource &source, const char *file)
static bool ClientTest::compare (ClientTest &client, const char *fileA, const char *fileB)
virtual void ClientTest::postSync (int res, const std::string &logname)
static void ClientTest::getTestData (const char *type, Config &config)
virtual void CheckSyncReport::check (int res, SyncReport &report) const

Variables

ClientListener syncListener

Detailed Description


Function Documentation

void SyncTests::addTests (  )  [virtual, inherited]

void LocalTests::addTests (  )  [virtual, inherited]

adds the supported tests to the instance itself; this is the function that a derived class can override to add additional tests

adds the supported tests to the instance itself

Reimplemented in EvolutionLocalTests.

Definition at line 183 of file ClientTest.cpp.

References ADD_TEST, ClientTest::Config::childItem, ClientTest::Config::childItemUpdate, ClientTest::Config::compare, LocalTests::config, ClientTest::Config::createSourceA, ClientTest::Config::createSourceB, ClientTest::Config::dump, ClientTest::Config::import, ClientTest::Config::insertItem, ClientTest::Config::parentItem, ClientTest::Config::parentItemUpdate, ClientTest::Config::sourceKnowsItemSemantic, ClientTest::Config::templateItem, ClientTest::Config::testcases, LocalTests::testChanges(), LocalTests::testComplexInsert(), LocalTests::testImport(), LocalTests::testImportDelete(), LocalTests::testIterateTwice(), LocalTests::testLinkedItemsChild(), LocalTests::testLinkedItemsChildChangesParent(), LocalTests::testLinkedItemsChildParent(), LocalTests::testLinkedItemsInsertBothUpdateChild(), LocalTests::testLinkedItemsInsertBothUpdateParent(), LocalTests::testLinkedItemsInsertChildTwice(), LocalTests::testLinkedItemsInsertParentTwice(), LocalTests::testLinkedItemsParent(), LocalTests::testLinkedItemsParentChild(), LocalTests::testLinkedItemsParentUpdate(), LocalTests::testLinkedItemsRemoveNormal(), LocalTests::testLinkedItemsRemoveParentFirst(), LocalTests::testLinkedItemsUpdateChild(), LocalTests::testLocalDeleteAll(), LocalTests::testLocalUpdate(), LocalTests::testManyChanges(), LocalTests::testOpen(), LocalTests::testSimpleInsert(), ClientTest::Config::uniqueProperties, and ClientTest::Config::updateItem.

Referenced by ClientTestFactory::makeTest().

void CheckSyncReport::check ( int  res,
SyncReport report 
) const [virtual, inherited]

ClientTest::ClientTest ( int  serverSleepSec = 0,
const std::string &  serverLog = "" 
) [inherited]

Definition at line 2551 of file ClientTest.cpp.

Referenced by TestEvolution::sync().

bool ClientTest::compare ( ClientTest client,
const char *  fileA,
const char *  fileB 
) [static, inherited]

utility function for comparing vCard and iCal files with the external synccompare.pl Perl script

Reimplemented in TestEvolution.

Definition at line 2621 of file ClientTest.cpp.

Referenced by getTestData().

void SyncTests::compareDatabases (  )  [protected, virtual, inherited]

void LocalTests::compareDatabases ( const char *  refFile,
SyncSource copy,
bool  raiseAssert = true 
) [virtual, inherited]

takes two databases, exports them, then compares them using synccompare

Parameters:
refFile existing file with source reference items, NULL uses a dump of sync source A instead
copy a sync source which contains the copied items, begin/endSync will be called
raiseAssert raise assertion if comparison yields differences (defaults to true)

Definition at line 417 of file ClientTest.cpp.

References SyncSource::beginSync(), LocalTests::client, ClientTest::Config::compare, LocalTests::config, LocalTests::createSourceA, ClientTest::Config::dump, SyncSource::endSync(), getCurrentTest(), simplifyFilename(), SOURCE_ASSERT_EQUAL, and SOURCE_ASSERT_NO_FAILURE.

Referenced by LocalTests::testImport().

template<class T , class V >
int countEqual ( const T &  container,
const V &  value 
) [inline]

LocalTests * ClientTest::createLocalTests ( const std::string &  name,
int  sourceParam,
ClientTest::Config co 
) [virtual, inherited]

Creates an instance of LocalTests (default implementation) or a class derived from it. LocalTests provides tests which cover the SyncSource interface and can be executed without a SyncML server. It also contains utility functions for working with SyncSources.

A ClientTest implementation can, but doesn't have to extend these tests by instantiating a derived class here.

Reimplemented in TestEvolution.

Definition at line 2567 of file ClientTest.cpp.

Referenced by ClientTestFactory::makeTest(), and SyncTests::SyncTests().

SyncTests * ClientTest::createSyncTests ( const std::string &  name,
std::vector< int >  sourceIndices,
bool  isClientA = true 
) [virtual, inherited]

Creates an instance of SyncTests (default) or a class derived from it. SyncTests provides tests which cover the actual interaction with a SyncML server.

A ClientTest implementation can, but doesn't have to extend these tests by instantiating a derived class here.

Definition at line 2572 of file ClientTest.cpp.

Referenced by ClientTestFactory::makeTest(), and SyncTests::SyncTests().

void SyncTests::deleteAll ( DeleteAllMode  mode = DELETE_ALL_SYNC  )  [protected, virtual, inherited]

void LocalTests::deleteAll ( CreateSource  createSource  )  [virtual, inherited]

void SyncTests::doCopy (  )  [protected, virtual, inherited]

get both clients in sync with empty server, then copy one item from client A to B

Definition at line 1708 of file ClientTest.cpp.

References SyncTests::accessClientB, SyncTests::compareDatabases(), SyncTests::deleteAll(), SyncTests::sources, and SyncTests::sync().

Referenced by SyncTests::testComplexUpdate(), SyncTests::testCopy(), SyncTests::testDelete(), SyncTests::testMerge(), and SyncTests::testUpdate().

void SyncTests::doVarSizes ( bool  withMaxMsgSize,
bool  withLargeObject,
const char *  encoding 
) [protected, virtual, inherited]

int ClientTest::dump ( ClientTest client,
SyncSource source,
const char *  file 
) [static, inherited]

utility function for dumping items which are C strings with blank lines as separator

Definition at line 2577 of file ClientTest.cpp.

References SyncSource::getFirstItem(), SyncSource::getNextItem(), and SOURCE_ASSERT_NO_FAILURE.

Referenced by getTestData().

const string& getCurrentTest (  ) 

Definition at line 177 of file client-test-main.cpp.

References Sync4jListener::getCurrentTest(), and syncListener.

void ClientTest::getTestData ( const char *  type,
Config config 
) [static, inherited]

A derived class can use this call to get default test cases, but still has to add callbacks which create sources and execute a sync session.

Some of the test cases are compiled into the library, other depend on the auxiliary files from the "test" directory. Currently supported types:

  • vcard30 = vCard 3.0 contacts
  • vcard21 = vCard 2.1 contacts
  • ical20 = iCal 2.0 events
  • vcal10 = vCal 1.0 events
  • itodo20 = iCal 2.0 tasks

Definition at line 2657 of file ClientTest.cpp.

References ClientTest::Config::childItem, ClientTest::Config::childItemUpdate, compare(), ClientTest::Config::compare, ClientTest::Config::complexUpdateItem, dump(), ClientTest::Config::dump, ClientTest::Config::import, ClientTest::Config::insertItem, ClientTest::Config::mergeItem1, ClientTest::Config::mergeItem2, ClientTest::Config::numItems, ClientTest::Config::parentItem, ClientTest::Config::parentItemUpdate, ClientTest::Config::sizeProperty, ClientTest::Config::sourceKnowsItemSemantic, ClientTest::Config::sourceName, ClientTest::Config::templateItem, ClientTest::Config::testcases, ClientTest::Config::type, ClientTest::Config::uniqueProperties, ClientTest::Config::updateItem, and ClientTest::Config::uri.

Referenced by TestEvolution::getSourceConfig().

int ClientTest::import ( ClientTest client,
SyncSource source,
const char *  file 
) [static, inherited]

utility function for importing items with blank lines as separator

Definition at line 2591 of file ClientTest.cpp.

std::string LocalTests::insert ( CreateSource  createSource,
const char *  data,
bool  relaxed = false 
) [virtual, inherited]

int LocalTests::insertManyItems ( CreateSource  createSource,
int  startIndex = 1,
int  numItems = 0,
int  size = -1 
) [virtual, inherited]

insert artificial items, number of them determined by TEST_EVOLUTION_NUM_ITEMS unless passed explicitly

Parameters:
createSource a factory for the sync source that is to be used
startIndex IDs are generated starting with this value
numItems number of items to be inserted if non-null, otherwise TEST_EVOLUTION_NUM_ITEMS is used
size minimum size for new items
Returns:
number of items inserted
insert artificial items, number of them determined by config.numItems unless passed explicitly

Parameters:
createSource a factory for the sync source that is to be used
startIndex IDs are generated starting with this value
numItems number of items to be inserted if non-null, otherwise config.numItems is used
size minimum size for new items
Returns:
number of items inserted

Definition at line 454 of file ClientTest.cpp.

References LocalTests::config, LocalTests::createSourceA, ClientTest::Config::numItems, ClientTest::Config::sizeProperty, SOURCE_ASSERT_EQUAL, SOURCE_ASSERT_NO_FAILURE, ClientTest::Config::templateItem, and ClientTest::Config::uniqueProperties.

Referenced by LocalTests::testManyChanges().

int main ( int  argc,
char *  argv[] 
)

USE_NAMESPACE void ClientTest::postSync ( int  res,
const std::string &  logname 
) [virtual, inherited]

This is called after successful sync() calls (res == 0) as well as after unsuccessful ones (res != 1). The default implementation sleeps for the number of seconds specified when constructing this instance and copies the server log if one was named.

Parameters:
res result of sync()
logname base name of the current sync log (without ".client.[AB].log" suffix)

Definition at line 2635 of file ClientTest.cpp.

References serverLogFileName, and serverSleepSeconds.

Referenced by SyncTests::sync().

void SyncTests::refreshClient (  )  [protected, virtual, inherited]

replicate server database locally: same as SYNC_REFRESH_FROM_SERVER, but done with explicit local delete and then a SYNC_SLOW because some servers do no support SYNC_REFRESH_FROM_SERVER

Definition at line 1733 of file ClientTest.cpp.

References SyncTests::sources, and SyncTests::sync().

Referenced by SyncTests::testAddUpdate(), SyncTests::testItems(), SyncTests::testManyItems(), SyncTests::testOneWayFromServer(), and SyncTests::testTwinning().

void ClientTest::registerTests (  )  [virtual, inherited]

This function registers tests using this instance of ClientTest for later use during a test run.

The instance must remain valid until after the tests were run. To run them use a separate test runner, like the one from client-test-main.cpp.

Definition at line 2545 of file ClientTest.cpp.

void simplifyFilename ( string &  filename  ) 

Definition at line 68 of file client-test-main.cpp.

void SyncTests::sync ( SyncMode  syncMode,
const std::string &  logprefix = "",
CheckSyncReport  checkReport = CheckSyncReport(),
long  maxMsgSize = 0,
long  maxObjSize = 0,
bool  loSupport = false,
const char *  encoding = "" 
) [protected, virtual, inherited]

SyncTests::SyncTests ( const std::string &  name,
ClientTest cl,
std::vector< int >  sourceIndices,
bool  isClientA = true 
) [inherited]

void SyncTests::testAddUpdate (  )  [protected, virtual, inherited]

void LocalTests::testChanges (  )  [virtual, inherited]

void LocalTests::testComplexInsert (  )  [virtual, inherited]

void SyncTests::testComplexUpdate (  )  [protected, virtual, inherited]

void SyncTests::testDelete (  )  [protected, virtual, inherited]

void SyncTests::testDeleteAllRefresh (  )  [protected, virtual, inherited]

void LocalTests::testImport (  )  [virtual, inherited]

void LocalTests::testImportDelete (  )  [virtual, inherited]

Definition at line 770 of file ClientTest.cpp.

References LocalTests::testImport(), and LocalTests::testLocalDeleteAll().

Referenced by LocalTests::addTests().

void SyncTests::testItems (  )  [protected, virtual, inherited]

void LocalTests::testIterateTwice (  )  [virtual, inherited]

void LocalTests::testLinkedItemsChild (  )  [virtual, inherited]

void LocalTests::testLinkedItemsChildChangesParent (  )  [virtual, inherited]

void LocalTests::testLinkedItemsChildParent (  )  [virtual, inherited]

void LocalTests::testLinkedItemsInsertBothUpdateChild (  )  [virtual, inherited]

void LocalTests::testLinkedItemsInsertBothUpdateParent (  )  [virtual, inherited]

void LocalTests::testLinkedItemsInsertChildTwice (  )  [virtual, inherited]

void LocalTests::testLinkedItemsInsertParentTwice (  )  [virtual, inherited]

void LocalTests::testLinkedItemsParent (  )  [virtual, inherited]

void LocalTests::testLinkedItemsParentChild (  )  [virtual, inherited]

void LocalTests::testLinkedItemsParentUpdate (  )  [virtual, inherited]

void LocalTests::testLinkedItemsRemoveNormal (  )  [virtual, inherited]

void LocalTests::testLinkedItemsRemoveParentFirst (  )  [virtual, inherited]

void LocalTests::testLinkedItemsUpdateChild (  )  [virtual, inherited]

void LocalTests::testLocalDeleteAll (  )  [virtual, inherited]

void LocalTests::testLocalUpdate (  )  [virtual, inherited]

void LocalTests::testManyChanges (  )  [virtual, inherited]

void SyncTests::testManyItems (  )  [protected, virtual, inherited]

void SyncTests::testMerge (  )  [protected, virtual, inherited]

void SyncTests::testOneWayFromClient (  )  [protected, virtual, inherited]

void SyncTests::testOneWayFromServer (  )  [protected, virtual, inherited]

void LocalTests::testOpen (  )  [virtual, inherited]

void SyncTests::testRefreshSemantic (  )  [protected, virtual, inherited]

void SyncTests::testRefreshStatus (  )  [protected, virtual, inherited]

Definition at line 1810 of file ClientTest.cpp.

References SyncTests::sources, and SyncTests::sync().

Referenced by SyncTests::addTests().

void LocalTests::testSimpleInsert (  )  [virtual, inherited]

void SyncTests::testTwinning (  )  [protected, virtual, inherited]

void SyncTests::testUpdate (  )  [protected, virtual, inherited]

void LocalTests::update ( CreateSource  createSource,
const char *  data,
bool  check = true 
) [virtual, inherited]

assumes that exactly one element is currently inserted and updates it with the given item

The type of the item is cleared, as in insert() above.

Parameters:
check if true, then reopen the source and verify that the reported items are as expected
assumes that exactly one element is currently inserted and updates it with the given item

The type of the item is cleared, as in insert() above.

Definition at line 325 of file ClientTest.cpp.

References CreateSource::createSource, LocalTests::source, SOURCE_ASSERT, SOURCE_ASSERT_EQUAL, and SOURCE_ASSERT_NO_FAILURE.

Referenced by LocalTests::testChanges(), and LocalTests::testLocalUpdate().

ClientTest::~ClientTest (  )  [virtual, inherited]

Definition at line 2558 of file ClientTest.cpp.

SyncTests::~SyncTests (  )  [inherited]


Variable Documentation


Generated on Sat Oct 18 17:17:02 2008 for SyncEvolution and Funambol by  doxygen 1.5.7.1