core: delete deprecated getGlobalScheduler() API
refs #1290
Change-Id: If994e3bd303f0788d8e945351c182bbd4ab5e0b2
diff --git a/tests/core/limited-io.cpp b/tests/core/limited-io.cpp
index 1eba63d..a7b1115 100644
--- a/tests/core/limited-io.cpp
+++ b/tests/core/limited-io.cpp
@@ -5,7 +5,6 @@
*/
#include "limited-io.hpp"
-#include "core/logger.hpp"
namespace nfd {
namespace tests {
@@ -26,13 +25,13 @@
{
BOOST_ASSERT(!m_isRunning);
m_isRunning = true;
-
+
m_reason = NO_WORK;
m_nOpsRemaining = nOpsLimit;
if (nTimeLimit >= time::nanoseconds::zero()) {
m_timeout = scheduler::schedule(nTimeLimit, bind(&LimitedIo::afterTimeout, this));
}
-
+
try {
getGlobalIoService().run();
}
@@ -41,7 +40,7 @@
NFD_LOG_ERROR("g_io.run() exception: " << ex.what());
m_lastException = ex;
}
-
+
getGlobalIoService().reset();
scheduler::cancel(m_timeout);
m_isRunning = false;
diff --git a/tests/core/limited-io.hpp b/tests/core/limited-io.hpp
index d3968c2..94fe476 100644
--- a/tests/core/limited-io.hpp
+++ b/tests/core/limited-io.hpp
@@ -7,6 +7,7 @@
#ifndef NFD_TEST_CORE_LIMITED_IO_HPP
#define NFD_TEST_CORE_LIMITED_IO_HPP
+#include "core/global-io.hpp"
#include "core/scheduler.hpp"
namespace nfd {
@@ -18,7 +19,7 @@
{
public:
LimitedIo();
-
+
/// indicates why .run returns
enum StopReason
{
@@ -31,7 +32,7 @@
/// an exception is thrown
EXCEPTION
};
-
+
/** \brief g_io.run() with operation count and/or time limit
*
* \param nOpsLimit operation count limit, pass UNLIMITED_OPS for no limit
@@ -39,14 +40,14 @@
*/
StopReason
run(int nOpsLimit, const time::nanoseconds& nTimeLimit);
-
+
/// count an operation
void
afterOp();
-
+
const std::exception&
getLastException() const;
-
+
private:
void
afterTimeout();
diff --git a/tests/core/scheduler.cpp b/tests/core/scheduler.cpp
index 87c75cf..6d648b9 100644
--- a/tests/core/scheduler.cpp
+++ b/tests/core/scheduler.cpp
@@ -13,13 +13,13 @@
BOOST_FIXTURE_TEST_SUITE(CoreScheduler, BaseFixture)
-struct SchedulerFixture : protected BaseFixture
+class SchedulerFixture : protected BaseFixture
{
+public:
SchedulerFixture()
: count1(0)
, count2(0)
, count3(0)
- , count4(0)
{
}
@@ -43,16 +43,9 @@
++count3;
}
- void
- event4()
- {
- ++count4;
- }
-
int count1;
int count2;
int count3;
- int count4;
};
BOOST_FIXTURE_TEST_CASE(Events, SchedulerFixture)
@@ -67,18 +60,11 @@
i = scheduler::schedule(time::milliseconds(50), bind(&SchedulerFixture::event2, this));
scheduler::cancel(i);
- // TODO deprecate periodic event
- i = scheduler::getGlobalScheduler().schedulePeriodicEvent(time::milliseconds(300),
- time::milliseconds(100),
- bind(&SchedulerFixture::event4, this));
- scheduler::schedule(time::seconds(1), bind(&scheduler::cancel, i));
-
g_io.run();
BOOST_CHECK_EQUAL(count1, 1);
BOOST_CHECK_EQUAL(count2, 0);
BOOST_CHECK_EQUAL(count3, 1);
- BOOST_CHECK_GT(count4, 1);
}
BOOST_AUTO_TEST_CASE(CancelEmptyEvent)
@@ -87,8 +73,9 @@
scheduler::cancel(i);
}
-struct SelfCancelFixture : protected BaseFixture
+class SelfCancelFixture : protected BaseFixture
{
+public:
void
cancelSelf()
{