src: Expiration time change for LSA and Fib entry

Changed lifetime of LSA and FIB Entry to ndn::time::system_clock::TimePoint
type expiration timepoint. And refreshing event is scheduled at that timepoint

Refs: #1594

Change-Id: Ib31fe7ca79e79174eb3a5a4956ed5334da093b1b
diff --git a/tests/test-fib-entry.cpp b/tests/test-fib-entry.cpp
index 1a908a3..2bcf138 100644
--- a/tests/test-fib-entry.cpp
+++ b/tests/test-fib-entry.cpp
@@ -3,6 +3,7 @@
  * See COPYING for copyright and distribution information.
  */
 
+#include <ndn-cxx/util/time.hpp>
 #include "route/fib-entry.hpp"
 #include "route/nexthop-list.hpp"
 #include <boost/test/unit_test.hpp>
@@ -15,10 +16,12 @@
 
 BOOST_AUTO_TEST_CASE(FibEntryConstructorAndGetters)
 {
+  ndn::time::system_clock::TimePoint testTimePoint =  ndn::time::system_clock::now();
   FibEntry fe1("next1");
+  fe1.setExpirationTimePoint(testTimePoint);
 
   BOOST_CHECK_EQUAL(fe1.getName(), "next1");
-  BOOST_CHECK_EQUAL(fe1.getTimeToRefresh(), 0);   //Default Time
+  BOOST_CHECK_EQUAL(fe1.getExpirationTimePoint(), testTimePoint);
   BOOST_CHECK_EQUAL(fe1.getSeqNo(), 0);           //Default Seq No.
 }
 
diff --git a/tests/test-lsa.cpp b/tests/test-lsa.cpp
index bd87b4b..5c46855 100644
--- a/tests/test-lsa.cpp
+++ b/tests/test-lsa.cpp
@@ -7,6 +7,7 @@
 #include "name-prefix-list.hpp"
 #include "adjacent.hpp"
 #include <boost/test/unit_test.hpp>
+#include <ndn-cxx/util/time.hpp>
 
 namespace nlsr {
 namespace test {
@@ -21,15 +22,14 @@
 
   npl1.insert(s1);
   npl1.insert(s2);
-
+  ndn::time::system_clock::TimePoint testTimePoint =  ndn::time::system_clock::now();
 //lsType is 1 for NameLsa, 3rd arg is seqNo. which will be a random number I just put in 12.
-//1800 is default lsa refresh time.
-  NameLsa nlsa1("router1", std::string("name"), 12, 1800, npl1);
-  NameLsa nlsa2("router2", std::string("name"), 12, 1500, npl1);
+  NameLsa nlsa1("router1", std::string("name"), 12, testTimePoint, npl1);
+  NameLsa nlsa2("router2", std::string("name"), 12, testTimePoint, npl1);
 
   BOOST_CHECK_EQUAL(nlsa1.getLsType(), "name");
 
-  BOOST_CHECK(nlsa1.getLifeTime() != nlsa2.getLifeTime());
+  BOOST_CHECK(nlsa1.getExpirationTimePoint() == nlsa2.getExpirationTimePoint());
 
   BOOST_CHECK(nlsa1.getKey() != nlsa2.getKey());
 }
@@ -41,15 +41,15 @@
 
   AdjacencyList adjList;
   adjList.insert(adj1);
-
+  ndn::time::system_clock::TimePoint testTimePoint =  ndn::time::system_clock::now();
 //For AdjLsa, lsType is 2.
 //1 is the number of adjacent in adjacent list.
-  AdjLsa alsa1("router1", std::string("adjacency"), 12, 1800, 1, adjList);
-  AdjLsa alsa2("router1", std::string("adjacency"), 12, 1800, 1, adjList);
+  AdjLsa alsa1("router1", std::string("adjacency"), 12, testTimePoint, 1, adjList);
+  AdjLsa alsa2("router1", std::string("adjacency"), 12, testTimePoint, 1, adjList);
 
   BOOST_CHECK_EQUAL(alsa1.getLsType(), "adjacency");
   BOOST_CHECK_EQUAL(alsa1.getLsSeqNo(), (uint32_t)12);
-  BOOST_CHECK_EQUAL(alsa1.getLifeTime(), (uint32_t)1800);
+  BOOST_CHECK_EQUAL(alsa1.getExpirationTimePoint(), testTimePoint);
   BOOST_CHECK_EQUAL(alsa1.getNoLink(), (uint32_t)1);
 
   BOOST_CHECK(alsa1.isEqualContent(alsa2));
@@ -62,9 +62,10 @@
 
 BOOST_AUTO_TEST_CASE(CoordinateLsaConstructorAndGetters)
 {
+  ndn::time::system_clock::TimePoint testTimePoint =  ndn::time::system_clock::now();
 //For CoordinateLsa, lsType is 3.
-  CoordinateLsa clsa1("router1", std::string("coordinate"), 12, 1800, 2.5, 30.0);
-  CoordinateLsa clsa2("router1", std::string("coordinate"), 12, 1800, 2.5, 30.0);
+  CoordinateLsa clsa1("router1", std::string("coordinate"), 12, testTimePoint, 2.5, 30.0);
+  CoordinateLsa clsa2("router1", std::string("coordinate"), 12, testTimePoint, 2.5, 30.0);
 
   BOOST_CHECK_CLOSE(clsa1.getCorRadius(), 2.5, 0.0001);
   BOOST_CHECK_CLOSE(clsa1.getCorTheta(), 30.0, 0.0001);
diff --git a/tests/test-lsdb.cpp b/tests/test-lsdb.cpp
index a72c55e..1f6e6d4 100644
--- a/tests/test-lsdb.cpp
+++ b/tests/test-lsdb.cpp
@@ -8,6 +8,7 @@
 #include "lsa.hpp"
 #include "name-prefix-list.hpp"
 #include <boost/test/unit_test.hpp>
+#include <ndn-cxx/util/time.hpp>
 
 namespace nlsr {
 
@@ -18,7 +19,7 @@
 BOOST_AUTO_TEST_CASE(LsdbRemoveAndExists)
 {
   Nlsr nlsr1;
-
+  ndn::time::system_clock::TimePoint testTimePoint =  ndn::time::system_clock::now();
   NamePrefixList npl1;
 
   std::string s1 = "name1";
@@ -31,7 +32,7 @@
 //For NameLsa lsType is name.
 //12 is seqNo, randomly generated.
 //1800 is the default life time.
-  NameLsa nlsa1("router1", std::string("name"), 12, 1800, npl1);
+  NameLsa nlsa1("router1", std::string("name"), 12, testTimePoint, npl1);
 
   Lsdb lsdb1(nlsr1);