BIND 10 trac2906, updated. b5b6b43f34a3901dff343367515ea08f09a9d6ce [2906] Update/add some assertions in tests
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed May 1 12:28:53 UTC 2013
The branch, trac2906 has been updated
via b5b6b43f34a3901dff343367515ea08f09a9d6ce (commit)
via 4f3776c2b1d06bca0e7e02feeba79caba01ac865 (commit)
via bf4f7d8e7a3404deafa3901720e58a524e178a18 (commit)
via 03cdf37097aac9e1f10f0f349e6c0aa83f6debe9 (commit)
from 1a7685ff5054b4a51178ae24064d8cf41e817ced (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 b5b6b43f34a3901dff343367515ea08f09a9d6ce
Author: Mukund Sivaraman <muks at isc.org>
Date: Wed May 1 17:56:20 2013 +0530
[2906] Update/add some assertions in tests
commit 4f3776c2b1d06bca0e7e02feeba79caba01ac865
Author: Mukund Sivaraman <muks at isc.org>
Date: Wed May 1 17:55:59 2013 +0530
[2906] Make some more minor comment updates
commit bf4f7d8e7a3404deafa3901720e58a524e178a18
Author: Mukund Sivaraman <muks at isc.org>
Date: Wed May 1 17:39:05 2013 +0530
[2906] Fix a compile error
Don't make ZoneTableAccessorCache derive from boost::noncopyable,
as ZoneTableAccessor derives from it already.
commit 03cdf37097aac9e1f10f0f349e6c0aa83f6debe9
Author: Mukund Sivaraman <muks at isc.org>
Date: Wed May 1 17:28:30 2013 +0530
[2906] Make some minor comment updates
-----------------------------------------------------------------------
Summary of changes:
.../datasrc/tests/zone_table_accessor_unittest.cc | 6 +-
src/lib/datasrc/zone_table_accessor.h | 58 ++++++++++----------
src/lib/datasrc/zone_table_accessor_cache.h | 23 ++++----
3 files changed, 46 insertions(+), 41 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/tests/zone_table_accessor_unittest.cc b/src/lib/datasrc/tests/zone_table_accessor_unittest.cc
index ace376f..e5164b5 100644
--- a/src/lib/datasrc/tests/zone_table_accessor_unittest.cc
+++ b/src/lib/datasrc/tests/zone_table_accessor_unittest.cc
@@ -40,7 +40,7 @@ namespace {
class ZoneTableAccessorTest : public ::testing::Test {
protected:
ZoneTableAccessorTest() :
- // The paths of the zone files are dummy and wouldn't even exist,
+ // The paths of the zone files are dummy and don't even exist,
// but it doesn't matter in this test.
config_spec_(Element::fromJSON(
"{\"cache-enable\": true,"
@@ -62,7 +62,7 @@ protected:
TEST_F(ZoneTableAccessorTest, iteratorFromCache) {
// Confirm basic iterator behavior.
ZoneTableAccessor::IteratorPtr it = accessor_.getIterator();
- EXPECT_TRUE(it);
+ ASSERT_TRUE(it);
EXPECT_FALSE(it->isLast());
EXPECT_EQ(0, it->getCurrent().index); // index is always 0 for this version
EXPECT_EQ(Name("example.com"), it->getCurrent().origin);
@@ -87,6 +87,7 @@ TEST_F(ZoneTableAccessorTest, emptyTable) {
"{\"cache-enable\": true, \"params\": {}}"), true);
ZoneTableAccessorCache accessor(empty_config);
ZoneTableAccessor::IteratorPtr it = accessor.getIterator();
+ ASSERT_TRUE(it);
EXPECT_TRUE(it->isLast());
EXPECT_THROW(it->getCurrent(), isc::InvalidOperation);
EXPECT_THROW(it->next(), isc::InvalidOperation);
@@ -102,6 +103,7 @@ TEST_F(ZoneTableAccessorTest, disabledTable) {
" \"cache-zones\": [\"example.com\", \"example.org\"]}"), true);
ZoneTableAccessorCache accessor(mock_config);
ZoneTableAccessor::IteratorPtr it = accessor.getIterator();
+ ASSERT_TRUE(it);
EXPECT_TRUE(it->isLast());
EXPECT_THROW(it->getCurrent(), isc::InvalidOperation);
EXPECT_THROW(it->next(), isc::InvalidOperation);
diff --git a/src/lib/datasrc/zone_table_accessor.h b/src/lib/datasrc/zone_table_accessor.h
index c232623..7e6cefe 100644
--- a/src/lib/datasrc/zone_table_accessor.h
+++ b/src/lib/datasrc/zone_table_accessor.h
@@ -36,7 +36,7 @@ namespace datasrc {
/// \c ZoneTableAccessor, and once created it will be immutable.
///
/// \note Once Trac #2144 is completed, this struct must be defined as
-/// non assignable because it has a const member variable.
+/// non-assignable because it has a const member variable.
struct ZoneSpec {
/// \brief Constructor.
ZoneSpec(uint32_t index_param, const dns::Name& origin_param) :
@@ -46,9 +46,9 @@ struct ZoneSpec {
/// \brief Numeric zone index.
///
/// In the current initial version, this field is just a placeholder.
- /// In future, we'll probably define it as a unique index in the table
+ /// In the future, we'll probably define it as a unique index in the table
/// for that particular zone so that applications can distinguish
- /// and specify different zones efficiently. Until it's fixed this field
+ /// and specify different zones efficiently. Until it's fixed, this field
/// shouldn't be used by applications.
const uint32_t index;
@@ -60,7 +60,7 @@ struct ZoneSpec {
///
/// This is an abstract base class providing simple iteration operation
/// over zones stored in a data source. A concrete object of this class
-/// is expected to be created by \c ZoneTableAccessor::getIterator().
+/// is expected to be returned by \c ZoneTableAccessor::getIterator().
///
/// The interface is intentionally simplified and limited: it works
/// "forward-only", i.e, only goes from begin to end one time; it's not
@@ -75,13 +75,13 @@ struct ZoneSpec {
/// Likewise, this iterator does not guarantee the ordering of the zones
/// returned by \c getCurrent(). It's probably possible to ensure some
/// sorted order, but until we can be sure it's the case for many cases
-/// in practice we'll not rely on it.
+/// in practice, we'll not rely on it.
///
/// A concrete object of this class is created by specific derived
/// implementation for the corresponding data source. The implementation
/// must ensure the iterator is located at the "beginning" of the zone table,
-/// and that subsequent calls to getCurrent() goes through all the zones
-/// one by one, until isLast() returns false. The implementation must
+/// and that subsequent calls to \c getCurrent() go through all the zones
+/// one by one, until \c isLast() returns false. The implementation must
/// support the concept of "empty table"; in that case \c isLast() will
/// return \c false from the beginning.
class ZoneTableIterator : boost::noncopyable {
@@ -110,7 +110,7 @@ public:
// method.
if (isLast()) {
isc_throw(InvalidOperation,
- "next() called beyond end of zone table iterator");
+ "next() called on iterator beyond end of zone table");
}
nextImpl();
}
@@ -119,7 +119,7 @@ public:
/// currently located in the form of \c ZoneSpec.
///
/// This method must not be called once the iterator reaches the end
- /// of the table.
+ /// of the zone table.
///
/// \throw InvalidOperation called after reaching the end of table.
///
@@ -129,24 +129,25 @@ public:
// method.
if (isLast()) {
isc_throw(InvalidOperation,
- "getCurrent() called beyond end of zone table iterator");
+ "getCurrent() called on iterator beyond "
+ "end of zone table");
}
return (getCurrentImpl());
}
protected:
- /// \brief Actual implementation of next().
+ /// \brief Actual implementation of \c next().
///
- /// Each derived class must provide the implementation of next() in
- /// its data source specific form, except for the common validation
- /// check.
+ /// Each derived class must provide the implementation of \c next()
+ /// in its data source specific form, except for the common
+ /// validation check.
virtual void nextImpl() = 0;
- /// \brief Actual implementation of getCurrent().
+ /// \brief Actual implementation of \c getCurrent().
///
- /// Each derived class must provide the implementation of getCurrent() in
- /// its data source specific form, except for the common validation
- /// check.
+ /// Each derived class must provide the implementation of
+ /// \c getCurrent() in its data source specific form, except for the
+ /// common validation check.
virtual ZoneSpec getCurrentImpl() const = 0;
};
@@ -154,16 +155,17 @@ protected:
///
/// This is an abstract base class providing common interfaces to get access
/// to a conceptual "zone table" corresponding to a specific data source.
-/// A zone table would contain a set of information of DNS zones stored in
+/// A zone table would contain a set of information about DNS zones stored in
/// the data source. It's "conceptual" in that the actual form of the
/// information is specific to the data source implementation.
///
-/// The initial version of this class only provides one simply feature:
-/// iterating over the table so an application can get a list of all zones
-/// of a specific data source (of a specific class). In future, this class
-/// will be extended so that, e.g., applications can add or remove zones.
+/// The initial version of this class only provides one simple feature:
+/// iterating over the table so that an application can get a list of
+/// all zones of a specific data source (of a specific RR class). In
+/// future, this class will be extended so that, e.g., applications can
+/// add or remove zones.
///
-/// \note It may make sense to move the \c DataSourceClient::createZone()
+/// \note It may make sense to move \c DataSourceClient::createZone()
/// and \c DataSourceClient::deleteZone() to this class.
class ZoneTableAccessor : boost::noncopyable {
protected:
@@ -185,18 +187,18 @@ public:
/// In general, the specific implementation of the iterator object would
/// contain some form of reference to the underlying data source
/// (e.g., a database connection or a pointer to memory region), which
- /// would be only valid until the object that created the instance of
+ /// would be valid only until the object that created the instance of
/// the accessor is destroyed. The iterator must not be used beyond
- /// the lifetime of such creator object, and normally it's expected to
+ /// the lifetime of such a creator object, and normally it's expected to
/// be even more ephemeral: it would be created by this method in a
/// single method or function and only used in that limited scope.
///
/// \throw std::bad_alloc Memory allocation for the iterator object failed.
/// \throw Others There will be other cases as more implementations
- /// are added (in this initial version it's not really fixed yet).
+ /// are added (in this initial version, it's not really decided yet).
///
/// \return A smart pointer to a newly created iterator object. Once
- /// returned, the \c ZoneTableAccessor effectively releases the ownership.
+ /// returned, the \c ZoneTableAccessor effectively releases its ownership.
virtual IteratorPtr getIterator() const = 0;
};
diff --git a/src/lib/datasrc/zone_table_accessor_cache.h b/src/lib/datasrc/zone_table_accessor_cache.h
index ed83ff5..1286293 100644
--- a/src/lib/datasrc/zone_table_accessor_cache.h
+++ b/src/lib/datasrc/zone_table_accessor_cache.h
@@ -30,32 +30,33 @@ class CacheConfig;
/// cache. Its conceptual table consists of the zones that are specified
/// to be loaded into memory in configuration. Note that these zones
/// may or may not actually be loaded in memory. In fact, this class object
-/// is intended to be used by applications that load these zones into memory
-/// so the application can get a list of zones to be loaded. Also, even
+/// is intended to be used by applications that load these zones into memory,
+/// so that the application can get a list of zones to be loaded. Also, even
/// after loading, some zone may still not be loaded, e.g., due to an error
-/// of the corresponding zone file.
+/// in the corresponding zone file.
///
/// An object of this class is expected to be returned by
/// \c ConfigurableClientList. Normal applications shouldn't instantiate
-/// it directly. It's still defined publicly visibly for testing purpose,
-/// but to clarify the intent it's hidden in the "internal" namespace.
-class ZoneTableAccessorCache : boost::noncopyable, public ZoneTableAccessor {
+/// this class directly. It's still defined to be publicly visible for
+/// testing purposes but, to clarify the intent, it's hidden in the
+/// "internal" namespace.
+class ZoneTableAccessorCache : public ZoneTableAccessor {
public:
/// \brief Constructor.
///
/// This class takes a \c CacheConfig object and holds it throughout
- /// its lifetime. The caller must ensure the configuration is valid
- /// throughout the lifetime of this accessor object.
+ /// its lifetime. The caller must ensure that the configuration is
+ /// valid throughout the lifetime of this accessor object.
///
/// \throw None
///
/// \param config The cache configuration that the accessor refers to.
ZoneTableAccessorCache(const CacheConfig& config) : config_(config) {}
- /// \brief in-memmory cache version of getIterator().
+ /// \brief In-memory cache version of \c getIterator().
///
- /// From this version of iterator, `ZoneSpec::index` will always be set
- /// to 0 at the moment.
+ /// As returned from this version of iterator, `ZoneSpec::index`
+ /// will always be set to 0 at the moment.
///
/// \throw None except std::bad_alloc in case of memory allocation failure
virtual IteratorPtr getIterator() const;
More information about the bind10-changes
mailing list