Browse Source

[2850] Make ZoneTableSegmentLocal::reset() throw NotImplemented exception

Mukund Sivaraman 12 years ago
parent
commit
2b96d4487c

+ 3 - 1
src/lib/datasrc/memory/zone_table_segment_local.cc

@@ -41,7 +41,9 @@ void
 ZoneTableSegmentLocal::reset(MemorySegmentOpenMode,
 ZoneTableSegmentLocal::reset(MemorySegmentOpenMode,
                              isc::data::ConstElementPtr)
                              isc::data::ConstElementPtr)
 {
 {
-    // This method doesn't do anything in this implementation.
+    isc_throw(isc::NotImplemented,
+              "ZoneTableSegmentLocal::reset() is not implemented and "
+              "should not be used.");
 }
 }
 
 
 // After more methods' definitions are added here, it would be a good
 // After more methods' definitions are added here, it would be a good

+ 2 - 2
src/lib/datasrc/memory/zone_table_segment_local.h

@@ -61,9 +61,9 @@ public:
         return (true);
         return (true);
     }
     }
 
 
-    /// \brief This method currently doesn't do anything.
+    /// \brief This method is not implemented.
     ///
     ///
-    /// \c mode and \c params args are currently ignored.
+    /// \throw isc::NotImplemented
     virtual void reset(MemorySegmentOpenMode mode,
     virtual void reset(MemorySegmentOpenMode mode,
                        isc::data::ConstElementPtr params);
                        isc::data::ConstElementPtr params);
 
 

+ 6 - 4
src/lib/datasrc/tests/memory/zone_table_segment_unittest.cc

@@ -52,10 +52,12 @@ TEST_F(ZoneTableSegmentTest, create) {
 }
 }
 
 
 TEST_F(ZoneTableSegmentTest, reset) {
 TEST_F(ZoneTableSegmentTest, reset) {
-    // reset() currently doesn't do anything in a local segment. But
-    // test the API.
-    ztable_segment_->reset(ZoneTableSegment::CREATE,
-                           Element::fromJSON("{}"));
+    // reset() should throw that it's not implemented so that any
+    // accidental calls are found out.
+    EXPECT_THROW({
+        ztable_segment_->reset(ZoneTableSegment::CREATE,
+                               Element::fromJSON("{}"));
+    }, isc::NotImplemented);
 }
 }
 
 
 // Helper function to check const and non-const methods.
 // Helper function to check const and non-const methods.