tests: use typed name components

refs #5044

Change-Id: I9ca85767056a7caeb81fcf1a833dfe450b61c5d2
diff --git a/ndns.conf.sample.in b/ndns.conf.sample.in
index 09521a3..854ff86 100644
--- a/ndns.conf.sample.in
+++ b/ndns.conf.sample.in
@@ -7,7 +7,7 @@
   {
     ; name / ; name of the zone
              ; KeyChain must have a identity with this name appended by <NDNS> at tail
-    ; cert  /KEY/dsk-123/CERT/%FD00 ; certificate to sign data
+    ; cert  /KEY/dsk-123/CERT/v=0 ; certificate to sign data
              ; omit cert to select the default certificate of above identity
   }
 
@@ -15,7 +15,7 @@
   ; {
     ; name /ndn ; name of the zone, zone should not have the same name
              ; KeyChain must have a identity with this name appended by <NDNS> at tail
-    ; cert  /ndn/KEY/dsk-234/CERT/%FD00 ; certificate to sign data
+    ; cert  /ndn/KEY/dsk-234/CERT/v=0 ; certificate to sign data
              ; omit cert to select the default certificate of above identity
   ; }
 }
diff --git a/tests/unit/daemon/rrset-factory.t.cpp b/tests/unit/daemon/rrset-factory.t.cpp
index 6f2eb69..f97f433 100644
--- a/tests/unit/daemon/rrset-factory.t.cpp
+++ b/tests/unit/daemon/rrset-factory.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020, Regents of the University of California.
+ * Copyright (c) 2014-2021, Regents of the University of California.
  *
  * This file is part of NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -123,10 +123,10 @@
   BOOST_CHECK_EQUAL(*rrset.getZone(), zone);
   BOOST_CHECK_EQUAL(rrset.getLabel(), label);
   BOOST_CHECK_EQUAL(rrset.getType(), type);
-  BOOST_CHECK_EQUAL(rrset.getVersion().toVersion(), version);
+  BOOST_CHECK_EQUAL(rrset.getVersion(), Name::Component::fromVersion(version));
   BOOST_CHECK_EQUAL(rrset.getTtl(), ttl);
 
-  const Name linkName("/rrest/factory/NDNS/nstest/NS/%FD%04%D2");
+  const auto linkName = Name("/rrest/factory/NDNS/nstest/NS").appendVersion(version);
   Link link;
   BOOST_CHECK_NO_THROW(link.wireDecode(rrset.getData()));
 
@@ -134,8 +134,7 @@
   BOOST_CHECK_EQUAL(link.getContentType(), NDNS_LINK);
   BOOST_CHECK(link.getDelegationList() == delegations);
 
-  // BOOST_CHECK_EQUAL(Validator::verifySignature(link, m_cert.getPublicKeyInfo()), true);
-  security::verifySignature(link, m_cert);
+  BOOST_CHECK(security::verifySignature(link, m_cert));
 }
 
 BOOST_AUTO_TEST_CASE(GenerateTxtRrset)
@@ -167,7 +166,7 @@
   BOOST_CHECK_EQUAL(*rrset.getZone(), zone);
   BOOST_CHECK_EQUAL(rrset.getLabel(), label);
   BOOST_CHECK_EQUAL(rrset.getType(), type);
-  BOOST_CHECK_EQUAL(rrset.getVersion().toVersion(), version);
+  BOOST_CHECK_EQUAL(rrset.getVersion(), Name::Component::fromVersion(version));
   BOOST_CHECK_EQUAL(rrset.getTtl(), ttl);
 
   Name dataName = m_zoneName.append(label::NDNS_ITERATIVE_QUERY)
@@ -183,9 +182,7 @@
 
   BOOST_CHECK(txts == RrsetFactory::wireDecodeTxt(data.getContent()));
 
-  // shared_ptr<IdentityCertificate> cert = m_keyChain.getCertificate(m_certName);
-  // BOOST_CHECK(Validator::verifySignature(data, cert->getPublicKeyInfo()));
-  security::verifySignature(data, m_cert);
+  BOOST_CHECK(security::verifySignature(data, m_cert));
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/unit/daemon/rrset.t.cpp b/tests/unit/daemon/rrset.t.cpp
index eb9f035..ed45bb9 100644
--- a/tests/unit/daemon/rrset.t.cpp
+++ b/tests/unit/daemon/rrset.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020, Regents of the University of California.
+ * Copyright (c) 2014-2021, Regents of the University of California.
  *
  * This file is part of NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -130,7 +130,7 @@
   boost::test_tools::output_test_stream os;
   os << rrset;
   BOOST_CHECK(os.is_equal("Rrset: Id=1 Zone=(Zone: Id=0 Name=/test)"
-                          " Label=/www/1 Type=NS Version=%FD%01"));
+                          " Label=/www/1 Type=NS Version=v=1"));
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/unit/ndns-label.t.cpp b/tests/unit/ndns-label.t.cpp
index 90c7ee1..9a392d8 100644
--- a/tests/unit/ndns-label.t.cpp
+++ b/tests/unit/ndns-label.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020, Regents of the University of California.
+ * Copyright (c) 2014-2021, Regents of the University of California.
  *
  * This file is part of NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -35,7 +35,7 @@
   Name zone("/net/ndnsim");
 
   Interest interest1("/net/ndnsim/NDNS/www/dsk-111/NS");
-  Interest interest2("/net/ndnsim/NDNS/www/dsk-111/NS/%FD%00");
+  Interest interest2(Name("/net/ndnsim/NDNS/www/dsk-111/NS").appendVersion(0));
 
   MatchResult re;
   BOOST_CHECK_EQUAL(matchName(interest1, zone, re), true);
@@ -46,7 +46,7 @@
   BOOST_CHECK_EQUAL(matchName(interest2, zone, re), true);
   BOOST_CHECK_EQUAL(re.rrLabel, Name("/www/dsk-111"));
   BOOST_CHECK_EQUAL(re.rrType, name::Component("NS"));
-  BOOST_CHECK_EQUAL(re.version, name::Component::fromEscapedString("%FD%00"));
+  BOOST_CHECK_EQUAL(re.version, name::Component::fromVersion(0));
 }
 
 BOOST_AUTO_TEST_CASE(MatchData)
@@ -54,7 +54,7 @@
   using namespace label;
   Name zone("/net/ndnsim");
 
-  Data data1("/net/ndnsim/NDNS/www/dsk-111/NS/%FD%00");
+  Data data1(Name("/net/ndnsim/NDNS/www/dsk-111/NS").appendVersion(0));
 
   MatchResult re;
   BOOST_CHECK_EQUAL(matchName(data1, zone, re), true);