Commit 17eb0c77 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

[1207] rename getInMemoryClientP back to getInMemoryClient

The temporary name with the added P is no longer necessary now the original method has been removed.
parent 188b12ea
......@@ -400,7 +400,7 @@ AuthSrv::getInMemoryClientContainer(const RRClass& rrclass) {
}
isc::datasrc::DataSourceClient*
AuthSrv::getInMemoryClientP(const RRClass& rrclass) {
AuthSrv::getInMemoryClient(const RRClass& rrclass) {
if (hasInMemoryClient()) {
return (&getInMemoryClientContainer(rrclass)->getInstance());
} else {
......
......@@ -251,7 +251,7 @@ public:
/// \param rrclass The RR class of the requested in-memory data source.
/// \return A pointer to the in-memory data source, if configured;
/// otherwise NULL.
isc::datasrc::DataSourceClient* getInMemoryClientP(
isc::datasrc::DataSourceClient* getInMemoryClient(
const isc::dns::RRClass& rrclass);
/// Returns the DataSourceClientContainer of the in-memory datasource
......
......@@ -211,7 +211,7 @@ private:
class_elem ? RRClass(class_elem->stringValue()) : RRClass::IN();
isc::datasrc::DataSourceClient* datasrc(
server.getInMemoryClientP(zone_class));
server.getInMemoryClient(zone_class));
if (datasrc == NULL) {
isc_throw(AuthCommandError, "Memory data source is disabled");
}
......
......@@ -840,7 +840,7 @@ TEST_F(AuthSrvTest, updateWithInMemoryClient) {
"{\"datasources\": [{\"type\": \"memory\"}]}", true);
// after successful configuration, we should have one (with empty zoneset).
EXPECT_TRUE(server.hasInMemoryClient());
EXPECT_EQ(0, server.getInMemoryClientP(rrclass)->getZoneCount());
EXPECT_EQ(0, server.getInMemoryClient(rrclass)->getZoneCount());
// The memory data source is empty, should return REFUSED rcode.
createDataFromFile("examplequery_fromWire.wire");
......@@ -858,7 +858,7 @@ TEST_F(AuthSrvTest, queryWithInMemoryClientNoDNSSEC) {
// for various types of queries are tested in the query tests.
updateConfig(&server, CONFIG_INMEMORY_EXAMPLE, true);
EXPECT_TRUE(server.hasInMemoryClient());
EXPECT_EQ(1, server.getInMemoryClientP(rrclass)->getZoneCount());
EXPECT_EQ(1, server.getInMemoryClient(rrclass)->getZoneCount());
createDataFromFile("nsec3query_nodnssec_fromWire.wire");
server.processMessage(*io_message, *parse_message, *response_obuffer,
......@@ -875,7 +875,7 @@ TEST_F(AuthSrvTest, queryWithInMemoryClientDNSSEC) {
// the previous case.
updateConfig(&server, CONFIG_INMEMORY_EXAMPLE, true);
EXPECT_TRUE(server.hasInMemoryClient());
EXPECT_EQ(1, server.getInMemoryClientP(rrclass)->getZoneCount());
EXPECT_EQ(1, server.getInMemoryClient(rrclass)->getZoneCount());
createDataFromFile("nsec3query_fromWire.wire");
server.processMessage(*io_message, *parse_message, *response_obuffer,
......@@ -1214,6 +1214,16 @@ private:
/// (with setInMemoryClient) with the current design of AuthSrv.
class FakeInMemoryClient : public isc::datasrc::InMemoryClient {
public:
/// \brief Create a proxy memory client
///
/// \param real_client The real (in-memory) client to proxy
/// \param throw_when if set to any value other than never, that is
/// the method that will throw an exception (either in this
/// class or the related FakeZoneFinder)
/// \param isc_exception if true, throw isc::Exception, otherwise,
/// throw std::exception
/// \param fake_rrset If non NULL, it will be used as an answer to
/// find() for that name and type.
FakeInMemoryClient(isc::datasrc::DataSourceClientContainerPtr real_client,
ThrowWhen throw_when, bool isc_exception,
ConstRRsetPtr fake_rrset = ConstRRsetPtr()) :
......@@ -1232,7 +1242,8 @@ public:
virtual FindResult
findZone(const isc::dns::Name& name) const {
checkThrow(THROW_AT_FIND_ZONE, throw_when_, isc_exception_);
const FindResult result = real_client_ptr_->getInstance().findZone(name);
const FindResult result =
real_client_ptr_->getInstance().findZone(name);
return (FindResult(result.code, isc::datasrc::ZoneFinderPtr(
new FakeZoneFinder(result.zone_finder,
throw_when_,
......
......@@ -68,7 +68,7 @@ protected:
}
void checkAnswer(const int expected_code) {
parseAnswer(rcode_, result_);
ASSERT_EQ(expected_code, rcode_) << result_->str();
EXPECT_EQ(expected_code, rcode_) << result_->str();
}
MockSession statistics_session_;
MockXfroutClient xfrout_;
......@@ -178,17 +178,17 @@ TEST_F(AuthCommandTest, shutdownIncorrectPID) {
// zones, and checks the zones are correctly loaded.
void
zoneChecks(AuthSrv& server) {
EXPECT_TRUE(server.getInMemoryClientP(RRClass::IN()));
EXPECT_EQ(ZoneFinder::SUCCESS, server.getInMemoryClientP(RRClass::IN())->
EXPECT_TRUE(server.getInMemoryClient(RRClass::IN()));
EXPECT_EQ(ZoneFinder::SUCCESS, server.getInMemoryClient(RRClass::IN())->
findZone(Name("ns.test1.example")).zone_finder->
find(Name("ns.test1.example"), RRType::A())->code);
EXPECT_EQ(ZoneFinder::NXRRSET, server.getInMemoryClientP(RRClass::IN())->
EXPECT_EQ(ZoneFinder::NXRRSET, server.getInMemoryClient(RRClass::IN())->
findZone(Name("ns.test1.example")).zone_finder->
find(Name("ns.test1.example"), RRType::AAAA())->code);
EXPECT_EQ(ZoneFinder::SUCCESS, server.getInMemoryClientP(RRClass::IN())->
EXPECT_EQ(ZoneFinder::SUCCESS, server.getInMemoryClient(RRClass::IN())->
findZone(Name("ns.test2.example")).zone_finder->
find(Name("ns.test2.example"), RRType::A())->code);
EXPECT_EQ(ZoneFinder::NXRRSET, server.getInMemoryClientP(RRClass::IN())->
EXPECT_EQ(ZoneFinder::NXRRSET, server.getInMemoryClient(RRClass::IN())->
findZone(Name("ns.test2.example")).zone_finder->
find(Name("ns.test2.example"), RRType::AAAA())->code);
}
......@@ -215,20 +215,20 @@ configureZones(AuthSrv& server) {
void
newZoneChecks(AuthSrv& server) {
EXPECT_TRUE(server.getInMemoryClientP(RRClass::IN()));
EXPECT_EQ(ZoneFinder::SUCCESS, server.getInMemoryClientP(RRClass::IN())->
EXPECT_TRUE(server.getInMemoryClient(RRClass::IN()));
EXPECT_EQ(ZoneFinder::SUCCESS, server.getInMemoryClient(RRClass::IN())->
findZone(Name("ns.test1.example")).zone_finder->
find(Name("ns.test1.example"), RRType::A())->code);
// now test1.example should have ns/AAAA
EXPECT_EQ(ZoneFinder::SUCCESS, server.getInMemoryClientP(RRClass::IN())->
EXPECT_EQ(ZoneFinder::SUCCESS, server.getInMemoryClient(RRClass::IN())->
findZone(Name("ns.test1.example")).zone_finder->
find(Name("ns.test1.example"), RRType::AAAA())->code);
// test2.example shouldn't change
EXPECT_EQ(ZoneFinder::SUCCESS, server.getInMemoryClientP(RRClass::IN())->
EXPECT_EQ(ZoneFinder::SUCCESS, server.getInMemoryClient(RRClass::IN())->
findZone(Name("ns.test2.example")).zone_finder->
find(Name("ns.test2.example"), RRType::A())->code);
EXPECT_EQ(ZoneFinder::NXRRSET, server.getInMemoryClientP(RRClass::IN())->
EXPECT_EQ(ZoneFinder::NXRRSET, server.getInMemoryClient(RRClass::IN())->
findZone(Name("ns.test2.example")).zone_finder->
find(Name("ns.test2.example"), RRType::AAAA())->code);
}
......@@ -314,7 +314,7 @@ TEST_F(AuthCommandTest,
// Get the zone and look if there are data in it (the original one was
// empty)
ASSERT_TRUE(server_.getInMemoryClientContainer(RRClass::IN()));
EXPECT_EQ(ZoneFinder::SUCCESS, server_.getInMemoryClientP(RRClass::IN())->
EXPECT_EQ(ZoneFinder::SUCCESS, server_.getInMemoryClient(RRClass::IN())->
findZone(Name("example.org")).zone_finder->
find(Name("example.org"), RRType::SOA())->code);
......@@ -329,7 +329,7 @@ TEST_F(AuthCommandTest,
checkAnswer(1);
// The previous zone is not hurt in any way
EXPECT_EQ(ZoneFinder::SUCCESS, server_.getInMemoryClientP(RRClass::IN())->
EXPECT_EQ(ZoneFinder::SUCCESS, server_.getInMemoryClient(RRClass::IN())->
findZone(Name("example.org")).zone_finder->
find(Name("example.org"), RRType::SOA())->code);
......@@ -339,7 +339,7 @@ TEST_F(AuthCommandTest,
checkAnswer(1);
// The previous zone is not hurt in any way
EXPECT_EQ(ZoneFinder::SUCCESS, server_.getInMemoryClientP(RRClass::IN())->
EXPECT_EQ(ZoneFinder::SUCCESS, server_.getInMemoryClient(RRClass::IN())->
findZone(Name("example.org")).zone_finder->
find(Name("example.org"), RRType::SOA())->code);
// Configure an unreadable zone. Should fail, but leave the original zone
......@@ -362,7 +362,7 @@ TEST_F(AuthCommandTest,
Element::fromJSON("{\"origin\": \"example.com\"}"));
checkAnswer(1);
// The previous zone is not hurt in any way
EXPECT_EQ(ZoneFinder::SUCCESS, server_.getInMemoryClientP(RRClass::IN())->
EXPECT_EQ(ZoneFinder::SUCCESS, server_.getInMemoryClient(RRClass::IN())->
findZone(Name("example.org")).zone_finder->
find(Name("example.org"), RRType::SOA())->code);
......
......@@ -76,7 +76,7 @@ TEST_F(AuthConfigTest, datasourceConfig) {
"{\"datasources\": [{\"type\": \"memory\"}]}"));
// after successful configuration, we should have one (with empty zoneset).
EXPECT_TRUE(server.hasInMemoryClient());
EXPECT_EQ(0, server.getInMemoryClientP(rrclass)->getZoneCount());
EXPECT_EQ(0, server.getInMemoryClient(rrclass)->getZoneCount());
}
TEST_F(AuthConfigTest, databaseConfig) {
......@@ -184,14 +184,14 @@ TEST_F(MemoryDatasrcConfigTest, addEmpty) {
EXPECT_FALSE(server.hasInMemoryClient());
parser->build(Element::fromJSON("[{\"type\": \"memory\"}]"));
parser->commit();
EXPECT_EQ(0, server.getInMemoryClientP(rrclass)->getZoneCount());
EXPECT_EQ(0, server.getInMemoryClient(rrclass)->getZoneCount());
}
TEST_F(MemoryDatasrcConfigTest, addZeroZone) {
parser->build(Element::fromJSON("[{\"type\": \"memory\","
" \"zones\": []}]"));
parser->commit();
EXPECT_EQ(0, server.getInMemoryClientP(rrclass)->getZoneCount());
EXPECT_EQ(0, server.getInMemoryClient(rrclass)->getZoneCount());
}
TEST_F(MemoryDatasrcConfigTest, addOneZone) {
......@@ -201,9 +201,9 @@ TEST_F(MemoryDatasrcConfigTest, addOneZone) {
" \"file\": \"" TEST_DATA_DIR
"/example.zone\"}]}]")));
EXPECT_NO_THROW(parser->commit());
EXPECT_EQ(1, server.getInMemoryClientP(rrclass)->getZoneCount());
EXPECT_EQ(1, server.getInMemoryClient(rrclass)->getZoneCount());
// Check it actually loaded something
EXPECT_EQ(ZoneFinder::SUCCESS, server.getInMemoryClientP(rrclass)->findZone(
EXPECT_EQ(ZoneFinder::SUCCESS, server.getInMemoryClient(rrclass)->findZone(
Name("ns.example.com.")).zone_finder->find(Name("ns.example.com."),
RRType::A())->code);
}
......@@ -230,7 +230,7 @@ TEST_F(MemoryDatasrcConfigTest,
+ test_db + "\","
" \"filetype\": \"sqlite3\"}]}]"));
parser->commit();
EXPECT_EQ(1, server.getInMemoryClientP(rrclass)->getZoneCount());
EXPECT_EQ(1, server.getInMemoryClient(rrclass)->getZoneCount());
// Failure case: the specified zone doesn't exist in the DB file.
delete parser;
......@@ -254,7 +254,7 @@ TEST_F(MemoryDatasrcConfigTest, addOneWithFiletypeText) {
TEST_DATA_DIR "/example.zone\","
" \"filetype\": \"text\"}]}]"));
parser->commit();
EXPECT_EQ(1, server.getInMemoryClientP(rrclass)->getZoneCount());
EXPECT_EQ(1, server.getInMemoryClient(rrclass)->getZoneCount());
}
TEST_F(MemoryDatasrcConfigTest, addMultiZones) {
......@@ -270,7 +270,7 @@ TEST_F(MemoryDatasrcConfigTest, addMultiZones) {
" \"file\": \"" TEST_DATA_DIR
"/example.net.zone\"}]}]")));
EXPECT_NO_THROW(parser->commit());
EXPECT_EQ(3, server.getInMemoryClientP(rrclass)->getZoneCount());
EXPECT_EQ(3, server.getInMemoryClient(rrclass)->getZoneCount());
}
TEST_F(MemoryDatasrcConfigTest, replace) {
......@@ -280,9 +280,9 @@ TEST_F(MemoryDatasrcConfigTest, replace) {
" \"file\": \"" TEST_DATA_DIR
"/example.zone\"}]}]")));
EXPECT_NO_THROW(parser->commit());
EXPECT_EQ(1, server.getInMemoryClientP(rrclass)->getZoneCount());
EXPECT_EQ(1, server.getInMemoryClient(rrclass)->getZoneCount());
EXPECT_EQ(isc::datasrc::result::SUCCESS,
server.getInMemoryClientP(rrclass)->findZone(
server.getInMemoryClient(rrclass)->findZone(
Name("example.com")).code);
// create a new parser, and install a new set of configuration. It
......@@ -298,9 +298,9 @@ TEST_F(MemoryDatasrcConfigTest, replace) {
" \"file\": \"" TEST_DATA_DIR
"/example.net.zone\"}]}]")));
EXPECT_NO_THROW(parser->commit());
EXPECT_EQ(2, server.getInMemoryClientP(rrclass)->getZoneCount());
EXPECT_EQ(2, server.getInMemoryClient(rrclass)->getZoneCount());
EXPECT_EQ(isc::datasrc::result::NOTFOUND,
server.getInMemoryClientP(rrclass)->findZone(
server.getInMemoryClient(rrclass)->findZone(
Name("example.com")).code);
}
......@@ -312,9 +312,9 @@ TEST_F(MemoryDatasrcConfigTest, exception) {
" \"file\": \"" TEST_DATA_DIR
"/example.zone\"}]}]")));
EXPECT_NO_THROW(parser->commit());
EXPECT_EQ(1, server.getInMemoryClientP(rrclass)->getZoneCount());
EXPECT_EQ(1, server.getInMemoryClient(rrclass)->getZoneCount());
EXPECT_EQ(isc::datasrc::result::SUCCESS,
server.getInMemoryClientP(rrclass)->findZone(
server.getInMemoryClient(rrclass)->findZone(
Name("example.com")).code);
// create a new parser, and try to load something. It will throw,
......@@ -335,9 +335,9 @@ TEST_F(MemoryDatasrcConfigTest, exception) {
// commit it
// The original should be untouched
EXPECT_EQ(1, server.getInMemoryClientP(rrclass)->getZoneCount());
EXPECT_EQ(1, server.getInMemoryClient(rrclass)->getZoneCount());
EXPECT_EQ(isc::datasrc::result::SUCCESS,
server.getInMemoryClientP(rrclass)->findZone(
server.getInMemoryClient(rrclass)->findZone(
Name("example.com")).code);
}
......@@ -348,7 +348,7 @@ TEST_F(MemoryDatasrcConfigTest, remove) {
" \"file\": \"" TEST_DATA_DIR
"/example.zone\"}]}]")));
EXPECT_NO_THROW(parser->commit());
EXPECT_EQ(1, server.getInMemoryClientP(rrclass)->getZoneCount());
EXPECT_EQ(1, server.getInMemoryClient(rrclass)->getZoneCount());
delete parser;
parser = createAuthConfigParser(server, "datasources");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment