tests: don't use makeDummyClientFace
refs #3383
Change-Id: Ia71fa8e349ced7495edcb79336ee34894bb200cb
diff --git a/tests/unit/validator.cpp b/tests/unit/validator.cpp
index 1ec16c6..b5fcfeb 100644
--- a/tests/unit/validator.cpp
+++ b/tests/unit/validator.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.
@@ -41,7 +41,7 @@
, m_randomId("/test03")
, m_keyChain("sqlite3", "file")
, m_version(name::Component::fromVersion(0))
- , m_face(ndn::util::makeDummyClientFace(ndn::util::DummyClientFace::Options { false, true }))
+ , m_face(m_keyChain, {false, true})
{
m_keyChain.deleteIdentity(m_testId1);
m_keyChain.deleteIdentity(m_testId2);
@@ -60,13 +60,13 @@
m_keyChain.addCertificate(*cert);
NDNS_LOG_TRACE("add cert: " << cert->getName() << " to KeyChain");
- m_face->onSendInterest.connect(bind(&Fixture::respondInterest, this, _1));
+ m_face.onSendInterest.connect(bind(&Fixture::respondInterest, this, _1));
}
~Fixture()
{
- m_face->getIoService().stop();
- m_face->shutdown();
+ m_face.getIoService().stop();
+ m_face.shutdown();
m_keyChain.deleteIdentity(m_testId1);
m_keyChain.deleteIdentity(m_testId2);
m_keyChain.deleteIdentity(m_testId3);
@@ -133,8 +133,8 @@
NDNS_LOG_TRACE("validator needs: " << certName);
BOOST_CHECK_EQUAL(m_keyChain.doesCertificateExist(certName), true);
auto cert = m_keyChain.getCertificate(certName);
- m_face->getIoService().post([this, cert] {
- m_face->receive<Data>(*cert);
+ m_face.getIoService().post([this, cert] {
+ m_face.receive<Data>(*cert);
});
}
@@ -158,14 +158,14 @@
name::Component m_version;
- shared_ptr<ndn::util::DummyClientFace> m_face;
+ ndn::util::DummyClientFace m_face;
};
BOOST_FIXTURE_TEST_CASE(Basic, Fixture)
{
// validator must be created after root key is saved to the target
- ndns::Validator validator(*m_face, TEST_CONFIG_PATH "/" "validator.conf");
+ ndns::Validator validator(m_face, TEST_CONFIG_PATH "/" "validator.conf");
Name dataName(m_testId3);
dataName.append("NDNS")
@@ -186,7 +186,7 @@
BOOST_CHECK(false);
});
- m_face->processEvents(time::milliseconds(-1));
+ m_face.processEvents(time::milliseconds(-1));
BOOST_CHECK_EQUAL(hasValidated, true);
@@ -210,7 +210,7 @@
BOOST_CHECK(true);
});
- m_face->processEvents(time::milliseconds(-1));
+ m_face.processEvents(time::milliseconds(-1));
// cannot pass verification due to key's owner's name is longer than data owner's
BOOST_CHECK_EQUAL(hasValidated, true);
@@ -234,7 +234,7 @@
BOOST_CHECK(true);
});
- m_face->processEvents(time::milliseconds(-1));
+ m_face.processEvents(time::milliseconds(-1));
// cannot pass due to self-sign cert is used
BOOST_CHECK_EQUAL(hasValidated, true);
@@ -257,7 +257,7 @@
BOOST_CHECK(true);
});
- m_face->processEvents(time::milliseconds(-1));
+ m_face.processEvents(time::milliseconds(-1));
// cannot pass due to a totally mismatched key
BOOST_CHECK_EQUAL(hasValidated, true);
}