ActiveSync: improved testImport for ActiveSyncCalendarSource
Instead of reading individual VEVENTs through ActiveSyncCalendarSource, go directly to the activesyncd via ActiveSyncSource. That cuts out the middle-man and will help to reveal bugs in it. activesyncd commit ID: ddefe1cfe9e92948b6d1dd4779b259a11c184341
This commit is contained in:
parent
ee0d351843
commit
063315da05
|
@ -66,12 +66,13 @@ class ActiveSyncCalendarSource : public ActiveSyncCalFormatSource
|
|||
virtual InsertItemResult insertItem(const std::string &luid, const std::string &item);
|
||||
virtual void readItem(const std::string &luid, std::string &item);
|
||||
|
||||
/** split luid into uid (first) and rid (second) */
|
||||
static StringPair splitLUID(const std::string &luid);
|
||||
|
||||
private:
|
||||
/** compose luid from mainid and subid */
|
||||
static std::string createLUID(const std::string &uid, const std::string &rid);
|
||||
|
||||
/** split luid into uid (first) and rid (second) */
|
||||
static StringPair splitLUID(const std::string &luid);
|
||||
/** escape / in uid with %2F, so that splitMainIDValue() and splitLUID() can use / as separator */
|
||||
static StringEscape m_escape;
|
||||
|
||||
|
|
|
@ -146,9 +146,22 @@ static int DumpItems(ClientTest &client, TestingSyncSource &source, const char *
|
|||
{
|
||||
ActiveSyncSource &eassource = static_cast<ActiveSyncSource &>(source);
|
||||
ofstream out(file);
|
||||
BOOST_FOREACH (const std::string &easid, eassource.getAllItems()) {
|
||||
|
||||
// find all ActiveSync server IDs: in ActiveSyncCalendarSource,
|
||||
// each server ID might appear multiple times, once for each
|
||||
// recurrence associated with it
|
||||
std::set<std::string> easids;
|
||||
BOOST_FOREACH (const std::string &luid, eassource.getAllItems()) {
|
||||
// slight hack: we know that luids in ActiveSyncSource base
|
||||
// class pass through this method unmodified, so no need to
|
||||
// avoid it
|
||||
StringPair ids = ActiveSyncCalendarSource::splitLUID(luid);
|
||||
easids.insert(ids.first);
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const std::string &easid, easids) {
|
||||
std::string item;
|
||||
eassource.readItem(easid, item);
|
||||
eassource.ActiveSyncSource::readItem(easid, item);
|
||||
out << item << '\n';
|
||||
if (!boost::ends_with(item, "\n")) {
|
||||
out << '\n';
|
||||
|
|
Loading…
Reference in a new issue