From 4135afb8bc2b07730a05d679ebf8e6bd7ee2dde5 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 12 Nov 2009 21:19:03 +0100 Subject: [PATCH] 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. --- src/syncevo/Cmdline.cpp | 11 +++++++++++ src/syncevo/SyncConfig.cpp | 21 ++++++++++++--------- src/syncevo/SyncConfig.h | 4 ++-- src/syncevo/SynthesisDBPlugin.cpp | 2 +- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/syncevo/Cmdline.cpp b/src/syncevo/Cmdline.cpp index 004afdb5..949b56ce 100644 --- a/src/syncevo/Cmdline.cpp +++ b/src/syncevo/Cmdline.cpp @@ -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, diff --git a/src/syncevo/SyncConfig.cpp b/src/syncevo/SyncConfig.cpp index a6b59aa0..afca6331 100644 --- a/src/syncevo/SyncConfig.cpp +++ b/src/syncevo/SyncConfig.cpp @@ -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; } diff --git a/src/syncevo/SyncConfig.h b/src/syncevo/SyncConfig.h index d56b23ef..3974db4c 100644 --- a/src/syncevo/SyncConfig.h +++ b/src/syncevo/SyncConfig.h @@ -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). diff --git a/src/syncevo/SynthesisDBPlugin.cpp b/src/syncevo/SynthesisDBPlugin.cpp index d6af20a9..0f8b4c6a 100644 --- a/src/syncevo/SynthesisDBPlugin.cpp +++ b/src/syncevo/SynthesisDBPlugin.cpp @@ -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 */