]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#25,!14] libprocess code now compiles and unit-tests pass
authorTomek Mrugalski <tomasz@isc.org>
Fri, 31 Aug 2018 19:10:32 +0000 (21:10 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Fri, 7 Sep 2018 14:40:06 +0000 (16:40 +0200)
14 files changed:
src/lib/process/config_base.h
src/lib/process/d_cfg_mgr.h
src/lib/process/d_controller.cc
src/lib/process/d_controller.h
src/lib/process/daemon.cc
src/lib/process/daemon.h
src/lib/process/log_parser.cc
src/lib/process/log_parser.h
src/lib/process/logging_info.cc
src/lib/process/logging_info.h
src/lib/process/tests/Makefile.am
src/lib/process/tests/daemon_unittest.cc
src/lib/process/tests/log_parser_unittests.cc
src/lib/process/tests/logging_info_unittests.cc

index 71ba21534e9328631588ab257fc7a2ac0e635b1c..c9e367138498f002cbaca520df1f1548519cb040 100644 (file)
@@ -54,7 +54,7 @@ public:
     /// @brief Compares two configuration.
     ///
     /// @param other the other configuration to compare to
-    virtual bool equals(const ConfigBase& other) const;
+    bool equals(const ConfigBase& other) const;
 
     /// @brief Converts to Element representation
     ///
@@ -70,7 +70,7 @@ protected:
     /// by descendant classes.
     ///
     /// @param new_config this configuration will be copied to new_config
-    virtual void copy(ConfigBase& new_config) const;
+    void copy(ConfigBase& new_config) const;
 
 private:
     /// @brief Logging specific information.
index d9ff933ea0d8fc64c6645cdeca36a626bca31101..e7896434732ce38f4209f6aa08eca53a8bab44da 100644 (file)
@@ -60,7 +60,7 @@ typedef boost::shared_ptr<DCfgContextBase> DCfgContextBasePtr;
 ///    // Restore from backup
 ///    context_ = backup_copy;
 ///
-class DCfgContextBase : public isc::dhcp::UserContext, public isc::data::CfgToElement {
+class DCfgContextBase : public isc::data::UserContext, public isc::data::CfgToElement {
 public:
     /// @brief Indicator that a configuration parameter is optional.
     static const bool OPTIONAL = true;
index 10eb43574e0318ae6108defb282df53a68ea19b3..c43c0588bdc47ad69d1c93ce3e5e8eae5ffa295a 100644 (file)
@@ -100,7 +100,7 @@ DControllerBase::launch(int argc, char* argv[], const bool test_mode) {
 
     try {
         createPIDFile();
-    } catch (const dhcp::DaemonPIDExists& ex) {
+    } catch (const DaemonPIDExists& ex) {
         LOG_FATAL(dctl_logger, DCTL_ALREADY_RUNNING)
                   .arg(bin_name_).arg(ex.what());
         isc_throw (LaunchError, "Launch Failed: " << ex.what());
index e5de1aa7c567a88c7f5ddf648be50e9a49949148..a9e439101316cdd5db7f5acadddc8b6747790da5 100644 (file)
@@ -9,9 +9,9 @@
 
 #include <asiolink/io_service.h>
 #include <cc/data.h>
-#include <dhcpsrv/daemon.h>
 #include <exceptions/exceptions.h>
 #include <log/logger_support.h>
+#include <process/daemon.h>
 #include <process/d_log.h>
 #include <process/d_process.h>
 #include <process/io_service_signal.h>
@@ -101,7 +101,7 @@ typedef boost::shared_ptr<DControllerBase> DControllerBasePtr;
 /// NOTE: Derivations must supply their own static singleton instance method(s)
 /// for creating and fetching the instance. The base class declares the instance
 /// member in order for it to be available for static callback functions.
-class DControllerBase : public dhcp::Daemon {
+class DControllerBase : public Daemon {
 public:
     /// @brief Constructor
     ///
index fd06e8b7320642b33facc3e2cd0198adfb1bcdac..d167530e721a42f1825717b817a34e427f1cb8d5 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015,2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -6,12 +6,12 @@
 
 #include <config.h>
 #include <cc/data.h>
-#include <dhcpsrv/cfgmgr.h>
-#include <dhcpsrv/daemon.h>
+#include <process/daemon.h>
+#include <process/log_parser.h>
 #include <exceptions/exceptions.h>
 #include <log/logger_name.h>
 #include <log/logger_support.h>
-#include <logging.h>
+#include <process/cfg_base.h>
 #include <util/filename.h>
 
 #include <boost/bind.hpp>
 /// This file provides stub implementations that are expected to be redefined
 /// in derived classes (e.g. ControlledDhcpv6Srv)
 namespace isc {
-namespace dhcp {
+namespace process {
+
+bool Daemon::verbose_ = false;
+
+std::string Daemon::default_logger_name_("kea");
 
 Daemon::Daemon()
     : signal_set_(), signal_handler_(), config_file_(""), proc_name_(""),
-    pid_file_dir_(DHCP_DATA_DIR), pid_file_(), am_file_author_(false) {
+      pid_file_dir_(DATA_DIR), pid_file_(), am_file_author_(false) {
 
     // The pid_file_dir can be overridden via environment variable
     // This is primarily intended to simplify testing
@@ -60,25 +64,25 @@ void Daemon::handleSignal() {
 }
 
 void Daemon::configureLogger(const isc::data::ConstElementPtr& log_config,
-                             const SrvConfigPtr& storage) {
+                             const ConfigPtr& storage) {
 
     if (log_config) {
         isc::data::ConstElementPtr loggers = log_config->get("loggers");
         if (loggers) {
             LogConfigParser parser(storage);
-            parser.parseConfiguration(loggers, CfgMgr::instance().isVerbose());
+            parser.parseConfiguration(loggers, verbose_);
         }
     }
 }
 
 void
 Daemon::setVerbose(bool verbose) {
-    CfgMgr::instance().setVerbose(verbose);
+    verbose_ = verbose;
 }
 
 bool
-Daemon::getVerbose() const {
-    return (CfgMgr::instance().isVerbose());
+Daemon::getVerbose() {
+    return (verbose_);
 }
 
 void Daemon::loggerInit(const char* name, bool verbose) {
@@ -209,10 +213,6 @@ Daemon::createPIDFile(int pid) {
 size_t
 Daemon::writeConfigFile(const std::string& config_file,
                         isc::data::ConstElementPtr cfg) const {
-    if (!cfg) {
-        cfg = CfgMgr::instance().getCurrentCfg()->toElement();
-    }
-
     if (!cfg) {
         isc_throw(Unexpected, "Can't write configuration: conversion to JSON failed");
     }
index df895ddd42308ddd7d5f494635e61778c7589d8a..2570ba9b67c554ea81266b1109db7601d04016d6 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015,2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -8,14 +8,14 @@
 #define DAEMON_H
 
 #include <cc/data.h>
-#include <dhcpsrv/srv_config.h>
+#include <process/config_base.h>
 #include <util/pid_file.h>
 #include <util/signal_set.h>
 #include <boost/noncopyable.hpp>
 #include <string>
 
 namespace isc {
-namespace dhcp {
+namespace process {
 
 /// @brief Exception thrown when a the PID file points to a live PID
 class DaemonPIDExists : public Exception {
@@ -96,7 +96,7 @@ public:
     /// @param log_config JSON structures that describe logging
     /// @param storage configuration will be stored here
     static void configureLogger(const isc::data::ConstElementPtr& log_config,
-                                const isc::dhcp::SrvConfigPtr& storage);
+                                const isc::process::ConfigPtr& storage);
 
     /// @brief Sets or clears verbose mode
     ///
@@ -105,12 +105,12 @@ public:
     /// config file are ignored.
     ///
     /// @param verbose specifies if verbose should be set or not
-    void setVerbose(const bool verbose);
+    static void setVerbose(const bool verbose);
 
     /// @brief Returns if running in verbose mode
     ///
     /// @return verbose mode
-    bool getVerbose() const;
+    static bool getVerbose();
 
     /// @brief returns Kea version on stdout and exits.
     ///
@@ -200,6 +200,19 @@ public:
     /// PID of the current process is used.
     void createPIDFile(int pid = 0);
 
+    /// @brief Returns default logger name.
+    static std::string getDefaultLoggerName() {
+        return (default_logger_name_);
+    }
+
+    /// @brief Sets the default logger name.
+    ///
+    /// This name is used in cases when a user doesn't provide a configuration
+    /// for logger in the Kea configuration file.
+    static void setDefaultLoggerName(const std::string& logger) {
+        default_logger_name_ = logger;
+    }
+
 protected:
 
     /// @brief Invokes handler for the next received signal.
@@ -245,6 +258,12 @@ private:
     /// @brief Pointer to the PID file for this process
     isc::util::PIDFilePtr pid_file_;
 
+    /// @brief Indicates whether verbose mode is turned on or not.
+    static bool verbose_;
+
+    /// @brief Stores default logger name
+    static std::string default_logger_name_;
+
     /// @brief Flag indicating if this instance created the file
     bool am_file_author_;
 };
index 6fad9354b5287547ff52c448c5dedd8f4f9076c0..47f340b6790e76323bd55e674004a255bbd65e60 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -6,7 +6,7 @@
 
 #include <config.h>
 #include <cc/data.h>
-#include <dhcpsrv/logging.h>
+#include <process/log_parser.h>
 #include <boost/foreach.hpp>
 #include <boost/lexical_cast.hpp>
 #include <log/logger_specification.h>
@@ -18,9 +18,9 @@ using namespace isc::data;
 using namespace isc::log;
 
 namespace isc {
-namespace dhcp {
+namespace process {
 
-LogConfigParser::LogConfigParser(const SrvConfigPtr& storage)
+LogConfigParser::LogConfigParser(const ConfigPtr& storage)
     :config_(storage), verbose_(false) {
     if (!storage) {
         isc_throw(BadValue, "LogConfigParser needs a pointer to the "
index 77a197f5c5cacecf206af754d8c02fe3334b2d1a..f7cd8c5fc83e4e80a1a77dbd85558fd9995172b7 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -8,11 +8,12 @@
 #define DHCPSRV_LOGGING_H
 
 #include <cc/data.h>
-#include <dhcpsrv/srv_config.h>
+#include <process/logging_info.h>
+#include <process/config_base.h>
 #include <vector>
 
 namespace isc {
-namespace dhcp {
+namespace process {
 
 /// @brief Configures log4cplus by translating Kea configuration structures
 ///
@@ -45,7 +46,7 @@ public:
     /// @brief Constructor
     ///
     /// @param storage parsed logging configuration will be stored here
-    LogConfigParser(const SrvConfigPtr& storage);
+    LogConfigParser(const ConfigPtr& storage);
 
     /// @brief Parses specified configuration
     ///
@@ -77,7 +78,7 @@ private:
     /// @brief Configuration is stored here
     ///
     /// LogConfigParser class uses only config_->logging_info_ field.
-    SrvConfigPtr config_;
+    ConfigPtr config_;
 
     /// @brief Verbose mode
     ///
index ff39f3a8864f4c811df8290e8fe34aaac51be143..8bb42c146beda80a4e3ef743e576528e3c0c341f 100644 (file)
@@ -1,19 +1,19 @@
-// Copyright (C) 2014-2015,2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #include <config.h>
-#include <dhcpsrv/cfgmgr.h>
-#include <dhcpsrv/logging_info.h>
+#include <process/logging_info.h>
+#include <process/daemon.h>
 #include <log/logger_name.h>
 
 using namespace isc::log;
 using namespace isc::data;
 
 namespace isc {
-namespace dhcp {
+namespace process {
 
 bool
 LoggingDestination::equals(const LoggingDestination& other) const {
@@ -43,16 +43,16 @@ LoggingInfo::LoggingInfo()
     : name_("kea"), severity_(isc::log::INFO), debuglevel_(0) {
     // If configuration Manager is in the verbose mode, we need to modify the
     // default settings.
-    if (CfgMgr::instance().isVerbose()) {
+    if (Daemon::getVerbose()) {
         severity_ = isc::log::DEBUG;
         debuglevel_ = 99;
     }
 
     // If the process has set the non-empty name for the default logger,
     // let's use this name.
-    std::string logger_name = CfgMgr::instance().getDefaultLoggerName();
-    if (!logger_name.empty()) {
-        name_ = logger_name;
+    std::string default_logger = Daemon::getDefaultLoggerName();
+    if (!default_logger.empty()) {
+        name_ = default_logger;
     }
 
     // Add a default logging destination in case use hasn't provided a
index d74fb4f16d3c09aae6afaeb0c194f179476656ba..91ca81181b83d7a5a12dd32c448f0f03b5a2ae25 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015,2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -15,7 +15,7 @@
 #include <vector>
 
 namespace isc {
-namespace dhcp {
+namespace process {
 
 /// @brief Defines single logging destination
 ///
@@ -73,7 +73,7 @@ public:
 ///            "severity": "WARN",
 ///            "debuglevel": 99
 ///        },
-class LoggingInfo : public UserContext, public isc::data::CfgToElement {
+class LoggingInfo : public isc::data::UserContext, public isc::data::CfgToElement {
 public:
 
     /// @brief logging name
@@ -133,7 +133,7 @@ public:
 };
 
 /// @brief storage for logging information in log4cplus format
-typedef std::vector<isc::dhcp::LoggingInfo> LoggingInfoStorage;
+typedef std::vector<isc::process::LoggingInfo> LoggingInfoStorage;
 
 }
 }
index 28833698e1798c4eaa758c1df33a40fd1fcc0762..5fe2f0227bb655a6f273cb379170add7c9472f91 100644 (file)
@@ -3,6 +3,7 @@ SUBDIRS = .
 AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
 AM_CPPFLAGS += $(BOOST_INCLUDES)
 AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_top_builddir)/src/lib/process/tests\"
+AM_CPPFLAGS += -DDATA_DIR="\"$(dhcp_data_dir)\""
 AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\"
 
 AM_CXXFLAGS = $(KEA_CXXFLAGS)
@@ -24,6 +25,8 @@ libprocess_unittests_SOURCES  = d_cfg_mgr_unittests.cc
 libprocess_unittests_SOURCES += d_controller_unittests.cc
 libprocess_unittests_SOURCES += daemon_unittest.cc
 libprocess_unittests_SOURCES += io_service_signal_unittests.cc
+libprocess_unittests_SOURCES += log_parser_unittests.cc
+libprocess_unittests_SOURCES += logging_info_unittests.cc
 libprocess_unittests_SOURCES += run_unittests.cc
 
 libprocess_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
@@ -35,6 +38,7 @@ libprocess_unittests_LDFLAGS  = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
 libprocess_unittests_LDADD  = $(top_builddir)/src/lib/process/testutils/libprocesstest.la
 libprocess_unittests_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
 libprocess_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
+libprocess_unittests_LDADD += $(top_builddir)/src/lib/testutils/libkea-testutils.la
 libprocess_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
 libprocess_unittests_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
 libprocess_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
index 80765a4ea1eba5db3589417264bc03c979f2a901..3cf3151d45ad49bb48266d47fd6edebde882ca0a 100644 (file)
@@ -9,8 +9,9 @@
 #include <exceptions/exceptions.h>
 #include <cc/data.h>
 #include <dhcpsrv/cfgmgr.h>
-#include <dhcpsrv/daemon.h>
-#include <dhcpsrv/logging.h>
+#include <process/daemon.h>
+#include <process/config_base.h>
+#include <process/log_parser.h>
 #include <log/logger_support.h>
 
 #include <gtest/gtest.h>
 #include <sys/wait.h>
 
 using namespace isc;
-using namespace isc::dhcp;
+using namespace isc::process;
 using namespace isc::data;
 
 namespace isc {
-namespace dhcp {
+namespace process {
 
 // @brief Derived Daemon class
 class DaemonImpl : public Daemon {
@@ -92,7 +93,7 @@ TEST_F(DaemonTest, constructor) {
 
     EXPECT_TRUE(instance2.getConfigFile().empty());
     EXPECT_TRUE(instance2.getProcName().empty());
-    EXPECT_EQ(CfgMgr::instance().getDataDir(),instance2.getPIDFileDir());
+    EXPECT_EQ(std::string(DATA_DIR), instance2.getPIDFileDir());
     EXPECT_TRUE(instance2.getPIDFileName().empty());
 }
 
@@ -265,10 +266,10 @@ TEST_F(DaemonTest, PIDFileCleanup) {
 // More dedicated tests are available for LogConfigParser class.
 // See logger_unittest.cc
 TEST_F(DaemonTest, parsingConsoleOutput) {
-    CfgMgr::instance().setVerbose(false);
+    Daemon::setVerbose(false);
 
     // Storage - parsed configuration will be stored here
-    SrvConfigPtr storage(new SrvConfig());
+    ConfigPtr storage(new ConfigBase());
 
     const char* config_txt =
     "{ \"loggers\": ["
index 30046f28bb2b8a9fbfde63a78d7c6639fc8f5fdc..d66f05903cd82cfc10fab5c8e32841328414dc5c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -6,16 +6,17 @@
 
 #include <config.h>
 #include <cc/data.h>
-#include <dhcpsrv/dhcpsrv_log.h>
-#include <dhcpsrv/logging.h>
+#include <process/log_parser.h>
+#include <process/process_messages.h>
 #include <exceptions/exceptions.h>
 #include <log/logger_support.h>
+#include <process/d_log.h>
 #include <testutils/io_utils.h>
 
 #include <gtest/gtest.h>
 
 using namespace isc;
-using namespace isc::dhcp;
+using namespace isc::process;
 using namespace isc::data;
 
 namespace {
@@ -78,10 +79,10 @@ const int LoggingTest::TEST_MAX_VERS = 2;       // More than the default of 1
 // Checks that the constructor is able to process specified storage properly.
 TEST_F(LoggingTest, constructor) {
 
-    SrvConfigPtr null_ptr;
+    ConfigPtr null_ptr;
     EXPECT_THROW(LogConfigParser parser(null_ptr), BadValue);
 
-    SrvConfigPtr nonnull(new SrvConfig());
+    ConfigPtr nonnull(new ConfigBase());
 
     EXPECT_NO_THROW(LogConfigParser parser(nonnull));
 }
@@ -106,7 +107,7 @@ TEST_F(LoggingTest, parsingConsoleOutput) {
     "    }"
     "]}";
 
-    SrvConfigPtr storage(new SrvConfig());
+    ConfigPtr storage(new ConfigBase());
 
     LogConfigParser parser(storage);
 
@@ -147,7 +148,7 @@ TEST_F(LoggingTest, parsingFile) {
     "    }"
     "]}";
 
-    SrvConfigPtr storage(new SrvConfig());
+    ConfigPtr storage(new ConfigBase());
 
     LogConfigParser parser(storage);
 
@@ -201,7 +202,7 @@ TEST_F(LoggingTest, multipleLoggers) {
     "    }"
     "]}";
 
-    SrvConfigPtr storage(new SrvConfig());
+    ConfigPtr storage(new ConfigBase());
 
     LogConfigParser parser(storage);
 
@@ -251,7 +252,7 @@ TEST_F(LoggingTest, multipleLoggingDestinations) {
     "    }"
     "]}";
 
-    SrvConfigPtr storage(new SrvConfig());
+    ConfigPtr storage(new ConfigBase());
 
     LogConfigParser parser(storage);
 
@@ -305,7 +306,7 @@ TEST_F(LoggingTest, logRotate) {
         "]}";
 
     // Create our server config container.
-    SrvConfigPtr server_cfg(new SrvConfig());
+    ConfigPtr server_cfg(new ConfigBase());
 
     // LogConfigParser expects a list of loggers, so parse
     // the JSON text and extract the "loggers" element from it
@@ -330,7 +331,7 @@ TEST_F(LoggingTest, logRotate) {
 
     for (int i = 1; i < TEST_MAX_VERS + 1; i++) {
         // Output the big log and make sure we get the expected rotation file.
-        LOG_INFO(logger, DHCPSRV_CFGMGR_ADD_IFACE).arg(big_arg);
+        LOG_INFO(logger, DCTL_CONFIG_COMPLETE).arg(big_arg);
         EXPECT_TRUE(isc::test::fileExists(logName(i).c_str()));
     }
 
index f7787650663ad3510aeb35261bb1e2e41f00f0f6..7768b77c16d55137325a8507c6c6a49122ee3e3d 100644 (file)
@@ -1,16 +1,16 @@
-// Copyright (C) 2014-2015,2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #include <config.h>
-#include <dhcpsrv/cfgmgr.h>
-#include <dhcpsrv/logging_info.h>
+#include <process/daemon.h>
+#include <process/logging_info.h>
 #include <testutils/test_to_element.h>
 #include <gtest/gtest.h>
 
-using namespace isc::dhcp;
+using namespace isc::process;
 using namespace isc::test;
 using namespace isc::data;
 
@@ -53,12 +53,12 @@ public:
 
     /// @brief Setup the test.
     virtual void SetUp() {
-        CfgMgr::instance().setVerbose(false);
+        Daemon::setVerbose(false);
     }
 
     /// @brief Clear after the test.
     virtual void TearDown() {
-        CfgMgr::instance().setVerbose(false);
+        Daemon::setVerbose(false);
     }
 };
 
@@ -94,7 +94,7 @@ TEST_F(LoggingInfoTest, defaults) {
     expected = header + comment + ",\n" + begin + "INFO" + dbglvl + "0" + trailer;
     runToElementTest<LoggingInfo>(expected, info_non_verbose);
 
-    CfgMgr::instance().setVerbose(true);
+    Daemon::setVerbose(true);
     LoggingInfo info_verbose;
     EXPECT_EQ("kea", info_verbose.name_);
     EXPECT_EQ(isc::log::DEBUG, info_verbose.severity_);