rib: Unit tests for RibManager
Change-Id: I8096089f6cc8a6eea7be51278b29700c79e68d5c
Refs: #1501
diff --git a/rib/main.cpp b/rib/main.cpp
index 75771b7..b123b04 100644
--- a/rib/main.cpp
+++ b/rib/main.cpp
@@ -72,12 +72,17 @@
}
};
+ Nrd()
+ : m_face(getGlobalIoService())
+ {
+ }
+
void
initialize(const std::string& configFile)
{
initializeLogging(configFile);
- m_ribManager = make_shared<RibManager>();
+ m_ribManager = make_shared<RibManager>(ndn::ref(m_face));
ConfigFile config((IgnoreNfdAndLogSections()));
m_ribManager->setConfigFile(config);
@@ -201,6 +206,7 @@
private:
shared_ptr<RibManager> m_ribManager;
+ ndn::Face m_face;
};
} // namespace rib
diff --git a/rib/rib-manager.cpp b/rib/rib-manager.cpp
index c5f8666..c8d6111 100644
--- a/rib/rib-manager.cpp
+++ b/rib/rib-manager.cpp
@@ -58,8 +58,8 @@
),
};
-RibManager::RibManager()
- : m_face(getGlobalIoService())
+RibManager::RibManager(ndn::Face& face)
+ : m_face(face)
, m_nfdController(m_face)
, m_localhostValidator(m_face)
, m_localhopValidator(m_face)
diff --git a/rib/rib-manager.hpp b/rib/rib-manager.hpp
index f664528..6566d1f 100644
--- a/rib/rib-manager.hpp
+++ b/rib/rib-manager.hpp
@@ -56,7 +56,8 @@
}
};
- RibManager();
+ explicit
+ RibManager(ndn::Face& face);
void
registerWithNfd();
@@ -199,7 +200,7 @@
private:
Rib m_managedRib;
- ndn::Face m_face;
+ ndn::Face& m_face;
ndn::nfd::Controller m_nfdController;
ndn::KeyChain m_keyChain;
ndn::ValidatorConfig m_localhostValidator;