]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#912] Made remove all deprecated
authorFrancis Dupont <fdupont@isc.org>
Wed, 23 Sep 2020 09:57:46 +0000 (11:57 +0200)
committerFrancis Dupont <fdupont@isc.org>
Thu, 24 Sep 2020 10:01:32 +0000 (12:01 +0200)
src/lib/stats/stats_mgr.cc
src/lib/stats/stats_mgr.h
src/lib/stats/tests/stats_mgr_unittest.cc
src/share/api/statistic-remove-all.json

index 8c4c93a3804f75fcb734831a9e2b093fc91cc75f..58b36abeed0ee6b24b5952142d3ba703196957fe 100644 (file)
@@ -519,7 +519,8 @@ StatsMgr::statisticRemoveAllHandler(const string& /*name*/,
                                     const ConstElementPtr& /*params*/) {
     StatsMgr::instance().removeAll();
     return (createAnswer(CONTROL_RESULT_SUCCESS,
-                         "All statistics removed."));
+                         "Warning: statistic-remove-all command is deprecated."
+                         " All statistics removed."));
 }
 
 ConstElementPtr
index 4b5f576644bd05731d23e876c23897d15f66236c..564df439768de9f0b35a01c2ca1596bec5f700ae 100644 (file)
@@ -219,6 +219,7 @@ public:
     void resetAll();
 
     /// @brief Removes all collected statistics.
+    /// @note This command was deprecated.
     void removeAll();
 
     /// @brief Returns size of specified statistic.
@@ -415,6 +416,8 @@ public:
 
     /// @brief Handles statistic-remove-all command
     ///
+    /// @note The statistic-remove-all command was deprecated.
+    ///
     /// This method handles statistic-remove-all command, which removes all
     /// statistics. Params parameter is ignored.
     ///
index d018b05dee7b3a5fca13ca1eb3249970464c49c3..734d134c8ddfa6039d9939f26005fcccdfdc8bbd 100644 (file)
@@ -900,6 +900,10 @@ TEST_F(StatsMgrTest, commandRemoveAll) {
     int status_code;
     ConstElementPtr rep_all = parseAnswer(status_code, rsp);
     ASSERT_EQ(0, status_code);
+    ASSERT_TRUE(rep_all);
+    std::string exp = "\"Warning: statistic-remove-all command is deprecated.";
+    exp += " All statistics removed.\"";
+    EXPECT_EQ(exp, rep_all->str());
 
     EXPECT_FALSE(StatsMgr::instance().getObservation("alpha"));
     EXPECT_FALSE(StatsMgr::instance().getObservation("beta"));
index 080ebd74a4d038e066e8b70ceb02589207f8661e..f1d9e13d9e6d37cd6957c7dc1c3cdf760436f218 100644 (file)
@@ -2,7 +2,7 @@
     "access": "write",
     "avail": "1.0.0",
     "brief": [
-        "This command deletes all statistics."
+        "(Deprecated) This command deletes all statistics."
     ],
     "cmd-comment": [
         "If the removal of all statistics is successful, the server responds with a status of 0, indicating success, and an empty parameters field. If an error is encountered, the server returns a status code of 1 (error) and the text field contains the error description."