previous_name_(false),
complete_(false),
seen_error_(false),
- warn_rfc1035_ttl_(true)
+ warn_rfc1035_ttl_(true),
+ rr_count_(0)
{}
void pushSource(const std::string& filename, const Name& current_origin) {
vector<IncludeInfo> include_info_;
bool previous_name_; // True if there was a previous name in this file
// (false at the beginning or after an $INCLUDE line)
+
public:
bool complete_; // All work done.
bool seen_error_; // Was there at least one error during the
// load?
bool warn_rfc1035_ttl_; // should warn if implicit TTL determination
// from the previous RR is used.
+ size_t rr_count_; // number of RRs successfully loaded
};
// A helper method of loadIncremental, parsing the first token of a new line.
rdata);
// Good, we loaded another one
++count;
+ ++rr_count_;
} else {
seen_error_ = true;
if (!many_errors_) {
return (impl_->complete_ && !impl_->seen_error_);
}
+size_t
+MasterLoader::getRRCount() const {
+ return (impl_->rr_count_);
+}
+
} // end namespace dns
} // end namespace isc
/// finishing the load.
bool loadedSucessfully() const;
+ size_t getRRCount() const;
+ size_t getSize() const;
+ size_t getPosition() const;
+
private:
class MasterLoaderImpl;
MasterLoaderImpl* impl_;
} // end namespace isc
#endif // MASTER_LOADER_H
+
+// Local Variables:
+// mode: c++
+// End:
RRClass::IN(), MasterLoader::MANY_ERRORS);
EXPECT_FALSE(loader_->loadedSucessfully());
+ EXPECT_EQ(0, loader_->getRRCount());
loader_->load();
EXPECT_TRUE(loader_->loadedSucessfully());
EXPECT_TRUE(errors_.empty());
EXPECT_TRUE(warnings_.empty());
+ EXPECT_EQ(4, loader_->getRRCount());
checkBasicRRs();
}
const string include_str = "$include " TEST_DATA_SRCDIR
"/broken.zone\nwww 3600 IN AAAA 2001:db8::1\n";
stringstream ss(include_str);
- // We don't test without MANY_ERRORS, we want to see what happens
+ // We perform the test with MANY_ERRORS, we want to see what happens
// after the error.
setLoader(ss, Name("example.org."), RRClass::IN(),
MasterLoader::MANY_ERRORS);
EXPECT_FALSE(loader_->loadedSucessfully());
EXPECT_EQ(1, errors_.size()); // For the broken RR
EXPECT_EQ(1, warnings_.size()); // For missing EOLN
+ EXPECT_EQ(1, loader_->getRRCount()); // broken RR shouldn't be counted
// The included file doesn't contain anything usable, but the
// line after the include should be there.