mgmt: merge ManagerBase with NfdManagerBase
Refs: #4528
Change-Id: I2ecb4af68927157a9eafc269399855cff192bb54
diff --git a/tests/daemon/mgmt/command-authenticator.t.cpp b/tests/daemon/mgmt/command-authenticator.t.cpp
index 5f55451..fc24ccd 100644
--- a/tests/daemon/mgmt/command-authenticator.t.cpp
+++ b/tests/daemon/mgmt/command-authenticator.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California,
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -25,8 +25,7 @@
#include "mgmt/command-authenticator.hpp"
-#include "tests/test-common.hpp"
-#include "tests/manager-common-fixture.hpp"
+#include "manager-common-fixture.hpp"
#include <boost/filesystem.hpp>
diff --git a/tests/daemon/mgmt/cs-manager.t.cpp b/tests/daemon/mgmt/cs-manager.t.cpp
index 1a485725..50c82b9 100644
--- a/tests/daemon/mgmt/cs-manager.t.cpp
+++ b/tests/daemon/mgmt/cs-manager.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California,
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -25,14 +25,14 @@
#include "mgmt/cs-manager.hpp"
-#include "nfd-manager-common-fixture.hpp"
+#include "manager-common-fixture.hpp"
#include <ndn-cxx/mgmt/nfd/cs-info.hpp>
namespace nfd {
namespace tests {
-class CsManagerFixture : public NfdManagerCommonFixture
+class CsManagerFixture : public ManagerFixtureWithAuthenticator
{
public:
CsManagerFixture()
diff --git a/tests/daemon/mgmt/face-manager-command-fixture.hpp b/tests/daemon/mgmt/face-manager-command-fixture.hpp
index b00b9cc..5864ad2 100644
--- a/tests/daemon/mgmt/face-manager-command-fixture.hpp
+++ b/tests/daemon/mgmt/face-manager-command-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -29,7 +29,7 @@
#include "mgmt/face-manager.hpp"
#include "fw/face-table.hpp"
-#include "tests/manager-common-fixture.hpp"
+#include "manager-common-fixture.hpp"
namespace nfd {
namespace tests {
@@ -50,7 +50,7 @@
public:
ndn::util::DummyClientFace face;
- ndn::mgmt::Dispatcher dispatcher;
+ Dispatcher dispatcher;
shared_ptr<CommandAuthenticator> authenticator;
FaceTable faceTable;
diff --git a/tests/daemon/mgmt/face-manager-create-face.t.cpp b/tests/daemon/mgmt/face-manager-create-face.t.cpp
index 41c68c2..ac42dc9 100644
--- a/tests/daemon/mgmt/face-manager-create-face.t.cpp
+++ b/tests/daemon/mgmt/face-manager-create-face.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California,
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -29,7 +29,6 @@
#include "mgmt/face-manager.hpp"
#include "face/generic-link-service.hpp"
#include "face-manager-command-fixture.hpp"
-#include "nfd-manager-common-fixture.hpp"
namespace nfd {
namespace tests {
diff --git a/tests/daemon/mgmt/face-manager-update-face.t.cpp b/tests/daemon/mgmt/face-manager-update-face.t.cpp
index 15bf6dd..1be0647 100644
--- a/tests/daemon/mgmt/face-manager-update-face.t.cpp
+++ b/tests/daemon/mgmt/face-manager-update-face.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California,
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,7 +26,6 @@
#include "mgmt/face-manager.hpp"
#include "face/generic-link-service.hpp"
#include "face-manager-command-fixture.hpp"
-#include "nfd-manager-common-fixture.hpp"
#include <ndn-cxx/lp/tags.hpp>
diff --git a/tests/daemon/mgmt/face-manager.t.cpp b/tests/daemon/mgmt/face-manager.t.cpp
index cebbfd4..8a418e5 100644
--- a/tests/daemon/mgmt/face-manager.t.cpp
+++ b/tests/daemon/mgmt/face-manager.t.cpp
@@ -26,9 +26,9 @@
#include "mgmt/face-manager.hpp"
#include "face/protocol-factory.hpp"
-#include "nfd-manager-common-fixture.hpp"
-#include "../face/dummy-face.hpp"
-#include "../face/dummy-transport.hpp"
+#include "manager-common-fixture.hpp"
+#include "tests/daemon/face/dummy-face.hpp"
+#include "tests/daemon/face/dummy-transport.hpp"
#include <ndn-cxx/encoding/tlv.hpp>
#include <ndn-cxx/encoding/tlv-nfd.hpp>
@@ -42,7 +42,7 @@
namespace nfd {
namespace tests {
-class FaceManagerFixture : public NfdManagerCommonFixture
+class FaceManagerFixture : public ManagerFixtureWithAuthenticator
{
public:
FaceManagerFixture()
diff --git a/tests/daemon/mgmt/fib-manager.t.cpp b/tests/daemon/mgmt/fib-manager.t.cpp
index 5fd193d..1002e44 100644
--- a/tests/daemon/mgmt/fib-manager.t.cpp
+++ b/tests/daemon/mgmt/fib-manager.t.cpp
@@ -26,8 +26,8 @@
#include "mgmt/fib-manager.hpp"
#include "table/fib-nexthop.hpp"
-#include "nfd-manager-common-fixture.hpp"
-#include "../face/dummy-face.hpp"
+#include "manager-common-fixture.hpp"
+#include "tests/daemon/face/dummy-face.hpp"
#include <ndn-cxx/lp/tags.hpp>
#include <ndn-cxx/mgmt/nfd/fib-entry.hpp>
@@ -35,7 +35,7 @@
namespace nfd {
namespace tests {
-class FibManagerFixture : public NfdManagerCommonFixture
+class FibManagerFixture : public ManagerFixtureWithAuthenticator
{
public:
FibManagerFixture()
diff --git a/tests/daemon/mgmt/forwarder-status-manager.t.cpp b/tests/daemon/mgmt/forwarder-status-manager.t.cpp
index 3df77ec..bb728f2 100644
--- a/tests/daemon/mgmt/forwarder-status-manager.t.cpp
+++ b/tests/daemon/mgmt/forwarder-status-manager.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California,
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,24 +26,25 @@
#include "mgmt/forwarder-status-manager.hpp"
#include "core/version.hpp"
-#include "nfd-manager-common-fixture.hpp"
+#include "manager-common-fixture.hpp"
namespace nfd {
namespace tests {
-class ForwarderStatusManagerFixture : public NfdManagerCommonFixture
+class ForwarderStatusManagerFixture : public ManagerCommonFixture
{
protected:
ForwarderStatusManagerFixture()
- : manager(m_forwarder, m_dispatcher)
- , startTime(time::system_clock::now())
+ : m_manager(m_forwarder, m_dispatcher)
+ , m_startTime(time::system_clock::now())
{
setTopPrefix();
}
protected:
- ForwarderStatusManager manager;
- time::system_clock::TimePoint startTime;
+ Forwarder m_forwarder;
+ ForwarderStatusManager m_manager;
+ time::system_clock::TimePoint m_startTime;
};
BOOST_AUTO_TEST_SUITE(Mgmt)
@@ -78,11 +79,9 @@
BOOST_CHECK_EQUAL(m_forwarder.getCounters().nUnsatisfiedInterests, 1);
// request
- time::system_clock::TimePoint beforeRequest = time::system_clock::now();
- Interest request("/localhost/nfd/status/general");
- request.setMustBeFresh(true).setChildSelector(1);
- this->receiveInterest(request);
- time::system_clock::TimePoint afterRequest = time::system_clock::now();
+ auto beforeRequest = time::system_clock::now();
+ receiveInterest(Interest("/localhost/nfd/status/general").setCanBePrefix(true));
+ auto afterRequest = time::system_clock::now();
// verify
Block response = this->concatenateResponses(0, m_responses.size());
@@ -90,7 +89,7 @@
BOOST_REQUIRE_NO_THROW(status.wireDecode(response));
BOOST_CHECK_EQUAL(status.getNfdVersion(), NFD_VERSION_BUILD_STRING);
- BOOST_CHECK_EQUAL(time::toUnixTimestamp(status.getStartTimestamp()), time::toUnixTimestamp(startTime));
+ BOOST_CHECK_EQUAL(time::toUnixTimestamp(status.getStartTimestamp()), time::toUnixTimestamp(m_startTime));
BOOST_CHECK_GE(time::toUnixTimestamp(status.getCurrentTimestamp()), time::toUnixTimestamp(beforeRequest));
BOOST_CHECK_LE(time::toUnixTimestamp(status.getCurrentTimestamp()), time::toUnixTimestamp(afterRequest));
diff --git a/tests/core/manager-base.t.cpp b/tests/daemon/mgmt/manager-base.t.cpp
similarity index 86%
rename from tests/core/manager-base.t.cpp
rename to tests/daemon/mgmt/manager-base.t.cpp
index 947727c..3aeeb9e 100644
--- a/tests/core/manager-base.t.cpp
+++ b/tests/daemon/mgmt/manager-base.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California,
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -23,10 +23,10 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "core/manager-base.hpp"
-#include "tests/manager-common-fixture.hpp"
+#include "mgmt/manager-base.hpp"
-#include <ndn-cxx/mgmt/nfd/control-command.hpp>
+#include "manager-common-fixture.hpp"
+
#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/security/pib/identity.hpp>
#include <ndn-cxx/security/pib/key.hpp>
@@ -35,30 +35,35 @@
namespace nfd {
namespace tests {
-class TestCommandVoidParameters : public ndn::nfd::ControlCommand
+class TestCommandVoidParameters : public ControlCommand
{
public:
TestCommandVoidParameters()
- : ndn::nfd::ControlCommand("test-module", "test-void-parameters")
+ : ControlCommand("test-module", "test-void-parameters")
{
}
};
-class TestCommandRequireName : public ndn::nfd::ControlCommand
+class TestCommandRequireName : public ControlCommand
{
public:
TestCommandRequireName()
- : ndn::nfd::ControlCommand("test-module", "test-require-name")
+ : ControlCommand("test-module", "test-require-name")
{
m_requestValidator.required(ndn::nfd::CONTROL_PARAMETER_NAME);
}
};
-class ManagerTester : public ManagerBase
+class DummyManager : public ManagerBase
{
public:
- using ManagerBase::ManagerBase;
+ explicit
+ DummyManager(Dispatcher& dispatcher)
+ : ManagerBase("test-module", dispatcher)
+ {
+ }
+private:
ndn::mgmt::Authorization
makeAuthorization(const std::string& verb) override
{
@@ -73,16 +78,11 @@
class ManagerBaseFixture : public ManagerCommonFixture
{
-public:
- ManagerBaseFixture()
- : m_manager(m_dispatcher, "test-module")
- {
- }
-
protected:
- ManagerTester m_manager;
+ DummyManager m_manager{m_dispatcher};
};
+BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_FIXTURE_TEST_SUITE(TestManagerBase, ManagerBaseFixture)
BOOST_AUTO_TEST_CASE(RegisterCommandHandler)
@@ -92,7 +92,7 @@
m_manager.registerCommandHandler<TestCommandVoidParameters>("test-void", handler);
m_manager.registerCommandHandler<TestCommandRequireName>("test-require-name", handler);
- setTopPrefix("/localhost/nfd");
+ setTopPrefix();
auto testRegisterCommandHandler = [&wasCommandHandlerCalled, this] (const Name& commandName) {
wasCommandHandlerCalled = false;
@@ -112,7 +112,7 @@
auto handler = bind([&] { isStatusDatasetCalled = true; });
m_manager.registerStatusDatasetHandler("test-status", handler);
- setTopPrefix("/localhost/nfd");
+ setTopPrefix();
receiveInterest(Interest("/localhost/nfd/test-module/test-status"));
BOOST_CHECK(isStatusDatasetCalled);
@@ -121,7 +121,7 @@
BOOST_AUTO_TEST_CASE(RegisterNotificationStream)
{
auto post = m_manager.registerNotificationStream("test-notification");
- setTopPrefix("/localhost/nfd");
+ setTopPrefix();
const uint8_t buf[] = {0x82, 0x01, 0x02};
post(Block(buf, sizeof(buf)));
@@ -166,6 +166,7 @@
}
BOOST_AUTO_TEST_SUITE_END() // TestManagerBase
+BOOST_AUTO_TEST_SUITE_END() // Mgmt
} // namespace tests
} // namespace nfd
diff --git a/tests/manager-common-fixture.cpp b/tests/daemon/mgmt/manager-common-fixture.cpp
similarity index 89%
rename from tests/manager-common-fixture.cpp
rename to tests/daemon/mgmt/manager-common-fixture.cpp
index 9511951..ee8d543 100644
--- a/tests/manager-common-fixture.cpp
+++ b/tests/daemon/mgmt/manager-common-fixture.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California,
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -24,6 +24,7 @@
*/
#include "manager-common-fixture.hpp"
+
#include <ndn-cxx/security/signing-helpers.hpp>
namespace nfd {
@@ -60,10 +61,10 @@
}
void
-ManagerCommonFixture::setTopPrefix(const Name& topPrefix)
+ManagerCommonFixture::setTopPrefix()
{
- m_dispatcher.addTopPrefix(topPrefix); // so that all filters are added
- advanceClocks(1_ms);
+ m_dispatcher.addTopPrefix("/localhost/nfd");
+ advanceClocks(1_ms); // so that all filters are added
}
void
@@ -167,7 +168,7 @@
}
std::ostream&
-operator<<(std::ostream& os, const ManagerCommonFixture::CheckResponseResult& result)
+operator<<(std::ostream& os, ManagerCommonFixture::CheckResponseResult result)
{
switch (result) {
case ManagerCommonFixture::CheckResponseResult::OK:
@@ -192,5 +193,29 @@
return os << static_cast<int>(result);
}
+void
+ManagerFixtureWithAuthenticator::setPrivilege(const std::string& privilege)
+{
+ saveIdentityCertificate(DEFAULT_COMMAND_SIGNER_IDENTITY, "ManagerCommonFixture.ndncert");
+
+ const std::string& config = R"CONFIG(
+ authorizations
+ {
+ authorize
+ {
+ certfile "ManagerCommonFixture.ndncert"
+ privileges
+ {
+ )CONFIG" + privilege + R"CONFIG(
+ }
+ }
+ }
+ )CONFIG";
+
+ ConfigFile cf;
+ m_authenticator->setConfigFile(cf);
+ cf.parse(config, false, "ManagerCommonFixture.authenticator.conf");
+}
+
} // namespace tests
} // namespace nfd
diff --git a/tests/manager-common-fixture.hpp b/tests/daemon/mgmt/manager-common-fixture.hpp
similarity index 75%
rename from tests/manager-common-fixture.hpp
rename to tests/daemon/mgmt/manager-common-fixture.hpp
index 186a5db..8725680 100644
--- a/tests/manager-common-fixture.hpp
+++ b/tests/daemon/mgmt/manager-common-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -23,21 +23,21 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef NFD_TESTS_MANAGER_COMMON_FIXTURE_HPP
-#define NFD_TESTS_MANAGER_COMMON_FIXTURE_HPP
+#ifndef NFD_TESTS_DAEMON_MGMT_MANAGER_COMMON_FIXTURE_HPP
+#define NFD_TESTS_DAEMON_MGMT_MANAGER_COMMON_FIXTURE_HPP
-#include "tests/test-common.hpp"
+#include "mgmt/manager-base.hpp"
+#include "fw/forwarder.hpp"
+
#include "tests/identity-management-fixture.hpp"
-#include "core/manager-base.hpp"
-#include <ndn-cxx/mgmt/dispatcher.hpp>
#include <ndn-cxx/security/command-interest-signer.hpp>
#include <ndn-cxx/util/dummy-client-face.hpp>
namespace nfd {
namespace tests {
-/** \brief a fixture that provides a CommandInterestSigner
+/** \brief A fixture that provides a CommandInterestSigner.
*/
class CommandInterestSignerFixture : public IdentityManagementTimeFixture
{
@@ -70,7 +70,7 @@
};
/**
- * @brief a collection of common functions shared by all manager's testing fixtures.
+ * @brief A collection of common functions shared by all manager's test fixtures.
*/
class ManagerCommonFixture : public CommandInterestSignerFixture
{
@@ -78,14 +78,12 @@
ManagerCommonFixture();
/**
- * @brief set topPrefix to the dispatcher.
+ * @brief Add `/localhost/nfd` as a top prefix to the dispatcher.
*
- * after setting @param topPrefix, call advanceClocks to ensure all added filters take effects.
- *
- * @param topPrefix top prefix for the dispatcher
+ * Afterwards, advanceClocks() is called to ensure all added filters take effect.
*/
void
- setTopPrefix(const Name& topPrefix);
+ setTopPrefix();
public: // test
/**
@@ -101,8 +99,7 @@
public: // verify
ControlResponse
- makeResponse(uint32_t code, const std::string& text,
- const ControlParameters& parameters);
+ makeResponse(uint32_t code, const std::string& text, const ControlParameters& parameters);
enum class CheckResponseResult
{
@@ -156,14 +153,52 @@
protected:
ndn::util::DummyClientFace m_face;
- ndn::mgmt::Dispatcher m_dispatcher;
- std::vector<Data>& m_responses; ///< a reference of m_face->sentData
+ Dispatcher m_dispatcher;
+ std::vector<Data>& m_responses; ///< a reference to m_face.sentData
};
std::ostream&
-operator<<(std::ostream& os, const ManagerCommonFixture::CheckResponseResult& result);
+operator<<(std::ostream& os, ManagerCommonFixture::CheckResponseResult result);
+
+class ManagerFixtureWithAuthenticator : public ManagerCommonFixture
+{
+public:
+ /** \brief grant m_identityName privilege to sign commands for the management module
+ */
+ void
+ setPrivilege(const std::string& privilege);
+
+protected:
+ Forwarder m_forwarder;
+ shared_ptr<CommandAuthenticator> m_authenticator = CommandAuthenticator::create();
+};
+
+class CommandSuccess
+{
+public:
+ static ControlResponse
+ getExpected()
+ {
+ return ControlResponse()
+ .setCode(200)
+ .setText("OK");
+ }
+};
+
+template<int CODE>
+class CommandFailure
+{
+public:
+ static ControlResponse
+ getExpected()
+ {
+ return ControlResponse()
+ .setCode(CODE);
+ // error description should not be checked
+ }
+};
} // namespace tests
} // namespace nfd
-#endif // NFD_TESTS_MANAGER_COMMON_FIXTURE_HPP
+#endif // NFD_TESTS_DAEMON_MGMT_MANAGER_COMMON_FIXTURE_HPP
diff --git a/tests/daemon/mgmt/nfd-manager-common-fixture.cpp b/tests/daemon/mgmt/nfd-manager-common-fixture.cpp
deleted file mode 100644
index f39e983..0000000
--- a/tests/daemon/mgmt/nfd-manager-common-fixture.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, 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 "nfd-manager-common-fixture.hpp"
-
-namespace nfd {
-namespace tests {
-
-NfdManagerCommonFixture::NfdManagerCommonFixture()
- : m_authenticator(CommandAuthenticator::create())
-{
-}
-
-void
-NfdManagerCommonFixture::setTopPrefix()
-{
- this->ManagerCommonFixture::setTopPrefix("/localhost/nfd");
-}
-
-void
-NfdManagerCommonFixture::setPrivilege(const std::string& privilege)
-{
- this->saveIdentityCertificate(DEFAULT_COMMAND_SIGNER_IDENTITY, "ManagerCommonFixture.ndncert");
-
- const std::string& config = R"CONFIG(
- authorizations
- {
- authorize
- {
- certfile "ManagerCommonFixture.ndncert"
- privileges
- {
- )CONFIG" + privilege + R"CONFIG(
- }
- }
- }
- )CONFIG";
-
- ConfigFile cf;
- m_authenticator->setConfigFile(cf);
- cf.parse(config, false, "ManagerCommonFixture.authenticator.conf");
-}
-
-} // namespace tests
-} // namespace nfd
diff --git a/tests/daemon/mgmt/nfd-manager-common-fixture.hpp b/tests/daemon/mgmt/nfd-manager-common-fixture.hpp
deleted file mode 100644
index fb2dbc2..0000000
--- a/tests/daemon/mgmt/nfd-manager-common-fixture.hpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, 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/>.
- */
-
-#ifndef NFD_TESTS_DAEMON_MGMT_NFD_MANAGER_COMMON_FIXTURE_HPP
-#define NFD_TESTS_DAEMON_MGMT_NFD_MANAGER_COMMON_FIXTURE_HPP
-
-#include "tests/manager-common-fixture.hpp"
-#include "fw/forwarder.hpp"
-#include "mgmt/command-authenticator.hpp"
-
-namespace nfd {
-namespace tests {
-
-/** \brief base fixture for testing an NFD Manager
- */
-class NfdManagerCommonFixture : public ManagerCommonFixture
-{
-public:
- NfdManagerCommonFixture();
-
- /** \brief add /localhost/nfd as a top prefix to the dispatcher
- */
- void
- setTopPrefix();
-
- /** \brief grant m_identityName privilege to sign commands for the management module
- */
- void
- setPrivilege(const std::string& privilege);
-
-protected:
- Forwarder m_forwarder;
- shared_ptr<CommandAuthenticator> m_authenticator;
-};
-
-class CommandSuccess
-{
-public:
- static ControlResponse
- getExpected()
- {
- return ControlResponse()
- .setCode(200)
- .setText("OK");
- }
-};
-
-template<int CODE>
-class CommandFailure
-{
-public:
- static ControlResponse
- getExpected()
- {
- return ControlResponse()
- .setCode(CODE);
- // error description should not be checked
- }
-};
-
-} // namespace tests
-} // namespace nfd
-
-#endif // NFD_TESTS_DAEMON_MGMT_NFD_MANAGER_COMMON_FIXTURE_HPP
diff --git a/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp b/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp
index 06e3d5e..452d758 100644
--- a/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp
+++ b/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp
@@ -165,7 +165,7 @@
ndn::util::DummyClientFace m_face;
ndn::util::Scheduler m_scheduler;
ndn::nfd::Controller m_nfdController;
- ndn::mgmt::Dispatcher m_dispatcher;
+ Dispatcher m_dispatcher;
rib::FibUpdater m_fibUpdater;
ndn::security::SigningInfo m_trustedSigner;
diff --git a/tests/daemon/mgmt/rib-manager.t.cpp b/tests/daemon/mgmt/rib-manager.t.cpp
index 46da6a1..c3c5dd6 100644
--- a/tests/daemon/mgmt/rib-manager.t.cpp
+++ b/tests/daemon/mgmt/rib-manager.t.cpp
@@ -27,7 +27,7 @@
#include "core/fib-max-depth.hpp"
#include "rib/fib-updater.hpp"
-#include "tests/manager-common-fixture.hpp"
+#include "manager-common-fixture.hpp"
#include <ndn-cxx/lp/tags.hpp>
#include <ndn-cxx/mgmt/nfd/face-status.hpp>
@@ -93,10 +93,10 @@
advanceClocks(1_ms);
auto replyFibAddCommand = [this] (const Interest& interest) {
- nfd::ControlParameters params(interest.getName().get(-5).blockFromValue());
+ ControlParameters params(interest.getName().get(-5).blockFromValue());
BOOST_CHECK(params.getName() == "/localhost/nfd/rib" || params.getName() == "/localhop/nfd/rib");
params.setFaceId(1).setCost(0);
- nfd::ControlResponse resp;
+ ControlResponse resp;
resp.setCode(200).setBody(params.wireEncode());
shared_ptr<Data> data = make_shared<Data>(interest.getName());
diff --git a/tests/daemon/mgmt/strategy-choice-manager.t.cpp b/tests/daemon/mgmt/strategy-choice-manager.t.cpp
index 817966e..6b7e390 100644
--- a/tests/daemon/mgmt/strategy-choice-manager.t.cpp
+++ b/tests/daemon/mgmt/strategy-choice-manager.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California,
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,15 +26,15 @@
#include "mgmt/strategy-choice-manager.hpp"
#include "table/strategy-choice.hpp"
-#include "nfd-manager-common-fixture.hpp"
-#include "../fw/dummy-strategy.hpp"
+#include "manager-common-fixture.hpp"
+#include "tests/daemon/fw/dummy-strategy.hpp"
#include <ndn-cxx/mgmt/nfd/strategy-choice.hpp>
namespace nfd {
namespace tests {
-class StrategyChoiceManagerFixture : public NfdManagerCommonFixture
+class StrategyChoiceManagerFixture : public ManagerFixtureWithAuthenticator
{
public:
StrategyChoiceManagerFixture()