tests: sync common testing infrastructure with ndn-cxx
Change-Id: I1e5cdcda8f6d3d9f9addc7a9f17359aedef9db7e
diff --git a/tests/communication/test-sync-logic-handler.cpp b/tests/communication/test-sync-logic-handler.cpp
index 3c71f74..b493290 100644
--- a/tests/communication/test-sync-logic-handler.cpp
+++ b/tests/communication/test-sync-logic-handler.cpp
@@ -20,11 +20,11 @@
*/
#include "communication/sync-logic-handler.hpp"
-#include "tests/test-common.hpp"
-#include "common.hpp"
#include "nlsr.hpp"
-#include <ndn-cxx/util/dummy-client-face.hpp>
+#include "tests/io-key-chain-fixture.hpp"
+#include "tests/test-common.hpp"
+
#include <boost/lexical_cast.hpp>
namespace nlsr {
@@ -32,7 +32,7 @@
using std::shared_ptr;
-class SyncLogicFixture : public UnitTestTimeFixture
+class SyncLogicFixture : public IoKeyChainFixture
{
public:
SyncLogicFixture()
@@ -42,7 +42,7 @@
this->conf.getSiteName().toUri() +
"/%C1.Router/other-router/")
{
- addIdentity(conf.getRouterPrefix());
+ m_keyChain.createIdentity(conf.getRouterPrefix());
}
void
@@ -59,16 +59,16 @@
}
public:
- ndn::util::DummyClientFace face{m_ioService, m_keyChain};
+ ndn::util::DummyClientFace face{m_io, m_keyChain};
ConfParameter conf{face, m_keyChain};
DummyConfFileProcessor confProcessor{conf, SYNC_PROTOCOL_PSYNC};
SyncLogicHandler::IsLsaNew testIsLsaNew;
SyncLogicHandler sync;
const std::string updateNamePrefix;
- const std::vector<Lsa::Type> lsaTypes = {Lsa::Type::NAME,
- Lsa::Type::ADJACENCY,
- Lsa::Type::COORDINATE};
+ const std::vector<Lsa::Type> lsaTypes{Lsa::Type::NAME,
+ Lsa::Type::ADJACENCY,
+ Lsa::Type::COORDINATE};
};
BOOST_FIXTURE_TEST_SUITE(TestSyncLogicHandler, SyncLogicFixture)
diff --git a/tests/communication/test-sync-protocol-adapter.cpp b/tests/communication/test-sync-protocol-adapter.cpp
index 0266981..74d9e23 100644
--- a/tests/communication/test-sync-protocol-adapter.cpp
+++ b/tests/communication/test-sync-protocol-adapter.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, The University of Memphis,
+ * Copyright (c) 2014-2022, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -20,24 +20,24 @@
*/
#include "communication/sync-protocol-adapter.hpp"
-#include "tests/test-common.hpp"
+
+#include "tests/boost-test.hpp"
+#include "tests/io-key-chain-fixture.hpp"
#include <ndn-cxx/util/dummy-client-face.hpp>
-#include <boost/lexical_cast.hpp>
-
namespace nlsr {
namespace test {
using namespace ndn;
-class SyncProtocolAdapterFixture : public UnitTestTimeFixture
+class SyncProtocolAdapterFixture : public IoKeyChainFixture
{
public:
SyncProtocolAdapterFixture()
- : syncPrefix("/localhop/ndn/nlsr/sync/")
- , nameLsaUserPrefix("/localhop/ndn/nlsr/LSA/NAME")
- , syncInterestLifetime(time::seconds(60))
+ : syncPrefix("/localhop/ndn/nlsr/sync")
+ , nameLsaUserPrefix("/localhop/ndn/nlsr/LSA/NAME")
+ , syncInterestLifetime(time::seconds(60))
{
syncPrefix.appendVersion(4);
}
@@ -46,14 +46,14 @@
addNodes()
{
for (int i = 0; i < 2; i++) {
- faces[i] = std::make_shared<ndn::util::DummyClientFace>(m_ioService,
- util::DummyClientFace::Options{true, true});
+ 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],
syncInterestLifetime,
[i, this] (const ndn::Name& updateName,
- uint64_t highSeq) {
+ uint64_t highSeq) {
prefixToSeq[i].emplace(updateName, highSeq);
});
}