mgmt: publish Strategy Choice dataset
refs: #1632
Change-Id: I4ed09d191433fd80071367e7b2ffcd2ac81c5c17
diff --git a/tests/daemon/mgmt/strategy-choice-manager.cpp b/tests/daemon/mgmt/strategy-choice-manager.cpp
index 9b5f2c5..9f6818e 100644
--- a/tests/daemon/mgmt/strategy-choice-manager.cpp
+++ b/tests/daemon/mgmt/strategy-choice-manager.cpp
@@ -32,6 +32,8 @@
#include "tests/daemon/face/dummy-face.hpp"
#include "tests/daemon/fw/dummy-strategy.hpp"
+#include <ndn-cxx/management/nfd-strategy-choice.hpp>
+
#include "tests/test-common.hpp"
#include "validation-common.hpp"
@@ -118,6 +120,15 @@
}
+ void
+ validateList(const Data& data, const ndn::nfd::StrategyChoice& expectedChoice)
+ {
+ m_callbackFired = true;
+ ndn::nfd::StrategyChoice choice(data.getContent().blockFromValue());
+ BOOST_CHECK_EQUAL(choice.getStrategy(), expectedChoice.getStrategy());
+ BOOST_CHECK_EQUAL(choice.getName(), expectedChoice.getName());
+ }
+
bool
didCallbackFire()
{
@@ -544,6 +555,22 @@
"/localhost/nfd/strategy/test-strategy-b");
}
+BOOST_AUTO_TEST_CASE(Publish)
+{
+ Name commandName("/localhost/nfd/strategy-choice/list");
+ shared_ptr<Interest> command(make_shared<Interest>(commandName));
+
+ ndn::nfd::StrategyChoice expectedChoice;
+ expectedChoice.setStrategy("/localhost/nfd/strategy/test-strategy-a");
+ expectedChoice.setName("/");
+
+ getFace()->onReceiveData +=
+ bind(&StrategyChoiceManagerFixture::validateList, this, _1, expectedChoice);
+
+ m_manager.onStrategyChoiceRequest(*command);
+ BOOST_REQUIRE(didCallbackFire());
+}
+
BOOST_AUTO_TEST_SUITE_END()
} // namespace tests