From: JINMEI Tatuya Date: Fri, 21 Sep 2012 00:24:05 +0000 (-0700) Subject: [2219] workaround for letting auth test refer to in-memory data source client X-Git-Tag: trac2351_base~37^2~1^2~13^2~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=56df3cb883631fc189fde26781f5d01695fcd386;p=thirdparty%2Fkea.git [2219] workaround for letting auth test refer to in-memory data source client this is a hack, and we should eventually make it more cleanly. --- diff --git a/src/bin/auth/tests/auth_srv_unittest.cc b/src/bin/auth/tests/auth_srv_unittest.cc index e86cca4cb9..e7b4ca7dea 100644 --- a/src/bin/auth/tests/auth_srv_unittest.cc +++ b/src/bin/auth/tests/auth_srv_unittest.cc @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -1393,16 +1394,19 @@ public: const isc::datasrc::DataSourceClientPtr client(new FakeClient(info.data_src_client_ != NULL ? info.data_src_client_ : - info.cache_.get(), + info.getCacheClient(), throw_when, isc_exception, fake_rrset)); clients_.push_back(client); - data_sources_.push_back(DataSourceInfo(client.get(), - isc::datasrc::DataSourceClientContainerPtr(), false)); + data_sources_.push_back( + DataSourceInfo(client.get(), + isc::datasrc::DataSourceClientContainerPtr(), + false, RRClass::IN(), mem_sgmt_)); } } private: const boost::shared_ptr real_; vector clients_; + MemorySegmentLocal mem_sgmt_; }; } // end anonymous namespace for throwing proxy classes diff --git a/src/lib/datasrc/client_list.cc b/src/lib/datasrc/client_list.cc index ca477334a3..c6683208cd 100644 --- a/src/lib/datasrc/client_list.cc +++ b/src/lib/datasrc/client_list.cc @@ -64,6 +64,11 @@ ConfigurableClientList::ConfigurableClientList(const RRClass& rrclass) : allow_cache_(false) {} +const DataSourceClient* +ConfigurableClientList::DataSourceInfo::getCacheClient() const { + return (cache_.get()); +} + void ConfigurableClientList::configure(const ConstElementPtr& config, bool allow_cache) diff --git a/src/lib/datasrc/client_list.h b/src/lib/datasrc/client_list.h index c5118fe26e..1ed41e1dbd 100644 --- a/src/lib/datasrc/client_list.h +++ b/src/lib/datasrc/client_list.h @@ -305,6 +305,13 @@ public: util::MemorySegment& mem_sgmt); DataSourceClient* data_src_client_; DataSourceClientContainerPtr container_; + + // Accessor to cache_ in the form of DataSourceClient, hiding + // the existence of InMemoryClient as much as possible. We should + // really consider cleaner abstraction, but for now it works. + // This is also only intended to be used in auth unit tests right now. + // No other applications or tests may use it. + const DataSourceClient* getCacheClient() const; boost::shared_ptr cache_; };