Do not compile ChronoSync support by default
ChronoSync dependency is now made optional
and is kept for testing purposes only.
Also change sig-type to ecdsa-sha256 in nlsr.conf
as ndn-cxx now has strict checking for it.
refs: #5147
Change-Id: I95c9fb844681ebf2c4e7bbb03cc7796a0795de83
diff --git a/tests/communication/test-sync-logic-handler.cpp b/tests/communication/test-sync-logic-handler.cpp
index bdd8a3e..55007b8 100644
--- a/tests/communication/test-sync-logic-handler.cpp
+++ b/tests/communication/test-sync-logic-handler.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-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
#include "communication/sync-logic-handler.hpp"
#include "tests/test-common.hpp"
@@ -25,20 +25,20 @@
#include "nlsr.hpp"
#include <ndn-cxx/util/dummy-client-face.hpp>
+#include <boost/lexical_cast.hpp>
namespace nlsr {
namespace test {
using std::shared_ptr;
-template<int32_t Protocol>
class SyncLogicFixture : public UnitTestTimeFixture
{
public:
SyncLogicFixture()
: face(m_ioService, m_keyChain)
, conf(face, m_keyChain)
- , confProcessor(conf, Protocol)
+ , confProcessor(conf, SYNC_PROTOCOL_PSYNC)
, testIsLsaNew([] (const ndn::Name& name, const Lsa::Type& lsaType,
const uint64_t sequenceNumber) {
return true;
@@ -57,16 +57,9 @@
this->advanceClocks(ndn::time::milliseconds(1), 10);
face.sentInterests.clear();
- if (Protocol == SYNC_PROTOCOL_CHRONOSYNC) {
- std::vector<chronosync::MissingDataInfo> updates;
- updates.push_back({ndn::Name(prefix).appendNumber(1), 0, seqNo});
- sync.m_syncLogic.onChronoSyncUpdate(updates);
- }
- else {
- std::vector<psync::MissingDataInfo> updates;
- updates.push_back({ndn::Name(prefix), 0, seqNo});
- sync.m_syncLogic.onPSyncUpdate(updates);
- }
+ std::vector<psync::MissingDataInfo> updates;
+ updates.push_back({ndn::Name(prefix), 0, seqNo});
+ sync.m_syncLogic.onPSyncUpdate(updates);
this->advanceClocks(ndn::time::milliseconds(1), 10);
}
@@ -83,17 +76,13 @@
Lsa::Type::COORDINATE};
};
-using mpl_::int_;
-using Protocols = boost::mpl::vector<int_<SYNC_PROTOCOL_CHRONOSYNC>,
- int_<SYNC_PROTOCOL_PSYNC>>;
-
BOOST_AUTO_TEST_SUITE(TestSyncLogicHandler)
/* Tests that when SyncLogicHandler receives an LSA of either Name or
Adjacency type that appears to be newer, it will emit to its signal
with those LSA details.
*/
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(UpdateForOtherLS, T, Protocols, SyncLogicFixture<T::value>)
+BOOST_FIXTURE_TEST_CASE(UpdateForOtherLS, SyncLogicFixture)
{
std::vector<Lsa::Type> lsaTypes = {Lsa::Type::NAME, Lsa::Type::ADJACENCY};
@@ -118,7 +107,7 @@
either Coordinate or Name type that appears to be newer, it will
emit to its signal with those LSA details.
*/
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(UpdateForOtherHR, T, Protocols, SyncLogicFixture<T::value>)
+BOOST_FIXTURE_TEST_CASE(UpdateForOtherHR, SyncLogicFixture)
{
this->conf.setHyperbolicState(HYPERBOLIC_STATE_ON);
@@ -143,7 +132,7 @@
any type that appears to be newer, it will emit to its signal with
those LSA details.
*/
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(UpdateForOtherHRDry, T, Protocols, SyncLogicFixture<T::value>)
+BOOST_FIXTURE_TEST_CASE(UpdateForOtherHRDry, SyncLogicFixture)
{
this->conf.setHyperbolicState(HYPERBOLIC_STATE_DRY_RUN);
@@ -167,7 +156,7 @@
details matching this router's details, it will *not* emit to its
signal those LSA details.
*/
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(NoUpdateForSelf, T, Protocols, SyncLogicFixture<T::value>)
+BOOST_FIXTURE_TEST_CASE(NoUpdateForSelf, SyncLogicFixture)
{
const uint64_t sequenceNumber = 1;
@@ -193,7 +182,7 @@
details that do not match the expected format, it will *not* emit
to its signal those LSA details.
*/
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(MalformedUpdate, T, Protocols, SyncLogicFixture<T::value>)
+BOOST_FIXTURE_TEST_CASE(MalformedUpdate, SyncLogicFixture)
{
const uint64_t sequenceNumber = 1;
@@ -215,7 +204,7 @@
details that do not appear to be new, it will *not* emit to its
signal those LSA details.
*/
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(LsaNotNew, T, Protocols, SyncLogicFixture<T::value>)
+BOOST_FIXTURE_TEST_CASE(LsaNotNew, SyncLogicFixture)
{
auto testLsaAlwaysFalse = [] (const ndn::Name& routerName, const Lsa::Type& lsaType,
const uint64_t& sequenceNumber) {
@@ -237,9 +226,9 @@
/* Tests that SyncLogicHandler successfully concatenates configured
variables together to form the necessary prefixes to advertise
- through ChronoSync.
+ through sync.
*/
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(UpdatePrefix, T, Protocols, SyncLogicFixture<T::value>)
+BOOST_FIXTURE_TEST_CASE(UpdatePrefix, SyncLogicFixture)
{
ndn::Name expectedPrefix = this->conf.getLsaPrefix();
expectedPrefix.append(this->conf.getSiteName());
diff --git a/tests/communication/test-sync-protocol-adapter.cpp b/tests/communication/test-sync-protocol-adapter.cpp
index 5998caf..0266981 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-2019, The University of Memphis,
+/*
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,15 +17,14 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
#include "communication/sync-protocol-adapter.hpp"
#include "tests/test-common.hpp"
#include <ndn-cxx/util/dummy-client-face.hpp>
-#include <boost/mpl/int.hpp>
-#include <boost/mpl/vector.hpp>
+#include <boost/lexical_cast.hpp>
namespace nlsr {
namespace test {
@@ -43,7 +42,6 @@
syncPrefix.appendVersion(4);
}
- template <int32_t T>
void
addNodes()
{
@@ -51,7 +49,7 @@
faces[i] = std::make_shared<ndn::util::DummyClientFace>(m_ioService,
util::DummyClientFace::Options{true, true});
userPrefixes[i] = Name(nameLsaUserPrefix).appendNumber(i);
- nodes[i] = std::make_shared<SyncProtocolAdapter>(*faces[i], T, syncPrefix,
+ nodes[i] = std::make_shared<SyncProtocolAdapter>(*faces[i], SYNC_PROTOCOL_PSYNC, syncPrefix,
userPrefixes[i],
syncInterestLifetime,
[i, this] (const ndn::Name& updateName,
@@ -73,14 +71,11 @@
std::map<ndn::Name, uint64_t> prefixToSeq[2];
};
-using boost::mpl::int_;
-using Protocols = boost::mpl::vector<int_<SYNC_PROTOCOL_CHRONOSYNC>, int_<SYNC_PROTOCOL_PSYNC>>;
+BOOST_AUTO_TEST_SUITE(TestSyncProtocolAdapter)
-BOOST_FIXTURE_TEST_SUITE(TestSyncProtocolAdapter, SyncProtocolAdapterFixture)
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(Sync, SyncProtocol, Protocols)
+BOOST_FIXTURE_TEST_CASE(Basic, SyncProtocolAdapterFixture)
{
- addNodes<SyncProtocol::value>();
+ addNodes();
nodes[0]->publishUpdate(userPrefixes[0], 10);
advanceClocks(ndn::time::milliseconds(1000), 100);
diff --git a/tests/security/test-certificate-store.cpp b/tests/security/test-certificate-store.cpp
index 00d5d62..df74c28 100644
--- a/tests/security/test-certificate-store.cpp
+++ b/tests/security/test-certificate-store.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-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -26,6 +26,7 @@
#include "lsdb.hpp"
#include <ndn-cxx/security/key-chain.hpp>
+#include <boost/lexical_cast.hpp>
namespace nlsr {
namespace test {
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index 495f0ba..0f18dd7 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -177,7 +177,7 @@
public:
DummyConfFileProcessor(ConfParameter& conf,
- int32_t protocol = SYNC_PROTOCOL_PSYNC,
+ SyncProtocol protocol = SYNC_PROTOCOL_PSYNC,
int32_t hyperbolicState = HYPERBOLIC_STATE_OFF,
ndn::Name networkName = "/ndn", ndn::Name siteName = "/site",
ndn::Name routerName = "/%C1.Router/this-router")
diff --git a/tests/test-lsa-rule.cpp b/tests/test-lsa-rule.cpp
index e6d4458..4e7b3b3 100644
--- a/tests/test-lsa-rule.cpp
+++ b/tests/test-lsa-rule.cpp
@@ -25,13 +25,14 @@
#include <ndn-cxx/interest.hpp>
#include <ndn-cxx/security/key-chain.hpp>
-#include <ndn-cxx/util/dummy-client-face.hpp>
#include <ndn-cxx/security/signing-helpers.hpp>
#include <ndn-cxx/security/signing-info.hpp>
+#include <ndn-cxx/util/dummy-client-face.hpp>
#include <boost/filesystem.hpp>
-#include <boost/property_tree/ptree.hpp>
+#include <boost/lexical_cast.hpp>
#include <boost/property_tree/info_parser.hpp>
+#include <boost/property_tree/ptree.hpp>
using namespace ndn;
diff --git a/tests/test-statistics.cpp b/tests/test-statistics.cpp
index 0000fb0..2c02bb7 100644
--- a/tests/test-statistics.cpp
+++ b/tests/test-statistics.cpp
@@ -26,6 +26,7 @@
#include "nlsr.hpp"
#include <ndn-cxx/util/dummy-client-face.hpp>
+#include <boost/lexical_cast.hpp>
namespace nlsr {
namespace test {
diff --git a/tests/update/test-nfd-rib-command-processor.cpp b/tests/update/test-nfd-rib-command-processor.cpp
index d5fa0c8..ef8c1b6 100644
--- a/tests/update/test-nfd-rib-command-processor.cpp
+++ b/tests/update/test-nfd-rib-command-processor.cpp
@@ -27,6 +27,8 @@
#include "../test-common.hpp"
#include "../control-commands.hpp"
+#include <boost/lexical_cast.hpp>
+
namespace nlsr {
namespace test {
diff --git a/tests/update/test-prefix-update-processor.cpp b/tests/update/test-prefix-update-processor.cpp
index e5a5890..70fd491 100644
--- a/tests/update/test-prefix-update-processor.cpp
+++ b/tests/update/test-prefix-update-processor.cpp
@@ -31,8 +31,9 @@
#include <ndn-cxx/security/signing-helpers.hpp>
#include <boost/filesystem.hpp>
-#include <boost/property_tree/ptree.hpp>
+#include <boost/lexical_cast.hpp>
#include <boost/property_tree/info_parser.hpp>
+#include <boost/property_tree/ptree.hpp>
using namespace ndn;
diff --git a/tests/update/test-save-delete-prefix.cpp b/tests/update/test-save-delete-prefix.cpp
index 336ec8a..26644f8 100644
--- a/tests/update/test-save-delete-prefix.cpp
+++ b/tests/update/test-save-delete-prefix.cpp
@@ -53,7 +53,7 @@
, SITE_CERT_PATH(boost::filesystem::current_path() / std::string("site.cert"))
, counter(0)
{
- std::ifstream source("/usr/local/etc/ndn/nlsr.conf.sample", std::ios::binary);
+ std::ifstream source("nlsr.conf", std::ios::binary);
std::ofstream destination(testConfFile, std::ios::binary);
destination << source.rdbuf();
source.close();