Follow ndn::Scheduler API changes
Refs: #4883
Change-Id: I94f9096225a26accbdc9e2dc37462f6d7c6474ef
diff --git a/tests/integrated/test-basic-command-insert-delete.cpp b/tests/integrated/test-basic-command-insert-delete.cpp
index e57d71e..cc40734 100644
--- a/tests/integrated/test-basic-command-insert-delete.cpp
+++ b/tests/integrated/test-basic-command-insert-delete.cpp
@@ -127,7 +127,7 @@
insertEvents.erase(eventIt);
}
// schedule an event 50ms later to check whether insert is Ok
- scheduler.scheduleEvent(500_ms, std::bind(&Fixture<T>::checkInsertOk, this, interest));
+ scheduler.schedule(500_ms, std::bind(&Fixture<T>::checkInsertOk, this, interest));
}
template<class T> void
@@ -160,7 +160,7 @@
BOOST_CHECK_EQUAL(statusCode, 200);
//schedlute an event to check whether delete is Ok.
- scheduler.scheduleEvent(100_ms, std::bind(&Fixture<T>::checkDeleteOk, this, interest));
+ scheduler.schedule(100_ms, std::bind(&Fixture<T>::checkDeleteOk, this, interest));
}
template<class T> void
@@ -230,11 +230,11 @@
insertCommandName.append(insertParameter.wireEncode());
Interest insertInterest = signer.makeCommandInterest(insertCommandName);
// schedule a job to express insertInterest every 50ms
- scheduler.scheduleEvent(milliseconds(timeCount * 50 + 1000),
- std::bind(&Fixture<T>::sendInsertInterest, this, insertInterest));
+ scheduler.schedule(milliseconds(timeCount * 50 + 1000),
+ std::bind(&Fixture<T>::sendInsertInterest, this, insertInterest));
// schedule what to do when interest timeout
- auto delayEventId = scheduler.scheduleEvent(milliseconds(5000 + timeCount * 50),
- std::bind(&Fixture<T>::delayedInterest, this));
+ auto delayEventId = scheduler.schedule(milliseconds(5000 + timeCount * 50),
+ std::bind(&Fixture<T>::delayedInterest, this));
insertEvents[insertParameter.getName()] = delayEventId;
// The delayEvent will be canceled in onInsertInterest
insertFace.setInterestFilter(insertParameter.getName(),
@@ -258,8 +258,8 @@
deleteCommandName.append(deleteParameter.wireEncode());
Interest deleteInterest = signer.makeCommandInterest(deleteCommandName);
deleteNamePairs[deleteInterest.getName()] = (*i)->getName();
- scheduler.scheduleEvent(milliseconds(4000 + timeCount * 50),
- std::bind(&Fixture<T>::sendDeleteInterest, this, deleteInterest));
+ scheduler.schedule(milliseconds(4000 + timeCount * 50),
+ std::bind(&Fixture<T>::sendDeleteInterest, this, deleteInterest));
timeCount++;
}
}
@@ -271,8 +271,8 @@
BOOST_FIXTURE_TEST_CASE_TEMPLATE(InsertDelete, T, Datasets, Fixture<T>)
{
// schedule events
- this->scheduler.scheduleEvent(0_s, std::bind(&Fixture<T>::scheduleInsertEvent, this));
- this->scheduler.scheduleEvent(10_s, std::bind(&Fixture<T>::scheduleDeleteEvent, this));
+ this->scheduler.schedule(0_s, std::bind(&Fixture<T>::scheduleInsertEvent, this));
+ this->scheduler.schedule(10_s, std::bind(&Fixture<T>::scheduleDeleteEvent, this));
this->repoFace.processEvents(30_s);
}
diff --git a/tests/integrated/test-basic-interest-read.cpp b/tests/integrated/test-basic-interest-read.cpp
index d73b0d1..81ace5b 100644
--- a/tests/integrated/test-basic-interest-read.cpp
+++ b/tests/integrated/test-basic-interest-read.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California.
+ * Copyright (c) 2014-2019, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -79,9 +79,8 @@
Interest readInterest((*i)->getName());
readInterest.setMustBeFresh(true);
- scheduler.scheduleEvent(ndn::time::milliseconds(timeCount * 50),
- std::bind(&BasicInterestReadFixture<Dataset>::sendInterest, this,
- readInterest));
+ scheduler.schedule(ndn::time::milliseconds(timeCount * 50),
+ std::bind(&BasicInterestReadFixture<Dataset>::sendInterest, this, readInterest));
timeCount++;
}
}
@@ -133,11 +132,9 @@
BOOST_FIXTURE_TEST_CASE_TEMPLATE(Read, T, Datasets, BasicInterestReadFixture<T>)
{
this->startListen();
- this->scheduler.scheduleEvent(1_s,
- std::bind(&BasicInterestReadFixture<T>::scheduleReadEvent, this));
+ this->scheduler.schedule(1_s, std::bind(&BasicInterestReadFixture<T>::scheduleReadEvent, this));
this->repoFace.processEvents(20_s);
-
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/unit/tcp-bulk-insert-handle.cpp b/tests/unit/tcp-bulk-insert-handle.cpp
index ad82c10..48d1ae3 100644
--- a/tests/unit/tcp-bulk-insert-handle.cpp
+++ b/tests/unit/tcp-bulk-insert-handle.cpp
@@ -84,8 +84,7 @@
: scheduler(ioService)
, bulkInserter(ioService, *handle)
{
- guardEvent = scheduler.scheduleEvent(ndn::time::seconds(2),
- std::bind(&TcpBulkInsertFixture::fail, this, "Test timed out"));
+ guardEvent = scheduler.schedule(2_s, std::bind(&TcpBulkInsertFixture::fail, this, "Test timed out"));
}
virtual void
@@ -118,12 +117,10 @@
}
if (isFinal) {
- scheduler.cancelEvent(guardEvent);
+ guardEvent.cancel();
// In case there are some outstanding handlers
- // ioService.post(bind(&TcpBulkInsertFixture::stop, this));
- scheduler.scheduleEvent(ndn::time::seconds(1),
- std::bind(&TcpBulkInsertFixture::stop, this));
+ scheduler.schedule(1_s, [this] { stop(); });
}
}
@@ -171,7 +168,6 @@
}
}
-
BOOST_AUTO_TEST_SUITE_END()
} // namespace tests