src: decouple classes from Nlsr object

refs: #1952, #2803, #3960, #4288

Change-Id: Ibe3ac3820f11e8107ee4b13e510d53c27467a6cb
diff --git a/tests/update/test-nfd-rib-command-processor.cpp b/tests/update/test-nfd-rib-command-processor.cpp
index 93a5f4d..8aa8cdf 100644
--- a/tests/update/test-nfd-rib-command-processor.cpp
+++ b/tests/update/test-nfd-rib-command-processor.cpp
@@ -28,7 +28,6 @@
 #include "../control-commands.hpp"
 
 namespace nlsr {
-namespace update {
 namespace test {
 
 class NfdRibCommandProcessorFixture : public nlsr::test::UnitTestTimeFixture
@@ -36,15 +35,13 @@
 public:
   NfdRibCommandProcessorFixture()
     : face(m_ioService, m_keyChain, {true, true})
-    , nlsr(m_ioService, m_scheduler, face, m_keyChain)
-    , namePrefixes(nlsr.getNamePrefixList())
-    , processor(nlsr.getNfdRibCommandProcessor())
+    , conf(face)
+    , confProcessor(conf)
+    , nlsr(face, m_keyChain, conf)
+    , namePrefixes(conf.getNamePrefixList())
+    , processor(nlsr.m_nfdRibCommandProcessor)
   {
-    // Set the network so the LSA prefix is constructed
-    nlsr.getConfParameter().setNetwork("/ndn");
-    nlsr.getConfParameter().setRouterName(ndn::Name("/This/router"));
-
-    addIdentity(ndn::Name("/ndn/This/router"));
+    addIdentity(conf.getRouterPrefix());
 
     // Initialize NLSR so a sync socket is created
     nlsr.initialize();
@@ -52,7 +49,7 @@
     this->advanceClocks(ndn::time::milliseconds(10), 10);
     face.sentInterests.clear();
 
-    nameLsaSeqNoBeforeInterest = nlsr.getLsdb().getSequencingManager().getNameLsaSeq();
+    nameLsaSeqNoBeforeInterest = nlsr.m_lsdb.getSequencingManager().getNameLsaSeq();
   }
 
   void
@@ -64,19 +61,15 @@
     this->advanceClocks(ndn::time::milliseconds(10), 10);
   }
 
-  void
-  sendInterestForPublishedData()
+  void sendInterestForPublishedData()
   {
-    // Need to send an interest now since ChronoSync
-    // no longer does face->put(*data) in publishData.
-    // Instead it does it in onInterest
-    ndn::Name lsaInterestName("/localhop/ndn/nlsr/LSA/This/router");
+    ndn::Name lsaInterestName = conf.getLsaPrefix();
+    lsaInterestName.append(conf.getSiteName());
+    lsaInterestName.append(conf.getRouterName());
     lsaInterestName.append(std::to_string(Lsa::Type::NAME));
+    lsaInterestName.appendNumber(nlsr.m_lsdb.getSequencingManager().getNameLsaSeq());
 
-    lsaInterestName.appendNumber(nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
-    auto lsaInterest = make_shared<ndn::Interest>(lsaInterestName);
-    lsaInterest->setCanBePrefix(true);
-    face.receive(*lsaInterest);
+    face.receive(ndn::Interest(lsaInterestName).setCanBePrefix(true));
     this->advanceClocks(ndn::time::milliseconds(10), 10);
   }
 
@@ -85,7 +78,7 @@
   {
     sendInterestForPublishedData();
 
-    const ndn::Name& lsaPrefix = nlsr.getConfParameter().getLsaPrefix();
+    const ndn::Name& lsaPrefix = conf.getLsaPrefix();
 
     const auto& it = std::find_if(face.sentData.begin(), face.sentData.end(),
       [&] (const ndn::Data& data) {
@@ -97,14 +90,17 @@
 
 public:
   ndn::util::DummyClientFace face;
+  ConfParameter conf;
+  DummyConfFileProcessor confProcessor;
 
   Nlsr nlsr;
   NamePrefixList& namePrefixes;
-  NfdRibCommandProcessor& processor;
+  update::NfdRibCommandProcessor& processor;
   uint64_t nameLsaSeqNoBeforeInterest;
 };
 
-typedef boost::mpl::vector<NfdRibRegisterCommand, NfdRibUnregisterCommand> Commands;
+typedef boost::mpl::vector<update::NfdRibRegisterCommand,
+                           update::NfdRibUnregisterCommand> Commands;
 
 BOOST_FIXTURE_TEST_SUITE(TestNfdRibCommandProcessor, NfdRibCommandProcessorFixture)
 
@@ -148,7 +144,7 @@
   }
   BOOST_CHECK_EQUAL((*itr), prefixName);
   BOOST_CHECK(wasRoutingUpdatePublished());
-  BOOST_CHECK(nameLsaSeqNoBeforeInterest < nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
+  BOOST_CHECK(nameLsaSeqNoBeforeInterest < nlsr.m_lsdb.getSequencingManager().getNameLsaSeq());
 }
 
 BOOST_AUTO_TEST_CASE(onReceiveInterestUnregisterCommand)
@@ -164,7 +160,7 @@
 
   BOOST_CHECK_EQUAL(namePrefixes.getNames().size(), 0);
   BOOST_CHECK(wasRoutingUpdatePublished());
-  BOOST_CHECK(nameLsaSeqNoBeforeInterest < nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
+  BOOST_CHECK(nameLsaSeqNoBeforeInterest < nlsr.m_lsdb.getSequencingManager().getNameLsaSeq());
 }
 
 BOOST_AUTO_TEST_CASE(onReceiveInterestInvalidPrefix)
@@ -180,11 +176,10 @@
 
   // Cannot use routingUpdatePublish test now since in
   // initialize nlsr calls buildOwnNameLsa which publishes the routing update
-  BOOST_CHECK(nameLsaSeqNoBeforeInterest == nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
+  BOOST_CHECK(nameLsaSeqNoBeforeInterest == nlsr.m_lsdb.getSequencingManager().getNameLsaSeq());
 }
 
 BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace test
-} // namespace update
 } // namespace nlsr