From: Tomek Mrugalski Date: Mon, 5 Nov 2018 04:52:48 +0000 (+0700) Subject: [#110,!156] Compilation fix. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd13f4edf8b19d9934c2d8623d91ee220835d48c;p=thirdparty%2Fkea.git [#110,!156] Compilation fix. --- diff --git a/src/bin/dhcp4/json_config_parser.cc b/src/bin/dhcp4/json_config_parser.cc index 2b8ad3cdbf..19b9be3964 100644 --- a/src/bin/dhcp4/json_config_parser.cc +++ b/src/bin/dhcp4/json_config_parser.cc @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include @@ -53,6 +53,7 @@ using namespace isc::asiolink; using namespace isc::hooks; using namespace isc::process; using namespace isc::config; +using namespace isc::db; namespace { diff --git a/src/bin/dhcp4/tests/config_parser_unittest.cc b/src/bin/dhcp4/tests/config_parser_unittest.cc index fbb8599e21..4d5f603740 100644 --- a/src/bin/dhcp4/tests/config_parser_unittest.cc +++ b/src/bin/dhcp4/tests/config_parser_unittest.cc @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include "marker_file.h" @@ -50,6 +50,7 @@ using namespace isc::data; using namespace isc::dhcp; using namespace isc::dhcp::test; using namespace isc::hooks; +using namespace isc::db; using namespace std; namespace { diff --git a/src/bin/dhcp6/json_config_parser.cc b/src/bin/dhcp6/json_config_parser.cc index c0a5aab29c..5336547de6 100644 --- a/src/bin/dhcp6/json_config_parser.cc +++ b/src/bin/dhcp6/json_config_parser.cc @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include @@ -61,6 +61,7 @@ using namespace isc::data; using namespace isc::dhcp; using namespace isc::asiolink; using namespace isc::hooks; +using namespace isc::db; namespace { @@ -612,8 +613,8 @@ configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set, } if (config_pair.first == "config-control") { - process::ConfigControlParser parser; - process::ConfigControlInfoPtr config_ctl_info = parser.parse(config_pair.second); + db::ConfigControlParser parser; + db::ConfigControlInfoPtr config_ctl_info = parser.parse(config_pair.second); CfgMgr::instance().getStagingCfg()->setConfigControlInfo(config_ctl_info); continue; } diff --git a/src/bin/dhcp6/tests/config_parser_unittest.cc b/src/bin/dhcp6/tests/config_parser_unittest.cc index eab081dcf2..131cf7e7b7 100644 --- a/src/bin/dhcp6/tests/config_parser_unittest.cc +++ b/src/bin/dhcp6/tests/config_parser_unittest.cc @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include "test_data_files_config.h" #include "test_libraries.h" @@ -53,6 +53,7 @@ using namespace isc::data; using namespace isc::dhcp; using namespace isc::dhcp::test; using namespace isc::hooks; +using namespace isc::db; using namespace std; namespace { @@ -6870,12 +6871,12 @@ TEST_F(Dhcp6ParserTest, configControlInfo) { configure(config, CONTROL_RESULT_SUCCESS, ""); // Make sure the config control info is there. - process::ConstConfigControlInfoPtr info = + db::ConstConfigControlInfoPtr info = CfgMgr::instance().getStagingCfg()->getConfigControlInfo(); ASSERT_TRUE(info); // Fetch the list of config dbs. It should have two entries. - const process::ConfigDbInfoList& dblist = info->getConfigDatabases(); + const db::ConfigDbInfoList& dblist = info->getConfigDatabases(); ASSERT_EQ(2, dblist.size()); // Make sure the entries are what we expect and in the right order. diff --git a/src/lib/dhcpsrv/srv_config.cc b/src/lib/dhcpsrv/srv_config.cc index ca4369709a..c923d14c3b 100644 --- a/src/lib/dhcpsrv/srv_config.cc +++ b/src/lib/dhcpsrv/srv_config.cc @@ -19,6 +19,7 @@ using namespace isc::log; using namespace isc::data; using namespace isc::process; +using namespace isc::db; namespace isc { namespace dhcp { diff --git a/src/lib/dhcpsrv/tests/srv_config_unittest.cc b/src/lib/dhcpsrv/tests/srv_config_unittest.cc index 1b7f56f90f..b78f5796ae 100644 --- a/src/lib/dhcpsrv/tests/srv_config_unittest.cc +++ b/src/lib/dhcpsrv/tests/srv_config_unittest.cc @@ -18,6 +18,7 @@ using namespace isc::asiolink; using namespace isc::dhcp; using namespace isc::data; using namespace isc::process; +using namespace isc::db; // Those are the tests for SrvConfig storage. Right now they are minimal, // but the number is expected to grow significantly once we migrate more @@ -974,4 +975,38 @@ TEST_F(SrvConfigTest, unparseConfigControlInfo6) { EXPECT_TRUE(info_elem->equals(*check)); } + +// Verifies construction, copy, and equality of +// ConfigBase with respect to ConfigControInfo. +TEST_F(SrvConfigTest, configControlInfoTests) { + + // Create a control info instance + ConfigControlInfoPtr ctl_info1(new ConfigControlInfo()); + ctl_info1->addConfigDatabase("type=mysql host=example.com"); + ctl_info1->addConfigDatabase("type=mysql host=example2.com"); + + // Create a ConfigBase + SrvConfig base1; + base1.setConfigControlInfo(ctl_info1); + + // Clone the ConfigBase + SrvConfig base2; + base1.copy(base2); + + // They should be equal. + EXPECT_TRUE(base1.equals(base2)); + + // Reset control info for one of them. + base1.setConfigControlInfo(ConfigControlInfoPtr()); + + // They should not be equal. + EXPECT_FALSE(base1.equals(base2)); + + // Reset control info for the other one. + base2.setConfigControlInfo(ConfigControlInfoPtr()); + + // They should be equal again. + EXPECT_TRUE(base1.equals(base2)); +} + } // end of anonymous namespace diff --git a/src/lib/process/tests/config_base_unittests.cc b/src/lib/process/tests/config_base_unittests.cc index 0b45bd03cc..046182e580 100644 --- a/src/lib/process/tests/config_base_unittests.cc +++ b/src/lib/process/tests/config_base_unittests.cc @@ -30,30 +30,20 @@ public: TEST(ConfigBase, configControlInfoTests) { // Create a control info instance - ConfigControlInfoPtr ctl_info1(new ConfigControlInfo()); - ctl_info1->addConfigDatabase("type=mysql host=example.com"); - ctl_info1->addConfigDatabase("type=mysql host=example2.com"); + LoggingInfo log_info; // Create a ConfigBase ConfigBaseImpl base1; - base1.setConfigControlInfo(ctl_info1); // Clone the ConfigBase ConfigBaseImpl base2; - base1.copy(base2); // They should be equal. EXPECT_TRUE(base1.equals(base2)); // Reset control info for one of them. - base1.setConfigControlInfo(ConfigControlInfoPtr()); + base1.addLoggingInfo(log_info); - // They should not be equal. + // They should not be equal anymore. EXPECT_FALSE(base1.equals(base2)); - - // Reset control info for the other one. - base2.setConfigControlInfo(ConfigControlInfoPtr()); - - // They should be equal again. - EXPECT_TRUE(base1.equals(base2)); }