diff --git a/sflphone-common/src/config/config.cpp b/sflphone-common/src/config/config.cpp index 839c992020a885ca1369f1d7ff5f2d5de533a60c..2c4c68dc45d1f158b4b9e6b5551caa0bd7662c09 100644 --- a/sflphone-common/src/config/config.cpp +++ b/sflphone-common/src/config/config.cpp @@ -273,6 +273,8 @@ ConfigTree::setConfigTreeItem (const std::string& section, bool ConfigTree::saveConfigTree (const std::string& fileName) { + _debug ("ConfigTree: Save %s", fileName.c_str()); + if (fileName.empty() && _sections.begin() == _sections.end()) { return false; } @@ -321,6 +323,8 @@ ConfigTree::populateFromFile (const std::string& fileName) { bool out = false; + _debug ("ConfigTree: Populate from file %s", fileName.c_str()); + if (fileName.empty()) { return 0; } @@ -378,6 +382,7 @@ ConfigTree::populateFromFile (const std::string& fileName) val = line.substr (pos + 1, line.length() - pos); if (key.length() > 0 && val.length() > 0) { + _debug ("setconfigtreeitem %s, %s", section.c_str(), val.c_str()); setConfigTreeItem (section, key, val); } diff --git a/sflphone-common/src/history/historymanager.cpp b/sflphone-common/src/history/historymanager.cpp index 909f20fd06945ed9a1f0a6022280df1569667493..57a70f8459fa76f51b13c10a89f5419bdd86b23d 100644 --- a/sflphone-common/src/history/historymanager.cpp +++ b/sflphone-common/src/history/historymanager.cpp @@ -77,12 +77,14 @@ bool HistoryManager::save_history (void) bool HistoryManager::load_history_from_file (Conf::ConfigTree *history_list) { - bool exist; + int exist; - exist = history_list->populateFromFile (_history_path); + _debug ("HistoryManager: Load history from file %s", _history_path.c_str()); + + exist = history_list->populateFromFile (_history_path.c_str()); _history_loaded = (exist == 2) ? false : true; - return exist; + return _history_loaded; } int HistoryManager::load_history_items_map (Conf::ConfigTree *history_list, int limit) @@ -97,6 +99,8 @@ int HistoryManager::load_history_items_map (Conf::ConfigTree *history_list, int int history_limit; time_t current_timestamp; + _debug ("HistoryManager: Load history items"); + // We want to save only the items recent enough (ie compared to CONFIG_HISTORY_LIMIT) // Get the current timestamp (void) time (¤t_timestamp); diff --git a/sflphone-common/test/configurationtest.cpp b/sflphone-common/test/configurationtest.cpp index 85abfe2a197c1acc9e23484489446206c4a63546..e79fc1d07eefe62e2bc6230d9217ed2538f2fc60 100644 --- a/sflphone-common/test/configurationtest.cpp +++ b/sflphone-common/test/configurationtest.cpp @@ -154,12 +154,9 @@ void ConfigurationTest::testYamlParser() try { - parser = new Conf::YamlParser ("sequence2.yml"); - + parser = new Conf::YamlParser ("ymlParser.yml"); parser->serializeEvents(); - parser->composeEvents(); - parser->constructNativeData(); delete parser; @@ -276,7 +273,7 @@ void ConfigurationTest::testYamlEmitter() tlsmap.setKeyValue (verifyServerKey, &verifyserver); try { - emitter = new Conf::YamlEmitter ("/tmp/sequenceEmiter.txt"); + emitter = new Conf::YamlEmitter ("/tmp/ymlEmiter.txt"); emitter->serializeAccount (&accountmap); emitter->serializeAccount (&accountmap); diff --git a/sflphone-common/test/constants.h b/sflphone-common/test/constants.h index 15bcd858601f5ff875c88ad956f8f234dc801cde..9272bfd7a86ce880201978b55996e88edcecff86 100644 --- a/sflphone-common/test/constants.h +++ b/sflphone-common/test/constants.h @@ -33,9 +33,9 @@ #define YES_STR "1" #define NO_STR "0" -#define HISTORY_SAMPLE "history-sample" +#define HISTORY_SAMPLE "history-sample.tpl" #define HISTORY_SAMPLE_SIZE 3 #define CONFIG_SAMPLE "sflphoned-sample.yml" -#define HUGE_HISTORY_LIMIT 20000 +#define HUGE_HISTORY_LIMIT 999999999 #endif /* CONSTANTS_H_ */ diff --git a/sflphone-common/test/history-sample b/sflphone-common/test/history-sample deleted file mode 100644 index a6f39f4ed3316e02f1d5d3b750efc16ad43276d5..0000000000000000000000000000000000000000 --- a/sflphone-common/test/history-sample +++ /dev/null @@ -1,21 +0,0 @@ -[144562436] -accountid= -name=Savoir-faire Linux -number=514-276-5468 -timestamp_stop=144562458 -type=0 - -[747638685] -accountid=Account:1239059899 -name=Emmanuel Milou -number=136 -timestamp_stop=747638765 -type=2 - -[775354456] -accountid=Account:43789459478 -name= -number=5143848557 -timestamp_stop=775354987 -type=1 - diff --git a/sflphone-common/test/history-sample.tpl b/sflphone-common/test/history-sample.tpl index 221e449538f4d36e20f35bcb1c6d0dc1721e515e..a6f39f4ed3316e02f1d5d3b750efc16ad43276d5 100644 --- a/sflphone-common/test/history-sample.tpl +++ b/sflphone-common/test/history-sample.tpl @@ -1,20 +1,21 @@ [144562436] -number=514-276-5468 +accountid= name=Savoir-faire Linux -type=0 +number=514-276-5468 timestamp_stop=144562458 -accountid= +type=0 [747638685] +accountid=Account:1239059899 name=Emmanuel Milou -timestamp_stop=747638765 number=136 +timestamp_stop=747638765 type=2 -accountid=Account:1239059899 [775354456] -number=5143848557 +accountid=Account:43789459478 name= +number=5143848557 timestamp_stop=775354987 type=1 -accountid=Account:43789459478 + diff --git a/sflphone-common/test/historytest.h b/sflphone-common/test/historytest.h index 84b1e7a5ec5a7720f7d3956180e36b034ef0ca8f..fac450afdfb0783b9bb770c48670501a2dc41f9b 100644 --- a/sflphone-common/test/historytest.h +++ b/sflphone-common/test/historytest.h @@ -54,13 +54,13 @@ class HistoryTest : public CppUnit::TestCase { */ CPPUNIT_TEST_SUITE (HistoryTest); CPPUNIT_TEST (test_create_history_path); - CPPUNIT_TEST (test_save_history_to_file); CPPUNIT_TEST (test_save_history_items_map); CPPUNIT_TEST (test_load_history_from_file); CPPUNIT_TEST (test_load_history_items_map); CPPUNIT_TEST (test_get_history_serialized); CPPUNIT_TEST (test_set_serialized_history); CPPUNIT_TEST (test_set_serialized_history_with_limit); + CPPUNIT_TEST (test_save_history_to_file); CPPUNIT_TEST_SUITE_END (); public: diff --git a/sflphone-common/test/sequence.yml b/sflphone-common/test/sequence.yml deleted file mode 100755 index 9cb54dd63661ab25b6255cb23ae414259c8bb91f..0000000000000000000000000000000000000000 --- a/sflphone-common/test/sequence.yml +++ /dev/null @@ -1,22 +0,0 @@ -accounts: - - id: 1234 - alias: sfl-181 - username: 181 - password: sfl-181pw - hostname: sflphone.org - enable: true - type: sip - - - id: 2345 - alias: sfl-431 - username: 431 - password: alexandre - hostname: 192.168.50.3 - enable: true - type: sip - - - - - - diff --git a/sflphone-common/test/sequence2.yml b/sflphone-common/test/ymlParser.yml similarity index 100% rename from sflphone-common/test/sequence2.yml rename to sflphone-common/test/ymlParser.yml