Commit 61e7f493 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

[trac471] address review comments

parent 13a3fcfa
...@@ -584,11 +584,6 @@ Resolver::updateConfig(ConstElementPtr config) { ...@@ -584,11 +584,6 @@ Resolver::updateConfig(ConstElementPtr config) {
} }
} }
void
Resolver::setConfigured() {
configured_ = true;
}
void void
Resolver::setForwardAddresses(const AddressList& addresses) Resolver::setForwardAddresses(const AddressList& addresses)
{ {
......
...@@ -119,11 +119,11 @@ public: ...@@ -119,11 +119,11 @@ public:
asiolink::SimpleCallback* getCheckinProvider() { return (checkin_); } asiolink::SimpleCallback* getCheckinProvider() { return (checkin_); }
/** /**
* \brief Tell the Resolver that is should has already been * \brief Tell the Resolver that is has already been configured
* configured (used by updateConfig() and tests, so * so that it will only set some defaults the first time
* that it will only set some defaults the first time * (used by updateConfig() and tests)
*/ */
void setConfigured(); void setConfigured() { configured_ = true; };
/** /**
* \brief Specify the list of upstream servers. * \brief Specify the list of upstream servers.
......
...@@ -373,19 +373,17 @@ ModuleSpec::validateSpecList(ConstElementPtr spec, ConstElementPtr data, ...@@ -373,19 +373,17 @@ ModuleSpec::validateSpecList(ConstElementPtr spec, ConstElementPtr data,
BOOST_FOREACH(maptype m, data->mapValue()) { BOOST_FOREACH(maptype m, data->mapValue()) {
bool found = false; bool found = false;
// Ignore 'version' as a config element // Ignore 'version' as a config element
if (m.first.compare("version") == 0) { if (m.first.compare("version") != 0) {
found = true;
} else {
BOOST_FOREACH(ConstElementPtr cur_spec_el, spec->listValue()) { BOOST_FOREACH(ConstElementPtr cur_spec_el, spec->listValue()) {
if (cur_spec_el->get("item_name")->stringValue().compare(m.first) == 0) { if (cur_spec_el->get("item_name")->stringValue().compare(m.first) == 0) {
found = true; found = true;
} }
} }
} if (!found) {
if (!found) { validated = false;
validated = false; if (errors) {
if (errors) { errors->add(Element::create("Unknown item " + m.first));
errors->add(Element::create("Unknown item " + m.first)); }
} }
} }
} }
......
...@@ -162,6 +162,10 @@ TEST(ModuleSpec, DataValidation) { ...@@ -162,6 +162,10 @@ TEST(ModuleSpec, DataValidation) {
EXPECT_FALSE(dataTest(dd, "data22_8.data")); EXPECT_FALSE(dataTest(dd, "data22_8.data"));
EXPECT_FALSE(dataTest(dd, "data22_9.data")); EXPECT_FALSE(dataTest(dd, "data22_9.data"));
// Test if "version" is allowed in config data
// (same data as 22_7, but added "version")
EXPECT_TRUE(dataTest(dd, "data22_10.data"));
ElementPtr errors = Element::createList(); ElementPtr errors = Element::createList();
EXPECT_FALSE(dataTestWithErrors(dd, "data22_8.data", errors)); EXPECT_FALSE(dataTestWithErrors(dd, "data22_8.data", errors));
EXPECT_EQ("[ \"Type mismatch\" ]", errors->str()); EXPECT_EQ("[ \"Type mismatch\" ]", errors->str());
......
Supports Markdown
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