tests: don't use makeDummyClientFace
refs #3383
Change-Id: Ia71fa8e349ced7495edcb79336ee34894bb200cb
diff --git a/tests/unit/daemon/name-server.cpp b/tests/unit/daemon/name-server.cpp
index 9e7a926..8944759 100644
--- a/tests/unit/daemon/name-server.cpp
+++ b/tests/unit/daemon/name-server.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2016, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -40,10 +40,10 @@
{
public:
NameServerFixture()
- : face(ndn::util::makeDummyClientFace({ false, true }))
+ : face({false, true})
, zone(m_root.getName())
- , validator(*face)
- , server(zone, m_certName, *face, m_session, m_keyChain, validator)
+ , validator(face)
+ , server(zone, m_certName, face, m_session, m_keyChain, validator)
{
// ensure prefix is registered
run();
@@ -52,12 +52,12 @@
void
run()
{
- face->getIoService().poll();
- face->getIoService().reset();
+ face.getIoService().poll();
+ face.getIoService().reset();
}
public:
- shared_ptr<ndn::util::DummyClientFace> face;
+ ndn::util::DummyClientFace face;
Name hint;
const Name& zone;
Validator validator;
@@ -74,7 +74,7 @@
bool hasDataBack = false;
- face->onSendData.connectSingleShot([&] (const Data& data) {
+ face.onSendData.connectSingleShot([&] (const Data& data) {
hasDataBack = true;
NDNS_LOG_TRACE("get Data back");
BOOST_CHECK_EQUAL(data.getName().getPrefix(-1), q.toInterest().getName());
@@ -84,7 +84,7 @@
BOOST_CHECK_EQUAL(resp.getNdnsType(), NDNS_RESP);
});
- face->receive(q.toInterest());
+ face.receive(q.toInterest());
run();
@@ -100,7 +100,7 @@
size_t nDataBack = 0;
// will ask for non-existing record
- face->onSendData.connectSingleShot([&] (const Data& data) {
+ face.onSendData.connectSingleShot([&] (const Data& data) {
++nDataBack;
NDNS_LOG_TRACE("get Data back");
BOOST_CHECK_EQUAL(data.getName().getPrefix(-1), q.toInterest().getName());
@@ -110,11 +110,11 @@
BOOST_CHECK_EQUAL(resp.getNdnsType(), NDNS_NACK);
});
- face->receive(q.toInterest());
+ face.receive(q.toInterest());
run();
// will ask for the existing record (will have type NDNS_RAW, as it is certificate)
- face->onSendData.connectSingleShot([&] (const Data& data) {
+ face.onSendData.connectSingleShot([&] (const Data& data) {
++nDataBack;
NDNS_LOG_TRACE("get Data back");
BOOST_CHECK_EQUAL(data.getName().getPrefix(-1), q.toInterest().getName());
@@ -126,15 +126,15 @@
q.setRrLabel("dsk-1");
- face->receive(q.toInterest());
+ face.receive(q.toInterest());
run();
BOOST_CHECK_EQUAL(nDataBack, 2);
// explicit interest with correct version
- face->receive(Interest("/test19/KEY/dsk-1/ID-CERT/%FDd"));
+ face.receive(Interest("/test19/KEY/dsk-1/ID-CERT/%FDd"));
- face->onSendData.connectSingleShot([&] (const Data& data) {
+ face.onSendData.connectSingleShot([&] (const Data& data) {
++nDataBack;
Response resp;
@@ -146,9 +146,9 @@
BOOST_CHECK_EQUAL(nDataBack, 3);
// explicit interest with wrong version
- face->receive(Interest("/test19/KEY/dsk-1/ID-CERT/%FD010101010"));
+ face.receive(Interest("/test19/KEY/dsk-1/ID-CERT/%FD010101010"));
- face->onSendData.connectSingleShot([&] (const Data& data) {
+ face.onSendData.connectSingleShot([&] (const Data& data) {
++nDataBack;
Response resp;
@@ -187,7 +187,7 @@
bool hasDataBack = false;
- face->onSendData.connectSingleShot([&] (const Data& data) {
+ face.onSendData.connectSingleShot([&] (const Data& data) {
hasDataBack = true;
NDNS_LOG_TRACE("get Data back");
BOOST_CHECK_EQUAL(data.getName().getPrefix(-1), q.toInterest().getName());
@@ -206,7 +206,7 @@
BOOST_CHECK_EQUAL(ret, 0);
});
- face->receive(q.toInterest());
+ face.receive(q.toInterest());
run();
BOOST_CHECK_EQUAL(hasDataBack, true);
@@ -239,7 +239,7 @@
bool hasDataBack = false;
- face->onSendData.connectSingleShot([&] (const Data& data) {
+ face.onSendData.connectSingleShot([&] (const Data& data) {
hasDataBack = true;
NDNS_LOG_TRACE("get Data back");
BOOST_CHECK_EQUAL(data.getName().getPrefix(-1), q.toInterest().getName());
@@ -258,7 +258,7 @@
BOOST_CHECK_EQUAL(ret, 0);
});
- face->receive(q.toInterest());
+ face.receive(q.toInterest());
run();
BOOST_CHECK_EQUAL(hasDataBack, true);
@@ -316,12 +316,12 @@
bool hasDataBack = false;
// no data back, since the Update cannot pass verification
- face->onSendData.connectSingleShot([&] (const Data& data) {
+ face.onSendData.connectSingleShot([&] (const Data& data) {
hasDataBack = true;
BOOST_FAIL("UNEXPECTED");
});
- face->receive(q.toInterest());
+ face.receive(q.toInterest());
run();
BOOST_CHECK_EQUAL(hasDataBack, false);
@@ -331,21 +331,21 @@
{
public:
NameServerFixture2()
- : face(ndn::util::makeDummyClientFace(io, { false, true }))
- , validatorFace(ndn::util::makeDummyClientFace(io, { false, true }))
+ : face(io, m_keyChain, {false, true})
+ , validatorFace(io, m_keyChain, {false, true})
, zone(m_root.getName())
- , validator(*validatorFace) // different face for validator
- , server(zone, m_certName, *face, m_session, m_keyChain, validator)
+ , validator(validatorFace) // different face for validator
+ , server(zone, m_certName, face, m_session, m_keyChain, validator)
{
// ensure prefix is registered
run();
- validatorFace->onSendInterest.connect([this] (const Interest& interest) {
+ validatorFace.onSendInterest.connect([this] (const Interest& interest) {
NDNS_LOG_TRACE("validatorFace get Interest: " << interest.getName());
shared_ptr<const Interest> i = interest.shared_from_this();
io.post([i, this] {
- face->receive(*i);
+ face.receive(*i);
});
});
}
@@ -359,8 +359,8 @@
public:
boost::asio::io_service io;
- shared_ptr<ndn::util::DummyClientFace> face;
- shared_ptr<ndn::util::DummyClientFace> validatorFace;
+ ndn::util::DummyClientFace face;
+ ndn::util::DummyClientFace validatorFace;
Name hint;
const Name& zone;
Validator validator;
@@ -419,11 +419,11 @@
bool hasDataBack = false;
shared_ptr<Regex> regex = make_shared<Regex>("(<>*)<KEY>(<>+)<ID-CERT><>");
- face->onSendData.connect([&] (const Data& data) {
+ face.onSendData.connect([&] (const Data& data) {
if (regex->match(data.getName())) {
shared_ptr<const Data> d = data.shared_from_this();
io.post([d, this] {
- validatorFace->receive(*d); // It's data requested by validator
+ validatorFace.receive(*d); // It's data requested by validator
});
}
else {
@@ -447,7 +447,7 @@
}
});
- face->receive(q.toInterest());
+ face.receive(q.toInterest());
run();
BOOST_CHECK_EQUAL(hasDataBack, true);