diff --git a/tests/dataset-fixtures.hpp b/tests/dataset-fixtures.hpp
index bb03bd6..1a4e272 100644
--- a/tests/dataset-fixtures.hpp
+++ b/tests/dataset-fixtures.hpp
@@ -40,13 +40,13 @@
     }
   };
 
-  typedef std::list<std::shared_ptr<ndn::Data> > DataContainer;
+  using DataContainer = std::list<std::shared_ptr<ndn::Data>>;
   DataContainer data;
 
-  typedef std::list<std::pair<ndn::Interest, std::shared_ptr<ndn::Data> > > InterestContainer;
+  using InterestContainer = std::list<std::pair<ndn::Interest, std::shared_ptr<ndn::Data>>>;
   InterestContainer interests;
 
-  typedef std::list<std::pair<ndn::Interest, size_t > > RemovalsContainer;
+  using RemovalsContainer = std::list<std::pair<ndn::Interest, size_t>>;
   RemovalsContainer removals;
 
 protected:
@@ -77,7 +77,7 @@
   }
 
 private:
-  std::map<Name, shared_ptr<Data> > map;
+  std::map<Name, std::shared_ptr<Data>> map;
 };
 
 
@@ -205,187 +205,10 @@
   }
 };
 
-
-class BasicChildSelectorDataset : public DatasetBase
-{
-public:
-  static const std::string&
-  getName()
-  {
-    static std::string name = "BasicChildSelectorDataset";
-    return name;
-  }
-
-  BasicChildSelectorDataset()
-  {
-    this->data.push_back(createData("/a/1"));
-    this->data.push_back(createData("/b/1"));
-    this->interests.push_back(std::make_pair(Interest()
-                                               .setName("/b")
-                                               .setSelectors(Selectors()
-                                                               .setChildSelector(0)),
-                                             this->data.back()));
-
-    this->data.push_back(createData("/c/1"));
-    this->data.push_back(createData("/b/99"));
-    this->interests.push_back(std::make_pair(Interest()
-                                               .setName("/b")
-                                               .setSelectors(Selectors()
-                                                               .setChildSelector(1)),
-                                             this->data.back()));
-    this->data.push_back(createData("/b/5"));
-    this->data.push_back(createData("/b/55"));
-  }
-};
-
-
-class ExtendedChildSelectorDataset : public DatasetBase
-{
-public:
-  static const std::string&
-  getName()
-  {
-    static std::string name = "storage";
-    return name;
-  }
-
-  ExtendedChildSelectorDataset()
-  {
-    this->data.push_back(createData("/a/b/1"));
-
-    this->data.push_back(createData("/a/c/1"));
-    this->interests.push_back(std::make_pair(Interest("/a")
-                                             .setSelectors(Selectors()
-                                                           .setChildSelector(1)),
-                                              this->data.back()));
-
-    this->data.push_back(createData("/a/c/2"));
-
-    this->data.push_back(createData("/b"));
-  }
-};
-
-
-class ComplexSelectorsDataset : public DatasetBase
-{
-public:
-  static const std::string&
-  getName()
-  {
-    static std::string name = "ComplexSelectorsDataset";
-    return name;
-  }
-
-  std::map<std::string, shared_ptr<Data> > map;
-
-  void
-  addData(const std::string& name)
-  {
-  }
-
-  ComplexSelectorsDataset()
-  {
-    // Dataset
-    this->data.push_back(createData("/a/b/c"));
-    this->data.push_back(createData("/a/b/d/1"));
-    this->data.push_back(createData("/a/b/d/2"));
-    this->data.push_back(createData("/a/b/d/3"));
-    this->data.push_back(createData("/a/b/d/4/I"));
-    this->data.push_back(createData("/a/b/d/4"));
-    this->data.push_back(createData("/a/b/d"));
-    this->data.push_back(createData("/a/b/e/1"));
-    this->data.push_back(createData("/a/b/e"));
-
-    // Basic selects
-    this->interests.push_back(std::make_pair(Interest("/a/b/c"),     this->getData("/a/b/c")));
-    this->interests.push_back(std::make_pair(Interest("/a/b/d"),     this->getData("/a/b/d")));
-    this->interests.push_back(std::make_pair(Interest("/a/b/d/1"),   this->getData("/a/b/d/1")));
-    this->interests.push_back(std::make_pair(Interest("/a/b/d/2"),   this->getData("/a/b/d/2")));
-    this->interests.push_back(std::make_pair(Interest("/a/b/d/3"),   this->getData("/a/b/d/3")));
-    this->interests.push_back(std::make_pair(Interest("/a/b/d/4/I"), this->getData("/a/b/d/4/I")));
-    this->interests.push_back(std::make_pair(Interest("/a/b/d/4"),   this->getData("/a/b/d/4")));
-    this->interests.push_back(std::make_pair(Interest("/a/b/e"),     this->getData("/a/b/e")));
-    this->interests.push_back(std::make_pair(Interest("/a/b/e/1"),   this->getData("/a/b/e/1")));
-
-    // Complex selects
-    this->interests.push_back(std::make_pair(Interest("/a/b")
-                                             .setSelectors(Selectors()
-                                                           .setMinSuffixComponents(2)
-                                                           .setMaxSuffixComponents(2)),
-                                             this->getData("/a/b/c")));
-
-    this->interests.push_back(std::make_pair(Interest("/a/b/d")
-                                             .setSelectors(Selectors()
-                                                           .setMinSuffixComponents(-1)
-                                                           .setChildSelector(0)),
-                                             this->getData("/a/b/d")));
-
-    this->interests.push_back(std::make_pair(Interest("/a/b/d")
-                                             .setSelectors(Selectors()
-                                                           .setMinSuffixComponents(2)
-                                                           .setChildSelector(0)),
-                                             this->getData("/a/b/d/1")));
-
-    this->interests.push_back(std::make_pair(
-      Interest("/a/b/d")
-      .setSelectors(Selectors()
-                    .setChildSelector(1)
-                    .setMaxSuffixComponents(2)
-                    .setMinSuffixComponents(2)
-                    .setExclude(Exclude()
-                                .excludeRange(ndn::name::Component("3"),
-                                              ndn::name::Component("4")))),
-      this->getData("/a/b/d/2")));
-
-
-    this->interests.push_back(std::make_pair(Interest("/a/b/d")
-                                               .setSelectors(Selectors().setMinSuffixComponents(3)),
-                                             this->getData("/a/b/d/4/I")));
-
-    // According to selector definition, RightMost for the next level and LeftMost for the next-next level
-    this->interests.push_back(std::make_pair(Interest("/a/b/d")
-                                             .setSelectors(Selectors()
-                                                           .setMinSuffixComponents(2)
-                                                           .setChildSelector(1)),
-                                             this->getData("/a/b/d/4")));
-
-    // because of the digest component, /a/b/d will be to the right of /a/b/d/4
-    this->interests.push_back(std::make_pair(Interest("/a/b/d")
-                                             .setSelectors(Selectors()
-                                                           .setChildSelector(1)),
-                                             this->getData("/a/b/d/4")));
-
-    // Alex: this interest doesn't make sense, as all Data packets will have the same selector
-    this->interests.push_back(std::make_pair(Interest("/a/b/e")
-                                             .setSelectors(Selectors()
-                                                           .setPublisherPublicKeyLocator(
-                                                             this->data.back()
-                                                               ->getSignature().getKeyLocator())),
-                                             this->getData("/a/b/e")));
-
-    // Removals
-    this->removals.push_back(std::make_pair(Interest("/a/b/d/2"), 1));
-
-    this->removals.push_back(std::make_pair(
-      Interest("/a/b/d")
-      .setSelectors(Selectors()
-                    .setMaxSuffixComponents(2)
-                    .setMinSuffixComponents(2)
-                    .setExclude(Exclude()
-                                .excludeOne(ndn::name::Component("3")))),
-      2));
-  }
-};
-
-
-typedef boost::mpl::vector<BasicDataset,
-                           FetchByPrefixDataset,
-                           BasicChildSelectorDataset,
-                           ExtendedChildSelectorDataset,
-                           SamePrefixDataset<10>,
-                           SamePrefixDataset<100>> CommonDatasets;
-
-
+using CommonDatasets = boost::mpl::vector<BasicDataset,
+                                          FetchByPrefixDataset,
+                                          SamePrefixDataset<10>,
+                                          SamePrefixDataset<100>>;
 } // namespace tests
 } // namespace repo
 
diff --git a/tests/integrated/command-fixture.cpp b/tests/integrated/command-fixture.cpp
index a803a51..ad7955a 100644
--- a/tests/integrated/command-fixture.cpp
+++ b/tests/integrated/command-fixture.cpp
@@ -28,8 +28,8 @@
   , dispatcher(repoFace, keyChain)
   , validator(repoFace)
 {
-  this->saveIdentityCertificate(keyChain.getPib().getDefaultIdentity().getName(),
-                                "tests/integrated/insert-delete-test.cert");
+  this->addIdentity("/ndn/test/repo");
+  this->saveIdentityCertificate("/ndn/test/repo", "tests/integrated/insert-delete-test.cert");
   validator.load("tests/integrated/insert-delete-validator-config.conf");
 }
 
diff --git a/tests/integrated/insert-delete-validator-config.conf b/tests/integrated/insert-delete-validator-config.conf
index c97bb4c..0820266 100644
--- a/tests/integrated/insert-delete-validator-config.conf
+++ b/tests/integrated/insert-delete-validator-config.conf
@@ -1,8 +1,7 @@
 ; The test rules below are for test suite TestBasicCommandInsertDelete.
 ; Signed interests and data packets are signed by default certificate.
 ; In these test rules, the type of checker is fixed signer and signer type is file.
-; So user who wants to run this test could use security tool to dump the defualt
-; certificate into a file named "insert-delete-test.cert"
+
 rule
 {
   id "Test Rule For Signed Interest"
@@ -20,7 +19,7 @@
     key-locator
     {
       type name
-      name /DEFAULT
+      name /ndn/test/repo
       relation equal
     }
   }
@@ -43,7 +42,7 @@
     key-locator
     {
       type name
-      name /DEFAULT
+      name /ndn/test/repo
       relation equal
     }
   }
diff --git a/tests/integrated/test-basic-command-insert-delete.cpp b/tests/integrated/test-basic-command-insert-delete.cpp
index ea58abe..f3685f6 100644
--- a/tests/integrated/test-basic-command-insert-delete.cpp
+++ b/tests/integrated/test-basic-command-insert-delete.cpp
@@ -36,9 +36,6 @@
 #include <boost/mpl/vector.hpp>
 #include <boost/test/unit_test.hpp>
 
-
-#include <iostream>
-
 namespace repo {
 namespace tests {
 
@@ -46,6 +43,7 @@
 using ndn::time::seconds;
 using ndn::EventId;
 
+
 // All the test cases in this test suite should be run at once.
 BOOST_AUTO_TEST_SUITE(TestBasicCommandInsertDelete)
 
@@ -60,6 +58,7 @@
     , deleteHandle(repoFace, *handle, dispatcher, scheduler, validator)
     , insertFace(repoFace.getIoService())
     , deleteFace(repoFace.getIoService())
+    , signer(keyChain)
   {
     Name cmdPrefix("/repo/command");
     repoFace.registerPrefix(cmdPrefix, nullptr,
@@ -113,6 +112,8 @@
   Face insertFace;
   Face deleteFace;
   std::map<Name, EventId> insertEvents;
+  std::map<Name, Name> deleteNamePairs;
+  ndn::security::CommandInterestSigner signer;
 };
 
 template<class T> void
@@ -129,9 +130,7 @@
     insertEvents.erase(event);
   }
   // schedule an event 50ms later to check whether insert is Ok
-  scheduler.scheduleEvent(500_ms,
-                          bind(&Fixture<T>::checkInsertOk, this, interest));
-
+  scheduler.scheduleEvent(500_ms, std::bind(&Fixture<T>::checkInsertOk, this, interest));
 }
 
 
@@ -165,8 +164,7 @@
   BOOST_CHECK_EQUAL(statusCode, 200);
 
   //schedlute an event to check whether delete is Ok.
-  scheduler.scheduleEvent(100_ms,
-                          bind(&Fixture<T>::checkDeleteOk, this, interest));
+  scheduler.scheduleEvent(100_ms, std::bind(&Fixture<T>::checkDeleteOk, this, interest));
 }
 
 template<class T> void
@@ -185,25 +183,25 @@
 Fixture<T>::sendInsertInterest(const Interest& insertInterest)
 {
   insertFace.expressInterest(insertInterest,
-                             bind(&Fixture<T>::onInsertData, this, _1, _2),
-                             bind(&Fixture<T>::onInsertTimeout, this, _1), // Nack
-                             bind(&Fixture<T>::onInsertTimeout, this, _1));
+                             std::bind(&Fixture<T>::onInsertData, this, _1, _2),
+                             std::bind(&Fixture<T>::onInsertTimeout, this, _1), // Nack
+                             std::bind(&Fixture<T>::onInsertTimeout, this, _1));
 }
 
 template<class T> void
 Fixture<T>::sendDeleteInterest(const Interest& deleteInterest)
 {
   deleteFace.expressInterest(deleteInterest,
-                             bind(&Fixture<T>::onDeleteData, this, _1, _2),
-                             bind(&Fixture<T>::onDeleteTimeout, this, _1), // Nack
-                             bind(&Fixture<T>::onDeleteTimeout, this, _1));
+                             std::bind(&Fixture<T>::onDeleteData, this, _1, _2),
+                             std::bind(&Fixture<T>::onDeleteTimeout, this, _1), // Nack
+                             std::bind(&Fixture<T>::onDeleteTimeout, this, _1));
 }
 
 template<class T> void
 Fixture<T>::checkInsertOk(const Interest& interest)
 {
   BOOST_TEST_MESSAGE(interest);
-  shared_ptr<Data> data = handle->readData(interest);
+  std::shared_ptr<Data> data = handle->readData(interest);
   if (data) {
     int rc = memcmp(data->getContent().value(), content, sizeof(content));
     BOOST_CHECK_EQUAL(rc, 0);
@@ -216,10 +214,14 @@
 template<class T> void
 Fixture<T>::checkDeleteOk(const Interest& interest)
 {
-  shared_ptr<Data> data = handle->readData(interest);
-  BOOST_CHECK_EQUAL(data, shared_ptr<Data>());
+  std::map<Name, Name>::iterator name = deleteNamePairs.find(interest.getName());
+  BOOST_CHECK_MESSAGE(name != deleteNamePairs.end(), "Delete name not found: " << interest.getName());
+  Interest dataInterest(name->second);
+  std::shared_ptr<Data> data = handle->readData(dataInterest);
+  BOOST_CHECK(!data);
 }
 
+
 template<class T> void
 Fixture<T>::scheduleInsertEvent()
 {
@@ -230,24 +232,20 @@
     RepoCommandParameter insertParameter;
     insertParameter.setName(Name((*i)->getName())
                             .appendNumber(ndn::random::generateWord64()));
-
     insertCommandName.append(insertParameter.wireEncode());
-    Interest insertInterest(insertCommandName);
-    keyChain.sign(insertInterest);
-
+    Interest insertInterest = signer.makeCommandInterest(insertCommandName);
     // schedule a job to express insertInterest every 50ms
     scheduler.scheduleEvent(milliseconds(timeCount * 50 + 1000),
-                            bind(&Fixture<T>::sendInsertInterest, this, insertInterest));
+                            std::bind(&Fixture<T>::sendInsertInterest, this, insertInterest));
     // schedule what to do when interest timeout
     EventId delayEventId = scheduler.scheduleEvent(milliseconds(5000 + timeCount * 50),
-                                                   bind(&Fixture<T>::delayedInterest, this));
+                                                   std::bind(&Fixture<T>::delayedInterest, this));
     insertEvents[insertParameter.getName()] = delayEventId;
-
-    //The delayEvent will be canceled in onInsertInterest
+    // The delayEvent will be canceled in onInsertInterest
     insertFace.setInterestFilter(insertParameter.getName(),
-                                 bind(&Fixture<T>::onInsertInterest, this, _2),
+                                 std::bind(&Fixture<T>::onInsertInterest, this, _2),
                                  ndn::RegisterPrefixSuccessCallback(),
-                                 bind(&Fixture<T>::onRegisterFailed, this, _2));
+                                 std::bind(&Fixture<T>::onRegisterFailed, this, _2));
     timeCount++;
   }
 }
@@ -263,27 +261,23 @@
     deleteParameter.setProcessId(ndn::random::generateWord64());
     deleteParameter.setName((*i)->getName());
     deleteCommandName.append(deleteParameter.wireEncode());
-    Interest deleteInterest(deleteCommandName);
-    keyChain.sign(deleteInterest);
+    Interest deleteInterest = signer.makeCommandInterest(deleteCommandName);
+    deleteNamePairs[deleteInterest.getName()] = (*i)->getName();
     scheduler.scheduleEvent(milliseconds(4000 + timeCount * 50),
-                            bind(&Fixture<T>::sendDeleteInterest, this, deleteInterest));
+                            std::bind(&Fixture<T>::sendDeleteInterest, this, deleteInterest));
     timeCount++;
   }
 }
 
-typedef boost::mpl::vector<BasicDataset,
-                           FetchByPrefixDataset,
-                           BasicChildSelectorDataset,
-                           ExtendedChildSelectorDataset,
-                           SamePrefixDataset<10>> Datasets;
+using Datasets = boost::mpl::vector<BasicDataset,
+                                    FetchByPrefixDataset,
+                                    SamePrefixDataset<10>>;
 
 BOOST_FIXTURE_TEST_CASE_TEMPLATE(InsertDelete, T, Datasets, Fixture<T>)
 {
   // schedule events
-  this->scheduler.scheduleEvent(0_s,
-                                bind(&Fixture<T>::scheduleInsertEvent, this));
-  this->scheduler.scheduleEvent(10_s,
-                                bind(&Fixture<T>::scheduleDeleteEvent, this));
+  this->scheduler.scheduleEvent(0_s, std::bind(&Fixture<T>::scheduleInsertEvent, this));
+  this->scheduler.scheduleEvent(10_s, std::bind(&Fixture<T>::scheduleDeleteEvent, this));
 
   this->repoFace.processEvents(30_s);
 }
diff --git a/tests/integrated/test-basic-command-watch.cpp b/tests/integrated/test-basic-command-watch.cpp
deleted file mode 100644
index 6fe677d..0000000
--- a/tests/integrated/test-basic-command-watch.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2018, Regents of the University of California.
- *
- * This file is part of NDN repo-ng (Next generation of NDN repository).
- * See AUTHORS.md for complete list of repo-ng authors and contributors.
- *
- * repo-ng is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * repo-ng is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.  See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * repo-ng, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "handles/watch-handle.hpp"
-#include "storage/sqlite-storage.hpp"
-
-#include "command-fixture.hpp"
-#include "../repo-storage-fixture.hpp"
-#include "../dataset-fixtures.hpp"
-
-#include <ndn-cxx/util/random.hpp>
-
-#include <boost/mpl/vector.hpp>
-#include <boost/test/unit_test.hpp>
-
-namespace repo {
-namespace tests {
-
-using ndn::time::milliseconds;
-using ndn::time::seconds;
-using ndn::EventId;
-
-// All the test cases in this test suite should be run at once.
-BOOST_AUTO_TEST_SUITE(TestBasicCommandWatchDelete)
-
-const static uint8_t content[8] = {3, 1, 4, 1, 5, 9, 2, 6};
-
-template<class Dataset>
-class Fixture : public CommandFixture, public RepoStorageFixture, public Dataset
-{
-public:
-  Fixture()
-    : watchHandle(repoFace, *handle, dispatcher, scheduler, validator)
-    , watchFace(repoFace.getIoService())
-  {
-    Name cmdPrefix("/repo/command");
-    repoFace.registerPrefix(cmdPrefix, nullptr,
-      [] (const Name& cmdPrefix, const std::string& reason) {
-        BOOST_FAIL("Command prefix registration error: " << reason);
-      });
-  }
-
-  void
-  scheduleWatchEvent();
-
-  void
-  onWatchInterest(const Interest& interest);
-
-  void
-  onRegisterFailed(const std::string& reason);
-
-  void
-  delayedInterest();
-
-  void
-  onWatchData(const Interest& interest, const Data& data);
-
-  void
-  onWatchStopData(const Interest& interest, const Data& data);
-
-  void
-  onWatchTimeout(const Interest& interest);
-
-  void
-  sendWatchStartInterest(const Interest& interest);
-
-  void
-  sendWatchStopInterest(const Interest& interest);
-
-  void
-  checkWatchOk(const Interest& interest);
-
-public:
-  WatchHandle watchHandle;
-  Face watchFace;
-  std::map<Name, EventId> watchEvents;
-};
-
-template<class T> void
-Fixture<T>::onWatchInterest(const Interest& interest)
-{
-  auto data = make_shared<Data>(Name(interest.getName())
-                                .appendNumber(ndn::random::generateWord64() + 100));
-  data->setContent(content, sizeof(content));
-  data->setFreshnessPeriod(0_ms);
-  keyChain.sign(*data);
-  watchFace.put(*data);
-
-  // schedule an event 50ms later to check whether watch is Ok
-  scheduler.scheduleEvent(10000_ms,
-                          bind(&Fixture<T>::checkWatchOk, this,
-                               Interest(data->getName())));
-}
-
-
-template<class T> void
-Fixture<T>::onRegisterFailed(const std::string& reason)
-{
-  BOOST_ERROR("ERROR: Failed to register prefix in local hub's daemon" + reason);
-}
-
-template<class T> void
-Fixture<T>::delayedInterest()
-{
-  BOOST_ERROR("Fetching interest does not come. It may be satisfied in CS or something is wrong");
-}
-
-template<class T> void
-Fixture<T>::onWatchData(const Interest& interest, const Data& data)
-{
-  RepoCommandResponse response;
-  response.wireDecode(data.getContent().blockFromValue());
-
-  int statusCode = response.getCode();
-  BOOST_CHECK_EQUAL(statusCode, 100);
-}
-
-template<class T> void
-Fixture<T>::onWatchStopData(const Interest& interest, const Data& data)
-{
-  RepoCommandResponse response;
-  response.wireDecode(data.getContent().blockFromValue());
-
-  int statusCode = response.getCode();
-  BOOST_CHECK_EQUAL(statusCode, 101);
-}
-
-template<class T> void
-Fixture<T>::onWatchTimeout(const Interest& interest)
-{
-  BOOST_ERROR("Watch command timeout");
-}
-
-template<class T> void
-Fixture<T>::sendWatchStartInterest(const Interest& watchInterest)
-{
-  watchFace.expressInterest(watchInterest,
-                            bind(&Fixture<T>::onWatchData, this, _1, _2),
-                            bind(&Fixture<T>::onWatchTimeout, this, _1), // Nack
-                            bind(&Fixture<T>::onWatchTimeout, this, _1));
-}
-
-template<class T> void
-Fixture<T>::sendWatchStopInterest(const Interest& watchInterest)
-{
-  watchFace.expressInterest(watchInterest,
-                            bind(&Fixture<T>::onWatchStopData, this, _1, _2),
-                            bind(&Fixture<T>::onWatchTimeout, this, _1), // Nack
-                            bind(&Fixture<T>::onWatchTimeout, this, _1));
-}
-
-template<class T> void
-Fixture<T>::checkWatchOk(const Interest& interest)
-{
-  BOOST_TEST_MESSAGE(interest);
-  shared_ptr<Data> data = handle->readData(interest);
-  if (data) {
-    int rc = memcmp(data->getContent().value(), content, sizeof(content));
-    BOOST_CHECK_EQUAL(rc, 0);
-  }
-  else {
-    std::cerr<<"Check Watch Failed"<<std::endl;
-  }
-}
-
-template<class T> void
-Fixture<T>::scheduleWatchEvent()
-{
-  Name watchCommandName("/repo/command/watch/start");
-  RepoCommandParameter watchParameter;
-  watchParameter.setName(Name("/a/b"));
-  watchParameter.setMaxInterestNum(10);
-  watchParameter.setInterestLifetime(50000_ms);
-  watchParameter.setWatchTimeout(1000000000_ms);
-  watchCommandName.append(watchParameter.wireEncode());
-  Interest watchInterest(watchCommandName);
-  keyChain.sign(watchInterest);
-  //schedule a job to express watchInterest
-  scheduler.scheduleEvent(1000_ms,
-                          bind(&Fixture<T>::sendWatchStartInterest, this, watchInterest));
-
-  Name watchStopName("/repo/command/watch/stop");
-  RepoCommandParameter watchStopParameter;
-  watchStopName.append(watchStopParameter.wireEncode());
-  Interest watchStopInterest(watchStopName);
-  keyChain.sign(watchStopInterest);
-
-  //The delayEvent will be canceled in onWatchInterest
-  watchFace.setInterestFilter(watchParameter.getName(),
-                              bind(&Fixture<T>::onWatchInterest, this, _2),
-                              ndn::RegisterPrefixSuccessCallback(),
-                              bind(&Fixture<T>::onRegisterFailed, this, _2));
-}
-
-typedef boost::mpl::vector<BasicDataset> Dataset;
-
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(WatchDelete, T, Dataset, Fixture<T>)
-{
-  // schedule events
-  this->scheduler.scheduleEvent(1_s,
-                                bind(&Fixture<T>::scheduleWatchEvent, this));
-
-  this->repoFace.processEvents(500_s);
-}
-
-BOOST_AUTO_TEST_SUITE_END()
-
-} // namespace tests
-} // namespace repo
diff --git a/tests/integrated/test-basic-interest-read.cpp b/tests/integrated/test-basic-interest-read.cpp
index 0ad2f3c..d73b0d1 100644
--- a/tests/integrated/test-basic-interest-read.cpp
+++ b/tests/integrated/test-basic-interest-read.cpp
@@ -27,12 +27,14 @@
 #include <boost/asio/io_service.hpp>
 #include <boost/test/unit_test.hpp>
 
+#include <ndn-cxx/util/logger.hpp>
 #include <ndn-cxx/util/time.hpp>
 
 namespace repo {
 namespace tests {
 
-// All the test cases in this test suite should be run at once.
+NDN_LOG_INIT(repo.tests.read);
+
 BOOST_AUTO_TEST_SUITE(TestBasicInerestRead)
 
 const static uint8_t content[8] = {3, 1, 4, 1, 5, 9, 2, 6};
@@ -69,13 +71,16 @@
       (*i)->setContent(content, sizeof(content));
       (*i)->setFreshnessPeriod(36000_ms);
       keyChain.sign(**i);
+      NDN_LOG_DEBUG(**i);
       bool rc = handle->insertData(**i);
 
       BOOST_CHECK_EQUAL(rc, true);
+      NDN_LOG_DEBUG("Inserted Data " << (**i).getName());
+
       Interest readInterest((*i)->getName());
       readInterest.setMustBeFresh(true);
       scheduler.scheduleEvent(ndn::time::milliseconds(timeCount * 50),
-                              bind(&BasicInterestReadFixture<Dataset>::sendInterest, this,
+                              std::bind(&BasicInterestReadFixture<Dataset>::sendInterest, this,
                                         readInterest));
       timeCount++;
     }
@@ -91,22 +96,25 @@
   void
   onReadTimeout(const ndn::Interest& interest)
   {
-    BOOST_ERROR("Insert not successfull or Read data does not successfull");
+    NDN_LOG_DEBUG("Timed out " << interest.getName());
+    BOOST_ERROR("Insert or read not successfull");
   }
 
   void
   onReadNack(const ndn::Interest& interest, const ndn::lp::Nack& nack)
   {
+    NDN_LOG_DEBUG("Nacked " << interest.getName() << nack.getReason());
     BOOST_ERROR("Read nacked");
   }
 
   void
   sendInterest(const ndn::Interest& interest)
   {
+    NDN_LOG_DEBUG("Sending Interest " << interest.getName());
     readFace.expressInterest(interest,
-                             bind(&BasicInterestReadFixture::onReadData, this, _1, _2),
-                             bind(&BasicInterestReadFixture::onReadNack, this, _1, _2),
-                             bind(&BasicInterestReadFixture::onReadTimeout, this, _1));
+                             std::bind(&BasicInterestReadFixture::onReadData, this, _1, _2),
+                             std::bind(&BasicInterestReadFixture::onReadNack, this, _1, _2),
+                             std::bind(&BasicInterestReadFixture::onReadTimeout, this, _1));
   }
 
 public:
@@ -117,17 +125,16 @@
   ndn::Face readFace;
 };
 
-typedef boost::mpl::vector<BasicDataset,
-                            FetchByPrefixDataset,
-                            BasicChildSelectorDataset,
-                            ExtendedChildSelectorDataset,
-                            SamePrefixDataset<10>> Datasets;
+
+using Datasets = boost::mpl::vector<BasicDataset,
+                                    FetchByPrefixDataset,
+                                    SamePrefixDataset<10>>;
 
 BOOST_FIXTURE_TEST_CASE_TEMPLATE(Read, T, Datasets, BasicInterestReadFixture<T>)
 {
   this->startListen();
   this->scheduler.scheduleEvent(1_s,
-                                bind(&BasicInterestReadFixture<T>::scheduleReadEvent, this));
+                                std::bind(&BasicInterestReadFixture<T>::scheduleReadEvent, this));
 
   this->repoFace.processEvents(20_s);
 
diff --git a/tests/repo-storage-fixture.hpp b/tests/repo-storage-fixture.hpp
index 29df163..9a82169 100644
--- a/tests/repo-storage-fixture.hpp
+++ b/tests/repo-storage-fixture.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014,  Regents of the University of California.
+ * Copyright (c) 2018,  Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -32,8 +32,8 @@
 {
 public:
   RepoStorageFixture()
-    : store(make_shared<SqliteStorage>("unittestdb"))
-    , handle(new RepoStorage(static_cast<int64_t>(65535), *store))
+    : store(std::make_shared<SqliteStorage>("unittestdb"))
+    , handle(std::make_shared<RepoStorage>(*store))
   {
   }
 
@@ -44,8 +44,8 @@
 
 
 public:
-  shared_ptr<Storage> store;
-  shared_ptr<RepoStorage> handle;
+  std::shared_ptr<Storage> store;
+  std::shared_ptr<RepoStorage> handle;
 };
 
 } // namespace tests
diff --git a/tests/unit/index.cpp b/tests/unit/index.cpp
deleted file mode 100644
index 6f255a2..0000000
--- a/tests/unit/index.cpp
+++ /dev/null
@@ -1,373 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2017, Regents of the University of California.
- *
- * This file is part of NDN repo-ng (Next generation of NDN repository).
- * See AUTHORS.md for complete list of repo-ng authors and contributors.
- *
- * repo-ng is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * repo-ng is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.  See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * repo-ng, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "storage/index.hpp"
-
-#include "../sqlite-fixture.hpp"
-#include "../dataset-fixtures.hpp"
-
-#include <iostream>
-
-#include <ndn-cxx/security/signing-helpers.hpp>
-#include <ndn-cxx/util/sha256.hpp>
-#include <ndn-cxx/util/random.hpp>
-
-#include <boost/mpl/push_back.hpp>
-#include <boost/test/unit_test.hpp>
-
-namespace repo {
-namespace tests {
-
-BOOST_AUTO_TEST_SUITE(Index)
-
-class FindFixture
-{
-protected:
-  FindFixture()
-    : m_index(std::numeric_limits<size_t>::max())
-  {
-  }
-
-  Name
-  insert(int id, const Name& name)
-  {
-    shared_ptr<Data> data = make_shared<Data>(name);
-    data->setContent(reinterpret_cast<const uint8_t*>(&id), sizeof(id));
-    m_keyChain.sign(*data, ndn::signingWithSha256());
-    data->wireEncode();
-    m_index.insert(*data, id);
-
-    return data->getFullName();
-  }
-
-  Interest&
-  startInterest(const Name& name)
-  {
-    m_interest = make_shared<Interest>(name);
-    return *m_interest;
-  }
-
-  int
-  find()
-  {
-    std::pair<int, Name> found = m_index.find(*m_interest);
-    return found.first;
-  }
-
-protected:
-  repo::Index m_index;
-  KeyChain m_keyChain;
-  shared_ptr<Interest> m_interest;
-};
-
-BOOST_FIXTURE_TEST_SUITE(Find, FindFixture)
-
-BOOST_AUTO_TEST_CASE(EmptyDataName)
-{
-  insert(1, "ndn:/");
-  startInterest("ndn:/");
-  BOOST_CHECK_EQUAL(find(), 1);
-}
-
-BOOST_AUTO_TEST_CASE(EmptyInterestName)
-{
-  insert(1, "ndn:/A");
-  startInterest("ndn:/");
-  BOOST_CHECK_EQUAL(find(), 1);
-}
-
-BOOST_AUTO_TEST_CASE(ExactName)
-{
-  insert(1, "ndn:/");
-  insert(2, "ndn:/A");
-  insert(3, "ndn:/A/B");
-  insert(4, "ndn:/A/C");
-  insert(5, "ndn:/D");
-
-  startInterest("ndn:/A");
-  BOOST_CHECK_EQUAL(find(), 2);
-}
-
-BOOST_AUTO_TEST_CASE(FullName)
-{
-  Name n1 = insert(1, "ndn:/A");
-  Name n2 = insert(2, "ndn:/A");
-
-  startInterest(n1);
-  BOOST_CHECK_EQUAL(find(), 1);
-
-  startInterest(n2);
-  BOOST_CHECK_EQUAL(find(), 2);
-}
-
-BOOST_AUTO_TEST_CASE(Leftmost)
-{
-  insert(1, "ndn:/A");
-  insert(2, "ndn:/B/p/1");
-  insert(3, "ndn:/B/p/2");
-  insert(4, "ndn:/B/q/1");
-  insert(5, "ndn:/B/q/2");
-  insert(6, "ndn:/C");
-
-  startInterest("ndn:/B");
-  BOOST_CHECK_EQUAL(find(), 2);
-}
-
-BOOST_AUTO_TEST_CASE(Rightmost)
-{
-  insert(1, "ndn:/A");
-  insert(2, "ndn:/B/p/1");
-  insert(3, "ndn:/B/p/2");
-  insert(4, "ndn:/B/q/1");
-  insert(5, "ndn:/B/q/2");
-  insert(6, "ndn:/C");
-
-  startInterest("ndn:/B")
-    .setChildSelector(1);
-  BOOST_CHECK_EQUAL(find(), 4);
-}
-
-BOOST_AUTO_TEST_CASE(MinSuffixComponents)
-{
-  insert(1, "ndn:/");
-  insert(2, "ndn:/A");
-  insert(3, "ndn:/B/1");
-  insert(4, "ndn:/C/1/2");
-  insert(5, "ndn:/D/1/2/3");
-  insert(6, "ndn:/E/1/2/3/4");
-
-  startInterest("ndn:/")
-    .setMinSuffixComponents(0);
-  BOOST_CHECK_EQUAL(find(), 1);
-
-  startInterest("ndn:/")
-    .setMinSuffixComponents(1);
-  BOOST_CHECK_EQUAL(find(), 1);
-
-  startInterest("ndn:/")
-    .setMinSuffixComponents(2);
-  BOOST_CHECK_EQUAL(find(), 2);
-
-  startInterest("ndn:/")
-    .setMinSuffixComponents(3);
-  BOOST_CHECK_EQUAL(find(), 3);
-
-  startInterest("ndn:/")
-    .setMinSuffixComponents(4);
-  BOOST_CHECK_EQUAL(find(), 4);
-
-  startInterest("ndn:/")
-    .setMinSuffixComponents(5);
-  BOOST_CHECK_EQUAL(find(), 5);
-
-  startInterest("ndn:/")
-    .setMinSuffixComponents(6);
-  BOOST_CHECK_EQUAL(find(), 6);
-
-  startInterest("ndn:/")
-    .setMinSuffixComponents(7);
-  BOOST_CHECK_EQUAL(find(), 0);
-}
-
-BOOST_AUTO_TEST_CASE(MaxSuffixComponents)
-{
-  insert(1, "ndn:/");
-  insert(2, "ndn:/A");
-  insert(3, "ndn:/B/2");
-  insert(4, "ndn:/C/2/3");
-  insert(5, "ndn:/D/2/3/4");
-  insert(6, "ndn:/E/2/3/4/5");
-
-  startInterest("ndn:/")
-    .setChildSelector(1)
-    .setMaxSuffixComponents(0);
-  BOOST_CHECK_EQUAL(find(), 0);
-
-  startInterest("ndn:/")
-    .setChildSelector(1)
-    .setMaxSuffixComponents(1);
-  BOOST_CHECK_EQUAL(find(), 1);
-
-  startInterest("ndn:/")
-    .setChildSelector(1)
-    .setMaxSuffixComponents(2);
-  BOOST_CHECK_EQUAL(find(), 2);
-
-  startInterest("ndn:/")
-    .setChildSelector(1)
-    .setMaxSuffixComponents(3);
-  BOOST_CHECK_EQUAL(find(), 3);
-
-  startInterest("ndn:/")
-    .setChildSelector(1)
-    .setMaxSuffixComponents(4);
-  BOOST_CHECK_EQUAL(find(), 4);
-
-  startInterest("ndn:/")
-    .setChildSelector(1)
-    .setMaxSuffixComponents(5);
-  BOOST_CHECK_EQUAL(find(), 5);
-
-  startInterest("ndn:/")
-    .setChildSelector(1)
-    .setMaxSuffixComponents(6);
-  BOOST_CHECK_EQUAL(find(), 6);
-
-  startInterest("ndn:/")
-    .setChildSelector(1)
-    .setMaxSuffixComponents(7);
-  BOOST_CHECK_EQUAL(find(), 6);
-}
-
-BOOST_AUTO_TEST_CASE(DigestOrder)
-{
-  insert(1, "ndn:/A");
-  insert(2, "ndn:/A");
-  // We don't know which comes first, but there must be some order
-
-  startInterest("ndn:/A")
-    .setChildSelector(0);
-  uint32_t leftmost = find();
-
-  startInterest("ndn:/A")
-    .setChildSelector(1);
-  uint32_t rightmost = find();
-
-  BOOST_CHECK_NE(leftmost, rightmost);
-}
-
-BOOST_AUTO_TEST_CASE(DigestExclude)
-{
-  insert(1, "ndn:/A");
-  Name n2 = insert(2, "ndn:/A");
-  insert(3, "ndn:/A/B");
-
-  uint8_t digest00[ndn::util::Sha256::DIGEST_SIZE];
-  std::fill_n(digest00, sizeof(digest00), 0x00);
-  uint8_t digestFF[ndn::util::Sha256::DIGEST_SIZE];
-  std::fill_n(digestFF, sizeof(digestFF), 0xFF);
-
-  Exclude excludeDigest;
-  excludeDigest.excludeRange(
-    name::Component::fromImplicitSha256Digest(digest00, sizeof(digest00)),
-    name::Component::fromImplicitSha256Digest(digestFF, sizeof(digestFF)));
-
-  startInterest("ndn:/A")
-    .setChildSelector(0)
-    .setExclude(excludeDigest);
-  BOOST_CHECK_EQUAL(find(), 3);
-
-  startInterest("ndn:/A")
-    .setChildSelector(1)
-    .setExclude(excludeDigest);
-  BOOST_CHECK_EQUAL(find(), 3);
-
-  Exclude excludeGeneric;
-  excludeGeneric.excludeAfter(name::Component(static_cast<uint8_t*>(nullptr), 0));
-
-  startInterest("ndn:/A")
-    .setChildSelector(0)
-    .setExclude(excludeGeneric);
-  int found1 = find();
-  BOOST_CHECK(found1 == 1 || found1 == 2);
-
-  startInterest("ndn:/A")
-    .setChildSelector(1)
-    .setExclude(excludeGeneric);
-  int found2 = find();
-  BOOST_CHECK(found2 == 1 || found2 == 2);
-
-  Exclude exclude2 = excludeGeneric;
-  exclude2.excludeOne(n2.get(-1));
-
-  startInterest("ndn:/A")
-    .setChildSelector(0)
-    .setExclude(exclude2);
-  BOOST_CHECK_EQUAL(find(), 1);
-
-  startInterest("ndn:/A")
-    .setChildSelector(1)
-    .setExclude(exclude2);
-  BOOST_CHECK_EQUAL(find(), 1);
-}
-
-BOOST_AUTO_TEST_SUITE_END() // Find
-
-
-template<class Dataset>
-class Fixture : public Dataset
-{
-public:
-  Fixture()
-    : index(65535)
-  {
-  }
-
-public:
-  std::map<int64_t, shared_ptr<Data> > idToDataMap;
-  repo::Index index;
-};
-
-// Combine CommonDatasets with ComplexSelectorDataset
-typedef boost::mpl::push_back<CommonDatasets,
-                              ComplexSelectorsDataset>::type Datasets;
-
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(Bulk, T, Datasets, Fixture<T>)
-{
-  BOOST_TEST_MESSAGE(T::getName());
-
-  for (typename T::DataContainer::iterator i = this->data.begin();
-       i != this->data.end(); ++i)
-    {
-      int64_t id = std::abs(static_cast<int64_t>(ndn::random::generateWord64()));
-      this->idToDataMap.insert(std::make_pair(id, *i));
-
-      BOOST_CHECK_EQUAL(this->index.insert(**i, id), true);
-    }
-
-  BOOST_CHECK_EQUAL(this->index.size(), this->data.size());
-
-  for (typename T::InterestContainer::iterator i = this->interests.begin();
-       i != this->interests.end(); ++i)
-    {
-      std::pair<int64_t, Name> item = this->index.find(i->first);
-
-      BOOST_REQUIRE_GT(item.first, 0);
-      BOOST_REQUIRE(this->idToDataMap.count(item.first) > 0);
-
-      BOOST_TEST_MESSAGE(i->first);
-      BOOST_CHECK_EQUAL(*this->idToDataMap[item.first], *i->second);
-
-      BOOST_CHECK_EQUAL(this->index.hasData(*i->second), true);
-    }
-
-  // Need support for selector-based removal
-  // for (typename T::RemovalsContainer::iterator i = this->removals.begin();
-  //      i != this->removals.end(); ++i)
-  //   {
-  //     size_t nRemoved = 0;
-  //     BOOST_REQUIRE_NO_THROW(this->index.erase(*i));
-  //     BOOST_CHECK_EQUAL(nRemoved, i->seconds);
-  //   }
-}
-
-BOOST_AUTO_TEST_SUITE_END()
-
-} // namespace tests
-} // namespace repo
diff --git a/tests/unit/repo-command-parameter.cpp b/tests/unit/repo-command-parameter.cpp
index 3e35169..f01832a 100644
--- a/tests/unit/repo-command-parameter.cpp
+++ b/tests/unit/repo-command-parameter.cpp
@@ -19,8 +19,12 @@
 
 #include "repo-command-parameter.hpp"
 
-#include <ndn-cxx/selectors.hpp>
+#include "common.hpp"
 
+#include <ndn-cxx/encoding/block.hpp>
+#include <ndn-cxx/encoding/block-helpers.hpp>
+
+#include <boost/lexical_cast.hpp>
 #include <boost/test/unit_test.hpp>
 
 namespace repo {
@@ -35,33 +39,21 @@
   parameter.setStartBlockId(1);
   parameter.setEndBlockId(100);
   parameter.setProcessId(1234567890);
-  ndn::Selectors selectors;
-  selectors.setMaxSuffixComponents(1);
-  parameter.setSelectors(selectors);
 
-  ndn::Block wire = parameter.wireEncode();
+  Block wire = parameter.wireEncode();
 
   // These octets are obtained by the snippet below.
   // This check is intended to detect unexpected encoding change in the future.
-  //for (auto it = wire.begin(); it != wire.end(); ++it) {
-  //  printf("0x%02x, ", *it);
-  //}
-  static const uint8_t expected[] = {
-    0xc9, 0x1c, 0x07, 0x09, 0x08, 0x01, 0x61, 0x08, 0x01, 0x62, 0x08,
-    0x01, 0x63, 0x09, 0x03, 0x0e, 0x01, 0x01, 0xcc, 0x01, 0x01, 0xcd,
-    0x01, 0x64, 0xce, 0x04, 0x49, 0x96, 0x02, 0xd2
-  };
+  // Construct a \c Block from hexadecimal \p input.
+  Block expected = "C917 0709080161080162080163CC0101CD0164CE04499602D2"_block;
 
-  BOOST_REQUIRE_EQUAL_COLLECTIONS(expected, expected + sizeof(expected),
-                                  wire.begin(), wire.end());
+  BOOST_CHECK_EQUAL(wire, expected);
 
   repo::RepoCommandParameter decoded(wire);
   BOOST_CHECK_EQUAL(decoded.getName(), parameter.getName());
   BOOST_CHECK_EQUAL(decoded.getStartBlockId(), parameter.getStartBlockId());
   BOOST_CHECK_EQUAL(decoded.getEndBlockId(), parameter.getEndBlockId());
   BOOST_CHECK_EQUAL(decoded.getProcessId(), parameter.getProcessId());
-  BOOST_CHECK_EQUAL(decoded.getSelectors().getMaxSuffixComponents(),
-                    parameter.getSelectors().getMaxSuffixComponents());
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/unit/repo-command-response.cpp b/tests/unit/repo-command-response.cpp
index 7686c50..057b180 100644
--- a/tests/unit/repo-command-response.cpp
+++ b/tests/unit/repo-command-response.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) 2018, Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -19,6 +19,8 @@
 
 #include "repo-command-response.hpp"
 
+#include "common.hpp"
+
 #include <boost/test/unit_test.hpp>
 
 namespace repo {
@@ -36,21 +38,15 @@
   response.setInsertNum(100);
   response.setDeleteNum(100);
 
-  ndn::Block wire = response.wireEncode();
+  Block wire = response.wireEncode();
 
   // These octets are obtained by the snippet below.
   // This check is intended to detect unexpected encoding change in the future.
-  //for (auto it = wire.begin(); it != wire.end(); ++it) {
-  //  printf("0x%02x, ", *it);
-  //}
-  static const uint8_t expected[] = {
-    0xcf, 0x16, 0xce, 0x04, 0x49, 0x96, 0x02, 0xd2, 0xd0, 0x02,
-    0x01, 0x94, 0xcc, 0x01, 0x01, 0xcd, 0x01, 0x64, 0xd1, 0x01,
-    0x64, 0xd2, 0x01, 0x64
-  };
+  // Construct a \c Block from hexadecimal \p input.
 
-  BOOST_REQUIRE_EQUAL_COLLECTIONS(expected, expected + sizeof(expected),
-                                  wire.begin(), wire.end());
+  Block expected = "CF16 CE04499602D2D0020194CC0101CD0164D10164D20164"_block;
+
+  BOOST_CHECK_EQUAL(wire, expected);
 
   repo::RepoCommandResponse decoded(wire);
   BOOST_CHECK_EQUAL(decoded.getCode(), response.getCode());
diff --git a/tests/unit/repo-storage.cpp b/tests/unit/repo-storage.cpp
index 1caecf1..0458c23 100644
--- a/tests/unit/repo-storage.cpp
+++ b/tests/unit/repo-storage.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-2018, Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -37,41 +37,31 @@
 {
 };
 
-// Combine CommonDatasets with ComplexSelectorDataset
-typedef boost::mpl::push_back<CommonDatasets,
-                              ComplexSelectorsDataset>::type Datasets;
 
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(Bulk, T, Datasets, Fixture<T>)
+BOOST_FIXTURE_TEST_CASE_TEMPLATE(Bulk, T, CommonDatasets, Fixture<T>)
 {
-  // typedef ComplexSelectorsDataset T;
   BOOST_TEST_MESSAGE(T::getName());
 
   // Insert data into repo
-  for (typename T::DataContainer::iterator i = this->data.begin();
-       i != this->data.end(); ++i)
-    {
-      BOOST_CHECK_EQUAL(this->handle->insertData(**i), true);
-    }
+  for (auto i = this->data.begin(); i != this->data.end(); ++i) {
+    BOOST_CHECK_EQUAL(this->handle->insertData(**i), true);
+  }
 
   // check size directly with the storage (repo doesn't have interface yet)
   BOOST_CHECK_EQUAL(this->store->size(), static_cast<int64_t>(this->data.size()));
 
   // Read
-  for (typename T::InterestContainer::iterator i = this->interests.begin();
-       i != this->interests.end(); ++i)
-  {
-      shared_ptr<ndn::Data> dataTest = this->handle->readData(i->first);
-      BOOST_CHECK_EQUAL(*this->handle->readData(i->first), *i->second);
-    }
+  for (auto i = this->interests.begin(); i != this->interests.end(); ++i) {
+    std::shared_ptr<ndn::Data> dataTest = this->handle->readData(i->first);
+    BOOST_CHECK_EQUAL(*dataTest, *i->second);
+  }
 
   // Remove items
-  for (typename T::RemovalsContainer::iterator i = this->removals.begin();
-       i != this->removals.end(); ++i)
-    {
-      size_t nRemoved = 0;
-      BOOST_REQUIRE_NO_THROW(nRemoved = this->handle->deleteData(i->first));
-      BOOST_CHECK_EQUAL(nRemoved, i->second);
-    }
+  for (auto i = this->removals.begin(); i != this->removals.end(); ++i) {
+    size_t nRemoved = 0;
+    nRemoved = this->handle->deleteData(i->first);
+    BOOST_CHECK_EQUAL(nRemoved, i->second);
+  }
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/unit/sqlite-handle.cpp b/tests/unit/sqlite-handle.cpp
index ca7c7dd..9cfb0bf 100644
--- a/tests/unit/sqlite-handle.cpp
+++ b/tests/unit/sqlite-handle.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-2018, Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -34,40 +34,40 @@
 class Fixture : public SqliteFixture, public Dataset
 {
 public:
-  std::map<int64_t, shared_ptr<Data>> idToDataMap;
+  std::map<Name, std::shared_ptr<Data>> nameToDataMap;
 };
 
 BOOST_FIXTURE_TEST_CASE_TEMPLATE(InsertReadDelete, T, CommonDatasets, Fixture<T>)
 {
   BOOST_TEST_CHECKPOINT(T::getName());
 
-  std::vector<int64_t> ids;
+  std::vector<Name> names;
 
   // Insert
-  for (typename T::DataContainer::iterator i = this->data.begin();
+  for (auto i = this->data.begin();
        i != this->data.end(); ++i) {
-    int64_t id = -1;
-    BOOST_REQUIRE_NO_THROW(id = this->handle->insert(**i));
-
-    this->idToDataMap.insert(std::make_pair(id, *i));
-    ids.push_back(id);
+    Name name = Name();
+    this->handle->insert(**i);
+    name = (*i)->getFullName();
+    this->nameToDataMap.insert(std::make_pair(name, *i));
+    names.push_back(name);
   }
   BOOST_CHECK_EQUAL(this->handle->size(), static_cast<int64_t>(this->data.size()));
 
   std::mt19937 rng{std::random_device{}()};
-  std::shuffle(ids.begin(), ids.end(), rng);
+  std::shuffle(names.begin(), names.end(), rng);
 
   // Read (all items should exist)
-  for (std::vector<int64_t>::iterator i = ids.begin(); i != ids.end(); ++i) {
-    shared_ptr<Data> retrievedData = this->handle->read(*i);
+  for (auto i = names.begin(); i != names.end(); ++i) {
+    std::shared_ptr<Data> retrievedData = this->handle->read(*i);
 
-    BOOST_REQUIRE(this->idToDataMap.count(*i) > 0);
-    BOOST_CHECK_EQUAL(*this->idToDataMap[*i], *retrievedData);
+    BOOST_REQUIRE(this->nameToDataMap.count(*i) > 0);
+    BOOST_CHECK_EQUAL(*this->nameToDataMap[*i], *retrievedData);
   }
   BOOST_CHECK_EQUAL(this->handle->size(), static_cast<int64_t>(this->data.size()));
 
   // Delete
-  for (std::vector<int64_t>::iterator i = ids.begin(); i != ids.end(); ++i) {
+  for (auto i = names.begin(); i != names.end(); ++i) {
     BOOST_CHECK_EQUAL(this->handle->erase(*i), true);
   }
 
diff --git a/tests/unit/tcp-bulk-insert-handle.cpp b/tests/unit/tcp-bulk-insert-handle.cpp
index f35a42f..48ec17d 100644
--- a/tests/unit/tcp-bulk-insert-handle.cpp
+++ b/tests/unit/tcp-bulk-insert-handle.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-2018,  Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -57,17 +57,16 @@
     ip::tcp::endpoint serverEndpoint = *endpoint;
 
     socket.async_connect(serverEndpoint,
-                         bind(&TcpClient::onSuccessfullConnect, this, _1));
+                         std::bind(&TcpClient::onSuccessfullConnect, this, _1));
   }
 
   virtual void
   onSuccessfullConnect(const boost::system::error_code& error)
   {
-    if (error)
-      {
-        BOOST_FAIL("TCP connection aborted");
-        return;
-      }
+    if (error) {
+      BOOST_FAIL("TCP connection aborted");
+      return;
+    }
   }
 
 public:
@@ -86,7 +85,7 @@
     , bulkInserter(ioService, *handle)
   {
     guardEvent = scheduler.scheduleEvent(ndn::time::seconds(2),
-                                         bind(&TcpBulkInsertFixture::fail, this, "Test timed out"));
+                                         std::bind(&TcpBulkInsertFixture::fail, this, "Test timed out"));
   }
 
   virtual void
@@ -102,15 +101,12 @@
     // described in http://www.boost.org/doc/libs/1_48_0/doc/html/boost_asio/overview/implementation.html,
     // scatter-gather is limited to at most `min(64,IOV_MAX)` buffers to be transmitted
     // in a single operation
-    for (typename Dataset::DataContainer::iterator i = this->data.begin();
-         i != this->data.end(); ++i) {
+    for (auto i = this->data.begin(); i != this->data.end(); ++i) {
 
-      socket.async_send(boost::asio::buffer((*i)->wireEncode().wire(),  (*i)->wireEncode().size()),
-                        bind(&TcpBulkInsertFixture::onSendFinished, this, _1, false));
+      socket.async_send(boost::asio::buffer((*i)->wireEncode().wire(), (*i)->wireEncode().size()),
+                        std::bind(&TcpBulkInsertFixture::onSendFinished, this, _1, false));
     }
-
-    socket.async_send(boost::asio::buffer(static_cast<const uint8_t*>(0), 0),
-                      bind(&TcpBulkInsertFixture::onSendFinished, this, _1, true));
+    onSendFinished(error, true);
   }
 
   void
@@ -127,7 +123,7 @@
       // In case there are some outstanding handlers
       // ioService.post(bind(&TcpBulkInsertFixture::stop, this));
       scheduler.scheduleEvent(ndn::time::seconds(1),
-                              bind(&TcpBulkInsertFixture::stop, this));
+                              std::bind(&TcpBulkInsertFixture::stop, this));
     }
   }
 
@@ -170,9 +166,8 @@
   this->ioService.run();
 
   // Read (all items should exist)
-  for (typename T::InterestContainer::iterator i = this->interests.begin();
-       i != this->interests.end(); ++i) {
-      BOOST_CHECK_EQUAL(*this->handle->readData(i->first), *i->second);
+  for (auto i = this->interests.begin(); i != this->interests.end(); ++i) {
+    BOOST_CHECK_EQUAL(*this->handle->readData(i->first), *i->second);
   }
 }
 
