summaryrefslogtreecommitdiff
path: root/src/components/functional_module
diff options
context:
space:
mode:
authorAlexander Kutsan <akutsan@luxoft.com>2017-09-05 21:29:24 +0300
committerAlexander Kutsan <akutsan@luxoft.com>2017-09-05 22:20:02 +0300
commit8666f1de67f6d5a355128165a5343ab8e0106239 (patch)
tree23216696d2eb29e49e37e1704105863ccef09821 /src/components/functional_module
parentd084df4e9baf485475a66180ef4c37dfa59e06c7 (diff)
downloadsdl_core-8666f1de67f6d5a355128165a5343ab8e0106239.tar.gz
Remove unused Settinng class
Diffstat (limited to 'src/components/functional_module')
-rw-r--r--src/components/functional_module/CMakeLists.txt1
-rw-r--r--src/components/functional_module/include/functional_module/settings.h125
-rw-r--r--src/components/functional_module/src/settings.cc64
-rw-r--r--src/components/functional_module/test/CMakeLists.txt3
-rw-r--r--src/components/functional_module/test/src/settings_test.cc72
-rw-r--r--src/components/functional_module/test/test.ini33
6 files changed, 0 insertions, 298 deletions
diff --git a/src/components/functional_module/CMakeLists.txt b/src/components/functional_module/CMakeLists.txt
index 255742b86f..07db91fc38 100644
--- a/src/components/functional_module/CMakeLists.txt
+++ b/src/components/functional_module/CMakeLists.txt
@@ -39,7 +39,6 @@ include_directories (
set (SOURCES
./src/generic_module.cc
./src/plugin_manager.cc
- ./src/settings.cc
./src/timer/timer_director.cc
)
set (LIBRARIES
diff --git a/src/components/functional_module/include/functional_module/settings.h b/src/components/functional_module/include/functional_module/settings.h
deleted file mode 100644
index 9c63f087cf..0000000000
--- a/src/components/functional_module/include/functional_module/settings.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2017, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_SETTINGS_H_
-#define SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_SETTINGS_H_
-
-#include <string>
-#include <sstream>
-#include "json/json.h"
-#include "utils/macro.h"
-
-namespace functional_modules {
-
-/*
- * @brief Settings class reads configuration for app from
- * default location - smartDeviceLink.ini - or set location
- * and provides access to them basing on template methods.
- */
-class Settings {
- public:
- /*
- * @brief Constrctor
- */
- Settings();
-
- /*
- * @brief Destructor
- */
- virtual ~Settings();
-
- /*
- * @brief Template method reads value from config file
- * stored under param_name in section_name paragraph
- * @param section_name Section name i.e [HMI]
- * @param param_name Parameter name i.e. ServerAddress
- * @returns True if value was read from config file, false otherwise
- */
- template <class T>
- bool ReadParameter(const std::string& section_name,
- const std::string& param_name,
- T* param_value) const;
-
- /*
- * @brief Template method reads value from config file
- * stored under param_name in [MAIN] paragraph
- * @param param_name Parameter name i.e. ServerAddress
- * @returns True if value was read from config file, false otherwise
- */
- template <class T>
- bool ReadParameter(const std::string& param_name, T* param_value) const;
-
- /*
- * @brief Changes path to configuration file
- * @param new_path Path to config file
- */
- void ChangeConfigFile(const std::string& new_path);
-
- protected:
- virtual std::string ReadParameter(const std::string& section_name,
- const std::string& param_name) const;
-
- private:
- const std::string kConfigFile_;
- std::string config_file_;
-};
-
-template <class T>
-bool Settings::ReadParameter(const std::string& section_name,
- const std::string& param_name,
- T* param_value) const {
- DCHECK(param_value);
- bool result = false;
- if (!param_value) {
- return result;
- }
-
- std::string param_string = ReadParameter(section_name, param_name);
-
- if (!param_string.empty()) {
- std::stringstream stream(param_string);
- stream >> (*param_value);
- result = true;
- }
-
- return result;
-}
-
-template <class T>
-bool Settings::ReadParameter(const std::string& param_name,
- T* param_value) const {
- return ReadParameter<T>("MAIN", param_name, param_value);
-}
-
-} // namespace functional_modules
-
-#endif // SRC_COMPONENTS_FUNCTIONAL_MODULE_INCLUDE_FUNCTIONAL_MODULE_SETTINGS_H_
diff --git a/src/components/functional_module/src/settings.cc b/src/components/functional_module/src/settings.cc
deleted file mode 100644
index 16e96000af..0000000000
--- a/src/components/functional_module/src/settings.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2017, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "functional_module/settings.h"
-#include "config_profile/ini_file.h"
-
-namespace functional_modules {
-
-Settings::Settings() : kConfigFile_("smartDeviceLink.ini") {
- config_file_ = kConfigFile_;
-}
-
-Settings::~Settings() {
- config_file_ = "";
-}
-
-void Settings::ChangeConfigFile(const std::string& new_path) {
- config_file_ = new_path;
-}
-
-std::string Settings::ReadParameter(const std::string& section_name,
- const std::string& param_name) const {
- std::string result;
- char param_string[INI_LINE_LEN + 1];
- param_string[0] = '\0';
- if (0 != profile::ini_read_value(config_file_.c_str(),
- section_name.c_str(),
- param_name.c_str(),
- param_string)) {
- result = param_string;
- }
- return result;
-}
-
-} // namespace functional_modules
diff --git a/src/components/functional_module/test/CMakeLists.txt b/src/components/functional_module/test/CMakeLists.txt
index e1cb673252..c4e966c84e 100644
--- a/src/components/functional_module/test/CMakeLists.txt
+++ b/src/components/functional_module/test/CMakeLists.txt
@@ -31,7 +31,6 @@ set(SOURCES
./src/generic_module_test.cc
./src/plugin_manager_test.cc
./src/module_timer_test.cc
- ./src/settings_test.cc
)
# use, i.e. don't skip the full RPATH for the build tree
@@ -49,8 +48,6 @@ SET(RPATH_DIRECTORIES
SET(CMAKE_INSTALL_RPATH "${RPATH_DIRECTORIES}")
-configure_file("test.ini" "test.ini" COPYONLY)
-
add_subdirectory(plugins)
create_test("function_module_test" "${SOURCES}" "${LIBRARIES}")
diff --git a/src/components/functional_module/test/src/settings_test.cc b/src/components/functional_module/test/src/settings_test.cc
deleted file mode 100644
index dac3a2669c..0000000000
--- a/src/components/functional_module/test/src/settings_test.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-#include "gtest/gtest.h"
-#include "functional_module/settings.h"
-
-namespace functional_modules {
-
-TEST(Settings, ChangeConfigFile) {
- Settings set;
- set.ChangeConfigFile("test.ini");
- int port = 0;
- bool result = set.ReadParameter("HMI", "ServerPort", &port);
- ASSERT_TRUE(result);
- ASSERT_EQ(8087, port);
- set.ChangeConfigFile("not_existing_file.ini");
- result = set.ReadParameter("HMI", "ServerPort", &port);
- ASSERT_FALSE(result);
-}
-
-TEST(Settings, ReadParamIntWithSectionSuccess) {
- Settings set;
- set.ChangeConfigFile("test.ini");
- int port = 0;
- bool result = set.ReadParameter<int>("HMI", "ServerPort", &port);
- ASSERT_TRUE(result);
- ASSERT_EQ(8087, port);
-}
-
-TEST(Settings, ReadParamIntWithSectionFail) {
- Settings set;
- set.ChangeConfigFile("test.ini");
- int port = 0;
- bool result = set.ReadParameter<int>("HMI", "ServerPo", &port);
- ASSERT_FALSE(result);
- ASSERT_EQ(0, port);
-}
-
-TEST(Settings, ReadParamBoolWithSectionSuccess) {
- Settings set;
- set.ChangeConfigFile("test.ini");
- bool launch = true;
- bool result = set.ReadParameter<bool>("HMI", "LaunchHMI", &launch);
- ASSERT_TRUE(result);
- ASSERT_FALSE(launch);
-}
-
-TEST(Settings, ReadParamBoolWithSectionFail) {
- Settings set;
- set.ChangeConfigFile("test.ini");
- bool launch = true;
- bool result = set.ReadParameter<bool>("HMI", "LaunchH", &launch);
- ASSERT_FALSE(result);
- ASSERT_TRUE(launch);
-}
-
-TEST(Settings, ReadParamStringNoSectionSuccess) {
- Settings set;
- set.ChangeConfigFile("test.ini");
- std::string caps;
- bool result = set.ReadParameter<std::string>("HMICapabilities", &caps);
- ASSERT_TRUE(result);
- ASSERT_EQ("hmi_capabilities.json", caps);
-}
-
-TEST(Settings, ReadParamStringNoSectionFail) {
- Settings set;
- set.ChangeConfigFile("test.ini");
- std::string caps;
- bool result = set.ReadParameter("HMICaps", &caps);
- ASSERT_FALSE(result);
- ASSERT_EQ("", caps);
-}
-
-} // namespace functional_modules
diff --git a/src/components/functional_module/test/test.ini b/src/components/functional_module/test/test.ini
deleted file mode 100644
index 9549c5baea..0000000000
--- a/src/components/functional_module/test/test.ini
+++ /dev/null
@@ -1,33 +0,0 @@
- ; The INI-file consists of different chapters.
-; Each chapter begins with the line containing
-; the name in square brackets. Syntax:
-; [chapter]
-; The chapters consists of a set of items with a
-; assinged value. The syntax is:
-; item=value
-; All white spaces an second encounters of chapters
-; or items will be ignored.
-; Remarks start with semicolon or star as first character.
-; It is alowed for names of chapters and items to
-; contain semicolon and star. Possible syntax is:
-; [ chapter ] ;Remark
-; item = value ;Remark
-
-[HMI]
-LaunchHMI = false
-ServerAddress = 127.0.0.1
-ServerPort = 8087
-
-[MAIN]
-
-;The value of a variable ThreadStackSize used only if its realy needed, other way stack size will be PTHREAD_STACK_MIN
-;
-ThreadStackSize = 20480
-MixingAudioSupported = true
-HMICapabilities = hmi_capabilities.json
-MaxCmdID = 2000000000
-; Default request timeout in milliseconds
-DefaultTimeout = 10000
-
-SystemFilesPath = /tmp/fs/mp/images/ivsu_cache
-