static const uint32_t CFGSEL_ALL = 0xFFFFFFFF;
//@}
- /// @brief logging specific information
- LoggingInfoStorage logging_info_;
-
/// @brief Default constructor.
///
/// This constructor sets configuration sequence number to 0.
/// @return true if sequence numbers are equal.
bool sequenceEquals(const Configuration& other);
+ /// @brief Returns logging specific configuration.
+ const LoggingInfoStorage& getLoggingInfo() const {
+ return (logging_info_);
+ }
+
+ /// @brief Sets logging specific configuration.
+ ///
+ /// @param logging_info New logging configuration.
+ void addLoggingInfo(const LoggingInfo& logging_info) {
+ logging_info_.push_back(logging_info);
+ }
+
/// @brief Returns object which represents selection of interfaces.
///
/// This function returns a reference to the object which represents the
/// @brief Sequence number identifying the configuration.
uint32_t sequence_;
+ /// @brief Logging specific information.
+ LoggingInfoStorage logging_info_;
+
/// @brief Interface configuration.
///
/// Used to select interfaces on which the DHCP server will listen to
// Check that by default there are no logging entries
TEST_F(ConfigurationTest, basic) {
- EXPECT_TRUE(conf_.logging_info_.empty());
+ EXPECT_TRUE(conf_.getLoggingInfo().empty());
}
// Check that Configuration can store logging information.
log1.destinations_.push_back(dest);
- conf_.logging_info_.push_back(log1);
+ conf_.addLoggingInfo(log1);
- EXPECT_EQ("foo", conf_.logging_info_[0].name_);
- EXPECT_EQ(isc::log::WARN, conf_.logging_info_[0].severity_);
- EXPECT_EQ(77, conf_.logging_info_[0].debuglevel_);
+ EXPECT_EQ("foo", conf_.getLoggingInfo()[0].name_);
+ EXPECT_EQ(isc::log::WARN, conf_.getLoggingInfo()[0].severity_);
+ EXPECT_EQ(77, conf_.getLoggingInfo()[0].debuglevel_);
- EXPECT_EQ("some-logfile.txt", conf_.logging_info_[0].destinations_[0].output_);
- EXPECT_EQ(5, conf_.logging_info_[0].destinations_[0].maxver_);
- EXPECT_EQ(2097152, conf_.logging_info_[0].destinations_[0].maxsize_);
+ EXPECT_EQ("some-logfile.txt", conf_.getLoggingInfo()[0].destinations_[0].output_);
+ EXPECT_EQ(5, conf_.getLoggingInfo()[0].destinations_[0].maxver_);
+ EXPECT_EQ(2097152, conf_.getLoggingInfo()[0].destinations_[0].maxsize_);
}
// Check that the configuration summary including information about the status
// 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_);
}
EXPECT_NO_THROW(parser.parseConfiguration(config));
- 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_);
}
// Checks if the LogConfigParser class is able to transform JSON structures
EXPECT_NO_THROW(parser.parseConfiguration(config));
- ASSERT_EQ(1, storage->logging_info_.size());
+ ASSERT_EQ(1, storage->getLoggingInfo().size());
- EXPECT_EQ("kea", storage->logging_info_[0].name_);
- EXPECT_EQ(0, storage->logging_info_[0].debuglevel_);
- EXPECT_EQ(isc::log::INFO, storage->logging_info_[0].severity_);
+ EXPECT_EQ("kea", storage->getLoggingInfo()[0].name_);
+ EXPECT_EQ(0, storage->getLoggingInfo()[0].debuglevel_);
+ EXPECT_EQ(isc::log::INFO, storage->getLoggingInfo()[0].severity_);
- ASSERT_EQ(1, storage->logging_info_[0].destinations_.size());
- EXPECT_EQ("logfile.txt" , storage->logging_info_[0].destinations_[0].output_);
+ ASSERT_EQ(1, storage->getLoggingInfo()[0].destinations_.size());
+ EXPECT_EQ("logfile.txt" , storage->getLoggingInfo()[0].destinations_[0].output_);
}
// Checks if the LogConfigParser class is able to transform data structures
EXPECT_NO_THROW(parser.parseConfiguration(config));
- ASSERT_EQ(2, storage->logging_info_.size());
+ ASSERT_EQ(2, storage->getLoggingInfo().size());
- EXPECT_EQ("kea", storage->logging_info_[0].name_);
- EXPECT_EQ(0, storage->logging_info_[0].debuglevel_);
- EXPECT_EQ(isc::log::INFO, storage->logging_info_[0].severity_);
- ASSERT_EQ(1, storage->logging_info_[0].destinations_.size());
- EXPECT_EQ("logfile.txt" , storage->logging_info_[0].destinations_[0].output_);
+ EXPECT_EQ("kea", storage->getLoggingInfo()[0].name_);
+ EXPECT_EQ(0, storage->getLoggingInfo()[0].debuglevel_);
+ EXPECT_EQ(isc::log::INFO, storage->getLoggingInfo()[0].severity_);
+ ASSERT_EQ(1, storage->getLoggingInfo()[0].destinations_.size());
+ EXPECT_EQ("logfile.txt" , storage->getLoggingInfo()[0].destinations_[0].output_);
- EXPECT_EQ("wombat", storage->logging_info_[1].name_);
- EXPECT_EQ(99, storage->logging_info_[1].debuglevel_);
- EXPECT_EQ(isc::log::DEBUG, storage->logging_info_[1].severity_);
- ASSERT_EQ(1, storage->logging_info_[1].destinations_.size());
- EXPECT_EQ("logfile2.txt" , storage->logging_info_[1].destinations_[0].output_);
+ EXPECT_EQ("wombat", storage->getLoggingInfo()[1].name_);
+ EXPECT_EQ(99, storage->getLoggingInfo()[1].debuglevel_);
+ EXPECT_EQ(isc::log::DEBUG, storage->getLoggingInfo()[1].severity_);
+ ASSERT_EQ(1, storage->getLoggingInfo()[1].destinations_.size());
+ EXPECT_EQ("logfile2.txt" , storage->getLoggingInfo()[1].destinations_[0].output_);
}
// Checks if the LogConfigParser class is able to transform data structures
EXPECT_NO_THROW(parser.parseConfiguration(config));
- ASSERT_EQ(1, storage->logging_info_.size());
+ ASSERT_EQ(1, storage->getLoggingInfo().size());
- EXPECT_EQ("kea", storage->logging_info_[0].name_);
- EXPECT_EQ(0, storage->logging_info_[0].debuglevel_);
- EXPECT_EQ(isc::log::INFO, storage->logging_info_[0].severity_);
- ASSERT_EQ(2, storage->logging_info_[0].destinations_.size());
- EXPECT_EQ("logfile.txt" , storage->logging_info_[0].destinations_[0].output_);
- EXPECT_EQ("stdout" , storage->logging_info_[0].destinations_[1].output_);
+ EXPECT_EQ("kea", storage->getLoggingInfo()[0].name_);
+ EXPECT_EQ(0, storage->getLoggingInfo()[0].debuglevel_);
+ EXPECT_EQ(isc::log::INFO, storage->getLoggingInfo()[0].severity_);
+ ASSERT_EQ(2, storage->getLoggingInfo()[0].destinations_.size());
+ EXPECT_EQ("logfile.txt" , storage->getLoggingInfo()[0].destinations_[0].output_);
+ EXPECT_EQ("stdout" , storage->getLoggingInfo()[0].destinations_[1].output_);
}
/// @todo There is no easy way to test applyConfiguration() and defaultLogging().