docs+tests: finalize migration to typed naming conventions
refs #5044
Change-Id: Ia6f52ae0a31db33ca0f9fa6c4553b8fbbc7809bc
diff --git a/tests/daemon/mgmt/tables-config-section.t.cpp b/tests/daemon/mgmt/tables-config-section.t.cpp
index df9992f..4f07f78 100644
--- a/tests/daemon/mgmt/tables-config-section.t.cpp
+++ b/tests/daemon/mgmt/tables-config-section.t.cpp
@@ -24,6 +24,8 @@
*/
#include "mgmt/tables-config-section.hpp"
+
+#include "fw/best-route-strategy.hpp"
#include "fw/forwarder.hpp"
#include "table/cs-policy-lru.hpp"
#include "table/cs-policy-priority-fifo.hpp"
@@ -40,17 +42,10 @@
{
protected:
TablesConfigSectionFixture()
- : forwarder(faceTable)
- , cs(forwarder.getCs())
- , strategyChoice(forwarder.getStrategyChoice())
- , networkRegionTable(forwarder.getNetworkRegionTable())
- , tablesConfig(forwarder)
- , strategyP(Name("/tables-config-section-strategy-P").appendVersion(2))
- , strategyP1(Name("/tables-config-section-strategy-P").appendVersion(1))
- , strategyQ(Name("/tables-config-section-strategy-Q").appendVersion(2))
{
DummyStrategy::registerAs(strategyP);
DummyStrategy::registerAs(strategyP1);
+ // strategyP1Marker is NOT registered
DummyStrategy::registerAs(strategyQ);
}
@@ -64,16 +59,18 @@
protected:
FaceTable faceTable;
- Forwarder forwarder;
- Cs& cs;
- StrategyChoice& strategyChoice;
- NetworkRegionTable& networkRegionTable;
+ Forwarder forwarder{faceTable};
+ Cs& cs{forwarder.getCs()};
+ StrategyChoice& strategyChoice{forwarder.getStrategyChoice()};
+ NetworkRegionTable& networkRegionTable{forwarder.getNetworkRegionTable()};
- TablesConfigSection tablesConfig;
+ TablesConfigSection tablesConfig{forwarder};
- const Name strategyP;
- const Name strategyP1;
- const Name strategyQ;
+ const Name defaultStrategy = fw::BestRouteStrategy::getStrategyName();
+ const Name strategyP = Name("/tables-config-section-strategy-P").appendVersion(2);
+ const Name strategyP1 = "/tables-config-section-strategy-P/v=1";
+ const Name strategyP1Marker = "/tables-config-section-strategy-P/%FD%01";
+ const Name strategyQ = Name("/tables-config-section-strategy-Q").appendVersion(2);
};
BOOST_AUTO_TEST_SUITE(Mgmt)
@@ -290,21 +287,21 @@
BOOST_REQUIRE_NO_THROW(runConfig(CONFIG, true));
{
fw::Strategy& rootStrategy = strategyChoice.findEffectiveStrategy("/");
- BOOST_CHECK_NE(rootStrategy.getInstanceName(), strategyP.getPrefix(-1));
- BOOST_CHECK_NE(rootStrategy.getInstanceName(), strategyQ.getPrefix(-1));
+ BOOST_CHECK_EQUAL(rootStrategy.getInstanceName(), defaultStrategy);
fw::Strategy& aStrategy = strategyChoice.findEffectiveStrategy("/a");
- BOOST_CHECK_NE(aStrategy.getInstanceName(), strategyP.getPrefix(-1));
- BOOST_CHECK_NE(aStrategy.getInstanceName(), strategyQ.getPrefix(-1));
+ BOOST_CHECK_EQUAL(aStrategy.getInstanceName(), defaultStrategy);
}
BOOST_REQUIRE_NO_THROW(runConfig(CONFIG, false));
{
fw::Strategy& rootStrategy = strategyChoice.findEffectiveStrategy("/");
BOOST_CHECK_EQUAL(rootStrategy.getInstanceName(), strategyP.getPrefix(-1));
+ NFD_CHECK_TYPEID_EQUAL(rootStrategy, DummyStrategy);
fw::Strategy& aStrategy = strategyChoice.findEffectiveStrategy("/a");
BOOST_CHECK_EQUAL(aStrategy.getInstanceName(), strategyQ.getPrefix(-1));
+ NFD_CHECK_TYPEID_EQUAL(aStrategy, DummyStrategy);
}
}
@@ -316,7 +313,8 @@
strategy_choice
{
/test/latest /tables-config-section-strategy-P
- /test/old /tables-config-section-strategy-P/%FD%01
+ /test/old /tables-config-section-strategy-P/v=1
+ /test/marker /tables-config-section-strategy-P/%FD%01
}
}
)CONFIG";
@@ -324,21 +322,28 @@
BOOST_REQUIRE_NO_THROW(runConfig(CONFIG, true));
{
fw::Strategy& testLatestStrategy = strategyChoice.findEffectiveStrategy("/test/latest");
- BOOST_CHECK_NE(testLatestStrategy.getInstanceName(), strategyP.getPrefix(-1));
- BOOST_CHECK_NE(testLatestStrategy.getInstanceName(), strategyP1);
+ BOOST_CHECK_EQUAL(testLatestStrategy.getInstanceName(), defaultStrategy);
fw::Strategy& testOldStrategy = strategyChoice.findEffectiveStrategy("/test/old");
- BOOST_CHECK_NE(testOldStrategy.getInstanceName(), strategyP.getPrefix(-1));
- BOOST_CHECK_NE(testOldStrategy.getInstanceName(), strategyP1);
+ BOOST_CHECK_EQUAL(testOldStrategy.getInstanceName(), defaultStrategy);
+
+ fw::Strategy& testMarkerStrategy = strategyChoice.findEffectiveStrategy("/test/marker");
+ BOOST_CHECK_EQUAL(testMarkerStrategy.getInstanceName(), defaultStrategy);
}
BOOST_REQUIRE_NO_THROW(runConfig(CONFIG, false));
{
fw::Strategy& testLatestStrategy = strategyChoice.findEffectiveStrategy("/test/latest");
BOOST_CHECK_EQUAL(testLatestStrategy.getInstanceName(), strategyP.getPrefix(-1));
+ NFD_CHECK_TYPEID_EQUAL(testLatestStrategy, DummyStrategy);
fw::Strategy& testOldStrategy = strategyChoice.findEffectiveStrategy("/test/old");
BOOST_CHECK_EQUAL(testOldStrategy.getInstanceName(), strategyP1);
+ NFD_CHECK_TYPEID_EQUAL(testOldStrategy, DummyStrategy);
+
+ fw::Strategy& testMarkerStrategy = strategyChoice.findEffectiveStrategy("/test/marker");
+ BOOST_CHECK_EQUAL(testMarkerStrategy.getInstanceName(), strategyP1Marker);
+ NFD_CHECK_TYPEID_EQUAL(testMarkerStrategy, DummyStrategy);
}
}
@@ -399,7 +404,7 @@
{
strategy_choice
{
- / /localhost/nfd/strategy/best-route/%FD%05/param
+ / /localhost/nfd/strategy/best-route/v=5/param
}
}
)CONFIG";
diff --git a/tests/tools/nfdc/strategy-choice-module.t.cpp b/tests/tools/nfdc/strategy-choice-module.t.cpp
index 634682b..22f7d92 100644
--- a/tests/tools/nfdc/strategy-choice-module.t.cpp
+++ b/tests/tools/nfdc/strategy-choice-module.t.cpp
@@ -69,8 +69,8 @@
this->execute("strategy list");
BOOST_CHECK_EQUAL(exitCode, 0);
- BOOST_CHECK(out.is_equal("prefix=/ strategy=/strategyP/%FD%01\n"
- "prefix=/52VRvpL9/Yqfut4TNHv strategy=/strategyQ/%FD%02\n"));
+ BOOST_CHECK(out.is_equal("prefix=/ strategy=/strategyP/v=1\n"
+ "prefix=/52VRvpL9/Yqfut4TNHv strategy=/strategyQ/v=2\n"));
BOOST_CHECK(err.is_empty());
}
@@ -97,7 +97,7 @@
this->execute("strategy show /I1Ixgg0X");
BOOST_CHECK_EQUAL(exitCode, 0);
BOOST_CHECK(out.is_equal(" prefix=/\n"
- "strategy=/strategyP/%FD%01\n"));
+ "strategy=/strategyP/v=1\n"));
BOOST_CHECK(err.is_empty());
}
@@ -110,7 +110,7 @@
this->execute("strategy show /52VRvpL9/Yqfut4TNHv/Y5gY7gom");
BOOST_CHECK_EQUAL(exitCode, 0);
BOOST_CHECK(out.is_equal(" prefix=/52VRvpL9/Yqfut4TNHv\n"
- "strategy=/strategyQ/%FD%02\n"));
+ "strategy=/strategyQ/v=2\n"));
BOOST_CHECK(err.is_empty());
}
@@ -145,7 +145,7 @@
this->execute("strategy set /VBXSJg3m/XYs81ARNhx /strategyP");
BOOST_CHECK_EQUAL(exitCode, 0);
- BOOST_CHECK(out.is_equal("strategy-set prefix=/VBXSJg3m/XYs81ARNhx strategy=/strategyP/%FD%05\n"));
+ BOOST_CHECK(out.is_equal("strategy-set prefix=/VBXSJg3m/XYs81ARNhx strategy=/strategyP/v=5\n"));
BOOST_CHECK(err.is_empty());
}
@@ -225,13 +225,13 @@
<strategyChoice>
<namespace>/</namespace>
<strategy>
- <name>/localhost/nfd/strategy/best-route/%FD%04</name>
+ <name>/localhost/nfd/strategy/best-route/v=4</name>
</strategy>
</strategyChoice>
<strategyChoice>
<namespace>/localhost</namespace>
<strategy>
- <name>/localhost/nfd/strategy/multicast/%FD%04</name>
+ <name>/localhost/nfd/strategy/multicast/v=4</name>
</strategy>
</strategyChoice>
</strategyChoices>
@@ -239,8 +239,8 @@
const std::string STATUS_TEXT = std::string(R"TEXT(
Strategy choices:
- prefix=/ strategy=/localhost/nfd/strategy/best-route/%FD%04
- prefix=/localhost strategy=/localhost/nfd/strategy/multicast/%FD%04
+ prefix=/ strategy=/localhost/nfd/strategy/best-route/v=4
+ prefix=/localhost strategy=/localhost/nfd/strategy/multicast/v=4
)TEXT").substr(1);
BOOST_FIXTURE_TEST_CASE(Status, StatusFixture<StrategyChoiceModule>)