face: LpFace counters
FaceCounters for LpFace consist of LinkService::Counters and
Transport::Counters. Old FaceCounters class from 2014 face architecture is
renamed as OldFaceCounters, and can be wrapped with new FaceCounters class.
OldFaceCounters is only used in old Face subclasses.
This commit also updates existing face test suites to use new FaceCounters,
updates ForwarderStatus so that it does not rely on FaceCounters,
and moves the logic of copying face properties and counters into management
structs from face system into FaceManager.
refs #3177
Change-Id: I587e8a32fa72bac3af9d750b2c88342740aa08d6
diff --git a/tests/daemon/face/lp-face-wrapper.t.cpp b/tests/daemon/face/lp-face-wrapper.t.cpp
index 182d2fc..8217d77 100644
--- a/tests/daemon/face/lp-face-wrapper.t.cpp
+++ b/tests/daemon/face/lp-face-wrapper.t.cpp
@@ -71,6 +71,14 @@
BOOST_CHECK_EQUAL(face1w->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERMANENT);
}
+BOOST_AUTO_TEST_CASE(Counters)
+{
+ auto face1w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
+ auto face1 = static_cast<DummyLpFace*>(face1w->getLpFace());
+
+ BOOST_CHECK(&face1->getCounters() == &face1w->getCounters());
+}
+
BOOST_AUTO_TEST_CASE(FailSignal)
{
auto face1w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
@@ -108,16 +116,6 @@
face1w->onReceiveData.connect(bind([&nReceivedData] { ++nReceivedData; }));
face1w->onReceiveNack.connect(bind([&nReceivedNacks] { ++nReceivedNacks; }));
- BOOST_CHECK_EQUAL(face1->getCounters().getNInInterests(), 0);
- BOOST_CHECK_EQUAL(face1->getCounters().getNInDatas(), 0);
- BOOST_CHECK_EQUAL(face1->getCounters().getNOutInterests(), 0);
- BOOST_CHECK_EQUAL(face1->getCounters().getNOutDatas(), 0);
- BOOST_CHECK_EQUAL(face1w->getCounters().getNInInterests(), 0);
- BOOST_CHECK_EQUAL(face1w->getCounters().getNInDatas(), 0);
- BOOST_CHECK_EQUAL(face1w->getCounters().getNOutInterests(), 0);
- BOOST_CHECK_EQUAL(face1w->getCounters().getNOutDatas(), 0);
- // There's no counters for NACK for now.
-
for (size_t i = 0; i < nInInterests; ++i) {
shared_ptr<Interest> interest = makeInterest("/JSQdqward4");
face1->receiveInterest(*interest);
@@ -148,15 +146,6 @@
face1w->sendNack(nack);
}
- BOOST_CHECK_EQUAL(face1->getCounters().getNInInterests(), nInInterests);
- BOOST_CHECK_EQUAL(face1->getCounters().getNInDatas(), nInData);
- BOOST_CHECK_EQUAL(face1->getCounters().getNOutInterests(), nOutInterests);
- BOOST_CHECK_EQUAL(face1->getCounters().getNOutDatas(), nOutData);
- BOOST_CHECK_EQUAL(face1w->getCounters().getNInInterests(), nInInterests);
- BOOST_CHECK_EQUAL(face1w->getCounters().getNInDatas(), nInData);
- BOOST_CHECK_EQUAL(face1w->getCounters().getNOutInterests(), nOutInterests);
- BOOST_CHECK_EQUAL(face1w->getCounters().getNOutDatas(), nOutData);
-
BOOST_CHECK_EQUAL(nReceivedInterests, nInInterests);
BOOST_CHECK_EQUAL(nReceivedData, nInData);
BOOST_CHECK_EQUAL(nReceivedNacks, nInNacks);