#include <dhcpsrv/parsers/sanity_checks_parser.h>
#include <dhcpsrv/host_data_source_factory.h>
#include <dhcpsrv/timer_mgr.h>
-#include <process/config_ctl_parser.h>
+#include <database/config_ctl_parser.h>
#include <hooks/hooks_parser.h>
#include <config/command_mgr.h>
#include <util/encode/hex.h>
using namespace isc::hooks;
using namespace isc::process;
using namespace isc::config;
+using namespace isc::db;
namespace {
#include <dhcpsrv/cfg_subnets4.h>
#include <dhcpsrv/testutils/config_result_check.h>
#include <dhcpsrv/testutils/test_config_backend_dhcp4.h>
-#include <process/config_ctl_info.h>
+#include <database/config_ctl_info.h>
#include <hooks/hooks_manager.h>
#include "marker_file.h"
using namespace isc::dhcp;
using namespace isc::dhcp::test;
using namespace isc::hooks;
+using namespace isc::db;
using namespace std;
namespace {
#include <dhcpsrv/host_data_source_factory.h>
#include <hooks/hooks_parser.h>
#include <log/logger_support.h>
-#include <process/config_ctl_parser.h>
+#include <database/config_ctl_parser.h>
#include <util/encode/hex.h>
#include <util/strutil.h>
using namespace isc::dhcp;
using namespace isc::asiolink;
using namespace isc::hooks;
+using namespace isc::db;
namespace {
}
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;
}
#include <dhcpsrv/subnet_selector.h>
#include <dhcpsrv/testutils/config_result_check.h>
#include <hooks/hooks_manager.h>
-#include <process/config_ctl_info.h>
+#include <database/config_ctl_info.h>
#include "test_data_files_config.h"
#include "test_libraries.h"
using namespace isc::dhcp;
using namespace isc::dhcp::test;
using namespace isc::hooks;
+using namespace isc::db;
using namespace std;
namespace {
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.
using namespace isc::log;
using namespace isc::data;
using namespace isc::process;
+using namespace isc::db;
namespace isc {
namespace dhcp {
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
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
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));
}