server config: fixed tests and code for new config options

The Cmdline tests hadn't been updated together with adding the
new options and therefore failed. New properties must be added
to the reference config m_scheduleWorldConfig and new internal
properties also to the props list in testOldConfigure.

While checking the test failures, the following problems were found
and fixed:
- "adminData" property name was used for both sync and source property.
  The sync property stores Synthesis device information and was
  renamed to "deviceData" to avoid confusion. SyncConfig API calls
  renamed accordingly. Property instance now follows syncProp* naming
  convention.
- The source "adminData" property was not declared as "hidden"
  and therefore showed up in the user-visible config.ini files
  and --print-config output. The real value set/get in SyncSourceAdmin
  was done correctly via the m_hiddenNode.
This commit is contained in:
Patrick Ohly 2009-11-12 21:19:03 +01:00
parent c48907f757
commit 4135afb8bc
4 changed files with 26 additions and 12 deletions

View file

@ -1090,6 +1090,9 @@ public:
m_testDir("CmdlineTest"),
m_scheduleWorldConfig(".internal.ini:# HashCode = 0\n"
".internal.ini:# ConfigDate = \n"
".internal.ini:# remoteDeviceId = \n"
".internal.ini:# lastNonce = \n"
".internal.ini:# deviceData = \n"
"config.ini:syncURL = http://sync.scheduleworld.com/funambol/ds\n"
"config.ini:username = your SyncML server account name\n"
"config.ini:password = your SyncML server password\n"
@ -1116,6 +1119,7 @@ public:
"config.ini:# IconURI = \n"
"config.ini:ConsumerReady = 1\n"
"sources/addressbook/.internal.ini:# last = 0\n"
"sources/addressbook/.internal.ini:# adminData = \n"
"sources/addressbook/config.ini:sync = two-way\n"
"sources/addressbook/config.ini:type = addressbook:text/vcard\n"
"sources/addressbook/config.ini:# evolutionsource = \n"
@ -1123,6 +1127,7 @@ public:
"sources/addressbook/config.ini:# evolutionuser = \n"
"sources/addressbook/config.ini:# evolutionpassword = \n"
"sources/calendar/.internal.ini:# last = 0\n"
"sources/calendar/.internal.ini:# adminData = \n"
"sources/calendar/config.ini:sync = two-way\n"
"sources/calendar/config.ini:type = calendar\n"
"sources/calendar/config.ini:# evolutionsource = \n"
@ -1130,6 +1135,7 @@ public:
"sources/calendar/config.ini:# evolutionuser = \n"
"sources/calendar/config.ini:# evolutionpassword = \n"
"sources/memo/.internal.ini:# last = 0\n"
"sources/memo/.internal.ini:# adminData = \n"
"sources/memo/config.ini:sync = two-way\n"
"sources/memo/config.ini:type = memo\n"
"sources/memo/config.ini:# evolutionsource = \n"
@ -1137,6 +1143,7 @@ public:
"sources/memo/config.ini:# evolutionuser = \n"
"sources/memo/config.ini:# evolutionpassword = \n"
"sources/todo/.internal.ini:# last = 0\n"
"sources/todo/.internal.ini:# adminData = \n"
"sources/todo/config.ini:sync = two-way\n"
"sources/todo/config.ini:type = todo\n"
"sources/todo/config.ini:# evolutionsource = \n"
@ -1602,6 +1609,10 @@ protected:
"devInfoHash" +
"HashCode" +
"ConfigDate" +
"deviceData" +
"adminData" +
"remoteDeviceId" +
"lastNonce" +
"last";
BOOST_FOREACH(string &prop, props) {
boost::replace_all(oldConfig,

View file

@ -611,8 +611,10 @@ static SafeConfigProperty syncPropRemoteDevID("remoteDeviceId",
"ID of our peer, empty if unknown; do not edit, used internally");
static SafeConfigProperty syncPropNonce("lastNonce",
"MD5 nonce of our peer, empty if not set yet; do not edit, used internally");
static SafeConfigProperty syncPropAdminData("adminData",
"Synthesis per-peer admin data; do not edit, used internally");
// used both as source and sync property, internal in both cases
static SafeConfigProperty syncPropDeviceData("deviceData",
"information about the peer in a Synthesis internal-format");
ConfigPropertyRegistry &SyncConfig::getRegistry()
{
@ -657,8 +659,8 @@ ConfigPropertyRegistry &SyncConfig::getRegistry()
syncPropRemoteDevID.setHidden(true);
registry.push_back(&syncPropNonce);
syncPropNonce.setHidden(true);
registry.push_back(&syncPropAdminData);
syncPropAdminData.setHidden(true);
registry.push_back(&syncPropDeviceData);
syncPropDeviceData.setHidden(true);
initialized = true;
}
@ -889,8 +891,8 @@ string SyncConfig::getRemoteDevID() const { return syncPropRemoteDevID.getProper
void SyncConfig::setRemoteDevID(const string &value) { syncPropRemoteDevID.setProperty(*m_hiddenNode, value); }
string SyncConfig::getNonce() const { return syncPropNonce.getProperty(*m_hiddenNode); }
void SyncConfig::setNonce(const string &value) { syncPropNonce.setProperty(*m_hiddenNode, value); }
string SyncConfig::getAdminData() const { return syncPropAdminData.getProperty(*m_hiddenNode); }
void SyncConfig::setAdminData(const string &value) { syncPropAdminData.setProperty(*m_hiddenNode, value); }
string SyncConfig::getDeviceData() const { return syncPropDeviceData.getProperty(*m_hiddenNode); }
void SyncConfig::setDeviceData(const string &value) { syncPropDeviceData.setProperty(*m_hiddenNode, value); }
std::string SyncConfig::findSSLServerCertificate()
{
@ -1179,8 +1181,8 @@ static EvolutionPasswordConfigProperty sourcePropPassword("evolutionpassword", "
static ULongConfigProperty sourcePropLast("last",
"used by the SyncML library internally; do not modify");
static ConfigProperty sourceAdminData(SourceAdminDataName,
"used by the Synthesis library internally; do not modify");
static ConfigProperty sourcePropAdminData(SourceAdminDataName,
"used by the Synthesis library internally; do not modify");
ConfigPropertyRegistry &SyncSourceConfig::getRegistry()
{
@ -1197,7 +1199,8 @@ ConfigPropertyRegistry &SyncSourceConfig::getRegistry()
registry.push_back(&sourcePropPassword);
registry.push_back(&sourcePropLast);
sourcePropLast.setHidden(true);
registry.push_back(&sourceAdminData);
registry.push_back(&sourcePropAdminData);
sourcePropAdminData.setHidden(true);
initialized = true;
}

View file

@ -1068,8 +1068,8 @@ class SyncConfig {
* The opaque per-peer admin data managed by the Synthesis
* engine. Only used when acting as server.
*/
virtual string getAdminData() const;
virtual void setAdminData(const string &value);
virtual string getDeviceData() const;
virtual void setDeviceData(const string &value);
/**
* Specifies whether WBXML is to be used (default).

View file

@ -268,7 +268,7 @@ TSyError SyncEvolution_Session_SaveDeviceInfo( CContext sContext, cAppCharP aDev
}
SE_LOG_DEBUG(NULL, NULL, "Session_SaveDeviceInfo info='%s'",
aDeviceInfo );
sc->setAdminData(aDeviceInfo);
sc->setDeviceData(aDeviceInfo);
sc->flush();
return LOCERR_OK;
} /* Session_SaveDeviceInfo */