Commit 9aabaa39 authored by Jerry's avatar Jerry
Browse files

simplify MockZone class

git-svn-id: svn:// e5f2f494-b856-4b98-b285-d166d9295462
parent 5b25a47d
......@@ -42,45 +42,26 @@ namespace datasrc {
// else return DNAME
class MockZone : public Zone{
MockZone(const isc::dns::RRClass& rrclass, const isc::dns::Name& origin);
// The destructor.
virtual ~MockZone();
MockZone() : origin_(Name(""))
virtual const isc::dns::Name& getOrigin() const;
virtual const isc::dns::RRClass& getClass() const;
FindResult find(const isc::dns::Name& name,
const isc::dns::RRType& type) const;
struct MockZoneImpl;
MockZoneImpl* impl_;
struct MockZone::MockZoneImpl {
MockZoneImpl(const RRClass& zone_class, const Name& origin) :
zone_class_(zone_class), origin_(origin)
RRClass zone_class_;
Name origin_;
MockZone::MockZone(const RRClass& zone_class, const Name& origin) :
impl_(new MockZoneImpl(zone_class, origin))
MockZone::~MockZone() {
delete impl_;
const Name&
MockZone::getOrigin() const {
return (impl_->origin_);
return (origin_);
const RRClass&
MockZone::getClass() const {
return (impl_->zone_class_);
return (RRClass::IN());
......@@ -131,7 +112,7 @@ TEST_F(QueryTest, noZone) {
TEST_F(QueryTest, matchZone) {
// match qname, normal query
memory_datasrc.addZone(ZonePtr(new MockZone(qclass, Name(""))));
memory_datasrc.addZone(ZonePtr(new MockZone()));
EXPECT_EQ(Rcode::NOERROR(), response.getRcode());
......@@ -154,8 +135,10 @@ TEST_F(QueryTest, matchZone) {
TEST_F(QueryTest, noMatchZone) {
// there's a zone in the memory datasource but it doesn't match the qname.
// should result in SERVFAIL.
memory_datasrc.addZone(ZonePtr(new MockZone(qclass, Name(""))));
memory_datasrc.addZone(ZonePtr(new MockZone()));
const Name nomatch_name(Name(""));
Query nomatch_query(memory_datasrc, nomatch_name, qtype, response);
EXPECT_EQ(Rcode::SERVFAIL(), response.getRcode());
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