/// Creates memfile and stores it in lmptr_ pointer
MemfileLeaseMgrTest() :
io4_(getLeaseFilePath("leasefile4_0.csv")),
- io6_(getLeaseFilePath("leasefile6_0.csv")) {
+ io6_(getLeaseFilePath("leasefile6_0.csv")),
+ timer_mgr_(TimerMgr::instance()) {
std::ostringstream s;
s << KEA_LFC_BUILD_DIR << "/kea-lfc";
/// destroys lease manager backend.
virtual ~MemfileLeaseMgrTest() {
// Stop TimerMgr worker thread if it is running.
- TimerMgr::instance()->stopThread();
+ timer_mgr_->stopThread();
// Make sure there are no timers registered.
- TimerMgr::instance()->unregisterTimers();
+ timer_mgr_->unregisterTimers();
LeaseMgrFactory::destroy();
// Remove lease files and products of Lease File Cleanup.
removeFiles(getLeaseFilePath("leasefile4_0.csv"));
/// @brief Object providing access to v6 lease IO.
LeaseFileIO io6_;
+ /// @brief Pointer to the instance of the @c TimerMgr.
+ TimerMgrPtr timer_mgr_;
};
// This test checks if the LeaseMgr can be instantiated and that it
lease_mgr(new LFCMemfileLeaseMgr(pmap));
// Start worker thread to execute LFC periodically.
- TimerMgr::instance()->startThread();
+ ASSERT_NO_THROW(timer_mgr_->startThread());
// Run the test for at most 2.9 seconds.
setTestTime(2900);
// Stop worker thread to make sure it is not running when lease
// manager is destroyed. The lease manager will be unable to
// unregster timer when the thread is active.
- TimerMgr::instance()->stopThread();
+ ASSERT_NO_THROW(timer_mgr_->stopThread());
// Within 2.9 we should record two LFC executions.
EXPECT_EQ(2, lease_mgr->getLFCCount());
lease_mgr(new LFCMemfileLeaseMgr(pmap));
// Start worker thread to execute LFC periodically.
- TimerMgr::instance()->startThread();
+ ASSERT_NO_THROW(timer_mgr_->startThread());
// Run the test for at most 1.9 seconds.
setTestTime(1900);
// Stop worker thread to make sure it is not running when lease
// manager is destroyed. The lease manager will be unable to
// unregster timer when the thread is active.
- TimerMgr::instance()->stopThread();
+ ASSERT_NO_THROW(timer_mgr_->stopThread());
// There should be no LFC execution recorded.
EXPECT_EQ(0, lease_mgr->getLFCCount());