tests: sync common testing infrastructure with ndn-cxx

Change-Id: I1e5cdcda8f6d3d9f9addc7a9f17359aedef9db7e
diff --git a/tests/update/test-advertise-crash.cpp b/tests/update/test-advertise-crash.cpp
index 8925469..e2ded04 100644
--- a/tests/update/test-advertise-crash.cpp
+++ b/tests/update/test-advertise-crash.cpp
@@ -21,16 +21,17 @@
 
 #include "nlsr.hpp"
 
-#include "../test-common.hpp"
+#include "tests/io-key-chain-fixture.hpp"
+#include "tests/test-common.hpp"
 
 namespace nlsr {
 namespace test {
 
-class AdvertiseCrashFixture : public UnitTestTimeFixture
+class AdvertiseCrashFixture : public IoKeyChainFixture
 {
 public:
   AdvertiseCrashFixture()
-    : face(m_ioService, m_keyChain, {true, true})
+    : face(m_io, m_keyChain, {true, true})
     , conf(face, m_keyChain)
     , confProcessor(conf)
     , nlsr(face, m_keyChain, conf)
@@ -49,7 +50,7 @@
 
     std::vector<ndn::nfd::FaceStatus> faces{payload1};
 
-    addIdentity(conf.getRouterPrefix());
+    m_keyChain.createIdentity(conf.getRouterPrefix());
 
     // Simulate a callback with fake response
     // This will trigger the undefined behavior found
diff --git a/tests/update/test-nfd-rib-command-processor.cpp b/tests/update/test-nfd-rib-command-processor.cpp
index c9be622..1ea89dc 100644
--- a/tests/update/test-nfd-rib-command-processor.cpp
+++ b/tests/update/test-nfd-rib-command-processor.cpp
@@ -24,26 +24,26 @@
 #include "conf-parameter.hpp"
 #include "nlsr.hpp"
 
-#include "../test-common.hpp"
-#include "../control-commands.hpp"
+#include "tests/io-key-chain-fixture.hpp"
+#include "tests/test-common.hpp"
 
 #include <boost/lexical_cast.hpp>
 
 namespace nlsr {
 namespace test {
 
-class NfdRibCommandProcessorFixture : public UnitTestTimeFixture
+class NfdRibCommandProcessorFixture : public IoKeyChainFixture
 {
 public:
   NfdRibCommandProcessorFixture()
-    : face(m_ioService, m_keyChain, {true, true})
+    : face(m_io, m_keyChain, {true, true})
     , conf(face, m_keyChain)
     , confProcessor(conf)
     , nlsr(face, m_keyChain, conf)
     , namePrefixes(conf.getNamePrefixList())
     , processor(nlsr.m_nfdRibCommandProcessor)
   {
-    addIdentity(conf.getRouterPrefix());
+    m_keyChain.createIdentity(conf.getRouterPrefix());
 
     this->advanceClocks(ndn::time::milliseconds(10), 10);
     face.sentInterests.clear();
diff --git a/tests/update/test-prefix-update-processor.cpp b/tests/update/test-prefix-update-processor.cpp
index ac50943..52fb7b1 100644
--- a/tests/update/test-prefix-update-processor.cpp
+++ b/tests/update/test-prefix-update-processor.cpp
@@ -22,29 +22,29 @@
 #include "update/prefix-update-processor.hpp"
 #include "nlsr.hpp"
 
-#include "tests/control-commands.hpp"
+#include "tests/io-key-chain-fixture.hpp"
 #include "tests/test-common.hpp"
 
-#include <ndn-cxx/mgmt/nfd/control-response.hpp>
+#include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
 #include <ndn-cxx/security/interest-signer.hpp>
-#include <ndn-cxx/security/pib/identity.hpp>
 #include <ndn-cxx/security/signing-helpers.hpp>
 
-#include <boost/filesystem.hpp>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/property_tree/info_parser.hpp>
 #include <boost/property_tree/ptree.hpp>
 
-using namespace ndn;
-
 namespace nlsr {
 namespace test {
 
-class PrefixUpdateFixture : public UnitTestTimeFixture
+using namespace ndn;
+
+class PrefixUpdateFixture : public IoKeyChainFixture
 {
 public:
   PrefixUpdateFixture()
-    : face(m_ioService, m_keyChain, {true, true})
+    : face(m_io, m_keyChain, {true, true})
     , siteIdentityName(ndn::Name("site"))
     , opIdentityName(ndn::Name("site").append(ndn::Name("%C1.Operator")))
     , conf(face, m_keyChain)
@@ -54,8 +54,8 @@
     , SITE_CERT_PATH(boost::filesystem::current_path() / std::string("site.cert"))
   {
     // Site cert
-    siteIdentity = addIdentity(siteIdentityName);
-    saveCertificate(siteIdentity, SITE_CERT_PATH.string());
+    siteIdentity = m_keyChain.createIdentity(siteIdentityName);
+    saveIdentityCert(siteIdentity, SITE_CERT_PATH.string());
 
     // Operator cert
     opIdentity = addSubCertificate(opIdentityName, siteIdentity);
@@ -68,11 +68,9 @@
 
     std::ifstream inputFile;
     inputFile.open(std::string("nlsr.conf"));
-
     BOOST_REQUIRE(inputFile.is_open());
 
     boost::property_tree::ptree pt;
-
     boost::property_tree::read_info(inputFile, pt);
     for (const auto& tn : pt) {
       if (tn.first == "security") {
@@ -85,7 +83,7 @@
     }
     inputFile.close();
 
-    addIdentity(conf.getRouterPrefix());
+    m_keyChain.createIdentity(conf.getRouterPrefix());
 
     this->advanceClocks(ndn::time::milliseconds(10));
 
diff --git a/tests/update/test-save-delete-prefix.cpp b/tests/update/test-save-delete-prefix.cpp
index c4db1bc..84612e4 100644
--- a/tests/update/test-save-delete-prefix.cpp
+++ b/tests/update/test-save-delete-prefix.cpp
@@ -20,18 +20,18 @@
  */
 
 #include "update/prefix-update-processor.hpp"
+#include "conf-parameter.hpp"
 #include "nlsr.hpp"
 
-#include "tests/control-commands.hpp"
+#include "tests/io-key-chain-fixture.hpp"
 #include "tests/test-common.hpp"
-#include "conf-parameter.hpp"
 
 #include <ndn-cxx/mgmt/nfd/control-response.hpp>
 #include <ndn-cxx/security/interest-signer.hpp>
-#include <ndn-cxx/security/pib/identity.hpp>
 #include <ndn-cxx/security/signing-helpers.hpp>
 
-#include <boost/filesystem.hpp>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
 #include <boost/property_tree/info_parser.hpp>
 
 namespace nlsr {
@@ -39,11 +39,11 @@
 
 namespace bpt = boost::property_tree;
 
-class PrefixSaveDeleteFixture : public UnitTestTimeFixture
+class PrefixSaveDeleteFixture : public IoKeyChainFixture
 {
 public:
   PrefixSaveDeleteFixture()
-    : face(m_ioService, m_keyChain, {true, true})
+    : face(m_io, m_keyChain, {true, true})
     , siteIdentityName(ndn::Name("/edu/test-site"))
     , opIdentityName(ndn::Name("/edu/test-site").append(ndn::Name("%C1.Operator")))
     , testConfFile("/tmp/nlsr.conf.test")
@@ -60,8 +60,8 @@
     destination.close();
 
     conf.setConfFileNameDynamic(testConfFile);
-    siteIdentity = addIdentity(siteIdentityName);
-    saveCertificate(siteIdentity, SITE_CERT_PATH.string());
+    siteIdentity = m_keyChain.createIdentity(siteIdentityName);
+    saveIdentityCert(siteIdentity, SITE_CERT_PATH.string());
 
     // Operator cert
     opIdentity = addSubCertificate(opIdentityName, siteIdentity);
@@ -86,8 +86,8 @@
     inputFile.close();
 
     // Site cert
-    siteIdentity = addIdentity(siteIdentityName);
-    saveCertificate(siteIdentity, SITE_CERT_PATH.string());
+    siteIdentity = m_keyChain.createIdentity(siteIdentityName);
+    saveIdentityCert(siteIdentity, SITE_CERT_PATH.string());
 
     // Operator cert
     opIdentity = addSubCertificate(opIdentityName, siteIdentity);
@@ -98,7 +98,7 @@
     conf.loadCertToValidator(opIdentity.getDefaultKey().getDefaultCertificate());
 
     // Set the network so the LSA prefix is constructed
-    addIdentity(conf.getRouterPrefix());
+    m_keyChain.createIdentity(conf.getRouterPrefix());
 
     this->advanceClocks(ndn::time::milliseconds(10));
     face.sentInterests.clear();