From: Michal 'vorner' Vaner Date: Fri, 22 Jun 2012 12:53:04 +0000 (+0200) Subject: [1976] Cleanup: test class to test file X-Git-Tag: trac2351_base~97^2~7^2~2^2~21^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=be542e8e2c04b89bc6788112e4006e91bcff2418;p=thirdparty%2Fkea.git [1976] Cleanup: test class to test file The SingletonList is no longer needed for transition in the main Auth code. It is now used in Query tests only, so it was moved to the query_unittest.cc and the list.h removed. --- diff --git a/src/bin/auth/Makefile.am b/src/bin/auth/Makefile.am index c39952169e..1f0fbbf63f 100644 --- a/src/bin/auth/Makefile.am +++ b/src/bin/auth/Makefile.am @@ -49,7 +49,7 @@ b10_auth_SOURCES += command.cc command.h b10_auth_SOURCES += common.h common.cc b10_auth_SOURCES += statistics.cc statistics.h b10_auth_SOURCES += datasrc_configurator.h -b10_auth_SOURCES += main.cc list.h +b10_auth_SOURCES += main.cc # This is a temporary workaround for #1206, where the InMemoryClient has been # moved to an ldopened library. We could add that library to LDADD, but that # is nonportable. This should've been moot after #1207, but there is still diff --git a/src/bin/auth/list.h b/src/bin/auth/list.h deleted file mode 100644 index 180f8bb170..0000000000 --- a/src/bin/auth/list.h +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include - -#include - -// Note: This file breaks almost every rule about how it should look like and -// other formalities. However, it is only a transitional file and will be deleted -// before the end of this branch. - -using namespace isc::datasrc; -using namespace isc::dns; - -class SingletonList : public ClientList { -public: - SingletonList(DataSourceClient& client) : - client_(client) - {} - virtual FindResult find(const Name& zone, bool exact, bool) const { - DataSourceClient::FindResult result(client_.findZone(zone)); - switch (result.code) { - case result::SUCCESS: - return (FindResult(&client_, result.zone_finder, true)); - case result::PARTIALMATCH: - if (!exact) { - return (FindResult(&client_, result.zone_finder, false)); - } - default: - return (FindResult()); - } - } -private: - DataSourceClient& client_; -}; diff --git a/src/bin/auth/tests/query_unittest.cc b/src/bin/auth/tests/query_unittest.cc index f2ac20ea3c..d63a8eb316 100644 --- a/src/bin/auth/tests/query_unittest.cc +++ b/src/bin/auth/tests/query_unittest.cc @@ -32,9 +32,9 @@ #include #include +#include #include -#include #include @@ -49,6 +49,32 @@ using namespace isc::testutils; namespace { +// Simple wrapper for a sincle data source client. +// The list simply delegates all the answers to the single +// client. +class SingletonList : public ClientList { +public: + SingletonList(DataSourceClient& client) : + client_(client) + {} + virtual FindResult find(const Name& zone, bool exact, bool) const { + DataSourceClient::FindResult result(client_.findZone(zone)); + switch (result.code) { + case result::SUCCESS: + return (FindResult(&client_, result.zone_finder, true)); + case result::PARTIALMATCH: + if (!exact) { + return (FindResult(&client_, result.zone_finder, false)); + } + default: + return (FindResult()); + } + } +private: + DataSourceClient& client_; +}; + + // This is the content of the mock zone (see below). // It's a sequence of textual RRs that is supposed to be parsed by // dns::masterLoad(). Some of the RRs are also used as the expected