using isc::dns::RRClass;
using isc::dns::Name;
+using isc::dns::RRType;
+using isc::dns::ConstRRsetPtr;
using std::string;
using std::vector;
+using boost::shared_ptr;
using namespace isc::datasrc;
namespace {
// FIXME: We should be destroying it by ZoneTableSegment::destroy.
// But the shared pointer won't let us, will it?
- boost::shared_ptr<memory::ZoneTableSegment> ztable_segment_;
+ shared_ptr<memory::ZoneTableSegment> ztable_segment_;
protected:
memory::InMemoryClient source_client_;
// This one is mocked. It will help us see what is happening inside.
// And it also throws when there's a syntax error in the master file
TEST_F(ZoneLoaderTest, loadSyntaxError) {
- EXPECT_THROW(ZoneLoader(destination_client_, Name::ROOT_NAME(),
- // This is not a master file for sure
- // (misusing a file that happens to be there
- // already).
- TEST_DATA_DIR "/example.org.sqlite3"),
- MasterFileError);
+ ZoneLoader loader(destination_client_, Name::ROOT_NAME(),
+ // This is not a master file for sure
+ // (misusing a file that happens to be there
+ // already).
+ TEST_DATA_DIR "/example.org.sqlite3");
+ EXPECT_THROW(loader.load(), MasterFileError);
+ EXPECT_FALSE(destination_client_.commit_called_);
}
}
/// beforehead.
/// \throw DataSourceError in case of other (possibly low-level) errors,
/// such as read-only data source or database error.
- /// \throw MasterFileError when the master_file is badly formatted or some
- /// similar problem is found when loading the master file.
ZoneLoader(DataSourceClient& destination, const isc::dns::Name& zone_name,
const char* master_file);
/// \throw InvalidOperation in case the loading was already completed
/// before this call.
/// \throw DataSourceError in case some error (possibly low-level) happens.
+ /// \throw MasterFileError when the master_file is badly formatted or some
+ /// similar problem is found when loading the master file.
void load() {
while (!loadIncremental(1000)) { // 1000 is arbitrary largish number
// Body intentionally left blank.
/// before this call (by load() or by a loadIncremental that returned
/// true).
/// \throw DataSourceError in case some error (possibly low-level) happens.
+ /// \throw MasterFileError when the master_file is badly formatted or some
+ /// similar problem is found when loading the master file.
bool loadIncremental(size_t limit);
private:
/// \brief The iterator used as source of data in case of the copy mode.