update profile fetching
Change-Id: I788ece8371f7e24c87918a57062673be1d866e5b
diff --git a/tests/unit-tests/bench.t.cpp b/tests/unit-tests/bench.t.cpp
index 28850a8..09986c6 100644
--- a/tests/unit-tests/bench.t.cpp
+++ b/tests/unit-tests/bench.t.cpp
@@ -19,9 +19,9 @@
*/
#include "ca-module.hpp"
-#include "requester.hpp"
#include "challenge-modules/challenge-pin.hpp"
#include "protocol-detail/info.hpp"
+#include "requester.hpp"
#include "test-common.hpp"
namespace ndn {
@@ -38,12 +38,26 @@
util::DummyClientFace face(io, m_keyChain, {true, true});
CaModule ca(face, m_keyChain, "tests/unit-tests/config-files/config-ca-1", "ca-storage-memory");
+ auto metaData = ca.generateCaConfigMetaData();
+ auto profileData = ca.generateCaConfigData();
advanceClocks(time::milliseconds(20), 60);
Interest interest = MetadataObject::makeDiscoveryInterest(Name("/ndn/CA/INFO"));
std::cout << "CA Config discovery Interest Size: " << interest.wireEncode().size() << std::endl;
shared_ptr<Interest> infoInterest = nullptr;
+ face.setInterestFilter(InterestFilter("/ndn/CA/INFO"),
+ [&](const auto&, const Interest& interest) {
+ if (interest.matchesData(*metaData)) {
+ face.put(*metaData);
+ }
+ else {
+ BOOST_CHECK(interest.matchesData(*profileData));
+ face.put(*profileData);
+ }
+ }, nullptr, nullptr);
+ advanceClocks(time::milliseconds(20), 60);
+
int count = 0;
face.onSendData.connect([&](const Data& response) {
if (count == 0) {
@@ -55,7 +69,6 @@
interest.setCanBePrefix(true);
infoInterest = make_shared<Interest>(interest);
std::cout << "CA Config fetch Interest Size: " << infoInterest->wireEncode().size() << std::endl;
-
}
else {
count++;