Browse Source

[2207] Tests for the getZoneReloader

Michal 'vorner' Vaner 12 years ago
parent
commit
51580fd1a4
1 changed files with 24 additions and 0 deletions
  1. 24 0
      src/lib/datasrc/tests/memory/zone_table_segment_unittest.cc

+ 24 - 0
src/lib/datasrc/tests/memory/zone_table_segment_unittest.cc

@@ -13,8 +13,14 @@
 // PERFORMANCE OF THIS SOFTWARE.
 
 #include <datasrc/memory/zone_table_segment.h>
+#include <datasrc/memory/zone_reloader.h>
 #include <gtest/gtest.h>
 
+#include <boost/scoped_ptr.hpp>
+
+using boost::scoped_ptr;
+using isc::dns::Name;
+using isc::dns::RRClass;
 using namespace isc::datasrc::memory;
 using namespace isc::data;
 using namespace isc::util;
@@ -80,4 +86,22 @@ TEST_F(ZoneTableSegmentTest, getMemorySegment) {
     EXPECT_TRUE(mem_sgmt.allMemoryDeallocated());
 }
 
+ZoneData*
+load_action(MemorySegment&) {
+    // The function won't be called, so this is OK
+    return (NULL);
+}
+
+// Test we can get a reloader.
+TEST_F(ZoneTableSegmentTest, getZoneReloader) {
+    scoped_ptr<ZoneReloader>
+        reloader(segment_->getZoneReloader(load_action, Name("example.org"),
+                                           RRClass::IN()));
+    // We have to get something
+    EXPECT_NE(static_cast<void*>(NULL), reloader.get());
+    // And for now, it should be the local reloader
+    EXPECT_NE(static_cast<void*>(NULL),
+              dynamic_cast<ZoneReloaderLocal*>(reloader.get()));
+}
+
 } // anonymous namespace