face: simplify prefix registration APIs with SigningInfo
refs #2932
Change-Id: I9a29cf2925272b9fc90b4fb69a14035a75291928
diff --git a/tests/unit-tests/face.t.cpp b/tests/unit-tests/face.t.cpp
index 19e6739..94d0935 100644
--- a/tests/unit-tests/face.t.cpp
+++ b/tests/unit-tests/face.t.cpp
@@ -188,6 +188,45 @@
advanceClocks(time::milliseconds(10), 10);
}
+BOOST_AUTO_TEST_CASE(SetUnsetInterestFilterWithoutSucessCallback)
+{
+ size_t nInterests = 0;
+ const RegisteredPrefixId* regPrefixId =
+ face->setInterestFilter("/Hello/World",
+ bind([&nInterests] { ++nInterests; }),
+ bind([] {
+ BOOST_FAIL("Unexpected setInterestFilter failure");
+ }));
+ advanceClocks(time::milliseconds(10), 10);
+ BOOST_CHECK_EQUAL(nInterests, 0);
+
+ face->receive(Interest("/Hello/World/!"));
+ advanceClocks(time::milliseconds(10), 10);
+
+ BOOST_CHECK_EQUAL(nInterests, 1);
+
+ face->receive(Interest("/Bye/World/!"));
+ advanceClocks(time::milliseconds(10000), 10);
+ BOOST_CHECK_EQUAL(nInterests, 1);
+
+ face->receive(Interest("/Hello/World/!/2"));
+ advanceClocks(time::milliseconds(10), 10);
+ BOOST_CHECK_EQUAL(nInterests, 2);
+
+ // removing filter
+ face->unsetInterestFilter(regPrefixId);
+ advanceClocks(time::milliseconds(10), 10);
+
+ face->receive(Interest("/Hello/World/!/3"));
+ BOOST_CHECK_EQUAL(nInterests, 2);
+
+ face->unsetInterestFilter(static_cast<const RegisteredPrefixId*>(0));
+ advanceClocks(time::milliseconds(10), 10);
+
+ face->unsetInterestFilter(static_cast<const InterestFilterId*>(0));
+ advanceClocks(time::milliseconds(10), 10);
+}
+
BOOST_FIXTURE_TEST_CASE(SetInterestFilterFail, FacesNoRegistrationReplyFixture)
{
// don't enable registration reply
@@ -210,6 +249,25 @@
BOOST_CHECK_EQUAL(nRegFailed, 1);
}
+BOOST_FIXTURE_TEST_CASE(SetInterestFilterFailWithoutSuccessCallback, FacesNoRegistrationReplyFixture)
+{
+ // don't enable registration reply
+ size_t nRegFailed = 0;
+ face->setInterestFilter("/Hello/World",
+ bind([] {
+ BOOST_FAIL("Unexpected Interest");
+ }),
+ bind([&nRegFailed] {
+ ++nRegFailed;
+ }));
+
+ advanceClocks(time::milliseconds(10), 10);
+ BOOST_CHECK_EQUAL(nRegFailed, 0);
+
+ advanceClocks(time::milliseconds(1000), 10);
+ BOOST_CHECK_EQUAL(nRegFailed, 1);
+}
+
BOOST_AUTO_TEST_CASE(RegisterUnregisterPrefix)
{
size_t nRegSuccesses = 0;