src: Replace LSA string literals with constants

refs: #2310

Change-Id: I0823c320400fe03b6268982cec05578c04d82ca8
diff --git a/tests/test-hyperbolic-calculator.cpp b/tests/test-hyperbolic-calculator.cpp
index 65b0ad2..5387ffd 100644
--- a/tests/test-hyperbolic-calculator.cpp
+++ b/tests/test-hyperbolic-calculator.cpp
@@ -68,10 +68,10 @@
     adjacencies.insert(b);
     adjacencies.insert(c);
 
-    AdjLsa adjA(a.getName(), "adjacency", 1, MAX_TIME, 2, adjacencies);
+    AdjLsa adjA(a.getName(), AdjLsa::TYPE_STRING, 1, MAX_TIME, 2, adjacencies);
     lsdb.installAdjLsa(adjA);
 
-    CoordinateLsa coordA(adjA.getOrigRouter(), "coordinate", 1, MAX_TIME, 16.23, 2.97);
+    CoordinateLsa coordA(adjA.getOrigRouter(), CoordinateLsa::TYPE_STRING, 1, MAX_TIME, 16.23, 2.97);
     lsdb.installCoordinateLsa(coordA);
 
     // Router B
@@ -82,10 +82,10 @@
     adjacencyListB.insert(a);
     adjacencyListB.insert(c);
 
-    AdjLsa adjB(b.getName(), "adjacency", 1, MAX_TIME, 2, adjacencyListB);
+    AdjLsa adjB(b.getName(), AdjLsa::TYPE_STRING, 1, MAX_TIME, 2, adjacencyListB);
     lsdb.installAdjLsa(adjB);
 
-    CoordinateLsa coordB(adjB.getOrigRouter(), "coordinate", 1, MAX_TIME, 16.59, 3.0);
+    CoordinateLsa coordB(adjB.getOrigRouter(), CoordinateLsa::TYPE_STRING, 1, MAX_TIME, 16.59, 3.0);
     lsdb.installCoordinateLsa(coordB);
 
     // Router C
@@ -96,10 +96,10 @@
     adjacencyListC.insert(a);
     adjacencyListC.insert(b);
 
-    AdjLsa adjC(c.getName(), "adjacency", 1, MAX_TIME, 2, adjacencyListC);
+    AdjLsa adjC(c.getName(), AdjLsa::TYPE_STRING, 1, MAX_TIME, 2, adjacencyListC);
     lsdb.installAdjLsa(adjC);
 
-    CoordinateLsa coordC(adjC.getOrigRouter(), "coordinate", 1, MAX_TIME, 14.11, 2.99);
+    CoordinateLsa coordC(adjC.getOrigRouter(), CoordinateLsa::TYPE_STRING, 1, MAX_TIME, 14.11, 2.99);
     lsdb.installCoordinateLsa(coordC);
 
     map.createFromAdjLsdb(nlsr);
diff --git a/tests/test-lsa.cpp b/tests/test-lsa.cpp
index 50975fa..17abd2b 100644
--- a/tests/test-lsa.cpp
+++ b/tests/test-lsa.cpp
@@ -41,10 +41,10 @@
   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.
-  NameLsa nlsa1("router1", std::string("name"), 12, testTimePoint, npl1);
-  NameLsa nlsa2("router2", std::string("name"), 12, testTimePoint, npl1);
+  NameLsa nlsa1("router1", NameLsa::TYPE_STRING, 12, testTimePoint, npl1);
+  NameLsa nlsa2("router2", NameLsa::TYPE_STRING, 12, testTimePoint, npl1);
 
-  BOOST_CHECK_EQUAL(nlsa1.getLsType(), "name");
+  BOOST_CHECK_EQUAL(nlsa1.getLsType(), NameLsa::TYPE_STRING);
 
   BOOST_CHECK(nlsa1.getExpirationTimePoint() == nlsa2.getExpirationTimePoint());
 
@@ -61,10 +61,10 @@
   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, testTimePoint, 1, adjList);
-  AdjLsa alsa2("router1", std::string("adjacency"), 12, testTimePoint, 1, adjList);
+  AdjLsa alsa1("router1", AdjLsa::TYPE_STRING, 12, testTimePoint, 1, adjList);
+  AdjLsa alsa2("router1", AdjLsa::TYPE_STRING, 12, testTimePoint, 1, adjList);
 
-  BOOST_CHECK_EQUAL(alsa1.getLsType(), "adjacency");
+  BOOST_CHECK_EQUAL(alsa1.getLsType(), AdjLsa::TYPE_STRING);
   BOOST_CHECK_EQUAL(alsa1.getLsSeqNo(), (uint32_t)12);
   BOOST_CHECK_EQUAL(alsa1.getExpirationTimePoint(), testTimePoint);
   BOOST_CHECK_EQUAL(alsa1.getNoLink(), (uint32_t)1);
@@ -81,8 +81,8 @@
 {
   ndn::time::system_clock::TimePoint testTimePoint =  ndn::time::system_clock::now();
 //For CoordinateLsa, lsType is 3.
-  CoordinateLsa clsa1("router1", std::string("coordinate"), 12, testTimePoint, 2.5, 30.0);
-  CoordinateLsa clsa2("router1", std::string("coordinate"), 12, testTimePoint, 2.5, 30.0);
+  CoordinateLsa clsa1("router1", CoordinateLsa::TYPE_STRING, 12, testTimePoint, 2.5, 30.0);
+  CoordinateLsa clsa2("router1", CoordinateLsa::TYPE_STRING, 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 d0508e1..b36d0c6 100644
--- a/tests/test-lsdb.cpp
+++ b/tests/test-lsdb.cpp
@@ -173,18 +173,18 @@
   //For NameLsa lsType is name.
   //12 is seqNo, randomly generated.
   //1800 is the default life time.
-  NameLsa nlsa1(ndn::Name("/router1/1"), std::string("name"), 12, testTimePoint, npl1);
+  NameLsa nlsa1(ndn::Name("/router1/1"), NameLsa::TYPE_STRING, 12, testTimePoint, npl1);
 
   Lsdb lsdb1(nlsr, g_scheduler, nlsr.getSyncLogicHandler());
 
   lsdb1.installNameLsa(nlsa1);
   lsdb1.writeNameLsdbLog();
 
-  BOOST_CHECK(lsdb1.doesLsaExist(ndn::Name("/router1/1/name"), std::string("name")));
+  BOOST_CHECK(lsdb1.doesLsaExist(ndn::Name("/router1/1/name"), NameLsa::TYPE_STRING));
 
   lsdb1.removeNameLsa(router1);
 
-  BOOST_CHECK_EQUAL(lsdb1.doesLsaExist(ndn::Name("/router1/1"), std::string("name")), false);
+  BOOST_CHECK_EQUAL(lsdb1.doesLsaExist(ndn::Name("/router1/1"), NameLsa::TYPE_STRING), false);
 }
 
 BOOST_AUTO_TEST_CASE(RegisterSyncPrefixOnFirstAdjLsaBuild)
@@ -225,10 +225,10 @@
   std::string otherRouter("/ndn/site/%C1.router/other-router");
   ndn::time::system_clock::TimePoint MAX_TIME = ndn::time::system_clock::TimePoint::max();
 
-  NameLsa lsa(otherRouter, "name", 1, MAX_TIME, prefixes);
+  NameLsa lsa(otherRouter, NameLsa::TYPE_STRING, 1, MAX_TIME, prefixes);
   lsdb.installNameLsa(lsa);
 
-  BOOST_REQUIRE_EQUAL(lsdb.doesLsaExist(otherRouter + "/name", "name"), true);
+  BOOST_REQUIRE_EQUAL(lsdb.doesLsaExist(otherRouter + "/name", NameLsa::TYPE_STRING), true);
   NamePrefixList& nameList = lsdb.findNameLsa(otherRouter + "/name")->getNpl();
 
   areNamePrefixListsEqual(nameList, prefixes);
@@ -237,7 +237,7 @@
   ndn::Name name3("/ndn/name3");
   prefixes.insert(name3);
 
-  NameLsa addLsa(otherRouter, "name", 2, MAX_TIME, prefixes);
+  NameLsa addLsa(otherRouter, NameLsa::TYPE_STRING, 2, MAX_TIME, prefixes);
   lsdb.installNameLsa(addLsa);
 
   // Lsa should include name1, name2, and name3
@@ -246,7 +246,7 @@
   // Remove a prefix: name2
   prefixes.remove(name2);
 
-  NameLsa removeLsa(otherRouter, "name", 3, MAX_TIME, prefixes);
+  NameLsa removeLsa(otherRouter, NameLsa::TYPE_STRING, 3, MAX_TIME, prefixes);
   lsdb.installNameLsa(removeLsa);
 
   // Lsa should include name1 and name3
@@ -256,7 +256,7 @@
   prefixes.insert(name2);
   prefixes.remove(name3);
 
-  NameLsa addAndRemoveLsa(otherRouter, "name", 4, MAX_TIME, prefixes);
+  NameLsa addAndRemoveLsa(otherRouter, NameLsa::TYPE_STRING, 4, MAX_TIME, prefixes);
   lsdb.installNameLsa(addAndRemoveLsa);
 
   // Lsa should include name1 and name2
@@ -270,7 +270,7 @@
   newPrefixes.insert(name4);
   newPrefixes.insert(name5);
 
-  NameLsa newLsa(otherRouter, "name", 5, MAX_TIME, newPrefixes);
+  NameLsa newLsa(otherRouter, NameLsa::TYPE_STRING, 5, MAX_TIME, newPrefixes);
   lsdb.installNameLsa(newLsa);
 
   // Lsa should include name4 and name5
diff --git a/tests/test-sync-logic-handler.cpp b/tests/test-sync-logic-handler.cpp
index dddbf1d..e4b6bd0 100644
--- a/tests/test-sync-logic-handler.cpp
+++ b/tests/test-sync-logic-handler.cpp
@@ -87,13 +87,13 @@
   BOOST_REQUIRE_EQUAL(interests.size(), 3);
 
   std::vector<ndn::Interest>::iterator it = interests.begin();
-  BOOST_CHECK_EQUAL(it->getName().getPrefix(-1), updateName + "name/");
+  BOOST_CHECK_EQUAL(it->getName().getPrefix(-1), updateName + NameLsa::TYPE_STRING + "/");
 
   ++it;
-  BOOST_CHECK_EQUAL(it->getName().getPrefix(-1), updateName + "adjacency/");
+  BOOST_CHECK_EQUAL(it->getName().getPrefix(-1), updateName + AdjLsa::TYPE_STRING + "/");
 
   ++it;
-  BOOST_CHECK_EQUAL(it->getName().getPrefix(-1), updateName + "coordinate/");
+  BOOST_CHECK_EQUAL(it->getName().getPrefix(-1), updateName + CoordinateLsa::TYPE_STRING + "/");
 }
 
 BOOST_AUTO_TEST_CASE(NoUpdateForSelf)
@@ -124,17 +124,17 @@
 
   // Install Name LSA
   NamePrefixList nameList;
-  NameLsa lsa(originRouter, "name", 999, ndn::time::system_clock::TimePoint::max(), nameList);
+  NameLsa lsa(originRouter, NameLsa::TYPE_STRING, 999, ndn::time::system_clock::TimePoint::max(), nameList);
   lsdb.installNameLsa(lsa);
 
   // Install Adj LSA
   AdjacencyList adjList;
-  AdjLsa adjLsa(originRouter, "adjacency", 1000, ndn::time::system_clock::TimePoint::max(),
+  AdjLsa adjLsa(originRouter, AdjLsa::TYPE_STRING, 1000, ndn::time::system_clock::TimePoint::max(),
                 3 , adjList);
   lsdb.installAdjLsa(adjLsa);
 
   // Install Cor LSA
-  CoordinateLsa corLsa(originRouter, "coordinate", 1000, ndn::time::system_clock::TimePoint::max(),
+  CoordinateLsa corLsa(originRouter, CoordinateLsa::TYPE_STRING, 1000, ndn::time::system_clock::TimePoint::max(),
                        0,0);
   lsdb.installCoordinateLsa(corLsa);