communication: adapt to API changes in PSync
Pass the KeyChain instance to psync::FullProducer
Change-Id: Ia97356dc364c7bdaf6dc80ad57fa351eeabe997d
diff --git a/tests/communication/test-sync-logic-handler.cpp b/tests/communication/test-sync-logic-handler.cpp
index b7836c2..8c0cc3d 100644
--- a/tests/communication/test-sync-logic-handler.cpp
+++ b/tests/communication/test-sync-logic-handler.cpp
@@ -37,7 +37,6 @@
public:
SyncLogicFixture()
: testIsLsaNew([] (auto&&...) { return true; })
- , sync(face, testIsLsaNew, conf)
, updateNamePrefix(this->conf.getLsaPrefix().toUri() +
this->conf.getSiteName().toUri() +
"/%C1.Router/other-router/")
@@ -61,9 +60,9 @@
public:
ndn::util::DummyClientFace face{m_io, m_keyChain};
ConfParameter conf{face, m_keyChain};
- DummyConfFileProcessor confProcessor{conf, SYNC_PROTOCOL_PSYNC};
+ DummyConfFileProcessor confProcessor{conf, SyncProtocol::PSYNC};
SyncLogicHandler::IsLsaNew testIsLsaNew;
- SyncLogicHandler sync;
+ SyncLogicHandler sync{face, m_keyChain, testIsLsaNew, conf};
const std::string updateNamePrefix;
const std::vector<Lsa::Type> lsaTypes{Lsa::Type::NAME,
@@ -85,7 +84,7 @@
for (auto lsaType : {Lsa::Type::NAME, Lsa::Type::ADJACENCY}) {
std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(lsaType);
- ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa->connect(
+ ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa.connect(
[&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) {
BOOST_CHECK_EQUAL(ndn::Name{updateName}, routerName);
BOOST_CHECK_EQUAL(sequenceNumber, syncSeqNo);
@@ -112,7 +111,7 @@
for (auto lsaType : {Lsa::Type::NAME, Lsa::Type::COORDINATE}) {
std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(lsaType);
- ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa->connect(
+ ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa.connect(
[&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) {
BOOST_CHECK_EQUAL(ndn::Name{updateName}, routerName);
BOOST_CHECK_EQUAL(sequenceNumber, syncSeqNo);
@@ -139,7 +138,7 @@
for (auto lsaType : this->lsaTypes) {
std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(lsaType);
- ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa->connect(
+ ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa.connect(
[&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) {
BOOST_CHECK_EQUAL(ndn::Name{updateName}, routerName);
BOOST_CHECK_EQUAL(sequenceNumber, syncSeqNo);
@@ -168,7 +167,7 @@
.append(this->conf.getRouterName())
.append(boost::lexical_cast<std::string>(lsaType));
- ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa->connect(
+ ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa.connect(
[&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) {
BOOST_FAIL("Updates for self should not be emitted!");
});
@@ -192,7 +191,7 @@
ndn::Name updateName{this->conf.getSiteName()};
updateName.append(this->conf.getRouterName()).append(boost::lexical_cast<std::string>(lsaType));
- ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa->connect(
+ ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa.connect(
[&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) {
BOOST_FAIL("Malformed updates should not be emitted!");
});
@@ -216,11 +215,11 @@
};
const uint64_t sequenceNumber = 1;
- SyncLogicHandler sync{this->face, testLsaAlwaysFalse, this->conf};
- ndn::util::signal::ScopedConnection connection = sync.onNewLsa->connect(
- [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) {
- BOOST_FAIL("An update for an LSA with non-new sequence number should not emit!");
- });
+ SyncLogicHandler sync{this->face, this->m_keyChain, testLsaAlwaysFalse, this->conf};
+ ndn::util::signal::ScopedConnection connection = sync.onNewLsa.connect(
+ [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) {
+ BOOST_FAIL("An update for an LSA with non-new sequence number should not emit!");
+ });
std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(Lsa::Type::NAME);
this->receiveUpdate(updateName, sequenceNumber);
diff --git a/tests/communication/test-sync-protocol-adapter.cpp b/tests/communication/test-sync-protocol-adapter.cpp
index 919f5e8..721b2f7 100644
--- a/tests/communication/test-sync-protocol-adapter.cpp
+++ b/tests/communication/test-sync-protocol-adapter.cpp
@@ -49,11 +49,11 @@
faces[i] = std::make_shared<util::DummyClientFace>(m_io,
util::DummyClientFace::Options{true, true});
userPrefixes[i] = Name(nameLsaUserPrefix).appendNumber(i);
- nodes[i] = std::make_shared<SyncProtocolAdapter>(*faces[i], SYNC_PROTOCOL_PSYNC, syncPrefix,
- userPrefixes[i],
+ nodes[i] = std::make_shared<SyncProtocolAdapter>(*faces[i], m_keyChain, SyncProtocol::PSYNC,
+ syncPrefix, userPrefixes[i],
syncInterestLifetime,
[i, this] (const ndn::Name& updateName,
- uint64_t highSeq, uint64_t incomingFaceId) {
+ uint64_t highSeq, uint64_t incomingFaceId) {
prefixToSeq[i].emplace(updateName, highSeq);
});
}
diff --git a/tests/security/test-certificate-store.cpp b/tests/security/test-certificate-store.cpp
index 6c8a4f6..b0580c9 100644
--- a/tests/security/test-certificate-store.cpp
+++ b/tests/security/test-certificate-store.cpp
@@ -42,7 +42,7 @@
CertificateStoreFixture()
: face(m_io, m_keyChain, {true, true})
, conf(face, m_keyChain, "unit-test-nlsr.conf")
- , confProcessor(conf, SYNC_PROTOCOL_PSYNC, HYPERBOLIC_STATE_OFF,
+ , confProcessor(conf, SyncProtocol::PSYNC, HYPERBOLIC_STATE_OFF,
"/ndn/", "/site", "/%C1.Router/router1")
, rootIdName(conf.getNetwork())
, siteIdentityName(ndn::Name(conf.getNetwork()).append(conf.getSiteName()))
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index 1c8c0e2..3498f81 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -62,7 +62,7 @@
{
public:
DummyConfFileProcessor(ConfParameter& conf,
- SyncProtocol protocol = SYNC_PROTOCOL_PSYNC,
+ SyncProtocol protocol = SyncProtocol::PSYNC,
HyperbolicState hyperbolicState = HYPERBOLIC_STATE_OFF,
const ndn::Name& networkName = "/ndn",
const ndn::Name& siteName = "/site",
diff --git a/tests/test-conf-file-processor.cpp b/tests/test-conf-file-processor.cpp
index 05e1a94..06c041c 100644
--- a/tests/test-conf-file-processor.cpp
+++ b/tests/test-conf-file-processor.cpp
@@ -171,7 +171,7 @@
BOOST_CHECK_EQUAL(conf.getSyncPrefix(), ndn::Name("/localhop/ndn/nlsr/sync").appendVersion(ConfParameter::SYNC_VERSION));
BOOST_CHECK_EQUAL(conf.getLsaPrefix(), "/localhop/ndn/nlsr/LSA");
BOOST_CHECK_EQUAL(conf.getLsaRefreshTime(), 1800);
- BOOST_CHECK_EQUAL(conf.getSyncProtocol(), SYNC_PROTOCOL_PSYNC);
+ BOOST_CHECK(conf.getSyncProtocol() == SyncProtocol::PSYNC);
BOOST_CHECK_EQUAL(conf.getLsaInterestLifetime(), ndn::time::seconds(3));
BOOST_CHECK_EQUAL(conf.getRouterDeadInterval(), 86400);
BOOST_CHECK_EQUAL(conf.getSyncInterestLifetime(), ndn::time::milliseconds(10000));
diff --git a/tests/test-conf-parameter.cpp b/tests/test-conf-parameter.cpp
index e45a605..4d16ba5 100644
--- a/tests/test-conf-parameter.cpp
+++ b/tests/test-conf-parameter.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2020, The University of Memphis,
+/*
+ * Copyright (c) 2014-2022, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -18,7 +18,7 @@
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*
* \author Ashlesh Gawande <agawande@memphis.edu>
- **/
+ */
#include "conf-parameter.hpp"
#include "tests/boost-test.hpp"
@@ -56,7 +56,7 @@
cp1.setLsaInterestLifetime(ndn::time::seconds(1));
- cp1.setSyncProtocol(SYNC_PROTOCOL_PSYNC);
+ cp1.setSyncProtocol(SyncProtocol::PSYNC);
cp1.setRouterDeadInterval(10);
@@ -92,7 +92,7 @@
BOOST_CHECK_EQUAL(cp1.getLsaInterestLifetime(), ndn::time::seconds(1));
- BOOST_CHECK_EQUAL(cp1.getSyncProtocol(), SYNC_PROTOCOL_PSYNC);
+ BOOST_CHECK(cp1.getSyncProtocol() == SyncProtocol::PSYNC);
BOOST_CHECK_EQUAL(cp1.getRouterDeadInterval(), 10);
diff --git a/tests/test-lsa-rule.cpp b/tests/test-lsa-rule.cpp
index a2d0481..e5e6823 100644
--- a/tests/test-lsa-rule.cpp
+++ b/tests/test-lsa-rule.cpp
@@ -46,7 +46,7 @@
, opIdentityName("/ndn/edu/test-site/%C1.Operator/op1")
, routerIdName("/ndn/edu/test-site/%C1.Router/router1")
, confParam(face, m_keyChain)
- , confProcessor(confParam, SYNC_PROTOCOL_PSYNC, HYPERBOLIC_STATE_OFF,
+ , confProcessor(confParam, SyncProtocol::PSYNC, HYPERBOLIC_STATE_OFF,
"/ndn/", "/edu/test-site", "/%C1.Router/router1")
, lsdb(face, m_keyChain, confParam)
, ROOT_CERT_PATH(boost::filesystem::current_path() / std::string("root.cert"))