Commit 5638c662 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

[trac736] a few cleanups

parent 1ef6e04b
......@@ -221,7 +221,6 @@ main(int argc, char* argv[]) {
LOG_DEBUG(resolver_logger, RESOLVER_DBG_INIT, RESOLVER_CONFIGLOAD);
LOG_INFO(resolver_logger, RESOLVER_STARTED);
io_service.run();
} catch (const std::exception& ex) {
LOG_FATAL(resolver_logger, RESOLVER_FAILED).arg(ex.what());
......
......@@ -638,12 +638,6 @@ Resolver::updateConfig(ConstElementPtr config) {
}
}
void
Resolver::updateLoggingConfig(ConstElementPtr config) {
std::cout << "[XX] Got new logger config: " << std::endl;
std::cout << config->str() << std::endl;
}
void
Resolver::setForwardAddresses(const AddressList& addresses)
{
......
......@@ -95,8 +95,6 @@ public:
/// \brief Handle commands from the config session
isc::data::ConstElementPtr updateConfig(isc::data::ConstElementPtr config);
void updateLoggingConfig(isc::data::ConstElementPtr config);
/// \brief Assign an ASIO IO Service queue to this Resolver object
void setDNSService(isc::asiodns::DNSService& dnss);
......
......@@ -49,11 +49,13 @@ find_spec_part(ConstElementPtr spec, const std::string& identifier) {
while(sep != std::string::npos) {
std::string part = id.substr(0, sep);
// As long as we are not in the 'final' element as specified
// by the identifier, we want to automatically traverse list
// and map specifications
while (spec_part->getType() == Element::map &&
(spec_part->contains("list_item_spec") ||
spec_part->contains("map_item_spec"))) {
if (spec_part->contains("list_item_spec")) {
std::cout << "[XX] traversing list item " << id << std::endl;
spec_part = spec_part->get("list_item_spec");
} else {
spec_part = spec_part->get("map_item_spec");
......@@ -108,11 +110,12 @@ find_spec_part(ConstElementPtr spec, const std::string& identifier) {
isc_throw(DataNotFoundError, id + " in " + identifier + " not found");
}
} else {
isc_throw(DataNotFoundError, "Element above " + id + " in " + identifier + " is not a map");
isc_throw(DataNotFoundError, "Element above " + id +
" in " + identifier +
" is not a map");
}
}
}
std::cout << "[XX] RETURNING SPEC PART FOR '" << identifier << "': " << spec_part->str() << std::endl;
return (spec_part);
}
......
......@@ -351,7 +351,9 @@ int remote_item1(0);
ConstElementPtr remote_config;
ModuleCCSession *remote_mccs(NULL);
void remoteHandler(const std::string& module_name, ConstElementPtr config, const ConfigData&) {
void remoteHandler(const std::string& module_name,
ConstElementPtr config,
const ConfigData&) {
remote_module_name = module_name;
remote_item1 = remote_mccs->getRemoteConfigValue("Spec2", "item1")->
intValue();
......
......@@ -56,16 +56,9 @@ TEST(ConfigData, getValue) {
EXPECT_EQ("a", cd.getValue(is_default, "value5")->get(0)->stringValue());
EXPECT_TRUE(is_default);
EXPECT_EQ("b", cd.getValue("value5")->get(1)->stringValue());
std::cout << "[XX] full: " << cd.getFullConfig()->str() << std::endl;
std::cout << "[XX] 1" << std::endl;
std::cout << "[XX] value5: " << cd.getValue(is_default, "value5")->str() << std::endl;
EXPECT_EQ("b", cd.getValue(is_default, "value5")->get(1)->stringValue());
std::cout << "[XX] 2" << std::endl;
std::cout << "[XX] value5/:" << cd.getValue(is_default, "value5/")->str() << std::endl;
EXPECT_EQ("b", cd.getValue(is_default, "value5/")->get(1)->stringValue());
std::cout << "[XX] 3" << std::endl;
EXPECT_TRUE(is_default);
std::cout << "[XX] 4" << std::endl;
EXPECT_EQ("{ }", cd.getValue("value6")->str());
EXPECT_EQ("{ }", cd.getValue(is_default, "value6")->str());
EXPECT_EQ("{ }", cd.getValue(is_default, "value6/")->str());
......
// Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#ifndef __DEBUG_LEVELS_H
#define __DEBUG_LEVELS_H
/// \brief Defines Debug Levels
///
/// Defines the maximum and minimum debug levels and the number of levels.
/// These are defined using #define as they are referenced in the construction
/// of variables declared outside execution units. (In this way we avoid the
/// "static initialization fiasco" problem.)
#define MIN_DEBUG_LEVEL (0)
#define MAX_DEBUG_LEVEL (99)
#define NUM_DEBUG_LEVEL (MAX_DEBUG_LEVEL - MIN_DEBUG_LEVEL + 1)
#endif // __DEBUG_LEVELS_H
......@@ -78,6 +78,7 @@ struct OutputOption {
OutputOption::Destination getDestination(const std::string& dest_str);
OutputOption::Stream getStream(const std::string& stream_str);
} // namespace log
} // namespace isc
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment