]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Merge branch 'trac3534'
authorMarcin Siodelski <marcin@isc.org>
Tue, 16 Sep 2014 11:12:23 +0000 (13:12 +0200)
committerMarcin Siodelski <marcin@isc.org>
Tue, 16 Sep 2014 11:12:23 +0000 (13:12 +0200)
Conflicts:
src/lib/dhcpsrv/tests/daemon_unittest.cc

1  2 
src/lib/dhcpsrv/tests/daemon_unittest.cc
src/lib/dhcpsrv/tests/logging_unittest.cc

index 23469d4c40a06a4ed80f0a833bca0988b4027f4a,8f01746f7e8f6f3bb0b6452c946e559d0c8975a2..bd9c3a37f364f893d63e83a57e2a4e3bade423dc
  // PERFORMANCE OF THIS SOFTWARE.
  
  #include <config.h>
 +
  #include <exceptions/exceptions.h>
 +#include <cc/data.h>
+ #include <dhcpsrv/cfgmgr.h>
  #include <dhcpsrv/daemon.h>
  #include <dhcpsrv/logging.h>
  #include <log/logger_unittest_support.h>
@@@ -67,10 -49,11 +68,11 @@@ TEST_F(DaemonTest, constructor) 
  // Checks that configureLogger method is behaving properly.
  // More dedicated tests are availablef for LogConfigParser class.
  // See logger_unittest.cc
 -TEST(DaemonTest, parsingConsoleOutput) {
 +TEST_F(DaemonTest, parsingConsoleOutput) {
+     CfgMgr::instance().setVerbose(false);
  
      // Storage - parsed configuration will be stored here
-     ConfigurationPtr storage(new Configuration());
+     SrvConfigPtr storage(new SrvConfig());
  
      const char* config_txt =
      "{ \"loggers\": ["
  
      // Spawn a daemon and tell it to configure logger
      Daemon x;
-     EXPECT_NO_THROW(x.configureLogger(config, storage, false));
+     EXPECT_NO_THROW(x.configureLogger(config, storage));
  
 -    // configureLogger will modify the logging options of the log4cplus logger.
 -    // We need to reset the logger settings so as the following tests are
 -    // not affected by this modification.
 -    isc::log::resetUnitTestRootLogger();
 -
      // The parsed configuration should be processed by the daemon and
      // stored in configuration storage.
-     ASSERT_EQ(1, storage->logging_info_.size());
+     ASSERT_EQ(1, storage->getLoggingInfo().size());
  
-     EXPECT_EQ("kea", storage->logging_info_[0].name_);
-     EXPECT_EQ(99, storage->logging_info_[0].debuglevel_);
-     EXPECT_EQ(isc::log::DEBUG, storage->logging_info_[0].severity_);
+     EXPECT_EQ("kea", storage->getLoggingInfo()[0].name_);
+     EXPECT_EQ(99, storage->getLoggingInfo()[0].debuglevel_);
+     EXPECT_EQ(isc::log::DEBUG, storage->getLoggingInfo()[0].severity_);
  
-     ASSERT_EQ(1, storage->logging_info_[0].destinations_.size());
-     EXPECT_EQ("stdout" , storage->logging_info_[0].destinations_[0].output_);
+     ASSERT_EQ(1, storage->getLoggingInfo()[0].destinations_.size());
+     EXPECT_EQ("stdout" , storage->getLoggingInfo()[0].destinations_[0].output_);
  }
  
  
index 2ae38d6b2fd7f9932258865766ffaaae2cefa3fb,3ea946e69af6baa0cd33220230ac7229eaae6f88..9310bba8ccce9557df1e412a3b159fe74522dd52
@@@ -25,34 -24,13 +25,34 @@@ using namespace isc::data
  
  namespace {
  
 +/// @brief Logging Test Fixture Class
 +///
 +/// Trivial class that ensures that the logging is reset to its defaults after
 +/// each test.  Strictly speaking this only resets the testing root logger (which
 +/// has the name "kea") but as the only other logger mentioned here ("wombat")
 +/// is not used elsewhere, that is sufficient.
 +
 +class LoggingTest : public ::testing::Test {
 +    public:
 +        /// @brief Constructor
 +        LoggingTest() {}
 +
 +        /// @brief Destructor
 +        ///
 +        /// Reset root logger back to defaults.
 +        ~LoggingTest() {
 +            isc::log::resetUnitTestRootLogger();
 +        }
 +};
 +
 +
  // Checks that contructor is able to process specified storage properly
 -TEST(LoggingTest, constructor) {
 +TEST_F(LoggingTest, constructor) {
  
-     ConfigurationPtr null_ptr;
+     SrvConfigPtr null_ptr;
      EXPECT_THROW(LogConfigParser parser(null_ptr), BadValue);
  
-     ConfigurationPtr nonnull(new Configuration());
+     SrvConfigPtr nonnull(new SrvConfig());
  
      EXPECT_NO_THROW(LogConfigParser parser(nonnull));
  }