tests: don't use makeDummyClientFace
refs #3383
Change-Id: I1803a6f482a4e6bf43363cd08a73c4bbcb26d0a2
diff --git a/tests/daemon/mgmt/face-manager-create-face.t.cpp b/tests/daemon/mgmt/face-manager-create-face.t.cpp
index b827c85..fe6d147 100644
--- a/tests/daemon/mgmt/face-manager-create-face.t.cpp
+++ b/tests/daemon/mgmt/face-manager-create-face.t.cpp
@@ -27,6 +27,7 @@
#include "fw/forwarder.hpp"
#include "tests/test-common.hpp"
+#include "tests/identity-management-fixture.hpp"
#include <ndn-cxx/mgmt/dispatcher.hpp>
#include <ndn-cxx/util/dummy-client-face.hpp>
@@ -46,8 +47,8 @@
{
public:
FaceManagerNode(ndn::KeyChain& keyChain, const std::string& port = "6363")
- : face(ndn::util::makeDummyClientFace(getGlobalIoService(), {true, true}))
- , dispatcher(*face, keyChain, ndn::security::SigningInfo())
+ : face(getGlobalIoService(), keyChain, {true, true})
+ , dispatcher(face, keyChain, ndn::security::SigningInfo())
, manager(forwarder.getFaceTable(), dispatcher, validator)
{
dispatcher.addTopPrefix("/localhost/nfd");
@@ -104,18 +105,19 @@
public:
Forwarder forwarder;
- shared_ptr<ndn::util::DummyClientFace> face;
+ ndn::util::DummyClientFace face;
ndn::mgmt::Dispatcher dispatcher;
CommandValidator validator;
FaceManager manager;
};
class FaceManagerFixture : public UnitTestTimeFixture
+ , public IdentityManagementFixture
{
public:
FaceManagerFixture()
- : node1(keyChain, "16363")
- , node2(keyChain, "26363")
+ : node1(m_keyChain, "16363")
+ , node2(m_keyChain, "26363")
{
advanceClocks(time::milliseconds(1), 100);
}
@@ -128,7 +130,6 @@
}
public:
- ndn::KeyChain keyChain;
FaceManagerNode node1; // used to test FaceManager
FaceManagerNode node2; // acts as a remote endpoint
};
@@ -263,10 +264,10 @@
commandName.append(FaceType().getParameters().wireEncode());
shared_ptr<Interest> command(make_shared<Interest>(commandName));
- this->keyChain.sign(*command);
+ m_keyChain.sign(*command);
bool hasCallbackFired = false;
- this->node1.face->onSendData.connect([this, command, &hasCallbackFired] (const Data& response) {
+ this->node1.face.onSendData.connect([this, command, &hasCallbackFired] (const Data& response) {
// std::cout << response << std::endl;
if (!command->getName().isPrefixOf(response.getName())) {
return;
@@ -287,7 +288,7 @@
hasCallbackFired = true;
});
- this->node1.face->receive(*command);
+ this->node1.face.receive(*command);
this->advanceClocks(time::milliseconds(1), 100);
BOOST_CHECK(hasCallbackFired);
@@ -314,9 +315,9 @@
commandName.append(FaceType1().getParameters().wireEncode());
shared_ptr<Interest> command(make_shared<Interest>(commandName));
- this->keyChain.sign(*command);
+ m_keyChain.sign(*command);
- this->node1.face->receive(*command);
+ this->node1.face.receive(*command);
this->advanceClocks(time::milliseconds(1), 10);
}
@@ -329,10 +330,10 @@
commandName.append(FaceType2().getParameters().wireEncode());
shared_ptr<Interest> command(make_shared<Interest>(commandName));
- this->keyChain.sign(*command);
+ m_keyChain.sign(*command);
bool hasCallbackFired = false;
- this->node1.face->onSendData.connect([this, command, &hasCallbackFired] (const Data& response) {
+ this->node1.face.onSendData.connect([this, command, &hasCallbackFired] (const Data& response) {
if (!command->getName().isPrefixOf(response.getName())) {
return;
}
@@ -347,7 +348,7 @@
hasCallbackFired = true;
});
- this->node1.face->receive(*command);
+ this->node1.face.receive(*command);
this->advanceClocks(time::milliseconds(1), 10);
BOOST_CHECK(hasCallbackFired);
@@ -390,10 +391,10 @@
commandName.append(OtherNodeFace().getParameters().wireEncode());
shared_ptr<Interest> command(make_shared<Interest>(commandName));
- this->keyChain.sign(*command);
+ m_keyChain.sign(*command);
ndn::util::signal::ScopedConnection connection =
- this->node2.face->onSendData.connect([this, command] (const Data& response) {
+ this->node2.face.onSendData.connect([this, command] (const Data& response) {
if (!command->getName().isPrefixOf(response.getName())) {
return;
}
@@ -409,7 +410,7 @@
face->sendInterest(*dummyInterest);
});
- this->node2.face->receive(*command);
+ this->node2.face.receive(*command);
this->advanceClocks(time::milliseconds(1), 10);
}
@@ -433,10 +434,10 @@
commandName.append(FaceType().getParameters().wireEncode());
shared_ptr<Interest> command(make_shared<Interest>(commandName));
- this->keyChain.sign(*command);
+ m_keyChain.sign(*command);
bool hasCallbackFired = false;
- this->node1.face->onSendData.connect([this, command, &hasCallbackFired] (const Data& response) {
+ this->node1.face.onSendData.connect([this, command, &hasCallbackFired] (const Data& response) {
if (!command->getName().isPrefixOf(response.getName())) {
return;
}
@@ -451,7 +452,7 @@
hasCallbackFired = true;
});
- this->node1.face->receive(*command);
+ this->node1.face.receive(*command);
this->advanceClocks(time::milliseconds(1), 10);
BOOST_CHECK(hasCallbackFired);