Commit 32d750c6 authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[2850] Rename MemorySegmentTest to MemorySegmentMock (to not resemble a fixture)

parent 7bea7dd8
......@@ -37,7 +37,7 @@
#include <testutils/dnsmessage_test.h>
#include "memory_segment_test.h"
#include <datasrc/tests/memory/memory_segment_mock.h>
#include <datasrc/tests/memory/zone_table_segment_mock.h>
#include <gtest/gtest.h>
......@@ -179,7 +179,7 @@ protected:
EXPECT_TRUE(mem_sgmt_.allMemoryDeallocated()); // catch any leak here.
}
const RRClass zclass_;
test::MemorySegmentTest mem_sgmt_;
test::MemorySegmentMock mem_sgmt_;
shared_ptr<ZoneTableSegment> ztable_segment_;
boost::scoped_ptr<InMemoryClient> client_;
};
......@@ -310,7 +310,7 @@ TEST_F(MemoryClientTest, loadMemoryAllocationFailures) {
// Include the InMemoryClient construction too here. Now,
// even allocations done from InMemoryClient constructor
// fail (due to MemorySegmentTest throwing) and we check for
// fail (due to MemorySegmentMock throwing) and we check for
// leaks when this happens.
InMemoryClient client2(ztable_segment, zclass_);
loadZoneIntoTable(*ztable_segment, Name("example.org"), zclass_,
......
......@@ -33,9 +33,9 @@ namespace test {
// allocate() will succeed, and the 3rd call will fail with an exception.
// This segment object can be used after the exception is thrown, and the
// count is internally reset to 0.
class MemorySegmentTest : public isc::util::MemorySegmentLocal {
class MemorySegmentMock : public isc::util::MemorySegmentLocal {
public:
MemorySegmentTest() : throw_count_(0) {}
MemorySegmentMock() : throw_count_(0) {}
virtual void* allocate(std::size_t size) {
if (throw_count_ > 0) {
if (--throw_count_ == 0) {
......
......@@ -15,13 +15,13 @@
#include <datasrc/memory/rrset_collection.h>
#include "memory_segment_test.h"
#include <datasrc/memory/zone_data_loader.h>
#include <datasrc/memory/segment_object_holder.h>
#include <dns/rrttl.h>
#include <dns/rdataclass.h>
#include <datasrc/tests/memory/memory_segment_mock.h>
#include <gtest/gtest.h>
using namespace isc::dns;
......@@ -52,7 +52,7 @@ public:
const RRClass rrclass;
const Name origin;
std::string zone_file;
test::MemorySegmentTest mem_sgmt;
test::MemorySegmentMock mem_sgmt;
SegmentObjectHolder<ZoneData, RRClass> zone_data_holder;
RRsetCollection collection;
};
......
......@@ -22,7 +22,7 @@
#include <dns/name.h>
#include <dns/rrclass.h>
#include "memory_segment_test.h"
#include <datasrc/tests/memory/memory_segment_mock.h>
#include <gtest/gtest.h>
......@@ -41,7 +41,7 @@ protected:
EXPECT_TRUE(mem_sgmt_.allMemoryDeallocated()); // catch any leak here.
}
const RRClass zclass_;
test::MemorySegmentTest mem_sgmt_;
test::MemorySegmentMock mem_sgmt_;
ZoneData* zone_data_;
};
......
......@@ -16,8 +16,6 @@
#include <datasrc/memory/rdata_serialization.h>
#include <datasrc/memory/rdataset.h>
#include "memory_segment_test.h"
#include <dns/rdataclass.h>
#include <exceptions/exceptions.h>
......@@ -30,6 +28,7 @@
#include <dns/rrttl.h>
#include <testutils/dnsmessage_test.h>
#include <datasrc/tests/memory/memory_segment_mock.h>
#include <gtest/gtest.h>
......@@ -73,7 +72,7 @@ protected:
EXPECT_TRUE(mem_sgmt_.allMemoryDeallocated());
}
MemorySegmentTest mem_sgmt_;
MemorySegmentMock mem_sgmt_;
NSEC3Data* nsec3_data_;
const generic::NSEC3PARAM param_rdata_, param_rdata_nosalt_,
param_rdata_largesalt_;
......@@ -88,7 +87,7 @@ protected:
// Shared by both test cases using NSEC3 and NSEC3PARAM Rdata
template <typename RdataType>
void
checkNSEC3Data(MemorySegmentTest& mem_sgmt,
checkNSEC3Data(MemorySegmentMock& mem_sgmt,
const Name& zone_name,
const RdataType& expect_rdata)
{
......
......@@ -25,7 +25,7 @@
#include <dns/rrset.h>
#include <dns/rrttl.h>
#include "memory_segment_test.h"
#include <datasrc/tests/memory/memory_segment_mock.h>
#include <gtest/gtest.h>
......@@ -66,7 +66,7 @@ protected:
const Name zname_;
const RRClass zclass_;
test::MemorySegmentTest mem_sgmt_;
test::MemorySegmentMock mem_sgmt_;
ZoneData* zone_data_;
boost::scoped_ptr<ZoneDataUpdater> updater_;
};
......
......@@ -12,7 +12,7 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#include <datasrc/tests/memory/memory_segment_test.h>
#include <datasrc/tests/memory/memory_segment_mock.h>
#include <datasrc/tests/memory/zone_table_segment_mock.h>
#include <datasrc/tests/memory/zone_loader_util.h>
......@@ -221,7 +221,7 @@ protected:
const RRClass class_;
const Name origin_;
// The zone finder to torture by tests
MemorySegmentTest mem_sgmt_;
MemorySegmentMock mem_sgmt_;
memory::ZoneData* zone_data_;
memory::InMemoryZoneFinder zone_finder_;
ZoneDataUpdater updater_;
......
......@@ -12,8 +12,6 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#include "memory_segment_test.h"
#include <exceptions/exceptions.h>
#include <util/memory_segment_local.h>
......@@ -26,6 +24,8 @@
#include <datasrc/memory/zone_table.h>
#include <datasrc/memory/segment_object_holder.h>
#include <datasrc/tests/memory/memory_segment_mock.h>
#include <gtest/gtest.h>
#include <new> // for bad_alloc
......@@ -56,7 +56,7 @@ protected:
}
const RRClass zclass_;
const Name zname1, zname2, zname3;
test::MemorySegmentTest mem_sgmt_;
test::MemorySegmentMock mem_sgmt_;
ZoneTable* zone_table;
};
......
......@@ -19,7 +19,7 @@
#include <dns/rrclass.h>
#include <dns/name.h>
#include <datasrc/tests/memory/memory_segment_test.h>
#include <datasrc/tests/memory/memory_segment_mock.h>
#include <datasrc/tests/memory/zone_table_segment_mock.h>
#include <gtest/gtest.h>
......@@ -103,7 +103,7 @@ public:
};
TEST_F(ZoneWriterTest, constructForReadOnlySegment) {
MemorySegmentTest mem_sgmt;
MemorySegmentMock mem_sgmt;
ReadOnlySegment ztable_segment(RRClass::IN(), mem_sgmt);
EXPECT_THROW(ZoneWriter(ztable_segment,
bind(&ZoneWriterTest::loadAction, this, _1),
......
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