} else if ((config_id.compare("next-server") == 0)) {
parser = new StringParser(config_id,
globalContext()->string_values_);
- } else if (config_id.compare("lease-database") == 0) {
- parser = new DbAccessParser(config_id, DbAccessParser::LEASE_DB);
- } else if (config_id.compare("hosts-database") == 0) {
- parser = new DbAccessParser(config_id, DbAccessParser::HOSTS_DB);
+ // lease-database and hosts-database have been converted to SimpleParser already.
} else if (config_id.compare("hooks-libraries") == 0) {
parser = new HooksLibrariesParser(config_id);
} else if (config_id.compare("echo-client-id") == 0) {
ParserCollection independent_parsers;
ParserPtr subnet_parser;
ParserPtr iface_parser;
- ParserPtr leases_parser;
ParserPtr client_classes_parser;
// Some of the parsers alter the state of the system in a way that can't
const std::map<std::string, ConstElementPtr>& values_map =
mutable_cfg->mapValue();
BOOST_FOREACH(config_pair, values_map) {
+ SrvConfigPtr srv_cfg = CfgMgr::instance().getStagingCfg();
if (config_pair.first == "option-def") {
// This is converted to SimpleParser and is handled already above.
if (config_pair.first == "option-data") {
OptionDataListParser parser(AF_INET);
- CfgOptionPtr cfg_option = CfgMgr::instance().getStagingCfg()->getCfgOption();
+ CfgOptionPtr cfg_option = srv_cfg->getCfgOption();
parser.parse(cfg_option, config_pair.second);
continue;
}
if (config_pair.first == "control-socket") {
ControlSocketParser parser;
- SrvConfigPtr srv_cfg = CfgMgr::instance().getStagingCfg();
parser.parse(*srv_cfg, config_pair.second);
continue;
}
continue;
}
+ // Please move at the end when migration will be finished.
+ if (config_pair.first == "lease-database") {
+ DbAccessParser parser(DbAccessParser::LEASE_DB);
+ CfgDbAccessPtr cfg_db_access = srv_cfg->getCfgDbAccess();
+ parser.parse(cfg_db_access, config_pair.second);
+ continue;
+ }
+
+ if (config_pair.first == "host-database") {
+ DbAccessParser parser(DbAccessParser::HOSTS_DB);
+ CfgDbAccessPtr cfg_db_access = srv_cfg->getCfgDbAccess();
+ parser.parse(cfg_db_access, config_pair.second);
+ continue;
+ }
+
ParserPtr parser(createGlobalDhcp4ConfigParser(config_pair.first,
config_pair.second));
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL, DHCP4_PARSER_CREATED)
.arg(config_pair.first);
if (config_pair.first == "subnet4") {
subnet_parser = parser;
- } else if (config_pair.first == "lease-database") {
- leases_parser = parser;
} else if (config_pair.first == "interfaces-config") {
// The interface parser is independent from any other
// parser and can be run here before any other parsers.
// Setup the command channel.
configureCommandChannel();
- // the leases database parser is the last to be run.
- std::map<std::string, ConstElementPtr>::const_iterator leases_config =
- values_map.find("lease-database");
- if (leases_config != values_map.end()) {
- config_pair.first = "lease-database";
- leases_parser->build(leases_config->second);
- leases_parser->commit();
- }
-
} catch (const isc::Exception& ex) {
LOG_ERROR(dhcp4_logger, DHCP4_PARSER_FAIL)
.arg(config_pair.first).arg(ex.what());
} else if (config_id.compare("version") == 0) {
parser = new StringParser(config_id,
globalContext()->string_values_);
- } else if (config_id.compare("lease-database") == 0) {
- parser = new DbAccessParser(config_id, DbAccessParser::LEASE_DB);
- } else if (config_id.compare("hosts-database") == 0) {
- parser = new DbAccessParser(config_id, DbAccessParser::HOSTS_DB);
+ // lease-database and hosts-database have been converted to SimpleParser already.
} else if (config_id.compare("hooks-libraries") == 0) {
parser = new HooksLibrariesParser(config_id);
} else if (config_id.compare("dhcp-ddns") == 0) {
ParserCollection independent_parsers;
ParserPtr subnet_parser;
ParserPtr iface_parser;
- ParserPtr leases_parser;
ParserPtr client_classes_parser;
// Some of the parsers alter state of the system that can't easily
}
BOOST_FOREACH(config_pair, values_map) {
+ SrvConfigPtr srv_config = CfgMgr::instance().getStagingCfg();
if (config_pair.first == "option-def") {
// This is converted to SimpleParser and is handled already above.
if (config_pair.first == "option-data") {
OptionDataListParser parser(AF_INET6);
- CfgOptionPtr cfg_option = CfgMgr::instance().getStagingCfg()->getCfgOption();
+ CfgOptionPtr cfg_option = srv_config->getCfgOption();
parser.parse(cfg_option, config_pair.second);
continue;
}
if (config_pair.first == "mac-sources") {
MACSourcesListConfigParser parser;
- CfgMACSource& mac_source = CfgMgr::instance().getStagingCfg()->getMACSources();
+ CfgMACSource& mac_source = srv_config->getMACSources();
parser.parse(mac_source, config_pair.second);
continue;
}
if (config_pair.first == "control-socket") {
ControlSocketParser parser;
- SrvConfigPtr srv_config = CfgMgr::instance().getStagingCfg();
parser.parse(*srv_config, config_pair.second);
continue;
}
if (config_pair.first == "server-id") {
DUIDConfigParser parser;
- const CfgDUIDPtr& cfg = CfgMgr::instance().getStagingCfg()->getCfgDUID();
+ const CfgDUIDPtr& cfg = srv_config->getCfgDUID();
parser.parse(cfg, config_pair.second);
continue;
}
+ // Please move at the end when migration will be finished.
+ if (config_pair.first == "lease-database") {
+ DbAccessParser parser(DbAccessParser::LEASE_DB);
+ CfgDbAccessPtr cfg_db_access = srv_config->getCfgDbAccess();
+ parser.parse(cfg_db_access, config_pair.second);
+ continue;
+ }
+
+ if (config_pair.first == "host-database") {
+ DbAccessParser parser(DbAccessParser::HOSTS_DB);
+ CfgDbAccessPtr cfg_db_access = srv_config->getCfgDbAccess();
+ parser.parse(cfg_db_access, config_pair.second);
+ continue;
+ }
+
ParserPtr parser(createGlobal6DhcpConfigParser(config_pair.first,
config_pair.second));
LOG_DEBUG(dhcp6_logger, DBG_DHCP6_DETAIL, DHCP6_PARSER_CREATED)
.arg(config_pair.first);
if (config_pair.first == "subnet6") {
subnet_parser = parser;
- } else if (config_pair.first == "lease-database") {
- leases_parser = parser;
} else if (config_pair.first == "hooks-libraries") {
// Executing the commit will alter currently loaded hooks
// libraries. Check if the supplied libraries are valid,
// Setup the command channel.
configureCommandChannel();
- // The lease database parser is the last to be run.
- std::map<std::string, ConstElementPtr>::const_iterator leases_config =
- values_map.find("lease-database");
- if (leases_config != values_map.end()) {
- config_pair.first = "lease-database";
- leases_parser->build(leases_config->second);
- leases_parser->commit();
- }
-
} catch (const isc::Exception& ex) {
LOG_ERROR(dhcp6_logger, DHCP6_PARSER_FAIL)
.arg(config_pair.first).arg(ex.what());
-// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2017 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
#include <dhcpsrv/lease_mgr_factory.h>
#include <dhcpsrv/host_mgr.h>
#include <dhcpsrv/parsers/dbaccess_parser.h>
+#include <dhcpsrv/parsers/dhcp_parsers.h>
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
// Factory function to build the parser
-DbAccessParser::DbAccessParser(const std::string&, DBType db_type)
+DbAccessParser::DbAccessParser(DBType db_type)
: values_(), type_(db_type) {
}
// Parse the configuration and check that the various keywords are consistent.
void
-DbAccessParser::build(isc::data::ConstElementPtr config_value) {
+DbAccessParser::parse(CfgDbAccessPtr& cfg_db,
+ ConstElementPtr database_config) {
// To cope with incremental updates, the strategy is:
// 1. Take a copy of the stored keyword/value pairs.
// 5. Save resulting database access string in the Configuration
// Manager.
+ // Note only range checks can fail with a database_config from
+ // a flex/bison parser.
+
// 1. Take a copy of the stored keyword/value pairs.
std::map<string, string> values_copy = values_;
int64_t lfc_interval = 0;
int64_t timeout = 0;
// 2. Update the copy with the passed keywords.
- BOOST_FOREACH(ConfigPair param, config_value->mapValue()) {
+ BOOST_FOREACH(ConfigPair param, database_config->mapValue()) {
try {
if ((param.first == "persist") || (param.first == "readonly")) {
values_copy[param.first] = (param.second->boolValue() ?
isc_throw(TypeKeywordMissing, (type_ == LEASE_DB ? "lease" : "host")
<< " database access parameters must "
"include the keyword 'type' to determine type of database "
- "to be accessed (" << config_value->getPosition() << ")");
+ "to be accessed (" << database_config->getPosition() << ")");
}
// b. Check if the 'type' keyword known and throw an exception if not.
string dbtype = type_ptr->second;
- if ((dbtype != "memfile") && (dbtype != "mysql") && (dbtype != "postgresql") && (dbtype != "cql")) {
+ if ((dbtype != "memfile") &&
+ (dbtype != "mysql") &&
+ (dbtype != "postgresql") &&
+ (dbtype != "cql")) {
isc_throw(BadValue, "unknown backend database type: " << dbtype
- << " (" << config_value->getPosition() << ")");
+ << " (" << database_config->getPosition() << ")");
}
- // c. Check that the lfc-interval is a number and it is within a resonable
- // range.
- if ((lfc_interval < 0) || (lfc_interval > std::numeric_limits<uint32_t>::max())) {
+ // c. Check that the lfc-interval is within a reasonable range.
+ if ((lfc_interval < 0) ||
+ (lfc_interval > std::numeric_limits<uint32_t>::max())) {
isc_throw(BadValue, "lfc-interval value: " << lfc_interval
<< " is out of range, expected value: 0.."
<< std::numeric_limits<uint32_t>::max());
}
- // d. Check that the timeout is a number and it is within a resonable
- // range.
- if ((timeout < 0) || (timeout > std::numeric_limits<uint32_t>::max())) {
+ // d. Check that the timeout is within a reasonable range.
+ if ((timeout < 0) ||
+ (timeout > std::numeric_limits<uint32_t>::max())) {
isc_throw(BadValue, "timeout value: " << timeout
<< " is out of range, expected value: 0.."
<< std::numeric_limits<uint32_t>::max());
values_.swap(values_copy);
// 5. Save the database access string in the Configuration Manager.
- CfgDbAccessPtr cfg_db = CfgMgr::instance().getStagingCfg()->getCfgDbAccess();
if (type_ == LEASE_DB) {
cfg_db->setLeaseDbAccessString(getDbAccessString());
return (dbaccess);
}
-// Commit the changes - reopen the database with the new parameters
-void
-DbAccessParser::commit() {
-}
-
}; // namespace dhcp
}; // namespace isc
-
-// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2017 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
#define DBACCESS_PARSER_H
#include <cc/data.h>
-#include <dhcpsrv/parsers/dhcp_config_parser.h>
-#include <dhcpsrv/parsers/dhcp_parsers.h>
+#include <cc/simple_parser.h>
+#include <dhcpsrv/cfg_db_access.h>
#include <exceptions/exceptions.h>
#include <string>
///
/// Only the "type" sub-element is mandatory: the remaining sub-elements
/// depend on the database chosen.
-class DbAccessParser: public DhcpConfigParser {
+class DbAccessParser: public isc::data::SimpleParser {
public:
/// @brief Specifies the database type
/// @brief Constructor
///
- /// @param param_name Name of the parameter under which the database
- /// access details are held.
/// @param db_type Specifies database type (lease or hosts)
- DbAccessParser(const std::string& param_name, DBType db_type);
+ DbAccessParser(DBType db_type);
/// The destructor.
virtual ~DbAccessParser()
{}
- /// @brief Prepare configuration value.
+ /// @brief Parse configuration value.
///
/// Parses the set of strings forming the database access specification and
/// checks that all are OK. In particular it checks:
///
/// - "type" is "memfile", "mysql" or "postgresql"
/// - "lfc-interval" is a number from the range of 0 to 4294967295.
- /// - "timeout" is a number from the range of 0 to 4294967295.
+ /// - "connect-timeout" is a number from the range of 0 to 4294967295.
///
/// Once all has been validated, constructs the database access string
/// expected by the lease manager.
///
- /// @param config_value The configuration value for the "lease-database"
+ /// @param cfg_db The configuration where the access string will be set
+ /// @param database_config The configuration value for the "*-database"
/// identifier.
///
/// @throw isc::BadValue The 'type' keyword contains an unknown database
/// type.
/// @throw isc::dhcp::MissingTypeKeyword The 'type' keyword is missing from
/// the list of database access keywords.
- virtual void build(isc::data::ConstElementPtr config_value);
+ void parse(isc::dhcp::CfgDbAccessPtr& cfg_db,
+ isc::data::ConstElementPtr database_config);
- /// @brief This method is no-op.
- virtual void commit();
-
- /// @brief Factory method to create parser
- ///
- /// Creates an instance of this parser.
- ///
- /// @param param_name Name of the parameter used to access the
- /// configuration.
- ///
- /// @return Pointer to a DbAccessParser. The caller is responsible for
- /// destroying the parser after use.
- static DhcpConfigParser* factory(const std::string& param_name) {
- if (param_name == "lease-database") {
- return (new DbAccessParser(param_name, DbAccessParser::LEASE_DB));
- } else if (param_name == "hosts-database") {
- return (new DbAccessParser(param_name, DbAccessParser::HOSTS_DB));
- } else {
- isc_throw(BadValue, "Unexpected parameter name (" << param_name
- << ") passed to DbAccessParser::factory");
- }
- }
protected:
/// @brief Get database access parameters
return (values_);
}
+
/// @brief Construct database access string
///
/// Constructs the database access string from the stored parameters.
/// @return Database access string
std::string getDbAccessString() const;
+
private:
std::map<std::string, std::string> values_; ///< Stored parameter values
-// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2017 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
/// (the last in particular).
///
/// As some of the tests have the side-effect of altering the logging
- /// settings (when the parser's "build" method is called), ensure that
+ /// settings (when the parser's "parse" method is called), ensure that
/// the logging is reset to the default after each test completes.
~DbAccessParserTest() {
LeaseMgrFactory::destroy();
/// @brief Constructor
///
/// @brief Keyword/value collection of database access parameters
- TestDbAccessParser(const std::string& param_name, DbAccessParser::DBType type)
- : DbAccessParser(param_name, type)
+ TestDbAccessParser(DbAccessParser::DBType type)
+ : DbAccessParser(type)
{}
/// @brief Destructor
virtual ~TestDbAccessParser()
{}
+ /// @brief Parse configuration value
+ void parse(ConstElementPtr database_config) {
+ CfgDbAccessPtr cfg_db(new CfgDbAccess());
+ DbAccessParser::parse(cfg_db, database_config);
+ }
+
/// Allow use of superclass's protected functions.
using DbAccessParser::getDbAccessParameters;
using DbAccessParser::getDbAccessString;
ConstElementPtr json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- TestDbAccessParser parser("lease-database", DbAccessParser::LEASE_DB);
- EXPECT_NO_THROW(parser.build(json_elements));
+ TestDbAccessParser parser(DbAccessParser::LEASE_DB);
+ EXPECT_NO_THROW(parser.parse(json_elements));
checkAccessString("Valid memfile", parser.getDbAccessParameters(), config);
}
ConstElementPtr json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- TestDbAccessParser parser("lease-database", DbAccessParser::LEASE_DB);
- EXPECT_NO_THROW(parser.build(json_elements));
+ TestDbAccessParser parser(DbAccessParser::LEASE_DB);
+ EXPECT_NO_THROW(parser.parse(json_elements));
checkAccessString("Valid memfile", parser.getDbAccessParameters(), config);
}
ConstElementPtr json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- TestDbAccessParser parser("lease-database", DbAccessParser::LEASE_DB);
- EXPECT_NO_THROW(parser.build(json_elements));
+ TestDbAccessParser parser(DbAccessParser::LEASE_DB);
+ EXPECT_NO_THROW(parser.parse(json_elements));
checkAccessString("Valid memfile", parser.getDbAccessParameters(),
config);
ConstElementPtr json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- TestDbAccessParser parser("lease-database", DbAccessParser::LEASE_DB);
- EXPECT_NO_THROW(parser.build(json_elements));
+ TestDbAccessParser parser(DbAccessParser::LEASE_DB);
+ EXPECT_NO_THROW(parser.parse(json_elements));
checkAccessString("Valid memfile", parser.getDbAccessParameters(),
config);
ConstElementPtr json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- TestDbAccessParser parser("lease-database", DbAccessParser::LEASE_DB);
- EXPECT_NO_THROW(parser.build(json_elements));
+ TestDbAccessParser parser(DbAccessParser::LEASE_DB);
+ EXPECT_NO_THROW(parser.parse(json_elements));
checkAccessString("Valid LFC Interval", parser.getDbAccessParameters(),
config);
}
ConstElementPtr json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- TestDbAccessParser parser("lease-database", DbAccessParser::LEASE_DB);
- EXPECT_THROW(parser.build(json_elements), BadValue);
+ TestDbAccessParser parser(DbAccessParser::LEASE_DB);
+ EXPECT_THROW(parser.parse(json_elements), BadValue);
}
// This test checks that the parser rejects the too large (greater than
ConstElementPtr json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- TestDbAccessParser parser("lease-database", DbAccessParser::LEASE_DB);
- EXPECT_THROW(parser.build(json_elements), BadValue);
+ TestDbAccessParser parser(DbAccessParser::LEASE_DB);
+ EXPECT_THROW(parser.parse(json_elements), BadValue);
}
// This test checks that the parser accepts the valid value of the
ConstElementPtr json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- TestDbAccessParser parser("lease-database", DbAccessParser::LEASE_DB);
- EXPECT_NO_THROW(parser.build(json_elements));
+ TestDbAccessParser parser(DbAccessParser::LEASE_DB);
+ EXPECT_NO_THROW(parser.parse(json_elements));
checkAccessString("Valid timeout", parser.getDbAccessParameters(),
config);
}
ConstElementPtr json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- TestDbAccessParser parser("lease-database", DbAccessParser::LEASE_DB);
- EXPECT_THROW(parser.build(json_elements), BadValue);
+ TestDbAccessParser parser(DbAccessParser::LEASE_DB);
+ EXPECT_THROW(parser.parse(json_elements), BadValue);
}
// This test checks that the parser rejects a too large (greater than
ConstElementPtr json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- TestDbAccessParser parser("lease-database", DbAccessParser::LEASE_DB);
- EXPECT_THROW(parser.build(json_elements), BadValue);
+ TestDbAccessParser parser(DbAccessParser::LEASE_DB);
+ EXPECT_THROW(parser.parse(json_elements), BadValue);
}
// Check that the parser works with a valid MySQL configuration
ConstElementPtr json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- TestDbAccessParser parser("lease-database", DbAccessParser::LEASE_DB);
- EXPECT_NO_THROW(parser.build(json_elements));
+ TestDbAccessParser parser(DbAccessParser::LEASE_DB);
+ EXPECT_NO_THROW(parser.parse(json_elements));
checkAccessString("Valid mysql", parser.getDbAccessParameters(), config);
}
ConstElementPtr json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- TestDbAccessParser parser("lease-database", DbAccessParser::LEASE_DB);
- EXPECT_THROW(parser.build(json_elements), TypeKeywordMissing);
-}
-
-// Check that the factory function works.
-TEST_F(DbAccessParserTest, factory) {
-
- // Check that the parser is built through the factory.
- boost::scoped_ptr<DhcpConfigParser> parser(
- DbAccessParser::factory("lease-database")
- );
- EXPECT_TRUE(parser);
- DbAccessParser* dbap = dynamic_cast<DbAccessParser*>(parser.get());
- EXPECT_NE(static_cast<DbAccessParser*>(NULL), dbap);
+ TestDbAccessParser parser(DbAccessParser::LEASE_DB);
+ EXPECT_THROW(parser.parse(json_elements), TypeKeywordMissing);
}
// Check reconfiguration. Checks that incremental changes applied to the
"name", "keatest",
NULL};
- TestDbAccessParser parser("lease-database", DbAccessParser::LEASE_DB);
+ TestDbAccessParser parser(DbAccessParser::LEASE_DB);
// First configuration string should cause a representation of that string
// to be held.
ConstElementPtr json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- EXPECT_NO_THROW(parser.build(json_elements));
+ EXPECT_NO_THROW(parser.parse(json_elements));
checkAccessString("Initial configuration", parser.getDbAccessParameters(),
config1);
json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- EXPECT_NO_THROW(parser.build(json_elements));
+ EXPECT_NO_THROW(parser.parse(json_elements));
checkAccessString("Subsequent configuration", parser.getDbAccessParameters(),
config2);
json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- EXPECT_NO_THROW(parser.build(json_elements));
+ EXPECT_NO_THROW(parser.parse(json_elements));
checkAccessString("Incremental configuration", parser.getDbAccessParameters(),
config3);
json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- EXPECT_THROW(parser.build(json_elements), BadValue);
+ EXPECT_THROW(parser.parse(json_elements), BadValue);
checkAccessString("Incompatible incremental change", parser.getDbAccessParameters(),
config3);
json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- EXPECT_NO_THROW(parser.build(json_elements));
+ EXPECT_NO_THROW(parser.parse(json_elements));
checkAccessString("Compatible incremental change", parser.getDbAccessParameters(),
config4);
}
ConstElementPtr json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- TestDbAccessParser parser("lease-database", DbAccessParser::LEASE_DB);
- EXPECT_NO_THROW(parser.build(json_elements));
+ TestDbAccessParser parser(DbAccessParser::LEASE_DB);
+ EXPECT_NO_THROW(parser.parse(json_elements));
// Get the database access string
std::string dbaccess = parser.getDbAccessString();
ConstElementPtr json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- TestDbAccessParser parser("lease-database", DbAccessParser::LEASE_DB);
- EXPECT_NO_THROW(parser.build(json_elements));
+ TestDbAccessParser parser(DbAccessParser::LEASE_DB);
+ EXPECT_NO_THROW(parser.parse(json_elements));
checkAccessString("Valid readonly parameter",
parser.getDbAccessParameters(),
ConstElementPtr json_elements = Element::fromJSON(json_config);
EXPECT_TRUE(json_elements);
- TestDbAccessParser parser("lease-database", DbAccessParser::LEASE_DB);
- EXPECT_THROW(parser.build(json_elements), BadValue);
+ TestDbAccessParser parser(DbAccessParser::LEASE_DB);
+ EXPECT_THROW(parser.parse(json_elements), BadValue);
}