tests: Replace usage of deprecated elements of ndn::util::DummyClientFace
Change-Id: I4aea29af101df1f9f63b16d1c49142deb89f182a
Refs: #3146
diff --git a/tests/unit-tests/face.t.cpp b/tests/unit-tests/face.t.cpp
index 43164a6..928a050 100644
--- a/tests/unit-tests/face.t.cpp
+++ b/tests/unit-tests/face.t.cpp
@@ -33,19 +33,18 @@
namespace tests {
using ndn::util::DummyClientFace;
-using ndn::util::makeDummyClientFace;
class FaceFixture : public UnitTestTimeFixture
{
public:
explicit
FaceFixture(bool enableRegistrationReply = true)
- : face(makeDummyClientFace(io, { true, enableRegistrationReply }))
+ : face(io, { true, enableRegistrationReply })
{
}
public:
- shared_ptr<DummyClientFace> face;
+ DummyClientFace face;
};
class FacesNoRegistrationReplyFixture : public FaceFixture
@@ -62,37 +61,37 @@
BOOST_AUTO_TEST_CASE(ExpressInterestData)
{
size_t nData = 0;
- face->expressInterest(Interest("/Hello/World", time::milliseconds(50)),
- [&] (const Interest& i, const Data& d) {
- BOOST_CHECK(i.getName().isPrefixOf(d.getName()));
- BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
- ++nData;
- },
- bind([] {
- BOOST_FAIL("Unexpected Nack");
- }),
- bind([] {
- BOOST_FAIL("Unexpected timeout");
- }));
+ face.expressInterest(Interest("/Hello/World", time::milliseconds(50)),
+ [&] (const Interest& i, const Data& d) {
+ BOOST_CHECK(i.getName().isPrefixOf(d.getName()));
+ BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
+ ++nData;
+ },
+ bind([] {
+ BOOST_FAIL("Unexpected Nack");
+ }),
+ bind([] {
+ BOOST_FAIL("Unexpected timeout");
+ }));
advanceClocks(time::milliseconds(1), 40);
- face->receive(*util::makeData("/Bye/World/a"));
- face->receive(*util::makeData("/Hello/World/a"));
+ face.receive(*util::makeData("/Bye/World/a"));
+ face.receive(*util::makeData("/Hello/World/a"));
advanceClocks(time::milliseconds(1), 100);
BOOST_CHECK_EQUAL(nData, 1);
- BOOST_CHECK_EQUAL(face->sentInterests.size(), 1);
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+ BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
+ BOOST_CHECK_EQUAL(face.sentData.size(), 0);
size_t nTimeouts = 0;
- face->expressInterest(Interest("/Hello/World/a/2", time::milliseconds(50)),
- bind([]{}),
- bind([]{}),
- bind([&nTimeouts] {
- ++nTimeouts;
- }));
+ face.expressInterest(Interest("/Hello/World/a/2", time::milliseconds(50)),
+ bind([]{}),
+ bind([]{}),
+ bind([&nTimeouts] {
+ ++nTimeouts;
+ }));
advanceClocks(time::milliseconds(10), 100);
BOOST_CHECK_EQUAL(nTimeouts, 1);
}
@@ -101,49 +100,49 @@
BOOST_AUTO_TEST_CASE(DeprecatedExpressInterestData)
{
size_t nData = 0;
- face->expressInterest(Interest("/Hello/World", time::milliseconds(50)),
- [&] (const Interest& i, const Data& d) {
- BOOST_CHECK(i.getName().isPrefixOf(d.getName()));
- ++nData;
- },
- bind([] {
- BOOST_FAIL("Unexpected timeout");
- }));
+ face.expressInterest(Interest("/Hello/World", time::milliseconds(50)),
+ [&] (const Interest& i, const Data& d) {
+ BOOST_CHECK(i.getName().isPrefixOf(d.getName()));
+ ++nData;
+ },
+ bind([] {
+ BOOST_FAIL("Unexpected timeout");
+ }));
advanceClocks(time::milliseconds(1), 40);
- face->receive(*util::makeData("/Bye/World/a"));
- face->receive(*util::makeData("/Hello/World/a"));
+ face.receive(*util::makeData("/Bye/World/a"));
+ face.receive(*util::makeData("/Hello/World/a"));
advanceClocks(time::milliseconds(1), 100);
BOOST_CHECK_EQUAL(nData, 1);
- BOOST_CHECK_EQUAL(face->sentInterests.size(), 1);
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+ BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
+ BOOST_CHECK_EQUAL(face.sentData.size(), 0);
- face->expressInterest(Interest("/Hello/World/a", time::milliseconds(50)),
- [&] (const Interest& i, const Data& d) {
- BOOST_CHECK(i.getName().isPrefixOf(d.getName()));
- ++nData;
- },
- bind([] {
- BOOST_FAIL("Unexpected timeout");
- }));
+ face.expressInterest(Interest("/Hello/World/a", time::milliseconds(50)),
+ [&] (const Interest& i, const Data& d) {
+ BOOST_CHECK(i.getName().isPrefixOf(d.getName()));
+ ++nData;
+ },
+ bind([] {
+ BOOST_FAIL("Unexpected timeout");
+ }));
advanceClocks(time::milliseconds(1), 40);
- face->receive(*util::makeData("/Hello/World/a/1/xxxxx"));
+ face.receive(*util::makeData("/Hello/World/a/1/xxxxx"));
advanceClocks(time::milliseconds(1), 100);
BOOST_CHECK_EQUAL(nData, 2);
- BOOST_CHECK_EQUAL(face->sentInterests.size(), 2);
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+ BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
+ BOOST_CHECK_EQUAL(face.sentData.size(), 0);
size_t nTimeouts = 0;
- face->expressInterest(Interest("/Hello/World/a/2", time::milliseconds(50)),
- bind([]{}),
- bind([&nTimeouts] {
- ++nTimeouts;
- }));
+ face.expressInterest(Interest("/Hello/World/a/2", time::milliseconds(50)),
+ bind([]{}),
+ bind([&nTimeouts] {
+ ++nTimeouts;
+ }));
advanceClocks(time::milliseconds(10), 100);
BOOST_CHECK_EQUAL(nTimeouts, 1);
}
@@ -151,43 +150,43 @@
BOOST_AUTO_TEST_CASE(ExpressInterestTimeout)
{
size_t nTimeouts = 0;
- face->expressInterest(Interest("/Hello/World", time::milliseconds(50)),
- bind([] {
- BOOST_FAIL("Unexpected ata");
- }),
- bind([] {
- BOOST_FAIL("Unexpected Nack");
- }),
- [&nTimeouts] (const Interest& i) {
- BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
- ++nTimeouts;
- });
+ face.expressInterest(Interest("/Hello/World", time::milliseconds(50)),
+ bind([] {
+ BOOST_FAIL("Unexpected ata");
+ }),
+ bind([] {
+ BOOST_FAIL("Unexpected Nack");
+ }),
+ [&nTimeouts] (const Interest& i) {
+ BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
+ ++nTimeouts;
+ });
advanceClocks(time::milliseconds(10), 100);
BOOST_CHECK_EQUAL(nTimeouts, 1);
- BOOST_CHECK_EQUAL(face->sentInterests.size(), 1);
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
- BOOST_CHECK_EQUAL(face->sentNacks.size(), 0);
+ BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
+ BOOST_CHECK_EQUAL(face.sentData.size(), 0);
+ BOOST_CHECK_EQUAL(face.sentNacks.size(), 0);
}
// test case for deprecated expressInterest implementation
BOOST_AUTO_TEST_CASE(DeprecatedExpressInterestTimeout)
{
size_t nTimeouts = 0;
- face->expressInterest(Interest("/Hello/World", time::milliseconds(50)),
- bind([] {
- BOOST_FAIL("Unexpected data");
- }),
- bind([&nTimeouts] {
- ++nTimeouts;
- }));
+ face.expressInterest(Interest("/Hello/World", time::milliseconds(50)),
+ bind([] {
+ BOOST_FAIL("Unexpected data");
+ }),
+ bind([&nTimeouts] {
+ ++nTimeouts;
+ }));
advanceClocks(time::milliseconds(10), 100);
BOOST_CHECK_EQUAL(nTimeouts, 1);
- BOOST_CHECK_EQUAL(face->sentInterests.size(), 1);
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+ BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
+ BOOST_CHECK_EQUAL(face.sentData.size(), 0);
}
BOOST_AUTO_TEST_CASE(ExpressInterestNack)
@@ -196,75 +195,75 @@
Interest interest("/Hello/World", time::milliseconds(50));
- face->expressInterest(interest,
- bind([] {
- BOOST_FAIL("Unexpected Data");
- }),
- [&] (const Interest& i, const lp::Nack& n) {
- BOOST_CHECK(i.getName().isPrefixOf(n.getInterest().getName()));
- BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
- BOOST_CHECK_EQUAL(n.getReason(), lp::NackReason::DUPLICATE);
- ++nNacks;
- },
- bind([] {
- BOOST_FAIL("Unexpected timeout");
- }));
+ face.expressInterest(interest,
+ bind([] {
+ BOOST_FAIL("Unexpected Data");
+ }),
+ [&] (const Interest& i, const lp::Nack& n) {
+ BOOST_CHECK(i.getName().isPrefixOf(n.getInterest().getName()));
+ BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
+ BOOST_CHECK_EQUAL(n.getReason(), lp::NackReason::DUPLICATE);
+ ++nNacks;
+ },
+ bind([] {
+ BOOST_FAIL("Unexpected timeout");
+ }));
advanceClocks(time::milliseconds(1), 40);
- lp::Nack nack(face->sentInterests[0]);
+ lp::Nack nack(face.sentInterests[0]);
nack.setReason(lp::NackReason::DUPLICATE);
- BOOST_CHECK_EQUAL(face->sentNacks.size(), 0);
+ BOOST_CHECK_EQUAL(face.sentNacks.size(), 0);
- face->receive(nack);
+ face.receive(nack);
advanceClocks(time::milliseconds(1), 100);
BOOST_CHECK_EQUAL(nNacks, 1);
- BOOST_CHECK_EQUAL(face->sentInterests.size(), 1);
+ BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
}
BOOST_AUTO_TEST_CASE(RemovePendingInterest)
{
const PendingInterestId* interestId =
- face->expressInterest(Interest("/Hello/World", time::milliseconds(50)),
- bind([] {
- BOOST_FAIL("Unexpected data");
- }),
- bind([] {
- BOOST_FAIL("Unexpected timeout");
- }));
+ face.expressInterest(Interest("/Hello/World", time::milliseconds(50)),
+ bind([] {
+ BOOST_FAIL("Unexpected data");
+ }),
+ bind([] {
+ BOOST_FAIL("Unexpected timeout");
+ }));
advanceClocks(time::milliseconds(10));
- face->removePendingInterest(interestId);
+ face.removePendingInterest(interestId);
advanceClocks(time::milliseconds(10));
- face->receive(*util::makeData("/Hello/World/!"));
+ face.receive(*util::makeData("/Hello/World/!"));
advanceClocks(time::milliseconds(10), 100);
}
BOOST_AUTO_TEST_CASE(removeAllPendingInterests)
{
- face->expressInterest(Interest("/Hello/World/0", time::milliseconds(50)),
- bind([] { BOOST_FAIL("Unexpected data"); }),
- bind([] { BOOST_FAIL("Unexpected nack"); }),
- bind([] { BOOST_FAIL("Unexpected timeout"); }));
+ face.expressInterest(Interest("/Hello/World/0", time::milliseconds(50)),
+ bind([] { BOOST_FAIL("Unexpected data"); }),
+ bind([] { BOOST_FAIL("Unexpected nack"); }),
+ bind([] { BOOST_FAIL("Unexpected timeout"); }));
- face->expressInterest(Interest("/Hello/World/1", time::milliseconds(50)),
- bind([] { BOOST_FAIL("Unexpected data"); }),
- bind([] { BOOST_FAIL("Unexpected nack"); }),
- bind([] { BOOST_FAIL("Unexpected timeout"); }));
+ face.expressInterest(Interest("/Hello/World/1", time::milliseconds(50)),
+ bind([] { BOOST_FAIL("Unexpected data"); }),
+ bind([] { BOOST_FAIL("Unexpected nack"); }),
+ bind([] { BOOST_FAIL("Unexpected timeout"); }));
advanceClocks(time::milliseconds(10));
- face->removeAllPendingInterests();
+ face.removeAllPendingInterests();
advanceClocks(time::milliseconds(10));
- BOOST_CHECK_EQUAL(face->getNPendingInterests(), 0);
+ BOOST_CHECK_EQUAL(face.getNPendingInterests(), 0);
- face->receive(*util::makeData("/Hello/World/0"));
- face->receive(*util::makeData("/Hello/World/1"));
+ face.receive(*util::makeData("/Hello/World/0"));
+ face.receive(*util::makeData("/Hello/World/1"));
advanceClocks(time::milliseconds(10), 100);
}
@@ -274,41 +273,41 @@
size_t nInterests = 0;
size_t nRegs = 0;
const RegisteredPrefixId* regPrefixId =
- face->setInterestFilter("/Hello/World",
- bind([&nInterests] { ++nInterests; }),
- bind([&nRegs] { ++nRegs; }),
- bind([] {
- BOOST_FAIL("Unexpected setInterestFilter failure");
- }));
+ face.setInterestFilter("/Hello/World",
+ bind([&nInterests] { ++nInterests; }),
+ bind([&nRegs] { ++nRegs; }),
+ bind([] {
+ BOOST_FAIL("Unexpected setInterestFilter failure");
+ }));
advanceClocks(time::milliseconds(10), 10);
BOOST_CHECK_EQUAL(nRegs, 1);
BOOST_CHECK_EQUAL(nInterests, 0);
- face->receive(Interest("/Hello/World/!"));
+ face.receive(Interest("/Hello/World/!"));
advanceClocks(time::milliseconds(10), 10);
BOOST_CHECK_EQUAL(nRegs, 1);
BOOST_CHECK_EQUAL(nInterests, 1);
- face->receive(Interest("/Bye/World/!"));
+ face.receive(Interest("/Bye/World/!"));
advanceClocks(time::milliseconds(10000), 10);
BOOST_CHECK_EQUAL(nInterests, 1);
- face->receive(Interest("/Hello/World/!/2"));
+ face.receive(Interest("/Hello/World/!/2"));
advanceClocks(time::milliseconds(10), 10);
BOOST_CHECK_EQUAL(nInterests, 2);
// removing filter
- face->unsetInterestFilter(regPrefixId);
+ face.unsetInterestFilter(regPrefixId);
advanceClocks(time::milliseconds(10), 10);
- face->receive(Interest("/Hello/World/!/3"));
+ face.receive(Interest("/Hello/World/!/3"));
BOOST_CHECK_EQUAL(nInterests, 2);
- face->unsetInterestFilter(static_cast<const RegisteredPrefixId*>(0));
+ face.unsetInterestFilter(static_cast<const RegisteredPrefixId*>(0));
advanceClocks(time::milliseconds(10), 10);
- face->unsetInterestFilter(static_cast<const InterestFilterId*>(0));
+ face.unsetInterestFilter(static_cast<const InterestFilterId*>(0));
advanceClocks(time::milliseconds(10), 10);
}
@@ -316,38 +315,38 @@
{
size_t nInterests = 0;
const RegisteredPrefixId* regPrefixId =
- face->setInterestFilter("/Hello/World",
- bind([&nInterests] { ++nInterests; }),
- bind([] {
- BOOST_FAIL("Unexpected setInterestFilter failure");
- }));
+ face.setInterestFilter("/Hello/World",
+ bind([&nInterests] { ++nInterests; }),
+ bind([] {
+ BOOST_FAIL("Unexpected setInterestFilter failure");
+ }));
advanceClocks(time::milliseconds(10), 10);
BOOST_CHECK_EQUAL(nInterests, 0);
- face->receive(Interest("/Hello/World/!"));
+ face.receive(Interest("/Hello/World/!"));
advanceClocks(time::milliseconds(10), 10);
BOOST_CHECK_EQUAL(nInterests, 1);
- face->receive(Interest("/Bye/World/!"));
+ face.receive(Interest("/Bye/World/!"));
advanceClocks(time::milliseconds(10000), 10);
BOOST_CHECK_EQUAL(nInterests, 1);
- face->receive(Interest("/Hello/World/!/2"));
+ face.receive(Interest("/Hello/World/!/2"));
advanceClocks(time::milliseconds(10), 10);
BOOST_CHECK_EQUAL(nInterests, 2);
// removing filter
- face->unsetInterestFilter(regPrefixId);
+ face.unsetInterestFilter(regPrefixId);
advanceClocks(time::milliseconds(10), 10);
- face->receive(Interest("/Hello/World/!/3"));
+ face.receive(Interest("/Hello/World/!/3"));
BOOST_CHECK_EQUAL(nInterests, 2);
- face->unsetInterestFilter(static_cast<const RegisteredPrefixId*>(0));
+ face.unsetInterestFilter(static_cast<const RegisteredPrefixId*>(0));
advanceClocks(time::milliseconds(10), 10);
- face->unsetInterestFilter(static_cast<const InterestFilterId*>(0));
+ face.unsetInterestFilter(static_cast<const InterestFilterId*>(0));
advanceClocks(time::milliseconds(10), 10);
}
@@ -355,16 +354,16 @@
{
// don't enable registration reply
size_t nRegFailed = 0;
- face->setInterestFilter("/Hello/World",
- bind([] {
- BOOST_FAIL("Unexpected Interest");
- }),
- bind([] {
- BOOST_FAIL("Unexpected success of setInterestFilter");
- }),
- bind([&nRegFailed] {
- ++nRegFailed;
- }));
+ face.setInterestFilter("/Hello/World",
+ bind([] {
+ BOOST_FAIL("Unexpected Interest");
+ }),
+ bind([] {
+ BOOST_FAIL("Unexpected success of setInterestFilter");
+ }),
+ bind([&nRegFailed] {
+ ++nRegFailed;
+ }));
advanceClocks(time::milliseconds(10), 10);
BOOST_CHECK_EQUAL(nRegFailed, 0);
@@ -377,13 +376,13 @@
{
// don't enable registration reply
size_t nRegFailed = 0;
- face->setInterestFilter("/Hello/World",
- bind([] {
- BOOST_FAIL("Unexpected Interest");
- }),
- bind([&nRegFailed] {
- ++nRegFailed;
- }));
+ face.setInterestFilter("/Hello/World",
+ bind([] {
+ BOOST_FAIL("Unexpected Interest");
+ }),
+ bind([&nRegFailed] {
+ ++nRegFailed;
+ }));
advanceClocks(time::milliseconds(10), 10);
BOOST_CHECK_EQUAL(nRegFailed, 0);
@@ -396,21 +395,21 @@
{
size_t nRegSuccesses = 0;
const RegisteredPrefixId* regPrefixId =
- face->registerPrefix("/Hello/World",
- bind([&nRegSuccesses] { ++nRegSuccesses; }),
- bind([] {
- BOOST_FAIL("Unexpected registerPrefix failure");
- }));
+ face.registerPrefix("/Hello/World",
+ bind([&nRegSuccesses] { ++nRegSuccesses; }),
+ bind([] {
+ BOOST_FAIL("Unexpected registerPrefix failure");
+ }));
advanceClocks(time::milliseconds(10), 10);
BOOST_CHECK_EQUAL(nRegSuccesses, 1);
size_t nUnregSuccesses = 0;
- face->unregisterPrefix(regPrefixId,
- bind([&nUnregSuccesses] { ++nUnregSuccesses; }),
- bind([] {
- BOOST_FAIL("Unexpected unregisterPrefix failure");
- }));
+ face.unregisterPrefix(regPrefixId,
+ bind([&nUnregSuccesses] { ++nUnregSuccesses; }),
+ bind([] {
+ BOOST_FAIL("Unexpected unregisterPrefix failure");
+ }));
advanceClocks(time::milliseconds(10), 10);
BOOST_CHECK_EQUAL(nUnregSuccesses, 1);
@@ -419,11 +418,11 @@
BOOST_FIXTURE_TEST_CASE(RegisterUnregisterPrefixFail, FacesNoRegistrationReplyFixture)
{
size_t nRegFailures = 0;
- face->registerPrefix("/Hello/World",
- bind([] {
- BOOST_FAIL("Unexpected registerPrefix success");
- }),
- bind([&nRegFailures] { ++nRegFailures; }));
+ face.registerPrefix("/Hello/World",
+ bind([] {
+ BOOST_FAIL("Unexpected registerPrefix success");
+ }),
+ bind([&nRegFailures] { ++nRegFailures; }));
advanceClocks(time::milliseconds(1000), 100);
BOOST_CHECK_EQUAL(nRegFailures, 1);
@@ -432,32 +431,32 @@
BOOST_AUTO_TEST_CASE(SimilarFilters)
{
size_t nInInterests1 = 0;
- face->setInterestFilter("/Hello/World",
- bind([&nInInterests1] { ++nInInterests1; }),
- RegisterPrefixSuccessCallback(),
- bind([] {
- BOOST_FAIL("Unexpected setInterestFilter failure");
- }));
+ face.setInterestFilter("/Hello/World",
+ bind([&nInInterests1] { ++nInInterests1; }),
+ RegisterPrefixSuccessCallback(),
+ bind([] {
+ BOOST_FAIL("Unexpected setInterestFilter failure");
+ }));
size_t nInInterests2 = 0;
- face->setInterestFilter("/Hello",
- bind([&nInInterests2] { ++nInInterests2; }),
- RegisterPrefixSuccessCallback(),
- bind([] {
- BOOST_FAIL("Unexpected setInterestFilter failure");
- }));
+ face.setInterestFilter("/Hello",
+ bind([&nInInterests2] { ++nInInterests2; }),
+ RegisterPrefixSuccessCallback(),
+ bind([] {
+ BOOST_FAIL("Unexpected setInterestFilter failure");
+ }));
size_t nInInterests3 = 0;
- face->setInterestFilter("/Los/Angeles/Lakers",
- bind([&nInInterests3] { ++nInInterests3; }),
- RegisterPrefixSuccessCallback(),
- bind([] {
- BOOST_FAIL("Unexpected setInterestFilter failure");
- }));
+ face.setInterestFilter("/Los/Angeles/Lakers",
+ bind([&nInInterests3] { ++nInInterests3; }),
+ RegisterPrefixSuccessCallback(),
+ bind([] {
+ BOOST_FAIL("Unexpected setInterestFilter failure");
+ }));
advanceClocks(time::milliseconds(10), 10);
- face->receive(Interest("/Hello/World/!"));
+ face.receive(Interest("/Hello/World/!"));
advanceClocks(time::milliseconds(10), 10);
BOOST_CHECK_EQUAL(nInInterests1, 1);
@@ -467,71 +466,71 @@
BOOST_AUTO_TEST_CASE(SetRegexFilterError)
{
- face->setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
- [] (const Name&, const Interest&) {
- BOOST_FAIL("InterestFilter::Error should have been triggered");
- },
- RegisterPrefixSuccessCallback(),
- bind([] {
- BOOST_FAIL("Unexpected setInterestFilter failure");
- }));
+ face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
+ [] (const Name&, const Interest&) {
+ BOOST_FAIL("InterestFilter::Error should have been triggered");
+ },
+ RegisterPrefixSuccessCallback(),
+ bind([] {
+ BOOST_FAIL("Unexpected setInterestFilter failure");
+ }));
advanceClocks(time::milliseconds(10), 10);
- BOOST_REQUIRE_THROW(face->receive(Interest("/Hello/World/XXX/b/c")), InterestFilter::Error);
+ BOOST_REQUIRE_THROW(face.receive(Interest("/Hello/World/XXX/b/c")), InterestFilter::Error);
}
BOOST_AUTO_TEST_CASE(SetRegexFilter)
{
size_t nInInterests = 0;
- face->setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
- bind([&nInInterests] { ++nInInterests; }),
- RegisterPrefixSuccessCallback(),
- bind([] {
- BOOST_FAIL("Unexpected setInterestFilter failure");
- }));
+ face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
+ bind([&nInInterests] { ++nInInterests; }),
+ RegisterPrefixSuccessCallback(),
+ bind([] {
+ BOOST_FAIL("Unexpected setInterestFilter failure");
+ }));
advanceClocks(time::milliseconds(10), 10);
- face->receive(Interest("/Hello/World/a")); // shouldn't match
+ face.receive(Interest("/Hello/World/a")); // shouldn't match
BOOST_CHECK_EQUAL(nInInterests, 0);
- face->receive(Interest("/Hello/World/a/b")); // should match
+ face.receive(Interest("/Hello/World/a/b")); // should match
BOOST_CHECK_EQUAL(nInInterests, 1);
- face->receive(Interest("/Hello/World/a/b/c")); // should match
+ face.receive(Interest("/Hello/World/a/b/c")); // should match
BOOST_CHECK_EQUAL(nInInterests, 2);
- face->receive(Interest("/Hello/World/a/b/d")); // should not match
+ face.receive(Interest("/Hello/World/a/b/d")); // should not match
BOOST_CHECK_EQUAL(nInInterests, 2);
}
BOOST_AUTO_TEST_CASE(SetRegexFilterAndRegister)
{
size_t nInInterests = 0;
- face->setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
- bind([&nInInterests] { ++nInInterests; }));
+ face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
+ bind([&nInInterests] { ++nInInterests; }));
size_t nRegSuccesses = 0;
- face->registerPrefix("/Hello/World",
- bind([&nRegSuccesses] { ++nRegSuccesses; }),
- bind([] {
- BOOST_FAIL("Unexpected setInterestFilter failure");
- }));
+ face.registerPrefix("/Hello/World",
+ bind([&nRegSuccesses] { ++nRegSuccesses; }),
+ bind([] {
+ BOOST_FAIL("Unexpected setInterestFilter failure");
+ }));
advanceClocks(time::milliseconds(10), 10);
BOOST_CHECK_EQUAL(nRegSuccesses, 1);
- face->receive(Interest("/Hello/World/a")); // shouldn't match
+ face.receive(Interest("/Hello/World/a")); // shouldn't match
BOOST_CHECK_EQUAL(nInInterests, 0);
- face->receive(Interest("/Hello/World/a/b")); // should match
+ face.receive(Interest("/Hello/World/a/b")); // should match
BOOST_CHECK_EQUAL(nInInterests, 1);
- face->receive(Interest("/Hello/World/a/b/c")); // should match
+ face.receive(Interest("/Hello/World/a/b/c")); // should match
BOOST_CHECK_EQUAL(nInInterests, 2);
- face->receive(Interest("/Hello/World/a/b/d")); // should not match
+ face.receive(Interest("/Hello/World/a/b/d")); // should not match
BOOST_CHECK_EQUAL(nInInterests, 2);
}
@@ -541,32 +540,32 @@
// Regular Face won't accept incoming packets until something is sent.
int hit = 0;
- face->setInterestFilter(Name("/"), bind([&hit] { ++hit; }));
- face->processEvents(time::milliseconds(-1));
+ face.setInterestFilter(Name("/"), bind([&hit] { ++hit; }));
+ face.processEvents(time::milliseconds(-1));
auto interest = make_shared<Interest>("/A");
- face->receive(*interest);
- face->processEvents(time::milliseconds(-1));
+ face.receive(*interest);
+ face.processEvents(time::milliseconds(-1));
BOOST_CHECK_EQUAL(hit, 1);
}
BOOST_AUTO_TEST_CASE(ProcessEvents)
{
- face->processEvents(time::milliseconds(-1)); // io_service::reset()/poll() inside
+ face.processEvents(time::milliseconds(-1)); // io_service::reset()/poll() inside
size_t nRegSuccesses = 0;
- face->registerPrefix("/Hello/World",
- bind([&nRegSuccesses] { ++nRegSuccesses; }),
- bind([] {
- BOOST_FAIL("Unexpected setInterestFilter failure");
- }));
+ face.registerPrefix("/Hello/World",
+ bind([&nRegSuccesses] { ++nRegSuccesses; }),
+ bind([] {
+ BOOST_FAIL("Unexpected setInterestFilter failure");
+ }));
// io_service::poll() without reset
- face->getIoService().poll();
+ face.getIoService().poll();
BOOST_CHECK_EQUAL(nRegSuccesses, 0);
- face->processEvents(time::milliseconds(-1)); // io_service::reset()/poll() inside
+ face.processEvents(time::milliseconds(-1)); // io_service::reset()/poll() inside
BOOST_CHECK_EQUAL(nRegSuccesses, 1);
}
@@ -575,22 +574,23 @@
lp::Nack nack(Interest("/Hello/World", time::milliseconds(50)));
nack.setReason(lp::NackReason::NO_ROUTE);
- BOOST_CHECK_EQUAL(face->sentNacks.size(), 0);
+ BOOST_CHECK_EQUAL(face.sentNacks.size(), 0);
- face->put(nack);
+ face.put(nack);
advanceClocks(time::milliseconds(10));
- BOOST_CHECK_EQUAL(face->sentNacks.size(), 1);
+ BOOST_CHECK_EQUAL(face.sentNacks.size(), 1);
}
BOOST_AUTO_TEST_CASE(DestructionWithoutCancellingPendingInterests) // Bug #2518
{
- face->expressInterest(Interest("/Hello/World", time::milliseconds(50)),
- bind([]{}), bind([]{}));
- advanceClocks(time::milliseconds(10), 10);
-
- face.reset();
+ {
+ DummyClientFace face2(io);
+ face2.expressInterest(Interest("/Hello/World", time::milliseconds(50)),
+ bind([]{}), bind([]{}));
+ advanceClocks(time::milliseconds(10), 10);
+ }
advanceClocks(time::milliseconds(10), 10);
// should not segfault
diff --git a/tests/unit-tests/management/nfd-controller.t.cpp b/tests/unit-tests/management/nfd-controller.t.cpp
index 6479cd6..2379d5c 100644
--- a/tests/unit-tests/management/nfd-controller.t.cpp
+++ b/tests/unit-tests/management/nfd-controller.t.cpp
@@ -34,7 +34,6 @@
namespace tests {
using ndn::util::DummyClientFace;
-using ndn::util::makeDummyClientFace;
BOOST_AUTO_TEST_SUITE(Management)
@@ -42,8 +41,8 @@
{
protected:
CommandFixture()
- : face(makeDummyClientFace(io))
- , controller(*face, keyChain)
+ : face(io)
+ , controller(face, keyChain)
, commandSucceedCallback(bind(&CommandFixture::onCommandSucceed, this, _1))
, commandFailCallback(bind(&CommandFixture::onCommandFail, this, _1, _2))
{
@@ -63,7 +62,7 @@
}
protected:
- shared_ptr<DummyClientFace> face;
+ DummyClientFace face;
KeyChain keyChain;
Controller controller;
@@ -90,8 +89,8 @@
advanceClocks(time::milliseconds(1));
- BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
- const Interest& requestInterest = face->sentInterests[0];
+ BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
+ const Interest& requestInterest = face.sentInterests[0];
FaceCreateCommand command;
BOOST_CHECK(Name("/localhost/nfd/faces/create").isPrefixOf(requestInterest.getName()));
@@ -113,7 +112,7 @@
auto responseData = util::makeData(requestInterest.getName());
responseData->setContent(responsePayload.wireEncode());
- face->receive(*responseData);
+ face.receive(*responseData);
advanceClocks(time::milliseconds(1));
@@ -148,14 +147,14 @@
commandFailCallback));
advanceClocks(time::milliseconds(1));
- BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
- const Interest& requestInterest = face->sentInterests[0];
+ BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
+ const Interest& requestInterest = face.sentInterests[0];
ControlResponse responsePayload(401, "Not Authenticated");
auto responseData = util::makeData(requestInterest.getName());
responseData->setContent(responsePayload.wireEncode());
- face->receive(*responseData);
+ face.receive(*responseData);
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(commandSucceedHistory.size(), 0);
@@ -174,8 +173,8 @@
commandFailCallback));
advanceClocks(time::milliseconds(1));
- BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
- const Interest& requestInterest = face->sentInterests[0];
+ BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
+ const Interest& requestInterest = face.sentInterests[0];
ControlParameters responseBody;
responseBody.setUri("tcp4://192.0.2.1:6363")
@@ -186,7 +185,7 @@
auto responseData = util::makeData(requestInterest.getName());
responseData->setContent(responsePayload.wireEncode());
- face->receive(*responseData);
+ face.receive(*responseData);
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(commandSucceedHistory.size(), 0);
@@ -204,11 +203,11 @@
commandFailCallback));
advanceClocks(time::milliseconds(1));
- BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
- const Interest& requestInterest = face->sentInterests[0];
+ BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
+ const Interest& requestInterest = face.sentInterests[0];
auto responseNack = util::makeNack(requestInterest, lp::NackReason::NO_ROUTE);
- face->receive(responseNack);
+ face.receive(responseNack);
advanceClocks(time::milliseconds(1));
BOOST_REQUIRE_EQUAL(commandFailHistory.size(), 1);
@@ -231,8 +230,8 @@
options));
advanceClocks(time::milliseconds(1));
- BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
- const Interest& requestInterest = face->sentInterests[0];
+ BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
+ const Interest& requestInterest = face.sentInterests[0];
FaceCreateCommand command;
BOOST_CHECK(Name("/localhop/net/example/router1/nfd/rib/register").isPrefixOf(
diff --git a/tests/unit-tests/mgmt/dispatcher.t.cpp b/tests/unit-tests/mgmt/dispatcher.t.cpp
index 2fbcd4f..1e7ff30 100644
--- a/tests/unit-tests/mgmt/dispatcher.t.cpp
+++ b/tests/unit-tests/mgmt/dispatcher.t.cpp
@@ -42,13 +42,13 @@
{
public:
DispatcherFixture()
- : face(util::makeDummyClientFace(io, {true, true}))
- , dispatcher(*face, m_keyChain, security::SigningInfo())
+ : face(io, {true, true})
+ , dispatcher(face, m_keyChain, security::SigningInfo())
{
}
public:
- shared_ptr<util::DummyClientFace> face;
+ util::DummyClientFace face;
mgmt::Dispatcher dispatcher;
};
@@ -157,7 +157,7 @@
bind([] { return true; }),
bind([&nCallbackCalled] { ++nCallbackCalled["test/2"]; }));
- face->receive(*util::makeInterest("/root/1/test/1/%80%00"));
+ face.receive(*util::makeInterest("/root/1/test/1/%80%00"));
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 0);
BOOST_CHECK_EQUAL(nCallbackCalled["test/2"], 0);
@@ -165,18 +165,18 @@
dispatcher.addTopPrefix("/root/1");
advanceClocks(time::milliseconds(1));
- face->receive(*util::makeInterest("/root/1/test/1/%80%00"));
+ face.receive(*util::makeInterest("/root/1/test/1/%80%00"));
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 1);
BOOST_CHECK_EQUAL(nCallbackCalled["test/2"], 0);
- face->receive(*util::makeInterest("/root/1/test/2/%80%00"));
+ face.receive(*util::makeInterest("/root/1/test/2/%80%00"));
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 1);
BOOST_CHECK_EQUAL(nCallbackCalled["test/2"], 1);
- face->receive(*util::makeInterest("/root/2/test/1/%80%00"));
- face->receive(*util::makeInterest("/root/2/test/2/%80%00"));
+ face.receive(*util::makeInterest("/root/2/test/1/%80%00"));
+ face.receive(*util::makeInterest("/root/2/test/2/%80%00"));
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 1);
BOOST_CHECK_EQUAL(nCallbackCalled["test/2"], 1);
@@ -184,22 +184,22 @@
dispatcher.addTopPrefix("/root/2");
advanceClocks(time::milliseconds(1));
- face->receive(*util::makeInterest("/root/1/test/1/%80%00"));
+ face.receive(*util::makeInterest("/root/1/test/1/%80%00"));
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 2);
- face->receive(*util::makeInterest("/root/2/test/1/%80%00"));
+ face.receive(*util::makeInterest("/root/2/test/1/%80%00"));
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 3);
dispatcher.removeTopPrefix("/root/1");
advanceClocks(time::milliseconds(1));
- face->receive(*util::makeInterest("/root/1/test/1/%80%00"));
+ face.receive(*util::makeInterest("/root/1/test/1/%80%00"));
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 3);
- face->receive(*util::makeInterest("/root/2/test/1/%80%00"));
+ face.receive(*util::makeInterest("/root/2/test/1/%80%00"));
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 4);
}
@@ -215,23 +215,23 @@
dispatcher.addTopPrefix("/root");
advanceClocks(time::milliseconds(1));
- face->sentDatas.clear();
+ face.sentData.clear();
- face->receive(*util::makeInterest("/root/test/%80%00")); // returns 403
- face->receive(*util::makeInterest("/root/test/%80%00/invalid")); // returns 403
- face->receive(*util::makeInterest("/root/test/%80%00/silent")); // silently ignored
- face->receive(*util::makeInterest("/root/test/.../invalid")); // silently ignored (wrong format)
- face->receive(*util::makeInterest("/root/test/.../valid")); // silently ignored (wrong format)
+ face.receive(*util::makeInterest("/root/test/%80%00")); // returns 403
+ face.receive(*util::makeInterest("/root/test/%80%00/invalid")); // returns 403
+ face.receive(*util::makeInterest("/root/test/%80%00/silent")); // silently ignored
+ face.receive(*util::makeInterest("/root/test/.../invalid")); // silently ignored (wrong format)
+ face.receive(*util::makeInterest("/root/test/.../valid")); // silently ignored (wrong format)
advanceClocks(time::milliseconds(1), 20);
BOOST_CHECK_EQUAL(nCallbackCalled, 0);
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 2);
+ BOOST_CHECK_EQUAL(face.sentData.size(), 2);
- BOOST_CHECK(face->sentDatas[0].getContentType() == tlv::ContentType_Blob);
- BOOST_CHECK_EQUAL(ControlResponse(face->sentDatas[0].getContent().blockFromValue()).getCode(), 403);
- BOOST_CHECK(face->sentDatas[1].getContentType() == tlv::ContentType_Blob);
- BOOST_CHECK_EQUAL(ControlResponse(face->sentDatas[1].getContent().blockFromValue()).getCode(), 403);
+ BOOST_CHECK(face.sentData[0].getContentType() == tlv::ContentType_Blob);
+ BOOST_CHECK_EQUAL(ControlResponse(face.sentData[0].getContent().blockFromValue()).getCode(), 403);
+ BOOST_CHECK(face.sentData[1].getContentType() == tlv::ContentType_Blob);
+ BOOST_CHECK_EQUAL(ControlResponse(face.sentData[1].getContent().blockFromValue()).getCode(), 403);
- face->receive(*util::makeInterest("/root/test/%80%00/valid"));
+ face.receive(*util::makeInterest("/root/test/%80%00/valid"));
advanceClocks(time::milliseconds(1), 10);
BOOST_CHECK_EQUAL(nCallbackCalled, 1);
}
@@ -278,30 +278,30 @@
dispatcher.addTopPrefix("/root");
advanceClocks(time::milliseconds(1));
- face->sentDatas.clear();
+ face.sentData.clear();
- face->receive(*util::makeInterest("/root/test/small/%80%00")); // returns 403
- face->receive(*util::makeInterest("/root/test/small/%80%00/invalid")); // returns 403
- face->receive(*util::makeInterest("/root/test/small/%80%00/silent")); // silently ignored
+ face.receive(*util::makeInterest("/root/test/small/%80%00")); // returns 403
+ face.receive(*util::makeInterest("/root/test/small/%80%00/invalid")); // returns 403
+ face.receive(*util::makeInterest("/root/test/small/%80%00/silent")); // silently ignored
advanceClocks(time::milliseconds(1), 20);
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 2);
+ BOOST_CHECK_EQUAL(face.sentData.size(), 2);
- BOOST_CHECK(face->sentDatas[0].getContentType() == tlv::ContentType_Blob);
- BOOST_CHECK_EQUAL(ControlResponse(face->sentDatas[0].getContent().blockFromValue()).getCode(), 403);
- BOOST_CHECK(face->sentDatas[1].getContentType() == tlv::ContentType_Blob);
- BOOST_CHECK_EQUAL(ControlResponse(face->sentDatas[1].getContent().blockFromValue()).getCode(), 403);
+ BOOST_CHECK(face.sentData[0].getContentType() == tlv::ContentType_Blob);
+ BOOST_CHECK_EQUAL(ControlResponse(face.sentData[0].getContent().blockFromValue()).getCode(), 403);
+ BOOST_CHECK(face.sentData[1].getContentType() == tlv::ContentType_Blob);
+ BOOST_CHECK_EQUAL(ControlResponse(face.sentData[1].getContent().blockFromValue()).getCode(), 403);
- face->sentDatas.clear();
- face->receive(*util::makeInterest("/root/test/small/valid"));
+ face.sentData.clear();
+ face.receive(*util::makeInterest("/root/test/small/valid"));
advanceClocks(time::milliseconds(1), 10);
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 1);
+ BOOST_CHECK_EQUAL(face.sentData.size(), 1);
- face->receive(*util::makeInterest(Name("/root/test/small/valid").appendVersion(10))); // should be ignored
- face->receive(*util::makeInterest(Name("/root/test/small/valid").appendSegment(20))); // should be ignored
+ face.receive(*util::makeInterest(Name("/root/test/small/valid").appendVersion(10))); // should be ignored
+ face.receive(*util::makeInterest(Name("/root/test/small/valid").appendSegment(20))); // should be ignored
advanceClocks(time::milliseconds(1), 10);
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 1);
+ BOOST_CHECK_EQUAL(face.sentData.size(), 1);
- Block content = face->sentDatas[0].getContent();
+ Block content = face.sentData[0].getContent();
BOOST_CHECK_NO_THROW(content.parse());
BOOST_CHECK_EQUAL(content.elements().size(), 3);
@@ -309,12 +309,12 @@
BOOST_CHECK(content.elements()[1] == smallBlock);
BOOST_CHECK(content.elements()[2] == smallBlock);
- face->sentDatas.clear();
- face->receive(*util::makeInterest("/root/test/large/valid"));
+ face.sentData.clear();
+ face.receive(*util::makeInterest("/root/test/large/valid"));
advanceClocks(time::milliseconds(1), 10);
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 2);
+ BOOST_CHECK_EQUAL(face.sentData.size(), 2);
- const auto& datas = face->sentDatas;
+ const auto& datas = face.sentData;
content = [&datas] () -> Block {
EncodingBuffer encoder;
size_t valueLength = encoder.prependByteArray(datas[1].getContent().value(),
@@ -333,12 +333,12 @@
BOOST_CHECK(content.elements()[1] == largeBlock);
BOOST_CHECK(content.elements()[2] == largeBlock);
- face->sentDatas.clear();
- face->receive(*util::makeInterest("/root/test/reject/%80%00/valid")); // returns nack
+ face.sentData.clear();
+ face.receive(*util::makeInterest("/root/test/reject/%80%00/valid")); // returns nack
advanceClocks(time::milliseconds(1));
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 1);
- BOOST_CHECK(face->sentDatas[0].getContentType() == tlv::ContentType_Nack);
- BOOST_CHECK_EQUAL(ControlResponse(face->sentDatas[0].getContent().blockFromValue()).getCode(), 400);
+ BOOST_CHECK_EQUAL(face.sentData.size(), 1);
+ BOOST_CHECK(face.sentData[0].getContentType() == tlv::ContentType_Nack);
+ BOOST_CHECK_EQUAL(ControlResponse(face.sentData[0].getContent().blockFromValue()).getCode(), 400);
}
BOOST_FIXTURE_TEST_CASE(NotificationStream, DispatcherFixture)
@@ -349,31 +349,31 @@
post(block);
advanceClocks(time::milliseconds(1));
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+ BOOST_CHECK_EQUAL(face.sentData.size(), 0);
dispatcher.addTopPrefix("/root");
advanceClocks(time::milliseconds(1));
- face->sentDatas.clear();
+ face.sentData.clear();
post(block);
advanceClocks(time::milliseconds(1));
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 1);
+ BOOST_CHECK_EQUAL(face.sentData.size(), 1);
post(block);
post(block);
post(block);
advanceClocks(time::milliseconds(1), 10);
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 4);
- BOOST_CHECK_EQUAL(face->sentDatas[0].getName(), "/root/test/%FE%00");
- BOOST_CHECK_EQUAL(face->sentDatas[1].getName(), "/root/test/%FE%01");
- BOOST_CHECK_EQUAL(face->sentDatas[2].getName(), "/root/test/%FE%02");
- BOOST_CHECK_EQUAL(face->sentDatas[3].getName(), "/root/test/%FE%03");
+ BOOST_CHECK_EQUAL(face.sentData.size(), 4);
+ BOOST_CHECK_EQUAL(face.sentData[0].getName(), "/root/test/%FE%00");
+ BOOST_CHECK_EQUAL(face.sentData[1].getName(), "/root/test/%FE%01");
+ BOOST_CHECK_EQUAL(face.sentData[2].getName(), "/root/test/%FE%02");
+ BOOST_CHECK_EQUAL(face.sentData[3].getName(), "/root/test/%FE%03");
- BOOST_CHECK(face->sentDatas[0].getContent().blockFromValue() == block);
- BOOST_CHECK(face->sentDatas[1].getContent().blockFromValue() == block);
- BOOST_CHECK(face->sentDatas[2].getContent().blockFromValue() == block);
- BOOST_CHECK(face->sentDatas[3].getContent().blockFromValue() == block);
+ BOOST_CHECK(face.sentData[0].getContent().blockFromValue() == block);
+ BOOST_CHECK(face.sentData[1].getContent().blockFromValue() == block);
+ BOOST_CHECK(face.sentData[2].getContent().blockFromValue() == block);
+ BOOST_CHECK(face.sentData[3].getContent().blockFromValue() == block);
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/unit-tests/security/validator-config.t.cpp b/tests/unit-tests/security/validator-config.t.cpp
index 63eee74..813d28c 100644
--- a/tests/unit-tests/security/validator-config.t.cpp
+++ b/tests/unit-tests/security/validator-config.t.cpp
@@ -1134,8 +1134,8 @@
struct FacesFixture : public security::IdentityManagementTimeFixture
{
FacesFixture()
- : face1(util::makeDummyClientFace(io, {true, true}))
- , face2(util::makeDummyClientFace(io, {true, true}))
+ : face1(io, {true, true})
+ , face2(io, {true, true})
, readInterestOffset1(0)
, readDataOffset1(0)
, readInterestOffset2(0)
@@ -1148,10 +1148,10 @@
{
bool hasPassed = false;
- checkFace(face1->sentInterests, readInterestOffset1, *face2, hasPassed);
- checkFace(face1->sentDatas, readDataOffset1, *face2, hasPassed);
- checkFace(face2->sentInterests, readInterestOffset2, *face1, hasPassed);
- checkFace(face2->sentInterests, readDataOffset2, *face1, hasPassed);
+ checkFace(face1.sentInterests, readInterestOffset1, face2, hasPassed);
+ checkFace(face1.sentData, readDataOffset1, face2, hasPassed);
+ checkFace(face2.sentInterests, readInterestOffset2, face1, hasPassed);
+ checkFace(face2.sentInterests, readDataOffset2, face1, hasPassed);
return hasPassed;
}
@@ -1175,8 +1175,8 @@
}
public:
- shared_ptr<util::DummyClientFace> face1;
- shared_ptr<util::DummyClientFace> face2;
+ util::DummyClientFace face1;
+ util::DummyClientFace face2;
size_t readInterestOffset1;
size_t readDataOffset1;
@@ -1225,13 +1225,13 @@
sld));
m_keyChain.addCertificateAsIdentityDefault(*nldCert);
- face1->setInterestFilter(sldCert->getName().getPrefix(-1),
- [&] (const InterestFilter&, const Interest&) { face1->put(*sldCert); },
+ face1.setInterestFilter(sldCert->getName().getPrefix(-1),
+ [&] (const InterestFilter&, const Interest&) { face1.put(*sldCert); },
RegisterPrefixSuccessCallback(),
[] (const Name&, const std::string&) {});
- face1->setInterestFilter(nldCert->getName().getPrefix(-1),
- [&] (const InterestFilter&, const Interest&) { face1->put(*nldCert); },
+ face1.setInterestFilter(nldCert->getName().getPrefix(-1),
+ [&] (const InterestFilter&, const Interest&) { face1.put(*nldCert); },
RegisterPrefixSuccessCallback(),
[] (const Name&, const std::string&) {});
@@ -1270,7 +1270,7 @@
(boost::filesystem::current_path() / std::string("unit-test-nfd.conf"));
- auto validator = make_shared<ValidatorConfig>(face2.get());
+ auto validator = make_shared<ValidatorConfig>(&face2);
validator->load(CONFIG, CONFIG_PATH.native());
advanceClocks(time::milliseconds(2), 100);
@@ -1338,13 +1338,13 @@
sld));
m_keyChain.addCertificateAsIdentityDefault(*nldCert);
- face1->setInterestFilter(sldCert->getName().getPrefix(-1),
- [&] (const InterestFilter&, const Interest&) { face1->put(*sldCert); },
+ face1.setInterestFilter(sldCert->getName().getPrefix(-1),
+ [&] (const InterestFilter&, const Interest&) { face1.put(*sldCert); },
RegisterPrefixSuccessCallback(),
[] (const Name&, const std::string&) {});
- face1->setInterestFilter(nldCert->getName().getPrefix(-1),
- [&] (const InterestFilter&, const Interest&) { face1->put(*nldCert); },
+ face1.setInterestFilter(nldCert->getName().getPrefix(-1),
+ [&] (const InterestFilter&, const Interest&) { face1.put(*nldCert); },
RegisterPrefixSuccessCallback(),
[] (const Name&, const std::string&) {});
@@ -1417,8 +1417,7 @@
const boost::filesystem::path CONFIG_PATH =
(boost::filesystem::current_path() / std::string("unit-test-nfd.conf"));
-
- auto validator = make_shared<ValidatorConfig>(face2.get());
+ auto validator = make_shared<ValidatorConfig>(&face2);
validator->load(CONFIG, CONFIG_PATH.native());
advanceClocks(time::milliseconds(2), 100);
@@ -1467,8 +1466,8 @@
struct DirTestFixture : public security::IdentityManagementTimeFixture
{
DirTestFixture()
- : face(util::makeDummyClientFace(io, {true, true}))
- , validator(face.get(), ValidatorConfig::DEFAULT_CERTIFICATE_CACHE,
+ : face(io, {true, true})
+ , validator(&face, ValidatorConfig::DEFAULT_CERTIFICATE_CACHE,
ValidatorConfig::DEFAULT_GRACE_INTERVAL, 0)
{
certDirPath = (boost::filesystem::current_path() / std::string("test-cert-dir"));
@@ -1510,7 +1509,7 @@
shared_ptr<IdentityCertificate> firstCert;
shared_ptr<IdentityCertificate> secondCert;
- shared_ptr<util::DummyClientFace> face;
+ util::DummyClientFace face;
ValidatorConfig validator;
};
diff --git a/tests/unit-tests/util/notification-stream.t.cpp b/tests/unit-tests/util/notification-stream.t.cpp
index fb91f5e..0b15e61 100644
--- a/tests/unit-tests/util/notification-stream.t.cpp
+++ b/tests/unit-tests/util/notification-stream.t.cpp
@@ -60,9 +60,9 @@
BOOST_AUTO_TEST_CASE(Post)
{
- shared_ptr<DummyClientFace> face = makeDummyClientFace(io);
+ DummyClientFace face(io);
ndn::KeyChain keyChain;
- util::NotificationStream<SimpleNotification> notificationStream(*face,
+ util::NotificationStream<SimpleNotification> notificationStream(face,
"/localhost/nfd/NotificationStreamTest", keyChain);
SimpleNotification event1("msg1");
@@ -70,11 +70,11 @@
advanceClocks(time::milliseconds(1));
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
- BOOST_CHECK_EQUAL(face->sentDatas[0].getName(),
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+ BOOST_CHECK_EQUAL(face.sentData[0].getName(),
"/localhost/nfd/NotificationStreamTest/%FE%00");
SimpleNotification decoded1;
- BOOST_CHECK_NO_THROW(decoded1.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_CHECK_NO_THROW(decoded1.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(decoded1.getMessage(), "msg1");
SimpleNotification event2("msg2");
@@ -82,11 +82,11 @@
advanceClocks(time::milliseconds(1));
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 2);
- BOOST_CHECK_EQUAL(face->sentDatas[1].getName(),
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 2);
+ BOOST_CHECK_EQUAL(face.sentData[1].getName(),
"/localhost/nfd/NotificationStreamTest/%FE%01");
SimpleNotification decoded2;
- BOOST_CHECK_NO_THROW(decoded2.wireDecode(face->sentDatas[1].getContent().blockFromValue()));
+ BOOST_CHECK_NO_THROW(decoded2.wireDecode(face.sentData[1].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(decoded2.getMessage(), "msg2");
}
diff --git a/tests/unit-tests/util/notification-subscriber.t.cpp b/tests/unit-tests/util/notification-subscriber.t.cpp
index 4fa222b..8dc1e60 100644
--- a/tests/unit-tests/util/notification-subscriber.t.cpp
+++ b/tests/unit-tests/util/notification-subscriber.t.cpp
@@ -44,10 +44,10 @@
public:
EndToEndFixture()
: streamPrefix("ndn:/NotificationSubscriberTest")
- , publisherFace(makeDummyClientFace(io))
- , notificationStream(*publisherFace, streamPrefix, publisherKeyChain)
- , subscriberFace(makeDummyClientFace(io))
- , subscriber(*subscriberFace, streamPrefix, time::seconds(1))
+ , publisherFace(io)
+ , notificationStream(publisherFace, streamPrefix, publisherKeyChain)
+ , subscriberFace(io)
+ , subscriber(subscriberFace, streamPrefix, time::seconds(1))
{
}
@@ -56,18 +56,18 @@
void
deliverNotification(const std::string& msg)
{
- publisherFace->sentDatas.clear();
+ publisherFace.sentData.clear();
SimpleNotification notification(msg);
notificationStream.postNotification(notification);
advanceClocks(time::milliseconds(1));
- BOOST_REQUIRE_EQUAL(publisherFace->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(publisherFace.sentData.size(), 1);
- lastDeliveredSeqNo = publisherFace->sentDatas[0].getName().at(-1).toSequenceNumber();
+ lastDeliveredSeqNo = publisherFace.sentData[0].getName().at(-1).toSequenceNumber();
lastNotification.setMessage("");
- subscriberFace->receive(publisherFace->sentDatas[0]);
+ subscriberFace.receive(publisherFace.sentData[0]);
}
void
@@ -93,10 +93,10 @@
bool
hasInitialRequest() const
{
- if (subscriberFace->sentInterests.empty())
+ if (subscriberFace.sentInterests.empty())
return 0;
- const Interest& interest = subscriberFace->sentInterests[0];
+ const Interest& interest = subscriberFace.sentInterests[0];
return interest.getName() == streamPrefix &&
interest.getChildSelector() == 1 &&
interest.getMustBeFresh() &&
@@ -109,10 +109,10 @@
uint64_t
getRequestSeqNo() const
{
- if (subscriberFace->sentInterests.size() != 1)
+ if (subscriberFace.sentInterests.size() != 1)
return 0;
- const Interest& interest = subscriberFace->sentInterests[0];
+ const Interest& interest = subscriberFace.sentInterests[0];
const Name& name = interest.getName();
if (streamPrefix.isPrefixOf(name) &&
name.size() == streamPrefix.size() + 1 &&
@@ -124,10 +124,10 @@
protected:
Name streamPrefix;
- shared_ptr<DummyClientFace> publisherFace;
+ DummyClientFace publisherFace;
ndn::KeyChain publisherKeyChain;
util::NotificationStream<SimpleNotification> notificationStream;
- shared_ptr<DummyClientFace> subscriberFace;
+ DummyClientFace subscriberFace;
util::NotificationSubscriber<SimpleNotification> subscriber;
util::signal::Connection notificationConn;
@@ -155,30 +155,30 @@
this->deliverNotification("n1");
advanceClocks(time::milliseconds(1));
BOOST_CHECK(lastNotification.getMessage().empty());
- BOOST_CHECK_EQUAL(subscriberFace->sentInterests.size(), 0);
+ BOOST_CHECK_EQUAL(subscriberFace.sentInterests.size(), 0);
- subscriberFace->sentInterests.clear();
+ subscriberFace.sentInterests.clear();
subscriber.start();
advanceClocks(time::milliseconds(1));
BOOST_REQUIRE_EQUAL(subscriber.isRunning(), true);
BOOST_CHECK(this->hasInitialRequest());
// respond to initial request
- subscriberFace->sentInterests.clear();
+ subscriberFace.sentInterests.clear();
this->deliverNotification("n2");
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(lastNotification.getMessage(), "n2");
BOOST_CHECK_EQUAL(this->getRequestSeqNo(), lastDeliveredSeqNo + 1);
// respond to continuation request
- subscriberFace->sentInterests.clear();
+ subscriberFace.sentInterests.clear();
this->deliverNotification("n3");
advanceClocks(time::milliseconds(1));
BOOST_CHECK_EQUAL(lastNotification.getMessage(), "n3");
BOOST_CHECK_EQUAL(this->getRequestSeqNo(), lastDeliveredSeqNo + 1);
// timeout
- subscriberFace->sentInterests.clear();
+ subscriberFace.sentInterests.clear();
lastNotification.setMessage("");
advanceClocks(subscriber.getInterestLifetime(), 2);
BOOST_CHECK(lastNotification.getMessage().empty());
@@ -190,8 +190,8 @@
wrongName.append("%07%07");
Data wrongData(wrongName);
publisherKeyChain.sign(wrongData);
- subscriberFace->receive(wrongData);
- subscriberFace->sentInterests.clear();
+ subscriberFace.receive(wrongData);
+ subscriberFace.sentInterests.clear();
lastNotification.setMessage("");
advanceClocks(time::milliseconds(1));
BOOST_CHECK(lastNotification.getMessage().empty());
@@ -199,7 +199,7 @@
BOOST_CHECK(this->hasInitialRequest());
// decode error in payload
- subscriberFace->sentInterests.clear();
+ subscriberFace.sentInterests.clear();
lastNotification.setMessage("");
this->deliverNotification("\x07n4");
advanceClocks(time::milliseconds(1));
@@ -208,10 +208,10 @@
// stop if handlers are cleared
notificationConn.disconnect();
- subscriberFace->sentInterests.clear();
+ subscriberFace.sentInterests.clear();
this->deliverNotification("n5");
advanceClocks(time::milliseconds(1));
- BOOST_CHECK_EQUAL(subscriberFace->sentInterests.size(), 0);
+ BOOST_CHECK_EQUAL(subscriberFace.sentInterests.size(), 0);
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/unit-tests/util/segment-fetcher.t.cpp b/tests/unit-tests/util/segment-fetcher.t.cpp
index e53cc0f..4cccc80 100644
--- a/tests/unit-tests/util/segment-fetcher.t.cpp
+++ b/tests/unit-tests/util/segment-fetcher.t.cpp
@@ -66,7 +66,7 @@
{
public:
Fixture()
- : face(makeDummyClientFace(io))
+ : face(io)
, nErrors(0)
, nDatas(0)
, dataSize(0)
@@ -107,14 +107,14 @@
void
nackLastInterest(lp::NackReason nackReason)
{
- const Interest& lastInterest = face->sentInterests.back();
+ const Interest& lastInterest = face.sentInterests.back();
lp::Nack nack = makeNack(lastInterest, nackReason);
- face->receive(nack);
+ face.receive(nack);
advanceClocks(time::milliseconds(1), 10);
}
public:
- shared_ptr<DummyClientFace> face;
+ DummyClientFace face;
KeyChain keyChain;
uint32_t nErrors;
@@ -127,7 +127,7 @@
BOOST_FIXTURE_TEST_CASE(Timeout, Fixture)
{
ValidatorNull nullValidator;
- SegmentFetcher::fetch(*face, Interest("/hello/world", time::milliseconds(100)),
+ SegmentFetcher::fetch(face, Interest("/hello/world", time::milliseconds(100)),
nullValidator,
bind(&Fixture::onComplete, this, _1),
bind(&Fixture::onError, this, _1));
@@ -136,10 +136,10 @@
BOOST_CHECK_EQUAL(nErrors, 0);
BOOST_CHECK_EQUAL(nDatas, 0);
- BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+ BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
+ BOOST_CHECK_EQUAL(face.sentData.size(), 0);
- const Interest& interest = face->sentInterests[0];
+ const Interest& interest = face.sentInterests[0];
BOOST_CHECK_EQUAL(interest.getName(), "/hello/world");
BOOST_CHECK_EQUAL(interest.getMustBeFresh(), true);
BOOST_CHECK_EQUAL(interest.getChildSelector(), 1);
@@ -148,22 +148,22 @@
BOOST_CHECK_EQUAL(nErrors, 1);
BOOST_CHECK_EQUAL(lastError, static_cast<uint32_t>(SegmentFetcher::INTEREST_TIMEOUT));
- BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+ BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
+ BOOST_CHECK_EQUAL(face.sentData.size(), 0);
}
BOOST_FIXTURE_TEST_CASE(Basic, Fixture)
{
ValidatorNull nullValidator;
- SegmentFetcher::fetch(*face, Interest("/hello/world", time::seconds(1000)),
+ SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
nullValidator,
bind(&Fixture::onComplete, this, _1),
bind(&Fixture::onError, this, _1));
advanceClocks(time::milliseconds(1), 10);
- face->receive(*makeDataSegment("/hello/world/version0", 0, true));
+ face.receive(*makeDataSegment("/hello/world/version0", 0, true));
advanceClocks(time::milliseconds(1), 10);
BOOST_CHECK_EQUAL(nErrors, 0);
@@ -176,10 +176,10 @@
BOOST_CHECK_EQUAL(dataString, bufferString);
- BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+ BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
+ BOOST_CHECK_EQUAL(face.sentData.size(), 0);
- const Interest& interest = face->sentInterests[0];
+ const Interest& interest = face.sentInterests[0];
BOOST_CHECK_EQUAL(interest.getName(), "/hello/world");
BOOST_CHECK_EQUAL(interest.getMustBeFresh(), true);
BOOST_CHECK_EQUAL(interest.getChildSelector(), 1);
@@ -188,7 +188,7 @@
BOOST_FIXTURE_TEST_CASE(NoSegmentInData, Fixture)
{
ValidatorNull nullValidator;
- SegmentFetcher::fetch(*face, Interest("/hello/world", time::seconds(1000)),
+ SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
nullValidator,
bind(&Fixture::onComplete, this, _1),
bind(&Fixture::onError, this, _1));
@@ -201,7 +201,7 @@
data->setContent(buffer, sizeof(buffer));
- face->receive(*data);
+ face.receive(*data);
advanceClocks(time::milliseconds(1), 10);
BOOST_CHECK_EQUAL(nErrors, 1);
@@ -212,13 +212,13 @@
BOOST_FIXTURE_TEST_CASE(SegmentValidationFailure, Fixture)
{
ValidatorFailed failedValidator;
- SegmentFetcher::fetch(*face, Interest("/hello/world", time::seconds(1000)),
+ SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
failedValidator,
bind(&Fixture::onComplete, this, _1),
bind(&Fixture::onError, this, _1));
advanceClocks(time::milliseconds(1), 10);
- face->receive(*makeDataSegment("/hello/world/version0", 0, true));
+ face.receive(*makeDataSegment("/hello/world/version0", 0, true));
advanceClocks(time::milliseconds(1), 10);
BOOST_CHECK_EQUAL(nErrors, 1);
@@ -229,19 +229,19 @@
BOOST_FIXTURE_TEST_CASE(Triple, Fixture)
{
ValidatorNull nullValidator;
- SegmentFetcher::fetch(*face, Interest("/hello/world", time::seconds(1000)),
+ SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
nullValidator,
bind(&Fixture::onComplete, this, _1),
bind(&Fixture::onError, this, _1));
advanceClocks(time::milliseconds(1), 10);
- face->receive(*makeDataSegment("/hello/world/version0", 0, false));
+ face.receive(*makeDataSegment("/hello/world/version0", 0, false));
advanceClocks(time::milliseconds(1), 10);
- face->receive(*makeDataSegment("/hello/world/version0", 1, false));
+ face.receive(*makeDataSegment("/hello/world/version0", 1, false));
advanceClocks(time::milliseconds(1), 10);
- face->receive(*makeDataSegment("/hello/world/version0", 2, true));
+ face.receive(*makeDataSegment("/hello/world/version0", 2, true));
advanceClocks(time::milliseconds(1), 10);
@@ -250,25 +250,25 @@
BOOST_CHECK_EQUAL(dataSize, 42);
- BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 3);
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+ BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 3);
+ BOOST_CHECK_EQUAL(face.sentData.size(), 0);
{
- const Interest& interest = face->sentInterests[0];
+ const Interest& interest = face.sentInterests[0];
BOOST_CHECK_EQUAL(interest.getName(), "/hello/world");
BOOST_CHECK_EQUAL(interest.getMustBeFresh(), true);
BOOST_CHECK_EQUAL(interest.getChildSelector(), 1);
}
{
- const Interest& interest = face->sentInterests[1];
+ const Interest& interest = face.sentInterests[1];
BOOST_CHECK_EQUAL(interest.getName(), "/hello/world/version0/%00%01");
BOOST_CHECK_EQUAL(interest.getMustBeFresh(), false);
BOOST_CHECK_EQUAL(interest.getChildSelector(), 0);
}
{
- const Interest& interest = face->sentInterests[2];
+ const Interest& interest = face.sentInterests[2];
BOOST_CHECK_EQUAL(interest.getName(), "/hello/world/version0/%00%02");
BOOST_CHECK_EQUAL(interest.getMustBeFresh(), false);
BOOST_CHECK_EQUAL(interest.getChildSelector(), 0);
@@ -278,22 +278,22 @@
BOOST_FIXTURE_TEST_CASE(TripleWithInitialSegmentFetching, Fixture)
{
ValidatorNull nullValidator;
- SegmentFetcher::fetch(*face, Interest("/hello/world", time::seconds(1000)),
+ SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
nullValidator,
bind(&Fixture::onComplete, this, _1),
bind(&Fixture::onError, this, _1));
advanceClocks(time::milliseconds(1), 10);
- face->receive(*makeDataSegment("/hello/world/version0", 1, false));
+ face.receive(*makeDataSegment("/hello/world/version0", 1, false));
advanceClocks(time::milliseconds(1), 10);
- face->receive(*makeDataSegment("/hello/world/version0", 0, false));
+ face.receive(*makeDataSegment("/hello/world/version0", 0, false));
advanceClocks(time::milliseconds(1), 10);
- face->receive(*makeDataSegment("/hello/world/version0", 1, false));
+ face.receive(*makeDataSegment("/hello/world/version0", 1, false));
advanceClocks(time::milliseconds(1), 10);
- face->receive(*makeDataSegment("/hello/world/version0", 2, true));
+ face.receive(*makeDataSegment("/hello/world/version0", 2, true));
advanceClocks(time::milliseconds(1), 10);
@@ -302,32 +302,32 @@
BOOST_CHECK_EQUAL(dataSize, 42);
- BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 4);
- BOOST_CHECK_EQUAL(face->sentDatas.size(), 0);
+ BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 4);
+ BOOST_CHECK_EQUAL(face.sentData.size(), 0);
{
- const Interest& interest = face->sentInterests[0];
+ const Interest& interest = face.sentInterests[0];
BOOST_CHECK_EQUAL(interest.getName(), "/hello/world");
BOOST_CHECK_EQUAL(interest.getMustBeFresh(), true);
BOOST_CHECK_EQUAL(interest.getChildSelector(), 1);
}
{
- const Interest& interest = face->sentInterests[1];
+ const Interest& interest = face.sentInterests[1];
BOOST_CHECK_EQUAL(interest.getName(), "/hello/world/version0/%00%00");
BOOST_CHECK_EQUAL(interest.getMustBeFresh(), false);
BOOST_CHECK_EQUAL(interest.getChildSelector(), 0);
}
{
- const Interest& interest = face->sentInterests[2];
+ const Interest& interest = face.sentInterests[2];
BOOST_CHECK_EQUAL(interest.getName(), "/hello/world/version0/%00%01");
BOOST_CHECK_EQUAL(interest.getMustBeFresh(), false);
BOOST_CHECK_EQUAL(interest.getChildSelector(), 0);
}
{
- const Interest& interest = face->sentInterests[3];
+ const Interest& interest = face.sentInterests[3];
BOOST_CHECK_EQUAL(interest.getName(), "/hello/world/version0/%00%02");
BOOST_CHECK_EQUAL(interest.getMustBeFresh(), false);
BOOST_CHECK_EQUAL(interest.getChildSelector(), 0);
@@ -337,7 +337,7 @@
BOOST_FIXTURE_TEST_CASE(MultipleSegmentFetching, Fixture)
{
ValidatorNull nullValidator;
- SegmentFetcher::fetch(*face, Interest("/hello/world", time::seconds(1000)),
+ SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
nullValidator,
bind(&Fixture::onComplete, this, _1),
bind(&Fixture::onError, this, _1));
@@ -346,10 +346,10 @@
for (uint64_t i = 0; i < 400; i++) {
advanceClocks(time::milliseconds(1), 10);
- face->receive(*makeDataSegment("/hello/world/version0", i, false));
+ face.receive(*makeDataSegment("/hello/world/version0", i, false));
}
advanceClocks(time::milliseconds(1), 10);
- face->receive(*makeDataSegment("/hello/world/version0", 400, true));
+ face.receive(*makeDataSegment("/hello/world/version0", 400, true));
advanceClocks(time::milliseconds(1), 10);
@@ -359,7 +359,7 @@
BOOST_FIXTURE_TEST_CASE(SegmentFetcherDuplicateNack, Fixture)
{
- SegmentFetcher::fetch(*face, Interest("/hello/world", time::seconds(1000)),
+ SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
make_shared<ValidatorNull>(),
bind(&Fixture::onComplete, this, _1),
bind(&Fixture::onError, this, _1));
@@ -373,13 +373,13 @@
nackLastInterest(lp::NackReason::DUPLICATE);
}
- BOOST_CHECK_EQUAL(face->sentInterests.size(), (SegmentFetcher::MAX_INTEREST_REEXPRESS + 1));
+ BOOST_CHECK_EQUAL(face.sentInterests.size(), (SegmentFetcher::MAX_INTEREST_REEXPRESS + 1));
BOOST_CHECK_EQUAL(lastError, static_cast<uint32_t>(SegmentFetcher::NACK_ERROR));
}
BOOST_FIXTURE_TEST_CASE(SegmentFetcherCongestionNack, Fixture)
{
- SegmentFetcher::fetch(*face, Interest("/hello/world", time::seconds(1000)),
+ SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
make_shared<ValidatorNull>(),
bind(&Fixture::onComplete, this, _1),
bind(&Fixture::onError, this, _1));
@@ -393,7 +393,7 @@
nackLastInterest(lp::NackReason::CONGESTION);
}
- BOOST_CHECK_EQUAL(face->sentInterests.size(), (SegmentFetcher::MAX_INTEREST_REEXPRESS + 1));
+ BOOST_CHECK_EQUAL(face.sentInterests.size(), (SegmentFetcher::MAX_INTEREST_REEXPRESS + 1));
BOOST_CHECK_EQUAL(lastError, static_cast<uint32_t>(SegmentFetcher::NACK_ERROR));
}