}
}
- void reset(TestingSyncSource *source = NULL)
+ enum Flags {
+ SLOW, /**< erase anchor, start accessing database from scratch */
+ INCREMENTAL /**< allow source to do incremental data read */
+ };
+
+ void reset(TestingSyncSource *source = NULL, Flags flags = INCREMENTAL)
{
if (get() && m_active) {
stopAccess();
base_t::reset(source);
}
if (source) {
- startAccess();
+ startAccess(flags);
}
}
* done automatically as part of reset(), only to be called
* after an explicit stopAccess()
*/
- void startAccess()
+ void startAccess(Flags flags = INCREMENTAL)
{
CT_ASSERT(get());
CT_ASSERT(!m_active);
CT_ASSERT_NO_THROW(get()->open());
string node = get()->getTrackingNode()->getName();
string anchor = m_anchors[node];
+ if (flags == SLOW) {
+ anchor = "";
+ }
get()->beginSync(anchor, "");
if (isServerMode()) {
CT_ASSERT_NO_THROW(get()->enableServerMode());
backupStorage(config, client);
CT_ASSERT_NO_THROW(source.reset());
- // export again and compare against original file
+ // export again and compare against original file,
+ // without relying on change tracking (because
+ // Google ActiveSync has problems with Fetch,
+ // which would be needed for a data dump when
+ // using the incremental approach)
TestingSyncSourcePtr copy;
- SOURCE_ASSERT_NO_FAILURE(copy.get(), copy.reset(createSourceA()));
+ SOURCE_ASSERT_NO_FAILURE(copy.get(), copy.reset(createSourceA(), TestingSyncSourcePtr::SLOW));
bool equal = compareDatabases(testcases.c_str(), *copy.get(), false);
CT_ASSERT_NO_THROW(source.reset());
// compare
TestingSyncSourcePtr copy;
- SOURCE_ASSERT_NO_FAILURE(copy.get(), copy.reset(createSourceA()));
+ SOURCE_ASSERT_NO_FAILURE(copy.get(), copy.reset(createSourceA(), TestingSyncSourcePtr::SLOW));
bool equal = compareDatabases(updated.c_str(), *copy.get(), false);
CT_ASSERT_NO_THROW(source.reset());
FullProps props = context.getConfigProps();
string target = url.substr(strlen("local://"));
props[target].m_syncProps["syncURL"] = fakeURL;
- props[target].m_syncProps["retryDuration"] = "10";
- props[target].m_syncProps["retryInterval"] = "10";
+ props[target].m_syncProps["retryDuration"] = InitStateString("10", true);
+ props[target].m_syncProps["retryInterval"] = InitStateString("10", true);
context.setConfigProps(props);
return false;
} else {