ConstRRsetPtr
RRsetCollection::find(const isc::dns::Name& name,
- const isc::dns::RRClass&,
+ const isc::dns::RRClass& rrclass,
const isc::dns::RRType& rrtype) const
{
- // TODO: RRClass needs to be checked here to see if it is as
- // expected.
+ if (rrclass != rrclass_) {
+ // We could throw an exception here, but RRsetCollection is
+ // expected to support an arbitrary collection of RRsets, and it
+ // can be queried just as arbitrarily. So we just return nothing
+ // here.
+ return (ConstRRsetPtr());
+ }
ZoneFinder& finder = updater_->getFinder();
ZoneFinderContextPtr result =
/// destroyed by the client.
///
/// \param updater The ZoneUpdater to wrap around.
- RRsetCollection(ZoneUpdaterPtr updater) :
- updater_(updater)
+ /// \param rrclass The RRClass of the records in the zone.
+ RRsetCollection(ZoneUpdaterPtr updater, const isc::dns::RRClass& rrclass) :
+ updater_(updater),
+ rrclass_(rrclass)
{}
/// \brief Destructor
private:
ZoneUpdaterPtr updater_;
+ isc::dns::RRClass rrclass_;
protected:
// TODO: RRsetCollectionBase::Iter is not implemented and the
public:
RRsetCollectionTest() :
DatabaseClientTest<ACCESSOR_TYPE>(),
- collection(this->client_->getUpdater(this->zname_, false))
+ collection(this->client_->getUpdater(this->zname_, false),
+ this->qclass_)
{}
RRsetCollection collection;
rrset = this->collection.find(Name("www.example.org"), this->qclass_,
RRType::AAAA());
EXPECT_TRUE(rrset);
+
+ // www.example.org with AAAA does not exist in RRClass::CH()
+ rrset = this->collection.find(Name("www.example.org"), RRClass::CH(),
+ RRType::AAAA());
+ EXPECT_FALSE(rrset);
}
TYPED_TEST(RRsetCollectionTest, iteratorTest) {