nlsr: Add support for sources to NamePrefixList
Added support for string sources to NamePrefixList entries. Required was
some tweaking of the API, and refactoring usage around the codebase.
Change-Id: I44813e024a88dc1f591f427b0fad568a7d5353ab
refs: #4177
diff --git a/tests/update/test-nfd-rib-command-processor.cpp b/tests/update/test-nfd-rib-command-processor.cpp
index bb4db42..20856fe 100644
--- a/tests/update/test-nfd-rib-command-processor.cpp
+++ b/tests/update/test-nfd-rib-command-processor.cpp
@@ -150,10 +150,10 @@
face.receive(*command);
this->advanceClocks(ndn::time::milliseconds(10));
- BOOST_CHECK_EQUAL(namePrefixes.getNameList().size(), 1);
- auto itr = std::find(namePrefixes.getNameList().begin(), namePrefixes.getNameList().end(),
- prefixName);
- if (itr == namePrefixes.getNameList().end()) {
+ BOOST_CHECK_EQUAL(namePrefixes.getNames().size(), 1);
+ std::list<ndn::Name> names = namePrefixes.getNames();
+ auto itr = std::find(names.begin(), names.end(), prefixName);
+ if (itr == namePrefixes.getNames().end()) {
BOOST_FAIL("Prefix was not inserted!");
}
BOOST_CHECK_EQUAL((*itr), prefixName);
@@ -167,7 +167,7 @@
ndn::Name prefixName("/test/prefixA");
ndn::nfd::ControlParameters parameters;
- namePrefixes.getNameList().push_back(prefixName);
+ namePrefixes.insert(prefixName);
shared_ptr<ndn::Interest> command = makeInterest(name.append(parameters.setName(prefixName)
.wireEncode()), 0);
@@ -175,7 +175,7 @@
face.receive(ndn::Interest(name));
this->advanceClocks(ndn::time::milliseconds(10));
- BOOST_CHECK_EQUAL(namePrefixes.getNameList().size(), 0);
+ BOOST_CHECK_EQUAL(namePrefixes.getNames().size(), 0);
BOOST_CHECK(wasRoutingUpdatePublished());
BOOST_CHECK(nameLsaSeqNoBeforeInterest < nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
}
@@ -192,7 +192,7 @@
face.receive(ndn::Interest(name));
this->advanceClocks(ndn::time::milliseconds(10));
- BOOST_CHECK_EQUAL(namePrefixes.getNameList().size(), 0);
+ BOOST_CHECK_EQUAL(namePrefixes.getNames().size(), 0);
// Cannot use routingUpdatePublish test now since in
// initialize nlsr calls buildOwnNameLsa which publishes the routing update
diff --git a/tests/update/test-prefix-update-processor.cpp b/tests/update/test-prefix-update-processor.cpp
index 19deaf6..32cacb5 100644
--- a/tests/update/test-prefix-update-processor.cpp
+++ b/tests/update/test-prefix-update-processor.cpp
@@ -253,7 +253,7 @@
NamePrefixList& namePrefixList = nlsr.getNamePrefixList();
BOOST_REQUIRE_EQUAL(namePrefixList.getSize(), 1);
- BOOST_CHECK_EQUAL(namePrefixList.getNameList().front(), parameters.getName());
+ BOOST_CHECK_EQUAL(namePrefixList.getNames().front(), parameters.getName());
BOOST_CHECK(wasRoutingUpdatePublished());
BOOST_CHECK(nameLsaSeqNoBeforeInterest < nlsr.getLsdb().getSequencingManager().getNameLsaSeq());