BIND 10 trac1060, updated. 119442008b97f3b39d0ade075dd219a2f781e2a3 [trac1060] Rename MemoryZoneFinder to InMemoryZoneFinder
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Jul 28 09:42:11 UTC 2011
The branch, trac1060 has been updated
via 119442008b97f3b39d0ade075dd219a2f781e2a3 (commit)
from feae0b934e048b17830f49779b01c48136a5b2bf (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 119442008b97f3b39d0ade075dd219a2f781e2a3
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Thu Jul 28 11:23:06 2011 +0200
[trac1060] Rename MemoryZoneFinder to InMemoryZoneFinder
To preserve consistency.
-----------------------------------------------------------------------
Summary of changes:
src/bin/auth/auth_config.cc | 3 +-
src/bin/auth/command.cc | 8 +-
src/lib/datasrc/memory_datasrc.cc | 36 +++---
src/lib/datasrc/memory_datasrc.h | 16 +-
src/lib/datasrc/tests/memory_datasrc_unittest.cc | 173 +++++++++++-----------
src/lib/datasrc/tests/zonetable_unittest.cc | 30 ++--
6 files changed, 136 insertions(+), 130 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/auth/auth_config.cc b/src/bin/auth/auth_config.cc
index 0198963..e45d499 100644
--- a/src/bin/auth/auth_config.cc
+++ b/src/bin/auth/auth_config.cc
@@ -163,7 +163,8 @@ MemoryDatasourceConfig::build(ConstElementPtr config_value) {
isc_throw(AuthConfigError, "Missing zone file for zone: "
<< origin->str());
}
- shared_ptr<MemoryZoneFinder> new_zone(new MemoryZoneFinder(rrclass_,
+ shared_ptr<InMemoryZoneFinder> new_zone(new
+ InMemoryZoneFinder(rrclass_,
Name(origin->stringValue())));
const result::Result result = memory_client_->addZone(new_zone);
if (result == result::EXIST) {
diff --git a/src/bin/auth/command.cc b/src/bin/auth/command.cc
index 87bae40..a240457 100644
--- a/src/bin/auth/command.cc
+++ b/src/bin/auth/command.cc
@@ -136,8 +136,8 @@ public:
// that doesn't block other server operations.
// TODO: we may (should?) want to check the "last load time" and
// the timestamp of the file and skip loading if the file isn't newer.
- shared_ptr<MemoryZoneFinder> newzone(
- new MemoryZoneFinder(oldzone->getClass(), oldzone->getOrigin()));
+ shared_ptr<InMemoryZoneFinder> newzone(
+ new InMemoryZoneFinder(oldzone->getClass(), oldzone->getOrigin()));
newzone->load(oldzone->getFileName());
oldzone->swap(*newzone);
LOG_DEBUG(auth_logger, DBG_AUTH_OPS, AUTH_LOAD_ZONE)
@@ -146,7 +146,7 @@ public:
private:
// zone finder to be updated with the new file.
- shared_ptr<MemoryZoneFinder> oldzone;
+ shared_ptr<InMemoryZoneFinder> oldzone;
// A helper private method to parse and validate command parameters.
// On success, it sets 'oldzone' to the zone to be updated.
@@ -195,7 +195,7 @@ private:
" is not found in data source");
}
- oldzone = boost::dynamic_pointer_cast<MemoryZoneFinder>(
+ oldzone = boost::dynamic_pointer_cast<InMemoryZoneFinder>(
result.zone_finder);
return (true);
diff --git a/src/lib/datasrc/memory_datasrc.cc b/src/lib/datasrc/memory_datasrc.cc
index a0edd4d..23a714e 100644
--- a/src/lib/datasrc/memory_datasrc.cc
+++ b/src/lib/datasrc/memory_datasrc.cc
@@ -32,10 +32,10 @@ using namespace isc::dns;
namespace isc {
namespace datasrc {
-// Private data and hidden methods of MemoryZoneFinder
-struct MemoryZoneFinder::MemoryZoneFinderImpl {
+// Private data and hidden methods of InMemoryZoneFinder
+struct InMemoryZoneFinder::InMemoryZoneFinderImpl {
// Constructor
- MemoryZoneFinderImpl(const RRClass& zone_class, const Name& origin) :
+ InMemoryZoneFinderImpl(const RRClass& zone_class, const Name& origin) :
zone_class_(zone_class), origin_(origin), origin_data_(NULL),
domains_(true)
{
@@ -223,7 +223,7 @@ struct MemoryZoneFinder::MemoryZoneFinderImpl {
* Implementation of longer methods. We put them here, because the
* access is without the impl_-> and it will get inlined anyway.
*/
- // Implementation of MemoryZoneFinder::add
+ // Implementation of InMemoryZoneFinder::add
result::Result add(const ConstRRsetPtr& rrset, DomainTree* domains) {
// Sanitize input. This will cause an exception to be thrown
// if the input RRset is empty.
@@ -409,7 +409,7 @@ struct MemoryZoneFinder::MemoryZoneFinderImpl {
}
}
- // Implementation of MemoryZoneFinder::find
+ // Implementation of InMemoryZoneFinder::find
FindResult find(const Name& name, RRType type,
RRsetList* target, const FindOptions options) const
{
@@ -593,50 +593,50 @@ struct MemoryZoneFinder::MemoryZoneFinderImpl {
}
};
-MemoryZoneFinder::MemoryZoneFinder(const RRClass& zone_class, const Name& origin) :
- impl_(new MemoryZoneFinderImpl(zone_class, origin))
+InMemoryZoneFinder::InMemoryZoneFinder(const RRClass& zone_class, const Name& origin) :
+ impl_(new InMemoryZoneFinderImpl(zone_class, origin))
{
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_CREATE).arg(origin).
arg(zone_class);
}
-MemoryZoneFinder::~MemoryZoneFinder() {
+InMemoryZoneFinder::~InMemoryZoneFinder() {
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_DESTROY).arg(getOrigin()).
arg(getClass());
delete impl_;
}
const Name&
-MemoryZoneFinder::getOrigin() const {
+InMemoryZoneFinder::getOrigin() const {
return (impl_->origin_);
}
const RRClass&
-MemoryZoneFinder::getClass() const {
+InMemoryZoneFinder::getClass() const {
return (impl_->zone_class_);
}
ZoneFinder::FindResult
-MemoryZoneFinder::find(const Name& name, const RRType& type,
+InMemoryZoneFinder::find(const Name& name, const RRType& type,
RRsetList* target, const FindOptions options) const
{
return (impl_->find(name, type, target, options));
}
result::Result
-MemoryZoneFinder::add(const ConstRRsetPtr& rrset) {
+InMemoryZoneFinder::add(const ConstRRsetPtr& rrset) {
return (impl_->add(rrset, &impl_->domains_));
}
void
-MemoryZoneFinder::load(const string& filename) {
+InMemoryZoneFinder::load(const string& filename) {
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_LOAD).arg(getOrigin()).
arg(filename);
// Load it into a temporary tree
- MemoryZoneFinderImpl::DomainTree tmp;
+ InMemoryZoneFinderImpl::DomainTree tmp;
masterLoad(filename.c_str(), getOrigin(), getClass(),
- boost::bind(&MemoryZoneFinderImpl::addFromLoad, impl_, _1, &tmp));
+ boost::bind(&InMemoryZoneFinderImpl::addFromLoad, impl_, _1, &tmp));
// If it went well, put it inside
impl_->file_name_ = filename;
tmp.swap(impl_->domains_);
@@ -644,14 +644,14 @@ MemoryZoneFinder::load(const string& filename) {
}
void
-MemoryZoneFinder::swap(MemoryZoneFinder& zone) {
+InMemoryZoneFinder::swap(InMemoryZoneFinder& zone) {
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_SWAP).arg(getOrigin()).
arg(zone.getOrigin());
std::swap(impl_, zone.impl_);
}
const string
-MemoryZoneFinder::getFileName() const {
+InMemoryZoneFinder::getFileName() const {
return (impl_->file_name_);
}
@@ -659,7 +659,7 @@ MemoryZoneFinder::getFileName() const {
/// interface.
///
/// For now, \c InMemoryClient only contains a \c ZoneTable object, which
-/// consists of (pointers to) \c MemoryZoneFinder objects, we may add more
+/// consists of (pointers to) \c InMemoryZoneFinder objects, we may add more
/// member variables later for new features.
class InMemoryClient::InMemoryClientImpl {
public:
diff --git a/src/lib/datasrc/memory_datasrc.h b/src/lib/datasrc/memory_datasrc.h
index 288563e..d57b0dc 100644
--- a/src/lib/datasrc/memory_datasrc.h
+++ b/src/lib/datasrc/memory_datasrc.h
@@ -38,7 +38,7 @@ namespace datasrc {
/// backend). This is why the class has methods like \c load() or \c add().
///
/// This class is non copyable.
-class MemoryZoneFinder : boost::noncopyable, public ZoneFinder {
+class InMemoryZoneFinder : boost::noncopyable, public ZoneFinder {
///
/// \name Constructors and Destructor.
public:
@@ -50,11 +50,11 @@ public:
///
/// \param rrclass The RR class of the zone.
/// \param origin The origin name of the zone.
- MemoryZoneFinder(const isc::dns::RRClass& rrclass,
+ InMemoryZoneFinder(const isc::dns::RRClass& rrclass,
const isc::dns::Name& origin);
/// The destructor.
- virtual ~MemoryZoneFinder();
+ virtual ~InMemoryZoneFinder();
//@}
/// \brief Returns the origin of the zone.
@@ -171,15 +171,15 @@ public:
///
/// This method never throws an exception.
///
- /// \param zone Another \c MemoryZone object which is to be swapped with
+ /// \param zone Another \c InMemoryZone object which is to be swapped with
/// \c this zone.
- void swap(MemoryZoneFinder& zone);
+ void swap(InMemoryZoneFinder& zone);
private:
/// \name Hidden private data
//@{
- struct MemoryZoneFinderImpl;
- MemoryZoneFinderImpl* impl_;
+ struct InMemoryZoneFinderImpl;
+ InMemoryZoneFinderImpl* impl_;
//@}
};
@@ -208,7 +208,7 @@ private:
/// backend.
///
/// The findZone() method takes a domain name and returns the best matching
-/// \c MemoryZoneFinder in the form of (Boost) shared pointer, so that it can
+/// \c InMemoryZoneFinder in the form of (Boost) shared pointer, so that it can
/// provide the general interface for all data sources.
class InMemoryClient : public DataSourceClient {
public:
diff --git a/src/lib/datasrc/tests/memory_datasrc_unittest.cc b/src/lib/datasrc/tests/memory_datasrc_unittest.cc
index 8d960b0..67cbb2e 100644
--- a/src/lib/datasrc/tests/memory_datasrc_unittest.cc
+++ b/src/lib/datasrc/tests/memory_datasrc_unittest.cc
@@ -58,48 +58,50 @@ TEST_F(InMemoryClientTest, add_find_Zone) {
// add zones with different names one by one
EXPECT_EQ(result::SUCCESS, memory_client.addZone(
- ZoneFinderPtr(new MemoryZoneFinder(RRClass::IN(),
- Name("a")))));
+ ZoneFinderPtr(new InMemoryZoneFinder(RRClass::IN(),
+ Name("a")))));
EXPECT_EQ(result::SUCCESS, memory_client.addZone(
- ZoneFinderPtr(new MemoryZoneFinder(RRClass::CH(), Name("b")))));
+ ZoneFinderPtr(new InMemoryZoneFinder(RRClass::CH(),
+ Name("b")))));
EXPECT_EQ(result::SUCCESS, memory_client.addZone(
- ZoneFinderPtr(new MemoryZoneFinder(RRClass::IN(), Name("c")))));
+ ZoneFinderPtr(new InMemoryZoneFinder(RRClass::IN(),
+ Name("c")))));
// add zones with the same name suffix
EXPECT_EQ(result::SUCCESS, memory_client.addZone(
- ZoneFinderPtr(new MemoryZoneFinder(RRClass::CH(),
- Name("x.d.e.f")))));
+ ZoneFinderPtr(new InMemoryZoneFinder(RRClass::CH(),
+ Name("x.d.e.f")))));
EXPECT_EQ(result::SUCCESS, memory_client.addZone(
- ZoneFinderPtr(new MemoryZoneFinder(RRClass::CH(),
- Name("o.w.y.d.e.f")))));
+ ZoneFinderPtr(new InMemoryZoneFinder(RRClass::CH(),
+ Name("o.w.y.d.e.f")))));
EXPECT_EQ(result::SUCCESS, memory_client.addZone(
- ZoneFinderPtr(new MemoryZoneFinder(RRClass::CH(),
- Name("p.w.y.d.e.f")))));
+ ZoneFinderPtr(new InMemoryZoneFinder(RRClass::CH(),
+ Name("p.w.y.d.e.f")))));
EXPECT_EQ(result::SUCCESS, memory_client.addZone(
- ZoneFinderPtr(new MemoryZoneFinder(RRClass::IN(),
- Name("q.w.y.d.e.f")))));
+ ZoneFinderPtr(new InMemoryZoneFinder(RRClass::IN(),
+ Name("q.w.y.d.e.f")))));
// add super zone and its subzone
EXPECT_EQ(result::SUCCESS, memory_client.addZone(
- ZoneFinderPtr(new MemoryZoneFinder(RRClass::CH(),
- Name("g.h")))));
+ ZoneFinderPtr(new InMemoryZoneFinder(RRClass::CH(),
+ Name("g.h")))));
EXPECT_EQ(result::SUCCESS, memory_client.addZone(
- ZoneFinderPtr(new MemoryZoneFinder(RRClass::IN(),
+ ZoneFinderPtr(new InMemoryZoneFinder(RRClass::IN(),
Name("i.g.h")))));
EXPECT_EQ(result::SUCCESS, memory_client.addZone(
- ZoneFinderPtr(new MemoryZoneFinder(RRClass::IN(),
- Name("z.d.e.f")))));
+ ZoneFinderPtr(new InMemoryZoneFinder(RRClass::IN(),
+ Name("z.d.e.f")))));
EXPECT_EQ(result::SUCCESS, memory_client.addZone(
- ZoneFinderPtr(new MemoryZoneFinder(RRClass::IN(),
- Name("j.z.d.e.f")))));
+ ZoneFinderPtr(new InMemoryZoneFinder(RRClass::IN(),
+ Name("j.z.d.e.f")))));
// different zone class isn't allowed.
EXPECT_EQ(result::EXIST, memory_client.addZone(
- ZoneFinderPtr(new MemoryZoneFinder(RRClass::CH(),
- Name("q.w.y.d.e.f")))));
+ ZoneFinderPtr(new InMemoryZoneFinder(RRClass::CH(),
+ Name("q.w.y.d.e.f")))));
// names are compared in a case insensitive manner.
EXPECT_EQ(result::EXIST, memory_client.addZone(
- ZoneFinderPtr(new MemoryZoneFinder(RRClass::IN(),
- Name("Q.W.Y.d.E.f")))));
+ ZoneFinderPtr(new InMemoryZoneFinder(RRClass::IN(),
+ Name("Q.W.Y.d.E.f")))));
// test find zone
EXPECT_EQ(result::SUCCESS, memory_client.findZone(Name("a")).code);
@@ -109,7 +111,8 @@ TEST_F(InMemoryClientTest, add_find_Zone) {
EXPECT_EQ(result::SUCCESS,
memory_client.findZone(Name("j.z.d.e.f")).code);
EXPECT_EQ(Name("j.z.d.e.f"),
- memory_client.findZone(Name("j.z.d.e.f")).zone_finder->getOrigin());
+ memory_client.findZone(Name("j.z.d.e.f")).zone_finder->
+ getOrigin());
// NOTFOUND
EXPECT_EQ(result::NOTFOUND, memory_client.findZone(Name("d.e.f")).code);
@@ -131,38 +134,39 @@ TEST_F(InMemoryClientTest, add_find_Zone) {
EXPECT_EQ(result::PARTIALMATCH,
memory_client.findZone(Name("z.i.g.h")).code);
EXPECT_EQ(Name("i.g.h"),
- memory_client.findZone(Name("z.i.g.h")).zone_finder->getOrigin());
+ memory_client.findZone(Name("z.i.g.h")).zone_finder->
+ getOrigin());
}
TEST_F(InMemoryClientTest, getZoneCount) {
EXPECT_EQ(0, memory_client.getZoneCount());
memory_client.addZone(
- ZoneFinderPtr(new MemoryZoneFinder(rrclass,
- Name("example.com"))));
+ ZoneFinderPtr(new InMemoryZoneFinder(rrclass,
+ Name("example.com"))));
EXPECT_EQ(1, memory_client.getZoneCount());
// duplicate add. counter shouldn't change
memory_client.addZone(
- ZoneFinderPtr(new MemoryZoneFinder(rrclass,
- Name("example.com"))));
+ ZoneFinderPtr(new InMemoryZoneFinder(rrclass,
+ Name("example.com"))));
EXPECT_EQ(1, memory_client.getZoneCount());
// add one more
memory_client.addZone(
- ZoneFinderPtr(new MemoryZoneFinder(rrclass,
- Name("example.org"))));
+ ZoneFinderPtr(new InMemoryZoneFinder(rrclass,
+ Name("example.org"))));
EXPECT_EQ(2, memory_client.getZoneCount());
}
-// A helper callback of masterLoad() used in MemoryZoneFinderTest.
+// A helper callback of masterLoad() used in InMemoryZoneFinderTest.
void
setRRset(RRsetPtr rrset, vector<RRsetPtr*>::iterator& it) {
*(*it) = rrset;
++it;
}
-/// \brief Test fixture for the MemoryZoneFinder class
-class MemoryZoneFinderTest : public ::testing::Test {
+/// \brief Test fixture for the InMemoryZoneFinder class
+class InMemoryZoneFinderTest : public ::testing::Test {
// A straightforward pair of textual RR(set) and a RRsetPtr variable
// to store the RRset. Used to build test data below.
struct RRsetData {
@@ -170,7 +174,7 @@ class MemoryZoneFinderTest : public ::testing::Test {
RRsetPtr* rrset;
};
public:
- MemoryZoneFinderTest() :
+ InMemoryZoneFinderTest() :
class_(RRClass::IN()),
origin_("example.org"),
zone_finder_(class_, origin_)
@@ -233,7 +237,7 @@ public:
const RRClass class_;
const Name origin_;
// The zone to torture by tests
- MemoryZoneFinder zone_finder_;
+ InMemoryZoneFinder zone_finder_;
/*
* Some RRsets to put inside the zone.
@@ -282,7 +286,7 @@ public:
* \param check_answer Should a check against equality of the answer be
* done?
* \param answer The expected rrset, if any should be returned.
- * \param zone Check different MemoryZoneFinder object than zone_ (if NULL,
+ * \param zone Check different InMemoryZoneFinder object than zone_ (if NULL,
* uses zone_)
* \param check_wild_answer Checks that the answer has the same RRs, type
* class and TTL as the eqxpected answer and that the name corresponds
@@ -294,7 +298,7 @@ public:
bool check_answer = true,
const ConstRRsetPtr& answer = ConstRRsetPtr(),
RRsetList* target = NULL,
- MemoryZoneFinder* zone_finder = NULL,
+ InMemoryZoneFinder* zone_finder = NULL,
ZoneFinder::FindOptions options = ZoneFinder::FIND_DEFAULT,
bool check_wild_answer = false)
{
@@ -347,12 +351,12 @@ public:
};
/**
- * \brief Test MemoryZoneFinder::MemoryZoneFinder constructor.
+ * \brief Test InMemoryZoneFinder::InMemoryZoneFinder constructor.
*
* Takes the created zone and checks its properties they are the same
* as passed parameters.
*/
-TEST_F(MemoryZoneFinderTest, constructor) {
+TEST_F(InMemoryZoneFinderTest, constructor) {
ASSERT_EQ(class_, zone_finder_.getClass());
ASSERT_EQ(origin_, zone_finder_.getOrigin());
}
@@ -362,12 +366,12 @@ TEST_F(MemoryZoneFinderTest, constructor) {
* We test that it throws at the correct moments and the correct exceptions.
* And we test the return value.
*/
-TEST_F(MemoryZoneFinderTest, add) {
+TEST_F(InMemoryZoneFinderTest, add) {
// This one does not belong to this zone
- EXPECT_THROW(zone_finder_.add(rr_out_), MemoryZoneFinder::OutOfZone);
+ EXPECT_THROW(zone_finder_.add(rr_out_), InMemoryZoneFinder::OutOfZone);
// Test null pointer
EXPECT_THROW(zone_finder_.add(ConstRRsetPtr()),
- MemoryZoneFinder::NullRRset);
+ InMemoryZoneFinder::NullRRset);
// Now put all the data we have there. It should throw nothing
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_ns_)));
@@ -380,22 +384,22 @@ TEST_F(MemoryZoneFinderTest, add) {
EXPECT_NO_THROW(EXPECT_EQ(EXIST, zone_finder_.add(rr_ns_a_)));
}
-TEST_F(MemoryZoneFinderTest, addMultipleCNAMEs) {
+TEST_F(InMemoryZoneFinderTest, addMultipleCNAMEs) {
rr_cname_->addRdata(generic::CNAME("canonical2.example.org."));
- EXPECT_THROW(zone_finder_.add(rr_cname_), MemoryZoneFinder::AddError);
+ EXPECT_THROW(zone_finder_.add(rr_cname_), InMemoryZoneFinder::AddError);
}
-TEST_F(MemoryZoneFinderTest, addCNAMEThenOther) {
+TEST_F(InMemoryZoneFinderTest, addCNAMEThenOther) {
EXPECT_EQ(SUCCESS, zone_finder_.add(rr_cname_));
- EXPECT_THROW(zone_finder_.add(rr_cname_a_), MemoryZoneFinder::AddError);
+ EXPECT_THROW(zone_finder_.add(rr_cname_a_), InMemoryZoneFinder::AddError);
}
-TEST_F(MemoryZoneFinderTest, addOtherThenCNAME) {
+TEST_F(InMemoryZoneFinderTest, addOtherThenCNAME) {
EXPECT_EQ(SUCCESS, zone_finder_.add(rr_cname_a_));
- EXPECT_THROW(zone_finder_.add(rr_cname_), MemoryZoneFinder::AddError);
+ EXPECT_THROW(zone_finder_.add(rr_cname_), InMemoryZoneFinder::AddError);
}
-TEST_F(MemoryZoneFinderTest, findCNAME) {
+TEST_F(InMemoryZoneFinderTest, findCNAME) {
// install CNAME RR
EXPECT_EQ(SUCCESS, zone_finder_.add(rr_cname_));
@@ -408,7 +412,7 @@ TEST_F(MemoryZoneFinderTest, findCNAME) {
rr_cname_);
}
-TEST_F(MemoryZoneFinderTest, findCNAMEUnderZoneCut) {
+TEST_F(InMemoryZoneFinderTest, findCNAMEUnderZoneCut) {
// There's nothing special when we find a CNAME under a zone cut
// (with FIND_GLUE_OK). The behavior is different from BIND 9,
// so we test this case explicitly.
@@ -425,27 +429,27 @@ TEST_F(MemoryZoneFinderTest, findCNAMEUnderZoneCut) {
// Two DNAMEs at single domain are disallowed by RFC 2672, section 3)
// Having a CNAME there is disallowed too, but it is tested by
// addOtherThenCNAME and addCNAMEThenOther.
-TEST_F(MemoryZoneFinderTest, addMultipleDNAMEs) {
+TEST_F(InMemoryZoneFinderTest, addMultipleDNAMEs) {
rr_dname_->addRdata(generic::DNAME("target2.example.org."));
- EXPECT_THROW(zone_finder_.add(rr_dname_), MemoryZoneFinder::AddError);
+ EXPECT_THROW(zone_finder_.add(rr_dname_), InMemoryZoneFinder::AddError);
}
/*
* These two tests ensure that we can't have DNAME and NS at the same
* node with the exception of the apex of zone (forbidden by RFC 2672)
*/
-TEST_F(MemoryZoneFinderTest, addDNAMEThenNS) {
+TEST_F(InMemoryZoneFinderTest, addDNAMEThenNS) {
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_dname_)));
- EXPECT_THROW(zone_finder_.add(rr_dname_ns_), MemoryZoneFinder::AddError);
+ EXPECT_THROW(zone_finder_.add(rr_dname_ns_), InMemoryZoneFinder::AddError);
}
-TEST_F(MemoryZoneFinderTest, addNSThenDNAME) {
+TEST_F(InMemoryZoneFinderTest, addNSThenDNAME) {
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_dname_ns_)));
- EXPECT_THROW(zone_finder_.add(rr_dname_), MemoryZoneFinder::AddError);
+ EXPECT_THROW(zone_finder_.add(rr_dname_), InMemoryZoneFinder::AddError);
}
// It is allowed to have NS and DNAME at apex
-TEST_F(MemoryZoneFinderTest, DNAMEAndNSAtApex) {
+TEST_F(InMemoryZoneFinderTest, DNAMEAndNSAtApex) {
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_dname_apex_)));
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_ns_)));
@@ -456,7 +460,7 @@ TEST_F(MemoryZoneFinderTest, DNAMEAndNSAtApex) {
rr_dname_apex_);
}
-TEST_F(MemoryZoneFinderTest, NSAndDNAMEAtApex) {
+TEST_F(InMemoryZoneFinderTest, NSAndDNAMEAtApex) {
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_ns_)));
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_dname_apex_)));
}
@@ -465,7 +469,7 @@ TEST_F(MemoryZoneFinderTest, NSAndDNAMEAtApex) {
// 2672 as well.
// Search under a DNAME record. It should return the DNAME
-TEST_F(MemoryZoneFinderTest, findBelowDNAME) {
+TEST_F(InMemoryZoneFinderTest, findBelowDNAME) {
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_dname_)));
findTest(Name("below.dname.example.org"), RRType::A(), ZoneFinder::DNAME,
true, rr_dname_);
@@ -473,7 +477,7 @@ TEST_F(MemoryZoneFinderTest, findBelowDNAME) {
// Search at the domain with DNAME. It should act as DNAME isn't there, DNAME
// influences only the data below (see RFC 2672, section 3)
-TEST_F(MemoryZoneFinderTest, findAtDNAME) {
+TEST_F(InMemoryZoneFinderTest, findAtDNAME) {
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_dname_)));
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_dname_a_)));
@@ -486,7 +490,7 @@ TEST_F(MemoryZoneFinderTest, findAtDNAME) {
// Try searching something that is both under NS and DNAME, without and with
// GLUE_OK mode (it should stop at the NS and DNAME respectively).
-TEST_F(MemoryZoneFinderTest, DNAMEUnderNS) {
+TEST_F(InMemoryZoneFinderTest, DNAMEUnderNS) {
zone_finder_.add(rr_child_ns_);
zone_finder_.add(rr_child_dname_);
@@ -498,7 +502,7 @@ TEST_F(MemoryZoneFinderTest, DNAMEUnderNS) {
}
// Test adding child zones and zone cut handling
-TEST_F(MemoryZoneFinderTest, delegationNS) {
+TEST_F(InMemoryZoneFinderTest, delegationNS) {
// add in-zone data
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_ns_)));
@@ -526,7 +530,7 @@ TEST_F(MemoryZoneFinderTest, delegationNS) {
ZoneFinder::DELEGATION, true, rr_child_ns_);
}
-TEST_F(MemoryZoneFinderTest, findAny) {
+TEST_F(InMemoryZoneFinderTest, findAny) {
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_a_)));
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_ns_)));
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_child_glue_)));
@@ -571,7 +575,7 @@ TEST_F(MemoryZoneFinderTest, findAny) {
EXPECT_EQ(0, new_glue_child_rrsets.size());
}
-TEST_F(MemoryZoneFinderTest, glue) {
+TEST_F(InMemoryZoneFinderTest, glue) {
// install zone data:
// a zone cut
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_child_ns_)));
@@ -619,7 +623,7 @@ TEST_F(MemoryZoneFinderTest, glue) {
* \todo This doesn't do any kind of CNAME and so on. If it isn't
* directly there, it just tells it doesn't exist.
*/
-TEST_F(MemoryZoneFinderTest, find) {
+TEST_F(InMemoryZoneFinderTest, find) {
// Fill some data inside
// Now put all the data we have there. It should throw nothing
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_ns_)));
@@ -641,7 +645,7 @@ TEST_F(MemoryZoneFinderTest, find) {
findTest(Name("example.net"), RRType::A(), ZoneFinder::NXDOMAIN);
}
-TEST_F(MemoryZoneFinderTest, emptyNode) {
+TEST_F(InMemoryZoneFinderTest, emptyNode) {
/*
* The backend RBTree for this test should look like as follows:
* example.org
@@ -680,7 +684,7 @@ TEST_F(MemoryZoneFinderTest, emptyNode) {
findTest(Name("org"), RRType::A(), ZoneFinder::NXDOMAIN);
}
-TEST_F(MemoryZoneFinderTest, load) {
+TEST_F(InMemoryZoneFinderTest, load) {
// Put some data inside the zone
EXPECT_NO_THROW(EXPECT_EQ(result::SUCCESS, zone_finder_.add(rr_ns_)));
// Loading with different origin should fail
@@ -689,7 +693,7 @@ TEST_F(MemoryZoneFinderTest, load) {
// See the original data is still there, survived the exception
findTest(origin_, RRType::NS(), ZoneFinder::SUCCESS, true, rr_ns_);
// Create correct zone
- MemoryZoneFinder rootzone(class_, Name("."));
+ InMemoryZoneFinder rootzone(class_, Name("."));
// Try putting something inside
EXPECT_NO_THROW(EXPECT_EQ(result::SUCCESS, rootzone.add(rr_ns_aaaa_)));
// Load the zone. It should overwrite/remove the above RRset
@@ -715,7 +719,7 @@ TEST_F(MemoryZoneFinderTest, load) {
* Test that puts a (simple) wildcard into the zone and checks we can
* correctly find the data.
*/
-TEST_F(MemoryZoneFinderTest, wildcard) {
+TEST_F(InMemoryZoneFinderTest, wildcard) {
/*
* example.org.
* |
@@ -768,7 +772,7 @@ TEST_F(MemoryZoneFinderTest, wildcard) {
* - When the query is in another zone. That is, delegation cancels
* the wildcard defaults."
*/
-TEST_F(MemoryZoneFinderTest, delegatedWildcard) {
+TEST_F(InMemoryZoneFinderTest, delegatedWildcard) {
EXPECT_EQ(SUCCESS, zone_finder_.add(rr_child_wild_));
EXPECT_EQ(SUCCESS, zone_finder_.add(rr_child_ns_));
@@ -787,7 +791,7 @@ TEST_F(MemoryZoneFinderTest, delegatedWildcard) {
}
// Tests combination of wildcard and ANY.
-TEST_F(MemoryZoneFinderTest, anyWildcard) {
+TEST_F(InMemoryZoneFinderTest, anyWildcard) {
EXPECT_EQ(SUCCESS, zone_finder_.add(rr_wild_));
// First try directly the name (normal match)
@@ -815,7 +819,7 @@ TEST_F(MemoryZoneFinderTest, anyWildcard) {
// Test there's nothing in the wildcard in the middle if we load
// wild.*.foo.example.org.
-TEST_F(MemoryZoneFinderTest, emptyWildcard) {
+TEST_F(InMemoryZoneFinderTest, emptyWildcard) {
/*
* example.org.
* foo
@@ -858,7 +862,7 @@ TEST_F(MemoryZoneFinderTest, emptyWildcard) {
}
// Same as emptyWildcard, but with multiple * in the path.
-TEST_F(MemoryZoneFinderTest, nestedEmptyWildcard) {
+TEST_F(InMemoryZoneFinderTest, nestedEmptyWildcard) {
EXPECT_EQ(SUCCESS, zone_finder_.add(rr_nested_emptywild_));
{
@@ -918,7 +922,7 @@ TEST_F(MemoryZoneFinderTest, nestedEmptyWildcard) {
// We run this part twice from the below test, in two slightly different
// situations
void
-MemoryZoneFinderTest::doCancelWildcardTest() {
+InMemoryZoneFinderTest::doCancelWildcardTest() {
// These should be canceled
{
SCOPED_TRACE("Canceled under foo.wild.example.org");
@@ -972,7 +976,7 @@ MemoryZoneFinderTest::doCancelWildcardTest() {
* Tests few cases "around" the canceled wildcard match, to see something that
* shouldn't be canceled isn't.
*/
-TEST_F(MemoryZoneFinderTest, cancelWildcard) {
+TEST_F(InMemoryZoneFinderTest, cancelWildcard) {
EXPECT_EQ(SUCCESS, zone_finder_.add(rr_wild_));
EXPECT_EQ(SUCCESS, zone_finder_.add(rr_not_wild_));
@@ -991,23 +995,24 @@ TEST_F(MemoryZoneFinderTest, cancelWildcard) {
}
}
-TEST_F(MemoryZoneFinderTest, loadBadWildcard) {
+TEST_F(InMemoryZoneFinderTest, loadBadWildcard) {
// We reject loading the zone if it contains a wildcard name for
// NS or DNAME.
- EXPECT_THROW(zone_finder_.add(rr_nswild_), MemoryZoneFinder::AddError);
- EXPECT_THROW(zone_finder_.add(rr_dnamewild_), MemoryZoneFinder::AddError);
+ EXPECT_THROW(zone_finder_.add(rr_nswild_), InMemoryZoneFinder::AddError);
+ EXPECT_THROW(zone_finder_.add(rr_dnamewild_),
+ InMemoryZoneFinder::AddError);
}
-TEST_F(MemoryZoneFinderTest, swap) {
+TEST_F(InMemoryZoneFinderTest, swap) {
// build one zone with some data
- MemoryZoneFinder zone1(class_, origin_);
+ InMemoryZoneFinder zone1(class_, origin_);
EXPECT_EQ(result::SUCCESS, zone1.add(rr_ns_));
EXPECT_EQ(result::SUCCESS, zone1.add(rr_ns_aaaa_));
// build another zone of a different RR class with some other data
const Name other_origin("version.bind");
ASSERT_NE(origin_, other_origin); // make sure these two are different
- MemoryZoneFinder zone2(RRClass::CH(), other_origin);
+ InMemoryZoneFinder zone2(RRClass::CH(), other_origin);
EXPECT_EQ(result::SUCCESS,
zone2.add(RRsetPtr(new RRset(Name("version.bind"),
RRClass::CH(), RRType::TXT(),
@@ -1029,7 +1034,7 @@ TEST_F(MemoryZoneFinderTest, swap) {
ConstRRsetPtr(), NULL, &zone2);
}
-TEST_F(MemoryZoneFinderTest, getFileName) {
+TEST_F(InMemoryZoneFinderTest, getFileName) {
// for an empty zone the file name should also be empty.
EXPECT_TRUE(zone_finder_.getFileName().empty());
@@ -1039,7 +1044,7 @@ TEST_F(MemoryZoneFinderTest, getFileName) {
EXPECT_TRUE(zone_finder_.getFileName().empty());
// after a successful load, the specified file name should be set
- MemoryZoneFinder rootzone(class_, Name("."));
+ InMemoryZoneFinder rootzone(class_, Name("."));
EXPECT_NO_THROW(rootzone.load(TEST_DATA_DIR "/root.zone"));
EXPECT_EQ(TEST_DATA_DIR "/root.zone", rootzone.getFileName());
// overriding load, which will fail
diff --git a/src/lib/datasrc/tests/zonetable_unittest.cc b/src/lib/datasrc/tests/zonetable_unittest.cc
index ec13382..fa74c0e 100644
--- a/src/lib/datasrc/tests/zonetable_unittest.cc
+++ b/src/lib/datasrc/tests/zonetable_unittest.cc
@@ -18,7 +18,7 @@
#include <dns/rrclass.h>
#include <datasrc/zonetable.h>
-// We use MemoryZone to put something into the table
+// We use InMemoryZone to put something into the table
#include <datasrc/memory_datasrc.h>
#include <gtest/gtest.h>
@@ -28,29 +28,29 @@ using namespace isc::datasrc;
namespace {
TEST(ZoneTest, init) {
- MemoryZoneFinder zone(RRClass::IN(), Name("example.com"));
+ InMemoryZoneFinder zone(RRClass::IN(), Name("example.com"));
EXPECT_EQ(Name("example.com"), zone.getOrigin());
EXPECT_EQ(RRClass::IN(), zone.getClass());
- MemoryZoneFinder ch_zone(RRClass::CH(), Name("example"));
+ InMemoryZoneFinder ch_zone(RRClass::CH(), Name("example"));
EXPECT_EQ(Name("example"), ch_zone.getOrigin());
EXPECT_EQ(RRClass::CH(), ch_zone.getClass());
}
TEST(ZoneTest, find) {
- MemoryZoneFinder zone(RRClass::IN(), Name("example.com"));
+ InMemoryZoneFinder zone(RRClass::IN(), Name("example.com"));
EXPECT_EQ(ZoneFinder::NXDOMAIN,
zone.find(Name("www.example.com"), RRType::A()).code);
}
class ZoneTableTest : public ::testing::Test {
protected:
- ZoneTableTest() : zone1(new MemoryZoneFinder(RRClass::IN(),
- Name("example.com"))),
- zone2(new MemoryZoneFinder(RRClass::IN(),
- Name("example.net"))),
- zone3(new MemoryZoneFinder(RRClass::IN(),
- Name("example")))
+ ZoneTableTest() : zone1(new InMemoryZoneFinder(RRClass::IN(),
+ Name("example.com"))),
+ zone2(new InMemoryZoneFinder(RRClass::IN(),
+ Name("example.net"))),
+ zone3(new InMemoryZoneFinder(RRClass::IN(),
+ Name("example")))
{}
ZoneTable zone_table;
ZoneFinderPtr zone1, zone2, zone3;
@@ -61,8 +61,8 @@ TEST_F(ZoneTableTest, addZone) {
EXPECT_EQ(result::EXIST, zone_table.addZone(zone1));
// names are compared in a case insensitive manner.
EXPECT_EQ(result::EXIST, zone_table.addZone(
- ZoneFinderPtr(new MemoryZoneFinder(RRClass::IN(),
- Name("EXAMPLE.COM")))));
+ ZoneFinderPtr(new InMemoryZoneFinder(RRClass::IN(),
+ Name("EXAMPLE.COM")))));
EXPECT_EQ(result::SUCCESS, zone_table.addZone(zone2));
EXPECT_EQ(result::SUCCESS, zone_table.addZone(zone3));
@@ -70,8 +70,8 @@ TEST_F(ZoneTableTest, addZone) {
// Zone table is indexed only by name. Duplicate origin name with
// different zone class isn't allowed.
EXPECT_EQ(result::EXIST, zone_table.addZone(
- ZoneFinderPtr(new MemoryZoneFinder(RRClass::CH(),
- Name("example.com")))));
+ ZoneFinderPtr(new InMemoryZoneFinder(RRClass::CH(),
+ Name("example.com")))));
/// Bogus zone (NULL)
EXPECT_THROW(zone_table.addZone(ZoneFinderPtr()), isc::InvalidParameter);
@@ -109,7 +109,7 @@ TEST_F(ZoneTableTest, findZone) {
// make sure the partial match is indeed the longest match by adding
// a zone with a shorter origin and query again.
- ZoneFinderPtr zone_com(new MemoryZoneFinder(RRClass::IN(), Name("com")));
+ ZoneFinderPtr zone_com(new InMemoryZoneFinder(RRClass::IN(), Name("com")));
EXPECT_EQ(result::SUCCESS, zone_table.addZone(zone_com));
EXPECT_EQ(Name("example.com"),
zone_table.findZone(Name("www.example.com")).zone->getOrigin());
More information about the bind10-changes
mailing list