ActiveSync: fixed change tracking in testing
When testing with "Client::Source::*::testChanges", two different accounts must be used. Otherwise the two simulated SyncEvolution clients share the same sync keys and testing fails. The solution is to switch to a different account, derived by appending _B to the original account ID, for the second client. With this fix, the testing continues. But it also needs change in client-test itself: "testChanges" had a check that all items can be read, which is not the case for ActiveSync because there unmodified item data is not available. activesyncd commit ID: 6300b3ea9184e114b521ef2e5eafda476c836e5c
This commit is contained in:
parent
b07b80677c
commit
24665a97c9
|
@ -261,7 +261,7 @@ void ActiveSyncSource::readItem(const std::string &luid, std::string &item)
|
|||
// return straight from cache
|
||||
std::map<std::string, std::string>::iterator it = m_items.find(luid);
|
||||
if (it == m_items.end()) {
|
||||
throwError("internal error: item data not available");
|
||||
throwError(std::string("internal error: item data for ") + luid + " not available");
|
||||
}
|
||||
item = it->second;
|
||||
}
|
||||
|
|
|
@ -113,8 +113,14 @@ class ActiveSyncSource :
|
|||
m_ids(new PrefixConfigNode("item-",
|
||||
boost::shared_ptr<ConfigNode>(new SafeConfigNode(params.m_nodes.getTrackingNode()))))
|
||||
{
|
||||
if (!m_context) {
|
||||
m_context.reset(new SyncConfig());
|
||||
}
|
||||
}
|
||||
|
||||
/** sync config used by this instance, never NULL */
|
||||
SyncConfig &getSyncConfig() { return *m_context; }
|
||||
|
||||
protected:
|
||||
|
||||
/* partial implementation of SyncSource */
|
||||
|
|
|
@ -133,6 +133,17 @@ static TestingSyncSource *createEASSource(const ClientTestConfig::createsource_t
|
|||
ClientTest &client, int source, bool isSourceA)
|
||||
{
|
||||
TestingSyncSource *res = create(client, source, isSourceA);
|
||||
|
||||
// Mangle username: if the base username in the config is account
|
||||
// "foo", then source B uses "foo_B", because otherwise it'll end
|
||||
// up sharing change tracking with source A.
|
||||
if (!isSourceA) {
|
||||
ActiveSyncSource *eassource = static_cast<ActiveSyncSource *>(res);
|
||||
std::string account = eassource->getSyncConfig().getSyncUsername();
|
||||
account += "_B";
|
||||
eassource->getSyncConfig().setSyncUsername(account, true);
|
||||
}
|
||||
|
||||
if (boost::ends_with(res->getDatabaseID(), "_1")) {
|
||||
// only default database currently supported,
|
||||
// use that instead of first named database
|
||||
|
|
|
@ -61,8 +61,14 @@ $ syncevolution exchange calendar
|
|||
Backend Testing
|
||||
===============
|
||||
|
||||
In addition to an activesyncd account called <EAS account ID> (usually
|
||||
an email adddress), also create an activesyncd account called <EAS
|
||||
account ID>_B ("_B" appended) with the same settings. This is required
|
||||
for Client::Source::*::testChanges, which must simulate two
|
||||
independent ActiveSync clients.
|
||||
|
||||
Configure "local" testing (backend is covered, no syncing involved):
|
||||
./syncevolution --configure username=<email adddress identifying the account> \
|
||||
./syncevolution --configure username=<EAS account ID> \
|
||||
--template SyncEvolution target-config@client-test
|
||||
|
||||
On MeeGo:
|
||||
|
|
Loading…
Reference in New Issue