diff --git a/tests/rib/auto-prefix-propagator.t.cpp b/tests/rib/auto-prefix-propagator.t.cpp
deleted file mode 100644
index f33c7ae..0000000
--- a/tests/rib/auto-prefix-propagator.t.cpp
+++ /dev/null
@@ -1,684 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2018,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD 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.
- *
- * NFD 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
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "rib/auto-prefix-propagator.hpp"
-
-#include "tests/identity-management-fixture.hpp"
-
-#include <ndn-cxx/security/pib/pib.hpp>
-#include <ndn-cxx/util/dummy-client-face.hpp>
-
-namespace nfd {
-namespace rib {
-namespace tests {
-
-using namespace nfd::tests;
-
-const Name TEST_LINK_LOCAL_NFD_PREFIX("/localhop/nfd");
-const time::milliseconds TEST_PREFIX_PROPAGATION_TIMEOUT(1000);
-
-class AutoPrefixPropagatorFixture : public IdentityManagementTimeFixture
-{
-public:
-  AutoPrefixPropagatorFixture()
-    : m_face(g_io, m_keyChain, {true, true})
-    , m_scheduler(g_io)
-    , m_controller(m_face, m_keyChain)
-    , m_propagator(m_controller, m_keyChain, m_scheduler, m_rib)
-    , m_requests(m_face.sentInterests)
-    , m_entries(m_propagator.m_propagatedEntries)
-  {
-    m_propagator.enable();
-    m_propagator.m_controlParameters
-      .setCost(15)
-      .setOrigin(ndn::nfd::ROUTE_ORIGIN_CLIENT)// set origin to client.
-      .setFaceId(0);// the remote hub will take the input face as the faceId.
-    m_propagator.m_commandOptions
-      .setPrefix(TEST_LINK_LOCAL_NFD_PREFIX)
-      .setTimeout(TEST_PREFIX_PROPAGATION_TIMEOUT);
-  }
-
-public: // helpers for test
-  bool
-  insertEntryToRib(const Name& name, const uint64_t& faceId = 0)
-  {
-    if (m_rib.find(name) != m_rib.end()) {
-      BOOST_TEST_MESSAGE("RIB entry already exists: " + name.toUri());
-      return false;
-    }
-
-    Route route;
-    route.faceId = faceId;
-    m_rib.insert(name, route);
-    advanceClocks(time::milliseconds(1));
-
-    return m_rib.find(name) != m_rib.end(); // return whether afterInserEntry will be triggered
-  }
-
-  bool
-  eraseEntryFromRib(const Name& name)
-  {
-    if (m_rib.find(name) == m_rib.end()) {
-      BOOST_TEST_MESSAGE("RIB entry does not exist: " + name.toUri());
-      return false;
-    }
-
-    std::vector<Route> routeList;
-    std::copy(m_rib.find(name)->second->begin(), m_rib.find(name)->second->end(),
-              std::back_inserter(routeList));
-    for (auto&& route : routeList) {
-      m_rib.erase(name, route);
-    }
-    advanceClocks(time::milliseconds(1));
-
-    return m_rib.find(name) == m_rib.end(); // return whether afterEraseEntry will be triggered
-  }
-
-  void
-  connectToHub()
-  {
-    insertEntryToRib("/localhop/nfd");
-  }
-
-  void
-  disconnectFromHub()
-  {
-    eraseEntryFromRib("/localhop/nfd");
-  }
-
-public: // helpers for check
-  enum class CheckRequestResult {
-    OK,
-    OUT_OF_BOUNDARY,
-    INVALID_N_COMPONENTS,
-    WRONG_COMMAND_PREFIX,
-    WRONG_VERB,
-    INVALID_PARAMETERS,
-    WRONG_REGISTERING_PREFIX
-  };
-
-  /**
-   * @brief check a request at specified index
-   *
-   * @param idx the index of the specified request in m_requests
-   * @param verb the expected verb of request
-   * @param registeringPrefix the expected registering prefix of request
-
-   * @retval OK the specified request has a valid name, the right verb, a valid ControlParameters
-   *            and the right registering prefix
-   * @retval OUT_OF_BOUNDARY the specified index out of boundary
-   * @retval INVALID_N_COMPONENTS the number of components of the request name is invalid
-   * @retval WRONG_COMMAND_PREFIX the command prefix of the request is wrong
-   * @retval WRONG_VERB the command verb of the request is wrong
-   * @retval INVALID_PARAMETERS no valid parameters can be decoded from the request's name
-   * @retval WRONG_REGISTERING_PREFIX the registering prefix of the request is wrong
-   */
-  CheckRequestResult
-  checkRequest(size_t idx, const std::string& verb, const Name& registeringPrefix)
-  {
-    Name requestName;
-    try {
-      requestName = m_requests.at(idx).getName();
-    }
-    catch (const std::out_of_range&) {
-      return CheckRequestResult::OUT_OF_BOUNDARY;
-    }
-
-    if (requestName.size() < 5) {
-      return CheckRequestResult::INVALID_N_COMPONENTS;
-    }
-
-    if (requestName.getPrefix(2) != TEST_LINK_LOCAL_NFD_PREFIX) {
-      return CheckRequestResult::WRONG_COMMAND_PREFIX;
-    }
-
-    if (requestName.get(3) != Name::Component(verb)) {
-      return CheckRequestResult::WRONG_VERB;
-    }
-
-    ControlParameters parameters;
-    try {
-      parameters.wireDecode(requestName.get(4).blockFromValue());
-    }
-    catch (const tlv::Error&) {
-      return CheckRequestResult::INVALID_PARAMETERS;
-    }
-
-    if (parameters.getName() != registeringPrefix) {
-      return CheckRequestResult::WRONG_REGISTERING_PREFIX;
-    }
-
-    return CheckRequestResult::OK;
-  }
-
-protected:
-  ndn::util::DummyClientFace m_face;
-  ndn::util::Scheduler m_scheduler;
-  ndn::nfd::Controller m_controller;
-  Rib m_rib;
-  AutoPrefixPropagator m_propagator;
-  std::vector<Interest>& m_requests; ///< store sent out requests
-  AutoPrefixPropagator::PropagatedEntryList& m_entries; ///< store propagated entries
-};
-
-std::ostream&
-operator<<(std::ostream &os, const AutoPrefixPropagatorFixture::CheckRequestResult& result)
-{
-  switch (result) {
-  case AutoPrefixPropagatorFixture::CheckRequestResult::OK:
-    os << "OK";
-    break;
-  case AutoPrefixPropagatorFixture::CheckRequestResult::OUT_OF_BOUNDARY:
-    os << "OUT_OF_BOUNDARY";
-    break;
-  case AutoPrefixPropagatorFixture::CheckRequestResult::INVALID_N_COMPONENTS:
-    os << "INVALID_N_COMPONENTS";
-    break;
-  case AutoPrefixPropagatorFixture::CheckRequestResult::WRONG_COMMAND_PREFIX:
-    os << "WRONG_COMMAND_PREFIX";
-    break;
-  case AutoPrefixPropagatorFixture::CheckRequestResult::WRONG_VERB:
-    os << "WRONG_VERB";
-    break;
-  case AutoPrefixPropagatorFixture::CheckRequestResult::INVALID_PARAMETERS:
-    os << "INVALID_PARAMETERS";
-    break;
-  case AutoPrefixPropagatorFixture::CheckRequestResult::WRONG_REGISTERING_PREFIX:
-    os << "WRONG_REGISTERING_PREFIX";
-    break;
-  default:
-    break;
-  }
-
-  return os;
-}
-
-BOOST_FIXTURE_TEST_SUITE(TestAutoPrefixPropagator, AutoPrefixPropagatorFixture)
-
-BOOST_AUTO_TEST_CASE(EnableDisable)
-{
-  connectToHub();
-  BOOST_REQUIRE(addIdentity("/test/A"));
-
-  auto testPropagateRevokeBasic = [this] () -> bool {
-    m_propagator.m_propagatedEntries.clear();
-
-    if (!insertEntryToRib("/test/A/app")) {
-      return false;
-    }
-    m_entries["/test/A"].succeed(m_scheduler, nullptr);
-    if (!eraseEntryFromRib("/test/A/app")) {
-      return false;
-    }
-    return true;
-  };
-
-  m_propagator.disable();
-  BOOST_REQUIRE(testPropagateRevokeBasic());
-  BOOST_CHECK(m_requests.empty());
-
-  m_propagator.enable();
-  BOOST_REQUIRE(testPropagateRevokeBasic());
-  BOOST_REQUIRE_EQUAL(m_requests.size(), 2);
-  BOOST_CHECK_EQUAL(checkRequest(0, "register", "/test/A"), CheckRequestResult::OK);
-  BOOST_CHECK_EQUAL(checkRequest(1, "unregister", "/test/A"), CheckRequestResult::OK);
-}
-
-BOOST_AUTO_TEST_CASE(LoadConfiguration)
-{
-  ConfigFile config;
-  config.addSectionHandler("auto_prefix_propagate",
-                           bind(&AutoPrefixPropagator::loadConfig, &m_propagator, _1));
-
-  const std::string CONFIG_STRING =
-    "auto_prefix_propagate\n"
-    "{\n"
-    "  cost 11\n"
-    "  timeout 22\n"
-    "  refresh_interval 33\n"
-    "  base_retry_wait 44\n"
-    "  max_retry_wait 55\n"
-    "}";
-  config.parse(CONFIG_STRING, true, "test-auto-prefix-propagator");
-
-  BOOST_CHECK_EQUAL(m_propagator.m_controlParameters.getCost(), 11);
-  BOOST_CHECK_EQUAL(m_propagator.m_controlParameters.getOrigin(), ndn::nfd::ROUTE_ORIGIN_CLIENT);
-  BOOST_CHECK_EQUAL(m_propagator.m_controlParameters.getFaceId(), 0);
-
-  BOOST_CHECK_EQUAL(m_propagator.m_commandOptions.getPrefix(), TEST_LINK_LOCAL_NFD_PREFIX);
-  BOOST_CHECK_EQUAL(m_propagator.m_commandOptions.getTimeout(), time::milliseconds(22));
-
-  BOOST_CHECK_EQUAL(m_propagator.m_refreshInterval, time::seconds(33));
-  BOOST_CHECK_EQUAL(m_propagator.m_baseRetryWait, time::seconds(44));
-  BOOST_CHECK_EQUAL(m_propagator.m_maxRetryWait, time::seconds(55));
-}
-
-BOOST_AUTO_TEST_CASE(GetPrefixPropagationParameters)
-{
-  BOOST_REQUIRE(addIdentity("/test/A"));
-  BOOST_REQUIRE(addIdentity("/test/A/B"));
-  BOOST_REQUIRE(addIdentity("/test/C/nrd"));
-
-  auto parameters1 = m_propagator.getPrefixPropagationParameters("/none/A/B/app");
-  auto parameters2 = m_propagator.getPrefixPropagationParameters("/test/A/B/app");
-  auto parameters3 = m_propagator.getPrefixPropagationParameters("/test/C/D/app");
-
-  BOOST_CHECK(!parameters1.isValid);
-
-  BOOST_CHECK(parameters2.isValid);
-  BOOST_CHECK_EQUAL(parameters2.parameters.getName(), "/test/A");
-  BOOST_CHECK_EQUAL(parameters2.options.getSigningInfo().getSignerName(), "/test/A");
-
-  BOOST_CHECK(parameters3.isValid);
-  BOOST_CHECK_EQUAL(parameters3.parameters.getName(), "/test/C");
-  BOOST_CHECK_EQUAL(parameters3.options.getSigningInfo().getSignerName(), "/test/C/nrd");
-}
-
-BOOST_AUTO_TEST_CASE(CheckCurrentPropagatedPrefix)
-{
-  BOOST_REQUIRE(addIdentity("/test/A"));
-  BOOST_REQUIRE(addIdentity("/test/B/nrd"));
-  BOOST_REQUIRE(addIdentity("/test/A/B"));
-
-  BOOST_CHECK(!m_propagator.doesCurrentPropagatedPrefixWork("/test/E")); // does not exist
-  BOOST_CHECK(!m_propagator.doesCurrentPropagatedPrefixWork("/test/A/B")); // has a better option
-  BOOST_CHECK(m_propagator.doesCurrentPropagatedPrefixWork("/test/A"));
-  BOOST_CHECK(m_propagator.doesCurrentPropagatedPrefixWork("/test/B"));
-}
-
-BOOST_AUTO_TEST_CASE(RedoPropagation)
-{
-  connectToHub();
-  BOOST_REQUIRE(addIdentity("/test/A"));
-  BOOST_REQUIRE(addIdentity("/test/B"));
-  BOOST_REQUIRE(addIdentity("/test/B/C"));
-  BOOST_REQUIRE(insertEntryToRib("/test/A/app"));
-  BOOST_REQUIRE(insertEntryToRib("/test/B/C/app"));
-  BOOST_REQUIRE(insertEntryToRib("/test/B/D/app"));
-
-  auto testRedoPropagation = [this] (const Name& signingIdentity) {
-    m_requests.clear();
-
-    m_entries[signingIdentity].setSigningIdentity(signingIdentity);
-
-    auto parameters = m_propagator.m_controlParameters;
-    auto options = m_propagator.m_commandOptions;
-    ndn::security::SigningInfo info(ndn::security::SigningInfo::SIGNER_TYPE_ID, signingIdentity);
-    m_propagator.redoPropagation(m_entries.find(signingIdentity),
-                                  parameters.setName(signingIdentity),
-                                  options.setSigningInfo(info),
-                                  time::seconds(0));
-    advanceClocks(time::milliseconds(1));
-  };
-
-  testRedoPropagation("/test/A"); // current propagated prefix still works
-  BOOST_REQUIRE_EQUAL(m_requests.size(), 1);
-  BOOST_CHECK_EQUAL(checkRequest(0, "register", "/test/A"), CheckRequestResult::OK);
-  BOOST_CHECK(m_entries.find("test/A") != m_entries.end());
-
-  m_keyChain.deleteIdentity(m_keyChain.getPib().getIdentity("/test/B"));
-  testRedoPropagation("/test/B"); // signingIdentity no longer exists
-  BOOST_REQUIRE_EQUAL(m_requests.size(), 1);
-  BOOST_CHECK_EQUAL(checkRequest(0, "register", "/test/B/C"), CheckRequestResult::OK);
-  BOOST_CHECK(m_entries.find("/test/B") == m_entries.end());
-  BOOST_CHECK(m_entries.find("/test/B/C") != m_entries.end());
-
-  testRedoPropagation("/test/B"); // no alternative identity
-  BOOST_CHECK(m_requests.empty());
-  BOOST_CHECK(m_entries.find("/test/B") == m_entries.end());
-
-  m_entries["/test/B/C"].succeed(m_scheduler, nullptr);
-  testRedoPropagation("/test/B"); // alternative identity has been propagated
-  BOOST_CHECK(m_requests.empty());
-  BOOST_CHECK(m_entries.find("/test/B") == m_entries.end());
-
-  BOOST_REQUIRE(addIdentity("/test/B/"));
-  testRedoPropagation("/test/B/C"); // better option exists: /test/B
-  BOOST_REQUIRE_EQUAL(m_requests.size(), 1);
-  BOOST_CHECK_EQUAL(checkRequest(0, "register", "/test/B"), CheckRequestResult::OK);
-  BOOST_CHECK(m_entries.find("test/B/C") == m_entries.end());
-}
-
-BOOST_AUTO_TEST_SUITE(PropagateRevokeSemantics)
-
-BOOST_AUTO_TEST_CASE(Basic)
-{
-  connectToHub(); // ensure connectivity to the hub
-  BOOST_REQUIRE(addIdentity("/test/A"));
-
-  BOOST_REQUIRE(insertEntryToRib("/test/A/app")); // ensure afterInsertEntry signal emitted
-  m_entries["/test/A"].succeed(m_scheduler, nullptr); // ensure there is a valid entry inserted
-  BOOST_REQUIRE(eraseEntryFromRib("/test/A/app")); // ensure afterEraseEntry signal emitted
-
-  BOOST_REQUIRE_EQUAL(m_requests.size(), 2);
-  BOOST_CHECK_EQUAL(checkRequest(0, "register", "/test/A"), CheckRequestResult::OK);
-  BOOST_CHECK_EQUAL(checkRequest(1, "unregister", "/test/A"), CheckRequestResult::OK);
-}
-
-BOOST_AUTO_TEST_CASE(LocalPrefix)
-{
-  connectToHub();
-  BOOST_REQUIRE(addIdentity("/localhost/A"));
-
-  BOOST_REQUIRE(insertEntryToRib("/localhost/A/app"));
-  BOOST_CHECK(m_requests.empty());
-
-  m_propagator.m_propagatedEntries["/localhost/A"].succeed(m_scheduler, nullptr);
-  BOOST_REQUIRE(eraseEntryFromRib("/localhost/A/app"));
-  BOOST_CHECK(m_requests.empty());
-}
-
-BOOST_AUTO_TEST_CASE(InvalidPropagationParameters)
-{
-  connectToHub();
-
-  // no identity can be found
-  BOOST_CHECK(!m_propagator.getPrefixPropagationParameters("/test/A/app").isValid);
-
-  BOOST_REQUIRE(insertEntryToRib("/test/A/app"));
-  BOOST_CHECK(m_requests.empty());
-
-  m_entries["/test/A"].succeed(m_scheduler, nullptr);
-  BOOST_REQUIRE(eraseEntryFromRib("/test/A/app"));
-  BOOST_CHECK(m_requests.empty());
-}
-
-BOOST_AUTO_TEST_CASE(NoHubConnectivity)
-{
-  BOOST_REQUIRE(addIdentity("/test/A"));
-
-  BOOST_REQUIRE(insertEntryToRib("/test/A/app"));
-  BOOST_CHECK(m_requests.empty());
-
-  m_entries["/test/A"].succeed(m_scheduler, nullptr);
-  BOOST_REQUIRE(eraseEntryFromRib("/test/A/app"));
-  BOOST_CHECK(m_requests.empty());
-}
-
-BOOST_AUTO_TEST_CASE(ProcessSuspendedEntries)
-{
-  BOOST_REQUIRE(addIdentity("/test/A"));
-
-  BOOST_REQUIRE(insertEntryToRib("/test/A/app1"));
-  BOOST_REQUIRE(insertEntryToRib("/test/A/app2"));
-  BOOST_CHECK(m_requests.empty()); // no propagation because no hub is connected
-  BOOST_CHECK_EQUAL(m_entries.size(), 1); // /test/A was suspended
-
-  BOOST_REQUIRE(eraseEntryFromRib("/test/A/app2"));
-  BOOST_CHECK_EQUAL(m_entries.size(), 1); // /test/A was kept for app1
-
-  // repeat the scenario that leads to BUG 3362.
-  // ensure there is no improper assertion.
-  BOOST_REQUIRE(insertEntryToRib("/test/A/app2"));
-}
-
-BOOST_AUTO_TEST_CASE(PropagatedEntryExists)
-{
-  connectToHub();
-  BOOST_REQUIRE(addIdentity("/test/A"));
-  BOOST_REQUIRE(insertEntryToRib("/test/A/app1"));
-
-  m_requests.clear();
-  BOOST_REQUIRE(insertEntryToRib("/test/A/app2")); // /test/A has been propagated by /test/A/app1
-  BOOST_CHECK(m_requests.empty());
-}
-
-BOOST_AUTO_TEST_CASE(PropagatedEntryShouldKeep)
-{
-  connectToHub();
-  BOOST_REQUIRE(addIdentity("/test/A"));
-  BOOST_REQUIRE(insertEntryToRib("/test/A/app1"));
-  BOOST_REQUIRE(insertEntryToRib("/test/A/app2"));
-
-  m_requests.clear();
-  BOOST_REQUIRE(eraseEntryFromRib("/test/A/app2")); // /test/A should be kept for /test/A/app1
-  BOOST_CHECK(m_requests.empty());
-}
-
-BOOST_AUTO_TEST_CASE(BackOffRetryPolicy)
-{
-  m_propagator.m_commandOptions.setTimeout(time::milliseconds(1));
-  m_propagator.m_baseRetryWait = time::seconds(1);
-  m_propagator.m_maxRetryWait = time::seconds(2);
-
-  connectToHub();
-  BOOST_REQUIRE(addIdentity("/test/A"));
-  BOOST_REQUIRE(insertEntryToRib("/test/A/app"));
-
-  BOOST_REQUIRE_EQUAL(m_requests.size(), 1);
-  BOOST_CHECK_EQUAL(checkRequest(0, "register", "/test/A"), CheckRequestResult::OK);
-
-  advanceClocks(time::milliseconds(10), time::milliseconds(1050)); // wait for the 1st retry
-  BOOST_REQUIRE_EQUAL(m_requests.size(), 2);
-  BOOST_CHECK_EQUAL(checkRequest(1, "register", "/test/A"), CheckRequestResult::OK);
-
-  advanceClocks(time::milliseconds(10), time::milliseconds(2050)); // wait for the 2nd retry, 2 times
-  BOOST_REQUIRE_EQUAL(m_requests.size(), 3);
-  BOOST_CHECK_EQUAL(checkRequest(2, "register", "/test/A"), CheckRequestResult::OK);
-
-  advanceClocks(time::milliseconds(10), time::milliseconds(2050)); // wait for the 3rd retry, reach the upper bound
-  BOOST_REQUIRE_EQUAL(m_requests.size(), 4);
-  BOOST_CHECK_EQUAL(checkRequest(3, "register", "/test/A"), CheckRequestResult::OK);
-}
-
-BOOST_AUTO_TEST_SUITE_END() // PropagateRevokeSemantics
-
-BOOST_AUTO_TEST_SUITE(PropagatedEntryStateChanges)
-
-BOOST_AUTO_TEST_CASE(AfterRibInsert)
-{
-  BOOST_REQUIRE(addIdentity("/test/A"));
-
-  auto testAfterRibInsert = [this] (const Name& ribEntryPrefix) {
-    m_requests.clear();
-    m_propagator.m_propagatedEntries.clear(); // ensure entry does not exist
-
-    auto propagateParameters = m_propagator.getPrefixPropagationParameters(ribEntryPrefix);
-    m_propagator.afterRibInsert(propagateParameters.parameters, propagateParameters.options);
-    advanceClocks(time::milliseconds(1));
-  };
-
-  testAfterRibInsert("/test/A/app1");
-  BOOST_CHECK(m_requests.empty()); // no connectivity now
-  BOOST_CHECK(m_entries.find("/test/A") != m_entries.end());
-
-  connectToHub();
-  testAfterRibInsert("/test/A/app2");
-  BOOST_REQUIRE_EQUAL(m_requests.size(), 1);
-  BOOST_CHECK_EQUAL(checkRequest(0, "register", "/test/A"), CheckRequestResult::OK);
-  BOOST_CHECK(m_entries.find("/test/A") != m_entries.end());
-}
-
-BOOST_AUTO_TEST_CASE(AfterRibErase)
-{
-  BOOST_REQUIRE(addIdentity("/test/A"));
-
-  auto testAfterRibInsert = [this] (const Name& localUnregPrefix) {
-    m_requests.clear();
-
-    auto propagateParameters = m_propagator.getPrefixPropagationParameters(localUnregPrefix);
-    m_propagator.afterRibErase(propagateParameters.parameters.unsetCost(),
-                               propagateParameters.options);
-    advanceClocks(time::milliseconds(1));
-  };
-
-  m_entries["/test/A"].succeed(m_scheduler, nullptr);
-  testAfterRibInsert("/test/A/app");
-  BOOST_CHECK(m_requests.empty()); // no connectivity
-  BOOST_CHECK(m_entries.find("/test/A") == m_entries.end()); // has been erased
-
-  connectToHub();
-  m_entries["/test/A"].fail(m_scheduler, nullptr);
-  testAfterRibInsert("/test/A/app");
-  BOOST_CHECK(m_requests.empty()); // previous propagation has not succeeded
-  BOOST_CHECK(m_entries.find("/test/A") == m_entries.end()); // has been erased
-
-  m_entries["/test/A"].succeed(m_scheduler, nullptr);
-  testAfterRibInsert("/test/A/app");
-  BOOST_REQUIRE_EQUAL(m_requests.size(), 1);
-  BOOST_CHECK_EQUAL(checkRequest(0, "unregister", "/test/A"), CheckRequestResult::OK);
-  BOOST_CHECK(m_entries.find("/test/A") == m_entries.end()); // has been erased
-}
-
-BOOST_AUTO_TEST_CASE(AfterHubConnectDisconnect)
-{
-  BOOST_REQUIRE(addIdentity("/test/A"));
-  BOOST_REQUIRE(addIdentity("/test/B"));
-  BOOST_REQUIRE(addIdentity("/test/C"));
-  BOOST_REQUIRE(insertEntryToRib("/test/A/app"));
-  BOOST_REQUIRE(insertEntryToRib("/test/B/app"));
-
-  // recorder the prefixes that will be propagated in order
-  std::vector<Name> propagatedPrefixes;
-
-  BOOST_CHECK(m_requests.empty()); // no request because there is no connectivity to the hub now
-  BOOST_REQUIRE_EQUAL(m_entries.size(), 2); // valid entries will be kept
-
-  connectToHub(); // 2 cached entries will be processed
-  for (auto&& entry : m_entries) {
-    propagatedPrefixes.push_back(entry.first);
-  }
-
-  BOOST_REQUIRE(insertEntryToRib("/test/C/app")); // will be processed directly
-  propagatedPrefixes.push_back("/test/C");
-  BOOST_REQUIRE_EQUAL(m_entries.size(), 3);
-
-  BOOST_REQUIRE(m_entries["/test/A"].isPropagating());
-  BOOST_REQUIRE(m_entries["/test/B"].isPropagating());
-  BOOST_REQUIRE(m_entries["/test/C"].isPropagating());
-
-  disconnectFromHub(); // all 3 entries are initialized
-  BOOST_CHECK(m_entries["/test/A"].isNew());
-  BOOST_CHECK(m_entries["/test/B"].isNew());
-  BOOST_CHECK(m_entries["/test/C"].isNew());
-
-  connectToHub(); // all 3 entries will be processed
-  for (auto&& entry : m_entries) {
-    propagatedPrefixes.push_back(entry.first);
-  }
-
-  BOOST_REQUIRE_EQUAL(m_requests.size(), 6);
-  BOOST_REQUIRE_EQUAL(propagatedPrefixes.size(), 6);
-  BOOST_CHECK_EQUAL(checkRequest(0, "register", propagatedPrefixes[0]), CheckRequestResult::OK);
-  BOOST_CHECK_EQUAL(checkRequest(1, "register", propagatedPrefixes[1]), CheckRequestResult::OK);
-  BOOST_CHECK_EQUAL(checkRequest(2, "register", propagatedPrefixes[2]), CheckRequestResult::OK);
-  BOOST_CHECK_EQUAL(checkRequest(3, "register", propagatedPrefixes[3]), CheckRequestResult::OK);
-  BOOST_CHECK_EQUAL(checkRequest(4, "register", propagatedPrefixes[4]), CheckRequestResult::OK);
-  BOOST_CHECK_EQUAL(checkRequest(5, "register", propagatedPrefixes[5]), CheckRequestResult::OK);
-}
-
-BOOST_AUTO_TEST_CASE(AfterPropagateSucceed)
-{
-  bool wasRefreshEventTriggered = false;
-  auto testAfterPropagateSucceed = [&] (const Name& ribEntryPrefix) {
-    m_requests.clear();
-    wasRefreshEventTriggered = false;
-
-    auto propagateParameters = m_propagator.getPrefixPropagationParameters(ribEntryPrefix);
-    m_propagator.afterPropagateSucceed(propagateParameters.parameters, propagateParameters.options,
-                                       [&]{ wasRefreshEventTriggered = true; });
-    advanceClocks(time::milliseconds(1));
-  };
-
-  BOOST_REQUIRE(addIdentity("/test/A"));
-  m_propagator.m_refreshInterval = time::seconds(0); // event will be executed at once
-  m_entries["/test/A"].startPropagation(); // set to be in PROPAGATING state
-
-  testAfterPropagateSucceed("/test/A/app"); // will trigger refresh event
-  BOOST_CHECK(wasRefreshEventTriggered);
-  BOOST_CHECK(m_requests.empty());
-
-  m_entries.erase(m_entries.find("/test/A")); // set to be in RELEASED state
-  testAfterPropagateSucceed("/test/A/app"); // will call startRevocation
-  BOOST_CHECK(!wasRefreshEventTriggered);
-  BOOST_REQUIRE_EQUAL(m_requests.size(), 1);
-  BOOST_CHECK_EQUAL(checkRequest(0, "unregister", "/test/A"), CheckRequestResult::OK);
-}
-
-BOOST_AUTO_TEST_CASE(AfterPropagateFail)
-{
-  bool wasRetryEventTriggered = false;
-  auto testAfterPropagateFail = [&] (const Name& ribEntryPrefix) {
-    m_requests.clear();
-    wasRetryEventTriggered = false;
-
-    auto propagateParameters = m_propagator.getPrefixPropagationParameters(ribEntryPrefix);
-    m_propagator.afterPropagateFail(ndn::nfd::ControlResponse(400, "test"),
-                                    propagateParameters.parameters, propagateParameters.options,
-                                    time::seconds(0), [&] { wasRetryEventTriggered = true; });
-    advanceClocks(time::milliseconds(1));
-  };
-
-  BOOST_REQUIRE(addIdentity("/test/A"));
-  m_entries["/test/A"].startPropagation(); // set to be in PROPAGATING state
-
-  testAfterPropagateFail("/test/A/app"); // will trigger retry event
-  BOOST_CHECK(wasRetryEventTriggered);
-  BOOST_CHECK(m_requests.empty());
-
-  m_entries.erase(m_entries.find("/test/A")); // set to be in RELEASED state
-  testAfterPropagateFail("/test/A/app"); // will do nothing
-  BOOST_CHECK(!wasRetryEventTriggered);
-  BOOST_CHECK(m_requests.empty());
-}
-
-BOOST_AUTO_TEST_CASE(AfterRevokeSucceed)
-{
-  auto testAfterRevokeSucceed = [&] (const Name& ribEntryPrefix) {
-    m_requests.clear();
-    auto propagateParameters = m_propagator.getPrefixPropagationParameters(ribEntryPrefix);
-    m_propagator.afterRevokeSucceed(propagateParameters.parameters,
-                                    propagateParameters.options,
-                                    time::seconds(0));
-    advanceClocks(time::milliseconds(1));
-  };
-
-  BOOST_REQUIRE(addIdentity("/test/A"));
-
-  testAfterRevokeSucceed("/test/A/app"); // in RELEASED state
-  BOOST_CHECK(m_requests.empty());
-
-  m_entries["/test/A"].fail(m_scheduler, nullptr); // in PROPAGATE_FAIL state
-  testAfterRevokeSucceed("/test/A/app");
-  BOOST_CHECK(m_requests.empty());
-
-  m_entries["/test/A"].succeed(m_scheduler, nullptr); // in PROPAGATED state
-  testAfterRevokeSucceed("/test/A/app");
-  BOOST_REQUIRE_EQUAL(m_requests.size(), 1);
-  BOOST_CHECK_EQUAL(checkRequest(0, "register", "/test/A"), CheckRequestResult::OK);
-
-  m_entries["/test/A"].startPropagation(); // in PROPAGATING state
-  testAfterRevokeSucceed("/test/A/app");
-  BOOST_REQUIRE_EQUAL(m_requests.size(), 1);
-  BOOST_CHECK_EQUAL(checkRequest(0, "register", "/test/A"), CheckRequestResult::OK);
-}
-
-BOOST_AUTO_TEST_SUITE_END() // PropagatedEntryStateChanges
-
-BOOST_AUTO_TEST_SUITE_END() // TestAutoPrefixPropagator
-
-} // namespace tests
-} // namespace rib
-} // namespace nfd
diff --git a/tests/rib/propagated-entry.t.cpp b/tests/rib/propagated-entry.t.cpp
deleted file mode 100644
index b03f153..0000000
--- a/tests/rib/propagated-entry.t.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2018,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD 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.
- *
- * NFD 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
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "rib/propagated-entry.hpp"
-
-#include "tests/test-common.hpp"
-
-namespace nfd {
-namespace rib {
-namespace tests {
-
-BOOST_FIXTURE_TEST_SUITE(TestPropagatedEntry, nfd::tests::BaseFixture)
-
-BOOST_AUTO_TEST_CASE(Identity)
-{
-  PropagatedEntry entry;
-  BOOST_CHECK(entry.m_signingIdentity.empty());
-
-  entry.setSigningIdentity("/test");
-  BOOST_CHECK_EQUAL(entry.m_signingIdentity, "/test");
-  BOOST_CHECK_EQUAL(entry.getSigningIdentity(), "/test");
-}
-
-BOOST_AUTO_TEST_CASE(Start)
-{
-  PropagatedEntry entry;
-  BOOST_CHECK(!entry.isPropagating());
-
-  entry.startPropagation();
-  BOOST_CHECK_EQUAL(PropagationStatus::PROPAGATING, entry.m_propagationStatus);
-  BOOST_CHECK(entry.isPropagating());
-}
-
-BOOST_AUTO_TEST_CASE(Succeed)
-{
-  ndn::util::Scheduler scheduler(g_io);
-  PropagatedEntry entry;
-  entry.succeed(scheduler, nullptr);
-  BOOST_CHECK_EQUAL(PropagationStatus::PROPAGATED, entry.m_propagationStatus);
-  BOOST_CHECK(entry.isPropagated());
-}
-
-BOOST_AUTO_TEST_CASE(Fail)
-{
-  ndn::util::Scheduler scheduler(g_io);
-  PropagatedEntry entry;
-  entry.fail(scheduler, nullptr);
-  BOOST_CHECK_EQUAL(PropagationStatus::PROPAGATE_FAIL, entry.m_propagationStatus);
-  BOOST_CHECK(entry.isPropagateFail());
-}
-
-BOOST_AUTO_TEST_CASE(Initialize)
-{
-  PropagatedEntry entry;
-  entry.startPropagation();
-  BOOST_CHECK_EQUAL(PropagationStatus::PROPAGATING, entry.m_propagationStatus);
-
-  entry.initialize();
-  BOOST_CHECK_EQUAL(PropagationStatus::NEW, entry.m_propagationStatus);
-}
-
-BOOST_AUTO_TEST_SUITE_END() // TestPropagatedEntry
-
-} // namespace tests
-} // namespace rib
-} // namespace nfd
diff --git a/tests/rib/readvertise/host-to-gateway-readvertise-policy.t.cpp b/tests/rib/readvertise/host-to-gateway-readvertise-policy.t.cpp
new file mode 100644
index 0000000..1b357cb
--- /dev/null
+++ b/tests/rib/readvertise/host-to-gateway-readvertise-policy.t.cpp
@@ -0,0 +1,114 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2018,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD 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.
+ *
+ * NFD 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
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "rib/readvertise/host-to-gateway-readvertise-policy.hpp"
+
+#include "tests/identity-management-fixture.hpp"
+
+#include <ndn-cxx/security/signing-helpers.hpp>
+
+namespace nfd {
+namespace rib {
+namespace tests {
+
+using namespace nfd::tests;
+
+class HostToGatewayReadvertisePolicyFixture : public IdentityManagementFixture
+{
+public:
+  RibRouteRef
+  makeNewRoute(const Name& prefix) {
+    auto entry = make_shared<RibEntry>();
+    entry->setName(prefix);
+
+    Route route;
+    auto routeIt = entry->insertRoute(route).first;
+    return RibRouteRef{entry, routeIt};
+  }
+
+  shared_ptr<HostToGatewayReadvertisePolicy>
+  makePolicy(const ConfigSection& section = ConfigSection())
+  {
+    return make_shared<HostToGatewayReadvertisePolicy>(m_keyChain, section);
+  }
+};
+
+BOOST_AUTO_TEST_SUITE(Readvertise)
+BOOST_FIXTURE_TEST_SUITE(TestHostToGatewayReadvertisePolicy,
+                         HostToGatewayReadvertisePolicyFixture)
+
+BOOST_AUTO_TEST_CASE(PrefixToAdvertise)
+{
+  BOOST_REQUIRE(addIdentity("/A"));
+  BOOST_REQUIRE(addIdentity("/A/B"));
+  BOOST_REQUIRE(addIdentity("/C/nrd"));
+
+  auto test = [this] (Name routeName, optional<ReadvertiseAction> expectedAction) {
+    auto policy = makePolicy();
+    auto action = policy->handleNewRoute(makeNewRoute(routeName));
+
+    if (expectedAction) {
+      BOOST_REQUIRE(action);
+      BOOST_CHECK_EQUAL(action->prefix, expectedAction->prefix);
+      BOOST_REQUIRE_EQUAL(action->signer, expectedAction->signer);
+    }
+    else {
+      BOOST_REQUIRE(!action);
+    }
+  };
+
+  test("/D/app", nullopt);
+  test("/A/B/app", ReadvertiseAction{"/A", ndn::security::signingByIdentity("/A")});
+  test("/C/nrd", ReadvertiseAction{"/C", ndn::security::signingByIdentity("/C/nrd")});
+}
+
+BOOST_AUTO_TEST_CASE(DontReadvertise)
+{
+  auto policy = makePolicy();
+  BOOST_REQUIRE(!policy->handleNewRoute(makeNewRoute("/localhost/test")));
+  BOOST_REQUIRE(!policy->handleNewRoute(makeNewRoute("/localhop/nfd")));
+}
+
+BOOST_AUTO_TEST_CASE(LoadRefreshInterval)
+{
+  auto policy = makePolicy();
+  BOOST_CHECK_EQUAL(policy->getRefreshInterval(), time::seconds(25)); // default setting is 25
+
+  ConfigSection section;
+  section.put("refresh_interval_wrong", 10);
+  policy = makePolicy(section);
+  BOOST_CHECK_EQUAL(policy->getRefreshInterval(), time::seconds(25)); // wrong formate
+
+  section.put("refresh_interval", 10);
+  policy = makePolicy(section);
+  BOOST_CHECK_EQUAL(policy->getRefreshInterval(), time::seconds(10));
+}
+
+BOOST_AUTO_TEST_SUITE_END() // TestHostToGatewayReadvertisePolicy
+BOOST_AUTO_TEST_SUITE_END() // Readvertise
+
+} // namespace tests
+} // namespace rib
+} // namespace nfd
diff --git a/tests/rib/readvertise/nfd-rib-readvertise-destination.t.cpp b/tests/rib/readvertise/nfd-rib-readvertise-destination.t.cpp
index 483f94a..48164bd 100644
--- a/tests/rib/readvertise/nfd-rib-readvertise-destination.t.cpp
+++ b/tests/rib/readvertise/nfd-rib-readvertise-destination.t.cpp
@@ -46,9 +46,9 @@
     , face(g_io, m_keyChain, {true, false})
     , scheduler(g_io)
     , controller(face, m_keyChain)
-    , dest(controller, Name("/localhost/nlsr"), rib)
+    , dest(controller, rib, ndn::nfd::CommandOptions().setPrefix("/localhost/nlsr"))
     , successCallback([this] { nSuccessCallbacks++; })
-    , failureCallback([this] (const std::string&) { nFailureCallbacks++; })
+    , failureCallback([this] (const std::string& str) { nFailureCallbacks++; })
   {
   }
 
