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);
});
}