From: JINMEI Tatuya Date: Tue, 23 Oct 2012 16:37:19 +0000 (-0700) Subject: [2211] s/swapDataSrcClientLists/setDataSrcClientLists/ and changed the behavior X-Git-Tag: trac2402_base~3^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=113201b72be892ffd8af815806ccbb0e14ad6b67;p=thirdparty%2Fkea.git [2211] s/swapDataSrcClientLists/setDataSrcClientLists/ and changed the behavior the users of this method only need the set behavior, and the previous code actually didn't swap them as expected anyway. --- diff --git a/src/bin/auth/benchmarks/query_bench.cc b/src/bin/auth/benchmarks/query_bench.cc index 2bc674d2ca..77b3377434 100644 --- a/src/bin/auth/benchmarks/query_bench.cc +++ b/src/bin/auth/benchmarks/query_bench.cc @@ -127,9 +127,9 @@ public: OutputBuffer& buffer) : QueryBenchMark(queries, query_message, buffer) { - // Note: swapDataSrcClientLists() may be deprecated, but until then + // Note: setDataSrcClientLists() may be deprecated, but until then // we use it because we want to be synchronized with the server. - server_->getDataSrcClientsMgr().swapDataSrcClientLists( + server_->getDataSrcClientsMgr().setDataSrcClientLists( configureDataSource( Element::fromJSON("{\"IN\":" " [{\"type\": \"sqlite3\"," @@ -148,7 +148,7 @@ public: OutputBuffer& buffer) : QueryBenchMark(queries, query_message, buffer) { - server_->getDataSrcClientsMgr().swapDataSrcClientLists( + server_->getDataSrcClientsMgr().setDataSrcClientLists( configureDataSource( Element::fromJSON("{\"IN\":" " [{\"type\": \"MasterFiles\"," diff --git a/src/bin/auth/datasrc_clients_mgr.h b/src/bin/auth/datasrc_clients_mgr.h index 1d5c17cfa5..273299311b 100644 --- a/src/bin/auth/datasrc_clients_mgr.h +++ b/src/bin/auth/datasrc_clients_mgr.h @@ -219,14 +219,14 @@ public: reconfigureHook(); // for test's customization } - /// \brief Swap the underlying data source client lists. + /// \brief Set the underlying data source client lists to new lists. /// /// This is provided only for some existing tests until we support a /// cleaner way to use faked data source clients. Non test code or /// newer tests must not use this. - void swapDataSrcClientLists(datasrc::DataSrcClientListsPtr new_lists) { + void setDataSrcClientLists(datasrc::DataSrcClientListsPtr new_lists) { typename MutexType::Locker locker(map_mutex_); - clients_map_.swap(new_lists); + clients_map_ = new_lists; } private: diff --git a/src/bin/auth/tests/auth_srv_unittest.cc b/src/bin/auth/tests/auth_srv_unittest.cc index e94dbf602f..5d224c3e9c 100644 --- a/src/bin/auth/tests/auth_srv_unittest.cc +++ b/src/bin/auth/tests/auth_srv_unittest.cc @@ -730,7 +730,7 @@ installDataSrcClientLists(AuthSrv& server, DataSrcClientListsPtr lists) { // For now, we use explicit swap than reconfigure() because the latter // involves a separate thread and cannot guarantee the new config is // available for the subsequent test. - server.getDataSrcClientsMgr().swapDataSrcClientLists(lists); + server.getDataSrcClientsMgr().setDataSrcClientLists(lists); } void @@ -1447,7 +1447,7 @@ TEST_F(AuthSrvTest, } DataSrcClientListsPtr lists(new std::map); lists->insert(pair(RRClass::IN(), list)); - server.getDataSrcClientsMgr().swapDataSrcClientLists(lists); + server.getDataSrcClientsMgr().setDataSrcClientLists(lists); createDataFromFile("nsec3query_nodnssec_fromWire.wire"); server.processMessage(*io_message, *parse_message, *response_obuffer, @@ -1479,7 +1479,7 @@ setupThrow(AuthSrv& server, ThrowWhen throw_when, bool isc_exception, } DataSrcClientListsPtr lists(new std::map); lists->insert(pair(RRClass::IN(), list)); - mgr.swapDataSrcClientLists(lists); + mgr.setDataSrcClientLists(lists); } TEST_F(AuthSrvTest, diff --git a/src/bin/auth/tests/command_unittest.cc b/src/bin/auth/tests/command_unittest.cc index 3e201e8e04..795d9a21d0 100644 --- a/src/bin/auth/tests/command_unittest.cc +++ b/src/bin/auth/tests/command_unittest.cc @@ -193,7 +193,7 @@ zoneChecks(AuthSrv& server) { void installDataSrcClientLists(AuthSrv& server, DataSrcClientListsPtr lists) { - server.getDataSrcClientsMgr().swapDataSrcClientLists(lists); + server.getDataSrcClientsMgr().setDataSrcClientLists(lists); } void diff --git a/src/bin/auth/tests/datasrc_config_unittest.cc b/src/bin/auth/tests/datasrc_config_unittest.cc index e0046d6396..b555aa69ad 100644 --- a/src/bin/auth/tests/datasrc_config_unittest.cc +++ b/src/bin/auth/tests/datasrc_config_unittest.cc @@ -77,8 +77,8 @@ datasrcConfigHandler(DatasrcConfigTest* fake_server, const std::string&, class DatasrcConfigTest : public ::testing::Test { public: - void swapDataSrcClientLists(shared_ptr > - new_lists) + void setDataSrcClientLists(shared_ptr > + new_lists) { lists_.clear(); // first empty it @@ -161,7 +161,7 @@ testConfigureDataSource(DatasrcConfigTest& test, // possible to easily look that they were called. shared_ptr > lists = configureDataSourceGeneric(config); - test.swapDataSrcClientLists(lists); + test.setDataSrcClientLists(lists); } // Push there a configuration with a single list.