]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2207] Tests for the zone updater
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Thu, 11 Oct 2012 17:08:56 +0000 (19:08 +0200)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Thu, 11 Oct 2012 17:08:56 +0000 (19:08 +0200)
Doesn't compile, there's no (not even empty) implementation of many
methods of the updater.

src/lib/datasrc/memory/zone_updater.h
src/lib/datasrc/tests/memory/Makefile.am

index cce07b93a3502031c6ca8983fd95ed3b5a3ce589..96588661252708be43d46f365f379b524f9e441f 100644 (file)
@@ -79,7 +79,23 @@ public:
 // TODO: Fully define this. It is supposed to be passed to the install_action
 // callback, but what does it actually represent? Is it the actuall zone data
 // there?
-class ZoneSegment {};
+//
+// The current interface is temporary, so the tests work. It will probably
+// change (and we may even fold this class to some other, because there
+// seem to be too many classes around holding zone already).
+//
+// FIXME: Who is responsible for releasing of the segment itself?
+class ZoneSegment {
+public:
+    explicit ZoneSegment(ZoneData* data) :
+        data_(data)
+    {}
+    ZoneData* getZoneData() {
+        return (data_);
+    }
+private:
+    ZoneData* data_;
+};
 // TODO: Somehow specify what the ID is
 class ZoneSegmentID {};
 
@@ -98,7 +114,8 @@ typedef boost::function<void(ZoneData*)> LoadAction;
 ///
 /// Upon successful completion, the ownership of the new zone is passed
 /// to the callback and the old to the updater.
-typedef boost::function<ZoneData* (ZoneSegmentID, ZoneSegment*)> InstallAction;
+typedef boost::function<ZoneData* (const ZoneSegmentID&,
+                                   ZoneSegment*)> InstallAction;
 
 /// \brief Updater implementation which loads data locally.
 ///
index 37e9043523d01eee11d22c73b8de70ffbeb2f4aa..ba922a648d2ba77424ef76b90e97b054ef159ce8 100644 (file)
@@ -33,6 +33,7 @@ run_unittests_SOURCES += memory_segment_test.h
 run_unittests_SOURCES += segment_object_holder_unittest.cc
 run_unittests_SOURCES += memory_client_unittest.cc
 run_unittests_SOURCES += zone_table_segment_unittest.cc
+run_unittests_SOURCES += zone_updater_unittest.cc
 
 run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
 run_unittests_LDFLAGS  = $(AM_LDFLAGS)  $(GTEST_LDFLAGS)