testing: use target-config@client-test-$CLIENT_TEST_SERVER for Client::Source

For testing sources instantiated via SyncSource.cpp (for example, EDS)
and client-test-app.cpp (ActiveSync) append the name of the server set
via the CLIENT_TEST_SERVER env variable to target-config@client-test,
separated by a hyphen.

This allows configuring testing differently for different servers.
Was already done for CalDAV sources, inside WebDAVSourceRegister.cpp.
This commit is contained in:
Patrick Ohly 2011-08-15 17:32:01 +02:00
parent 40bbb59028
commit 24efbe11db
2 changed files with 14 additions and 2 deletions

View File

@ -515,7 +515,13 @@ private:
/** called internally in this class */
TestingSyncSource *createNamedSource(const string &name, bool isSourceA) {
string database = getDatabaseName(name);
boost::shared_ptr<SyncConfig> context(new SyncConfig("target-config@client-test"));
std::string config = "target-config@client-test";
const char *server = getenv("CLIENT_TEST_SERVER");
if (server) {
config += "-";
config += server;
}
boost::shared_ptr<SyncConfig> context(new SyncConfig(config));
SyncSourceNodes nodes = context->getSyncSourceNodes(name,
string("_") + m_clientID +
"_" + (isSourceA ? "A" : "B"));

View File

@ -372,7 +372,13 @@ SyncSource *SyncSource::createSource(const SyncSourceParams &params, bool error,
SyncSource *SyncSource::createTestingSource(const string &name, const string &type, bool error,
const char *prefix)
{
boost::shared_ptr<SyncConfig> context(new SyncConfig("target-config@client-test"));
std::string config = "target-config@client-test";
const char *server = getenv("CLIENT_TEST_SERVER");
if (server) {
config += "-";
config += server;
}
boost::shared_ptr<SyncConfig> context(new SyncConfig(config));
SyncSourceNodes nodes = context->getSyncSourceNodes(name);
SyncSourceParams params(name, nodes, context);
PersistentSyncSourceConfig sourceconfig(name, nodes);