From: Francis Dupont Date: Wed, 23 Sep 2020 09:57:46 +0000 (+0200) Subject: [#912] Made remove all deprecated X-Git-Tag: Kea-1.9.0~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=069b850592a8d7f95deda4d1302bf4ef6fa58d14;p=thirdparty%2Fkea.git [#912] Made remove all deprecated --- diff --git a/src/lib/stats/stats_mgr.cc b/src/lib/stats/stats_mgr.cc index 8c4c93a380..58b36abeed 100644 --- a/src/lib/stats/stats_mgr.cc +++ b/src/lib/stats/stats_mgr.cc @@ -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 diff --git a/src/lib/stats/stats_mgr.h b/src/lib/stats/stats_mgr.h index 4b5f576644..564df43976 100644 --- a/src/lib/stats/stats_mgr.h +++ b/src/lib/stats/stats_mgr.h @@ -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. /// diff --git a/src/lib/stats/tests/stats_mgr_unittest.cc b/src/lib/stats/tests/stats_mgr_unittest.cc index d018b05dee..734d134c8d 100644 --- a/src/lib/stats/tests/stats_mgr_unittest.cc +++ b/src/lib/stats/tests/stats_mgr_unittest.cc @@ -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")); diff --git a/src/share/api/statistic-remove-all.json b/src/share/api/statistic-remove-all.json index 080ebd74a4..f1d9e13d9e 100644 --- a/src/share/api/statistic-remove-all.json +++ b/src/share/api/statistic-remove-all.json @@ -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."