BIND 10 trac1976, updated. 0e5ceb2ea0871dfd07db2eb8548ba7454df0fa02 [1976] Register for the remote config
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Jun 20 16:01:15 UTC 2012
The branch, trac1976 has been updated
via 0e5ceb2ea0871dfd07db2eb8548ba7454df0fa02 (commit)
via 343dc8e1fefc65298ddf3cc7d82adf8b6b9a60bf (commit)
from 2536cfbce01e0fdd5b3d891beeedf2105ec8178c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 0e5ceb2ea0871dfd07db2eb8548ba7454df0fa02
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Jun 20 18:00:53 2012 +0200
[1976] Register for the remote config
commit 343dc8e1fefc65298ddf3cc7d82adf8b6b9a60bf
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Jun 20 17:45:23 2012 +0200
[1976] The "any" type is compatible with any default
The validation rejected all the values of "item_default" in spec files,
if the desired type was "any". Actually, the exact opposite is required,
since any type is compatible with "any".
-----------------------------------------------------------------------
Summary of changes:
src/bin/auth/datasrc_configurator.h | 6 +++++-
src/bin/auth/tests/Makefile.am | 1 +
.../auth/tests/datasrc_configurator_unittest.cc | 20 +++++++++++++++++---
src/lib/config/module_spec.cc | 2 +-
src/lib/config/tests/module_spec_unittests.cc | 1 +
src/lib/config/tests/testdata/Makefile.am | 1 +
.../tests/testdata/{spec9.spec => spec40.spec} | 4 ++--
7 files changed, 28 insertions(+), 7 deletions(-)
copy src/lib/config/tests/testdata/{spec9.spec => spec40.spec} (72%)
-----------------------------------------------------------------------
diff --git a/src/bin/auth/datasrc_configurator.h b/src/bin/auth/datasrc_configurator.h
index d5ba529..40eb9ff 100644
--- a/src/bin/auth/datasrc_configurator.h
+++ b/src/bin/auth/datasrc_configurator.h
@@ -82,6 +82,7 @@ public:
}
server_ = server;
session_ = session;
+ session->addRemoteConfig("data_sources", reconfigureInternal, false);
}
/// \brief Deinitializes the class.
///
@@ -91,6 +92,9 @@ public:
/// This can be called even if it is not initialized currently. You
/// can initialize it again after this.
static void deinit() {
+ if (session_ != NULL) {
+ session_->removeRemoteConfig("data_sources");
+ }
session_ = NULL;
server_ = NULL;
}
@@ -104,7 +108,7 @@ public:
/// \param config The configuration value to parse. It is in the form
/// as an update from the config manager.
/// \throw InvalidOperation if it is called when not initialized.
- static void reconfigure(const isc::data::ConstElementPtr& config) {
+ static void reconfigure(const isc::data::ConstElementPtr& ) {
}
};
diff --git a/src/bin/auth/tests/Makefile.am b/src/bin/auth/tests/Makefile.am
index bdb5eaa..52fc5e7 100644
--- a/src/bin/auth/tests/Makefile.am
+++ b/src/bin/auth/tests/Makefile.am
@@ -7,6 +7,7 @@ AM_CPPFLAGS += -DAUTH_OBJ_DIR=\"$(abs_top_builddir)/src/bin/auth\"
AM_CPPFLAGS += -DTEST_DATA_DIR=\"$(abs_top_srcdir)/src/lib/testutils/testdata\"
AM_CPPFLAGS += -DTEST_OWN_DATA_DIR=\"$(abs_top_srcdir)/src/bin/auth/tests/testdata\"
AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_top_builddir)/src/lib/testutils/testdata\"
+AM_CPPFLAGS += -DPLUGIN_DATA_PATH=\"$(abs_top_srcdir)/src/bin/cfgmgr/plugins\"
AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\"
AM_CXXFLAGS = $(B10_CXXFLAGS)
diff --git a/src/bin/auth/tests/datasrc_configurator_unittest.cc b/src/bin/auth/tests/datasrc_configurator_unittest.cc
index 032b603..107049a 100644
--- a/src/bin/auth/tests/datasrc_configurator_unittest.cc
+++ b/src/bin/auth/tests/datasrc_configurator_unittest.cc
@@ -57,7 +57,18 @@ protected:
// Make sure no matter what we did, it is cleaned up.
Configurator::deinit();
}
- void init() {
+ void init(const ElementPtr& config = ElementPtr()) {
+ session.getMessages()->
+ add(createAnswer(0,
+ moduleSpecFromFile(string(PLUGIN_DATA_PATH) +
+ "/datasrc.spec").
+ getFullSpec()));
+ if (config) {
+ session.getMessages()->add(createAnswer(0, config));
+ } else {
+ session.getMessages()->
+ add(createAnswer(0, ElementPtr(new MapElement)));
+ }
Configurator::init(mccs.get(), this);
}
void SetUp() {
@@ -72,15 +83,18 @@ protected:
TEST_F(DatasrcConfiguratorTest, initialization) {
// It can't be initialized again
EXPECT_THROW(init(), InvalidOperation);
+ EXPECT_TRUE(session.haveSubscription("data_sources", "*"));
// Deinitialize to make the tests reasonable
Configurator::deinit();
- // Make sure there are enough messages in it, etc.
- initSession();
+ EXPECT_FALSE(session.haveSubscription("data_sources", "*"));
// If one of them is NULL, it does not work
EXPECT_THROW(Configurator::init(NULL, this), InvalidParameter);
+ EXPECT_FALSE(session.haveSubscription("data_sources", "*"));
EXPECT_THROW(Configurator::init(mccs.get(), NULL), InvalidParameter);
+ EXPECT_FALSE(session.haveSubscription("data_sources", "*"));
// But we can initialize it again now
EXPECT_NO_THROW(init());
+ EXPECT_TRUE(session.haveSubscription("data_sources", "*"));
}
}
diff --git a/src/lib/config/module_spec.cc b/src/lib/config/module_spec.cc
index 98a991d..4414c5d 100644
--- a/src/lib/config/module_spec.cc
+++ b/src/lib/config/module_spec.cc
@@ -37,7 +37,7 @@ check_leaf_item(ConstElementPtr spec, const std::string& name,
Element::types type, bool mandatory)
{
if (spec->contains(name)) {
- if (spec->get(name)->getType() == type) {
+ if (type == Element::any || spec->get(name)->getType() == type) {
return;
} else {
isc_throw(ModuleSpecError,
diff --git a/src/lib/config/tests/module_spec_unittests.cc b/src/lib/config/tests/module_spec_unittests.cc
index b2ca7b4..d6b9a76 100644
--- a/src/lib/config/tests/module_spec_unittests.cc
+++ b/src/lib/config/tests/module_spec_unittests.cc
@@ -110,6 +110,7 @@ TEST(ModuleSpec, SpecfileItems) {
"item_default not of type map");
moduleSpecError("spec15.spec",
"badname is not a valid type name");
+ EXPECT_NO_THROW(moduleSpecFromFile(specfile("spec40.spec")));
}
TEST(ModuleSpec, SpecfileConfigData) {
diff --git a/src/lib/config/tests/testdata/Makefile.am b/src/lib/config/tests/testdata/Makefile.am
index 1bf9496..6b66005 100644
--- a/src/lib/config/tests/testdata/Makefile.am
+++ b/src/lib/config/tests/testdata/Makefile.am
@@ -66,3 +66,4 @@ EXTRA_DIST += spec36.spec
EXTRA_DIST += spec37.spec
EXTRA_DIST += spec38.spec
EXTRA_DIST += spec39.spec
+EXTRA_DIST += spec40.spec
diff --git a/src/lib/config/tests/testdata/spec40.spec b/src/lib/config/tests/testdata/spec40.spec
new file mode 100644
index 0000000..8e64fa9
--- /dev/null
+++ b/src/lib/config/tests/testdata/spec40.spec
@@ -0,0 +1,13 @@
+{
+ "module_spec": {
+ "module_name": "Spec40",
+ "config_data": [
+ { "item_name": "item1",
+ "item_type": "any",
+ "item_optional": false,
+ "item_default": "asdf"
+ }
+ ]
+ }
+}
+
More information about the bind10-changes
mailing list