tests: sync common testing infrastructure with ndn-cxx

Upgrade waf to version 2.0.21

Change-Id: I30615cc49416088e9c5e4d602fd11360c0ed9328
diff --git a/tests/unit/clients/iterative-query-controller.cpp b/tests/unit/clients/iterative-query-controller.t.cpp
similarity index 97%
rename from tests/unit/clients/iterative-query-controller.cpp
rename to tests/unit/clients/iterative-query-controller.t.cpp
index 46d11d4..6478156 100644
--- a/tests/unit/clients/iterative-query-controller.cpp
+++ b/tests/unit/clients/iterative-query-controller.t.cpp
@@ -20,9 +20,11 @@
 #include "clients/iterative-query-controller.hpp"
 #include "daemon/name-server.hpp"
 
-#include "test-common.hpp"
+#include "boost-test.hpp"
 #include "unit/database-test-data.hpp"
 
+#include <ndn-cxx/util/dummy-client-face.hpp>
+
 namespace ndn {
 namespace ndns {
 namespace tests {
@@ -128,7 +130,6 @@
       }
     }
   }
-
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/unit/clients/query.cpp b/tests/unit/clients/query.t.cpp
similarity index 91%
rename from tests/unit/clients/query.cpp
rename to tests/unit/clients/query.t.cpp
index f7ed478..e4da482 100644
--- a/tests/unit/clients/query.cpp
+++ b/tests/unit/clients/query.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2017, Regents of the University of California.
+ * Copyright (c) 2014-2020, 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.
@@ -19,10 +19,10 @@
 
 #include "clients/query.hpp"
 
-#include "test-common.hpp"
+#include "boost-test.hpp"
+#include "key-chain-fixture.hpp"
 
 #include <boost/lexical_cast.hpp>
-#include <string>
 
 namespace ndn {
 namespace ndns {
@@ -30,9 +30,9 @@
 
 BOOST_AUTO_TEST_SUITE(Query)
 
-BOOST_FIXTURE_TEST_CASE(TestCase, IdentityManagementFixture)
+BOOST_FIXTURE_TEST_CASE(TestCase, KeyChainFixture)
 {
-  security::Identity certIdentity = addIdentity("/cert/name");
+  auto certIdentity = m_keyChain.createIdentity("/cert/name");
   Name zone("/net");
   name::Component qType = ndns::label::NDNS_ITERATIVE_QUERY;
   ndns::Query q(zone, qType);
@@ -77,7 +77,7 @@
   BOOST_CHECK_EQUAL(q5.fromInterest(zone, interest), true);
   BOOST_CHECK_EQUAL(q4, q5);
   BOOST_CHECK_NE(q2, q4);
- }
+}
 
 BOOST_AUTO_TEST_SUITE_END()
 
diff --git a/tests/unit/clients/response.cpp b/tests/unit/clients/response.t.cpp
similarity index 93%
rename from tests/unit/clients/response.cpp
rename to tests/unit/clients/response.t.cpp
index 88941c8..97a6fe0 100644
--- a/tests/unit/clients/response.cpp
+++ b/tests/unit/clients/response.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Regents of the University of California.
+/*
+ * Copyright (c) 2014-2020, 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.
@@ -19,13 +19,14 @@
 
 #include "clients/response.hpp"
 
-#include "test-common.hpp"
+#include "boost-test.hpp"
+#include "key-chain-fixture.hpp"
 
 namespace ndn {
 namespace ndns {
 namespace tests {
 
-BOOST_FIXTURE_TEST_SUITE(Response, IdentityManagementFixture)
+BOOST_FIXTURE_TEST_SUITE(Response, KeyChainFixture)
 
 BOOST_AUTO_TEST_CASE(Basic)
 {
diff --git a/tests/unit/daemon/db-mgr.cpp b/tests/unit/daemon/db-mgr.t.cpp
similarity index 96%
rename from tests/unit/daemon/db-mgr.cpp
rename to tests/unit/daemon/db-mgr.t.cpp
index ffa38b8..0b69330 100644
--- a/tests/unit/daemon/db-mgr.cpp
+++ b/tests/unit/daemon/db-mgr.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018, Regents of the University of California.
+ * Copyright (c) 2014-2020, 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.
@@ -18,9 +18,12 @@
  */
 
 #include "daemon/db-mgr.hpp"
-#include "test-common.hpp"
+#include "logger.hpp"
+
+#include "boost-test.hpp"
 
 #include <algorithm>
+#include <boost/filesystem.hpp>
 
 namespace ndn {
 namespace ndns {
@@ -30,7 +33,7 @@
 
 BOOST_AUTO_TEST_SUITE(DbMgr)
 
-static const boost::filesystem::path TEST_DATABASE2 = TEST_CONFIG_PATH "/" "test-ndns.db";
+const auto TEST_DATABASE2 = boost::filesystem::path(UNIT_TESTS_TMPDIR) / "test-ndns.db";
 
 class DbMgrFixture
 {
@@ -43,16 +46,14 @@
   ~DbMgrFixture()
   {
     session.close();
-    boost::filesystem::remove(TEST_DATABASE2);
     NDNS_LOG_INFO("remove database " << TEST_DATABASE2);
+    boost::filesystem::remove(TEST_DATABASE2);
   }
 
 public:
   ndns::DbMgr session;
 };
 
-
-
 BOOST_FIXTURE_TEST_CASE(Zones, DbMgrFixture)
 {
   Zone zone1;
diff --git a/tests/unit/daemon/name-server.cpp b/tests/unit/daemon/name-server.t.cpp
similarity index 98%
rename from tests/unit/daemon/name-server.cpp
rename to tests/unit/daemon/name-server.t.cpp
index cf31a8f..4ad5a11 100644
--- a/tests/unit/daemon/name-server.cpp
+++ b/tests/unit/daemon/name-server.t.cpp
@@ -18,13 +18,16 @@
  */
 
 #include "daemon/name-server.hpp"
-#include "daemon/db-mgr.hpp"
-#include "clients/response.hpp"
-#include "clients/query.hpp"
 
-#include "test-common.hpp"
+#include "clients/query.hpp"
+#include "clients/response.hpp"
+#include "daemon/db-mgr.hpp"
+#include "logger.hpp"
+
+#include "boost-test.hpp"
 #include "unit/database-test-data.hpp"
 
+#include <ndn-cxx/util/dummy-client-face.hpp>
 #include <ndn-cxx/util/regex.hpp>
 
 namespace ndn {
diff --git a/tests/unit/daemon/rrset-factory.cpp b/tests/unit/daemon/rrset-factory.t.cpp
similarity index 89%
rename from tests/unit/daemon/rrset-factory.cpp
rename to tests/unit/daemon/rrset-factory.t.cpp
index 39c9286..6f2eb69 100644
--- a/tests/unit/daemon/rrset-factory.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-2018, Regents of the University of California.
+ * Copyright (c) 2014-2020, 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.
@@ -18,11 +18,13 @@
  */
 
 #include "daemon/rrset-factory.hpp"
-
-#include "test-common.hpp"
 #include "mgmt/management-tool.hpp"
 
+#include "boost-test.hpp"
+#include "key-chain-fixture.hpp"
+
 #include <boost/lexical_cast.hpp>
+
 #include <ndn-cxx/security/verification-helpers.hpp>
 
 namespace ndn {
@@ -31,15 +33,16 @@
 
 NDNS_LOG_INIT(RrsetFactoryTest);
 
-class RrsetFactoryFixture : public IdentityManagementFixture
+const auto TEST_DATABASE2 = boost::filesystem::path(UNIT_TESTS_TMPDIR) / "test-ndns.db";
+const auto TEST_CERT = boost::filesystem::path(UNIT_TESTS_TMPDIR) / "anchors" / "root.cert";
+
+class RrsetFactoryFixture : public KeyChainFixture
 {
 public:
   RrsetFactoryFixture()
-    : TEST_DATABASE2(TEST_CONFIG_PATH "/" "test-ndns.db"),
-      TEST_IDENTITY_NAME("/rrest/factory"),
-      TEST_CERT(TEST_CONFIG_PATH "/" "anchors/root.cert"),
-      m_session(TEST_DATABASE2.string()),
-      m_zoneName(TEST_IDENTITY_NAME)
+    : TEST_IDENTITY_NAME("/rrest/factory")
+    , m_session(TEST_DATABASE2.string())
+    , m_zoneName(TEST_IDENTITY_NAME)
   {
     Zone zone1;
     zone1.setName(m_zoneName);
@@ -48,12 +51,12 @@
 
     Name identityName = Name(TEST_IDENTITY_NAME).append("NDNS");
 
-    m_identity = this->addIdentity(identityName);
+    m_identity = m_keyChain.createIdentity(identityName);
     m_cert = m_identity.getDefaultKey().getDefaultCertificate();
     m_certName = m_cert.getName();
-    saveIdentityCertificate(m_identity, TEST_CERT.string());
+    saveIdentityCert(m_identity, TEST_CERT.string());
 
-    NDNS_LOG_INFO("save test root cert " << m_certName << " to: " << TEST_CERT.string());
+    NDNS_LOG_INFO("save test root cert " << m_certName << " to: " << TEST_CERT);
     BOOST_CHECK_GT(m_certName.size(), 0);
     NDNS_LOG_TRACE("test certName: " << m_certName);
   }
@@ -61,15 +64,13 @@
   ~RrsetFactoryFixture()
   {
     m_session.close();
-    boost::filesystem::remove(TEST_DATABASE2);
     NDNS_LOG_INFO("remove database " << TEST_DATABASE2);
+    boost::filesystem::remove(TEST_DATABASE2);
     boost::filesystem::remove(TEST_CERT);
   }
 
 public:
-  const boost::filesystem::path TEST_DATABASE2;
   const Name TEST_IDENTITY_NAME;
-  const boost::filesystem::path TEST_CERT;
   ndns::DbMgr m_session;
   Name m_zoneName;
   Name m_certName;
diff --git a/tests/unit/daemon/rrset.cpp b/tests/unit/daemon/rrset.t.cpp
similarity index 99%
rename from tests/unit/daemon/rrset.cpp
rename to tests/unit/daemon/rrset.t.cpp
index f9e2704..eb9f035 100644
--- a/tests/unit/daemon/rrset.cpp
+++ b/tests/unit/daemon/rrset.t.cpp
@@ -19,7 +19,7 @@
 
 #include "daemon/rrset.hpp"
 
-#include "test-common.hpp"
+#include "boost-test.hpp"
 
 #if BOOST_VERSION >= 105900
 #include <boost/test/tools/output_test_stream.hpp>
diff --git a/tests/unit/daemon/zone.cpp b/tests/unit/daemon/zone.t.cpp
similarity index 98%
rename from tests/unit/daemon/zone.cpp
rename to tests/unit/daemon/zone.t.cpp
index 09bc781..ed57285 100644
--- a/tests/unit/daemon/zone.cpp
+++ b/tests/unit/daemon/zone.t.cpp
@@ -19,7 +19,7 @@
 
 #include "daemon/zone.hpp"
 
-#include "test-common.hpp"
+#include "boost-test.hpp"
 
 #if BOOST_VERSION >= 105900
 #include <boost/test/tools/output_test_stream.hpp>
diff --git a/tests/unit/database-test-data.cpp b/tests/unit/database-test-data.cpp
index 2aef965..d4808d6 100644
--- a/tests/unit/database-test-data.cpp
+++ b/tests/unit/database-test-data.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018, Regents of the University of California.
+ * Copyright (c) 2014-2020, 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.
@@ -19,27 +19,28 @@
 
 #include "database-test-data.hpp"
 #include "daemon/rrset-factory.hpp"
-#include "util/cert-helper.hpp"
 #include "mgmt/management-tool.hpp"
+#include "util/cert-helper.hpp"
+
 #include <ndn-cxx/security/verification-helpers.hpp>
 
+namespace fs = boost::filesystem;
+
 namespace ndn {
 namespace ndns {
 namespace tests {
 
 NDNS_LOG_INIT(TestFakeData);
 
-const boost::filesystem::path DbTestData::TEST_DATABASE = TEST_CONFIG_PATH "/" "test-ndns.db";
+const fs::path DbTestData::TEST_DATABASE = fs::path(UNIT_TESTS_TMPDIR) / "test-ndns.db";
 const Name DbTestData::TEST_IDENTITY_NAME("/test19");
-const boost::filesystem::path DbTestData::TEST_CERT =
-  TEST_CONFIG_PATH "/" "anchors/root.cert";
-const boost::filesystem::path DbTestData::TEST_DKEY_CERT =
-  TEST_CONFIG_PATH "/" "dkey.cert";
+const fs::path DbTestData::TEST_CERT = fs::path(UNIT_TESTS_TMPDIR) / "anchors" / "root.cert";
+const fs::path DbTestData::TEST_DKEY_CERT = fs::path(UNIT_TESTS_TMPDIR) / "dkey.cert";
 
 DbTestData::PreviousStateCleaner::PreviousStateCleaner()
 {
-  boost::filesystem::remove(TEST_DATABASE);
-  boost::filesystem::remove(TEST_CERT);
+  fs::remove(TEST_DATABASE);
+  fs::remove(TEST_CERT);
 }
 
 DbTestData::DbTestData()
@@ -50,20 +51,16 @@
 {
   NDNS_LOG_TRACE("start creating test data");
 
-  ndns::NdnsValidatorBuilder::VALIDATOR_CONF_FILE = TEST_CONFIG_PATH "/" "validator.conf";
+  NdnsValidatorBuilder::VALIDATOR_CONF_FILE = (fs::path(UNIT_TESTS_TMPDIR) / "validator.conf").string();
 
   ManagementTool tool(TEST_DATABASE.string(), m_keyChain);
   // this is how DKEY is added to parent zone in real world.
-  auto addDkeyCertToParent = [&tool](Zone& dkeyFrom, Zone& dkeyTo)->void{
+  auto addDkeyCertToParent = [&tool] (Zone& dkeyFrom, Zone& dkeyTo) {
     Certificate dkeyCert;
     dkeyCert = tool.getZoneDkey(dkeyFrom);
-    ndn::io::save(dkeyCert, TEST_DKEY_CERT.string());
-    tool.addRrsetFromFile(dkeyTo.getName(),
-                          TEST_DKEY_CERT.string(),
-                          DEFAULT_RR_TTL,
-                          DEFAULT_CERT,
-                          ndn::io::BASE64,
-                          true);
+    io::save(dkeyCert, TEST_DKEY_CERT.string());
+    tool.addRrsetFromFile(dkeyTo.getName(), TEST_DKEY_CERT.string(),
+                          DEFAULT_RR_TTL, DEFAULT_CERT, io::BASE64, true);
   };
 
   Name testName(m_testName);
@@ -85,16 +82,15 @@
   m_certName = CertHelper::getDefaultCertificateNameOfIdentity(m_keyChain, identityName);
   m_cert = CertHelper::getCertificate(m_keyChain, identityName, m_certName);
 
-  ndn::io::save(m_cert, TEST_CERT.string());
+  io::save(m_cert, TEST_CERT.string());
   NDNS_LOG_INFO("save test root cert " << m_certName << " to: " << TEST_CERT.string());
 
-  BOOST_CHECK_GT(m_certName.size(), 0);
+  BOOST_ASSERT(m_certName.size() > 0);
   NDNS_LOG_TRACE("test certName: " << m_certName);
 
   int certificateIndex = 0;
-  function<void(const Name&,Zone&,const name::Component&)> addQueryRrset =
-    [this, &certificateIndex] (const Name& label, Zone& zone,
-                               const name::Component& type) {
+  auto addQueryRrset = [this, &certificateIndex] (const Name& label, Zone& zone,
+                                                  const name::Component& type) {
     const time::seconds ttl(3000 + 100 * certificateIndex);
     const name::Component version = name::Component::fromVersion(100 + 1000 * certificateIndex);
     name::Component qType(label::NDNS_ITERATIVE_QUERY);
@@ -140,7 +136,7 @@
                   m_keyChain, m_certName);
   rf.onlyCheckZone();
   if (type == label::NS_RR_TYPE) {
-    ndn::DelegationList ds;
+    DelegationList ds;
     ds.insert(1, "xx");
     rrset = rf.generateNsRrset(label, version.toVersion(), ttl, ds);
     if (contentType != NDNS_AUTH) {
@@ -157,8 +153,7 @@
                                  m_cert);
   }
 
-  shared_ptr<Data> data = make_shared<Data>(rrset.getData());
-
+  auto data = make_shared<Data>(rrset.getData());
   security::verifySignature(*data, m_cert);
 
   ManagementTool tool(TEST_DATABASE.string(), m_keyChain);
diff --git a/tests/unit/database-test-data.hpp b/tests/unit/database-test-data.hpp
index f1ff278..a7a9668 100644
--- a/tests/unit/database-test-data.hpp
+++ b/tests/unit/database-test-data.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2017, Regents of the University of California.
+ * Copyright (c) 2014-2020, 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.
@@ -25,13 +25,14 @@
 #include "clients/query.hpp"
 #include "validator/validator.hpp"
 
-#include "test-common.hpp"
+#include "io-fixture.hpp"
+#include "key-chain-fixture.hpp"
 
 namespace ndn {
 namespace ndns {
 namespace tests {
 
-class DbTestData : public IdentityManagementFixture, public UnitTestTimeFixture
+class DbTestData : public IoFixture, public KeyChainFixture
 {
 public:
   static const boost::filesystem::path TEST_DATABASE;
@@ -41,7 +42,7 @@
 
   DbTestData();
 
-  ~DbTestData();
+  ~DbTestData() override;
 
 private:
   void
diff --git a/tests/unit/mgmt/management-tool.cpp b/tests/unit/mgmt/management-tool.t.cpp
similarity index 96%
rename from tests/unit/mgmt/management-tool.cpp
rename to tests/unit/mgmt/management-tool.t.cpp
index a8a47cc..2ac878a 100644
--- a/tests/unit/mgmt/management-tool.cpp
+++ b/tests/unit/mgmt/management-tool.t.cpp
@@ -23,7 +23,9 @@
 #include "ndns-enum.hpp"
 #include "ndns-label.hpp"
 #include "ndns-tlv.hpp"
-#include "test-common.hpp"
+
+#include "boost-test.hpp"
+#include "key-chain-fixture.hpp"
 
 #include <random>
 
@@ -39,22 +41,22 @@
 #include <ndn-cxx/util/io.hpp>
 #include <ndn-cxx/util/regex.hpp>
 
-using boost::test_tools::output_test_stream;
-
 namespace ndn {
 namespace ndns {
 namespace tests {
 
-static const boost::filesystem::path TEST_DATABASE = TEST_CONFIG_PATH "/management_tool.db";
-static const boost::filesystem::path TEST_CERTDIR = TEST_CONFIG_PATH "/management_tool_certs";
-static const Name FAKE_ROOT("/fake-root/123456789");
+using boost::test_tools::output_test_stream;
+
+const auto TEST_DATABASE = boost::filesystem::path(UNIT_TESTS_TMPDIR) / "management_tool.db";
+const auto TEST_CERTDIR = boost::filesystem::path(UNIT_TESTS_TMPDIR) / "management_tool_certs";
+const Name FAKE_ROOT("/fake-root/123456789");
 
 /**
  * @brief Recursive copy a directory using Boost Filesystem
  *
  * Based on from http://stackoverflow.com/q/8593608/2150331
  */
-void
+static void
 copyDir(const boost::filesystem::path& source, const boost::filesystem::path& destination)
 {
   namespace fs = boost::filesystem;
@@ -79,16 +81,17 @@
     if (std::getenv("HOME"))
       m_origHome = std::getenv("HOME");
 
-    setenv("HOME", TEST_CONFIG_PATH "/tests/unit/mgmt/", 1);
-    boost::filesystem::remove_all(TEST_CONFIG_PATH "/tests/unit/mgmt/");
-    boost::filesystem::create_directories(TEST_CONFIG_PATH "/tests/unit/mgmt");
-    copyDir("tests/unit/mgmt/.ndn", TEST_CONFIG_PATH "/tests/unit/mgmt/.ndn");
+    auto p = boost::filesystem::path(UNIT_TESTS_TMPDIR) / "tests" / "unit" / "mgmt";
+    setenv("HOME", p.c_str(), 1);
+    boost::filesystem::remove_all(p);
+    boost::filesystem::create_directories(p);
+    copyDir("tests/unit/mgmt/.ndn", p / ".ndn");
   }
 
   ~TestHome()
   {
     if (!m_origHome.empty())
-      setenv("HOME", m_origHome.c_str(), 1);
+      setenv("HOME", m_origHome.data(), 1);
     else
       unsetenv("HOME");
   }
@@ -97,18 +100,13 @@
   std::string m_origHome;
 };
 
-
-class ManagementToolFixture : public TestHome, public IdentityManagementFixture
+class ManagementToolFixture : public TestHome, public KeyChainFixture
 {
 public:
   class Error : public std::runtime_error
   {
   public:
-    explicit
-    Error(const std::string& what)
-      : std::runtime_error(what)
-    {
-    }
+    using std::runtime_error::runtime_error;
   };
 
   class PreviousStateCleaner
@@ -126,7 +124,7 @@
     , m_dbMgr(TEST_DATABASE.string().c_str())
   {
     boost::filesystem::create_directory(TEST_CERTDIR);
-    Identity root = addIdentity("NDNS");
+    Identity root = m_keyChain.createIdentity("NDNS");
     Key ksk = root.getDefaultKey();
     m_keyChain.deleteCertificate(ksk, ksk.getDefaultCertificate().getName());
     Certificate kskCert = CertHelper::createCertificate(m_keyChain, ksk, ksk, "CERT");
@@ -140,7 +138,7 @@
     m_keyChain.addCertificate(dsk, dskCert);
     rootDsk = dskCert.getName();
 
-    Identity other = addIdentity("/ndns-test/NDNS");
+    Identity other = m_keyChain.createIdentity("/ndns-test/NDNS");
     Key otherKskKey = other.getDefaultKey();
     m_keyChain.deleteCertificate(otherKskKey, otherKskKey.getDefaultCertificate().getName());
     Certificate otherKskCert = CertHelper::createCertificate(m_keyChain, otherKskKey, otherKskKey, "CERT");
@@ -287,7 +285,7 @@
 //   Name rootDsk = generateCerts(ROOT_ZONE);
 //   generateCerts("/ndns-test", rootDsk);
 
-//   copyDir(TEST_CONFIG_PATH "/tests/unit/mgmt/.ndn", "/tmp/.ndn");
+//   copyDir(UNIT_TESTS_TMPDIR "/tests/unit/mgmt/.ndn", "/tmp/.ndn");
 //   std::cout << "Manually copy contents of /tmp/.ndn into tests/unit/mgmt/.ndn" << std::endl;
 // }
 
@@ -503,25 +501,25 @@
                                       time::seconds(1), time::days(1), "/com/ndnsim"),
                                       ndns::ManagementTool::Error);
 
-  Identity id = addIdentity("/net/ndnsim/NDNS");
+  Identity id = m_keyChain.createIdentity("/net/ndnsim/NDNS");
   Certificate cert = id.getDefaultKey().getDefaultCertificate();
   BOOST_CHECK_NO_THROW(m_tool.createZone("/net/ndnsim", "/net",
                                          time::seconds(1), time::days(1), cert.getName()));
 
-  id = addIdentity("/com/ndnsim/NDNS");
+  id = m_keyChain.createIdentity("/com/ndnsim/NDNS");
   cert = id.getDefaultKey().getDefaultCertificate();
 
   BOOST_CHECK_THROW(m_tool.createZone("/net/ndnsim", "/net",
                                       time::seconds(1), time::days(1), cert.getName()),
                     ndns::ManagementTool::Error);
 
-  id = addIdentity("/net/ndnsim/www/NDNS");
+  id = m_keyChain.createIdentity("/net/ndnsim/www/NDNS");
   cert = id.getDefaultKey().getDefaultCertificate();
   BOOST_CHECK_THROW(m_tool.createZone("/net/ndnsim", "/net",
                                       time::seconds(1), time::days(1), cert.getName()),
                     ndns::ManagementTool::Error);
 
-  id = addIdentity("/net/ndnsim/NDNS");
+  id = m_keyChain.createIdentity("/net/ndnsim/NDNS");
   cert = id.getDefaultKey().getDefaultCertificate();
   m_keyChain.deleteCertificate(id.getDefaultKey(), cert.getName());
   BOOST_CHECK_THROW(m_tool.createZone("/net/ndnsim", "/net",
diff --git a/tests/unit/ndns-label.cpp b/tests/unit/ndns-label.t.cpp
similarity index 94%
rename from tests/unit/ndns-label.cpp
rename to tests/unit/ndns-label.t.cpp
index cfd650c..90c7ee1 100644
--- a/tests/unit/ndns-label.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-2016, Regents of the University of California.
+/*
+ * Copyright (c) 2014-2020, 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.
@@ -19,7 +19,9 @@
 
 #include "ndns-label.hpp"
 
-#include "test-common.hpp"
+#include "boost-test.hpp"
+
+#include <ndn-cxx/data.hpp>
 
 namespace ndn {
 namespace ndns {
diff --git a/tests/unit/validator/certificate-fetcher-ndns-app-cert.cpp b/tests/unit/validator/certificate-fetcher-ndns-app-cert.t.cpp
similarity index 93%
rename from tests/unit/validator/certificate-fetcher-ndns-app-cert.cpp
rename to tests/unit/validator/certificate-fetcher-ndns-app-cert.t.cpp
index d425832..ae41eeb 100644
--- a/tests/unit/validator/certificate-fetcher-ndns-app-cert.cpp
+++ b/tests/unit/validator/certificate-fetcher-ndns-app-cert.t.cpp
@@ -17,18 +17,20 @@
  * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "validator/validator.hpp"
 #include "validator/certificate-fetcher-ndns-appcert.hpp"
+
 #include "ndns-label.hpp"
-#include "util/cert-helper.hpp"
 #include "daemon/name-server.hpp"
 #include "daemon/rrset-factory.hpp"
 #include "mgmt/management-tool.hpp"
+#include "util/cert-helper.hpp"
+#include "validator/validator.hpp"
 
-#include "test-common.hpp"
+#include "boost-test.hpp"
 #include "unit/database-test-data.hpp"
 
 #include <ndn-cxx/security/validation-policy-simple-hierarchy.hpp>
+#include <ndn-cxx/util/dummy-client-face.hpp>
 
 namespace ndn {
 namespace ndns {
@@ -39,7 +41,7 @@
 static unique_ptr<security::Validator>
 makeValidatorAppCert(Face& face)
 {
-  return make_unique<security::Validator>(make_unique<::ndn::security::ValidationPolicySimpleHierarchy>(),
+  return make_unique<security::Validator>(make_unique<security::ValidationPolicySimpleHierarchy>(),
                                           make_unique<CertificateFetcherAppCert>(face));
 }
 
@@ -54,7 +56,7 @@
     buildAppCertAndData();
 
     auto serverValidator = NdnsValidatorBuilder::create(m_validatorFace, 10, 0,
-                                                        TEST_CONFIG_PATH "/validator.conf");
+                                                        UNIT_TESTS_TMPDIR "/validator.conf");
     // initialize all servers
     auto addServer = [this, &serverValidator] (const Name& zoneName) {
       m_serverFaces.push_back(make_unique<util::DummyClientFace>(m_io, m_keyChain,
@@ -81,7 +83,7 @@
   buildAppCertAndData()
   {
     // create NDNS-stored certificate and the signed data
-    Identity ndnsimIdentity = addIdentity(m_ndnsimName);
+    Identity ndnsimIdentity = m_keyChain.createIdentity(m_ndnsimName);
     Key randomKey = m_keyChain.createKey(ndnsimIdentity);
     Certificate ndnsStoredAppCert = randomKey.getDefaultCertificate();
     RrsetFactory rf(TEST_DATABASE.string(), m_ndnsimName, m_keyChain,
diff --git a/tests/unit/validator/validator.cpp b/tests/unit/validator/validator.t.cpp
similarity index 97%
rename from tests/unit/validator/validator.cpp
rename to tests/unit/validator/validator.t.cpp
index 2948ae3..0161125 100644
--- a/tests/unit/validator/validator.cpp
+++ b/tests/unit/validator/validator.t.cpp
@@ -19,12 +19,14 @@
 
 #include "validator/validator.hpp"
 #include "ndns-label.hpp"
-#include "util/cert-helper.hpp"
 #include "daemon/name-server.hpp"
+#include "util/cert-helper.hpp"
 
-#include "test-common.hpp"
+#include "boost-test.hpp"
 #include "unit/database-test-data.hpp"
 
+#include <ndn-cxx/util/dummy-client-face.hpp>
+
 namespace ndn {
 namespace ndns {
 namespace tests {
@@ -37,7 +39,7 @@
   ValidatorTestFixture()
     : m_validatorFace(m_io, m_keyChain, {true, true})
     , m_validator(NdnsValidatorBuilder::create(m_validatorFace, 500, 0,
-                                               TEST_CONFIG_PATH "/validator.conf"))
+                                               UNIT_TESTS_TMPDIR "/validator.conf"))
   {
     // generate a random cert
     // check how does name-server test do