mgmt: migrate to new Dispatcher API for control commands
Change-Id: Iaba68dde879fbb562e13ef383e0b753174708baa
diff --git a/tests/daemon/mgmt/face-manager.t.cpp b/tests/daemon/mgmt/face-manager.t.cpp
index 458599f..1e3ba99 100644
--- a/tests/daemon/mgmt/face-manager.t.cpp
+++ b/tests/daemon/mgmt/face-manager.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2024, Regents of the University of California,
+ * Copyright (c) 2014-2025, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -218,7 +218,7 @@
auto face3 = addFace(REMOVE_LAST_NOTIFICATION | SET_URI_TEST); // test://
auto generateQuery = [] (const auto& filter) {
- return Interest(Name("/localhost/nfd/faces/query").append(tlv::GenericNameComponent, filter.wireEncode()))
+ return Interest(Name("/localhost/nfd/faces/query").append(filter.wireEncode()))
.setCanBePrefix(true);
};
@@ -226,7 +226,7 @@
auto idQuery = generateQuery(FaceQueryFilter().setFaceId(face1->getId()));
auto scopeQuery = generateQuery(FaceQueryFilter().setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL));
auto invalidQueryName = Name("/localhost/nfd/faces/query")
- .append(tlv::GenericNameComponent, ndn::makeStringBlock(tlv::Content, "invalid"));
+ .append(ndn::makeStringBlock(tlv::Content, "invalid"));
auto invalidQuery = Interest(invalidQueryName).setCanBePrefix(true);
receiveInterest(schemeQuery); // face1 and face2 expected
diff --git a/tests/daemon/mgmt/manager-base.t.cpp b/tests/daemon/mgmt/manager-base.t.cpp
index 2fcdd62..70eb1b6 100644
--- a/tests/daemon/mgmt/manager-base.t.cpp
+++ b/tests/daemon/mgmt/manager-base.t.cpp
@@ -31,14 +31,14 @@
class TestCommandVoidParameters : public ndn::nfd::ControlCommand<TestCommandVoidParameters>
{
- NDN_CXX_CONTROL_COMMAND(TestCommandVoidParameters, "test-module", "test-void-parameters");
+ NDN_CXX_CONTROL_COMMAND("test-module", "test-void");
};
const TestCommandVoidParameters::RequestFormat TestCommandVoidParameters::s_requestFormat;
class TestCommandRequireName : public ndn::nfd::ControlCommand<TestCommandRequireName>
{
- NDN_CXX_CONTROL_COMMAND(TestCommandRequireName, "test-module", "test-require-name");
+ NDN_CXX_CONTROL_COMMAND("test-module", "test-name-required");
};
const TestCommandRequireName::RequestFormat TestCommandRequireName::s_requestFormat =
@@ -81,8 +81,8 @@
bool wasHandlerCalled = false;
auto handler = [&] (auto&&...) { wasHandlerCalled = true; };
- m_manager.registerCommandHandler<TestCommandVoidParameters>("test-void", handler);
- m_manager.registerCommandHandler<TestCommandRequireName>("test-require-name", handler);
+ m_manager.registerCommandHandler<TestCommandVoidParameters>(handler);
+ m_manager.registerCommandHandler<TestCommandRequireName>(handler);
setTopPrefix();
auto testRegisterCommandHandler = [&] (const Name& commandName) {
@@ -93,11 +93,11 @@
testRegisterCommandHandler("/localhost/nfd/test-module/test-void");
BOOST_CHECK(wasHandlerCalled);
- testRegisterCommandHandler("/localhost/nfd/test-module/test-require-name");
+ testRegisterCommandHandler("/localhost/nfd/test-module/test-name-required");
BOOST_CHECK(!wasHandlerCalled);
- testRegisterCommandHandler(Name("/localhost/nfd/test-module/test-require-name")
- .append(ControlParameters().setName("test-name").wireEncode()));
+ testRegisterCommandHandler(Name("/localhost/nfd/test-module/test-name-required")
+ .append(ControlParameters().setName("/foo").wireEncode()));
BOOST_CHECK(wasHandlerCalled);
}
diff --git a/tests/daemon/mgmt/manager-common-fixture.cpp b/tests/daemon/mgmt/manager-common-fixture.cpp
index d69763d..3b98dd2 100644
--- a/tests/daemon/mgmt/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-2022, Regents of the University of California,
+ * Copyright (c) 2014-2025, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -38,7 +38,7 @@
ndn::security::SignedInterestFormat format,
const Name& identity)
{
- commandName.append(tlv::GenericNameComponent, params.wireEncode());
+ commandName.append(params.wireEncode());
switch (format) {
case ndn::security::SignedInterestFormat::V02: