tests: use DummyClientFace::linkTo() instead of DummyForwarder
Change-Id: Ied69eeb1b98fd2bdf3672db21bbea7a4a559382b
diff --git a/tests/unit/validator/validator.cpp b/tests/unit/validator/validator.cpp
index 21f6d27..c9ac644 100644
--- a/tests/unit/validator/validator.cpp
+++ b/tests/unit/validator/validator.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California.
+ * Copyright (c) 2014-2019, 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.
@@ -23,11 +23,8 @@
#include "daemon/name-server.hpp"
#include "test-common.hpp"
-#include "dummy-forwarder.hpp"
#include "unit/database-test-data.hpp"
-#include <ndn-cxx/util/io.hpp>
-
namespace ndn {
namespace ndns {
namespace tests {
@@ -38,50 +35,47 @@
{
public:
ValidatorTestFixture()
- : m_forwarder(m_io, m_keyChain)
- , m_face(m_forwarder.addFace())
- , m_validator(NdnsValidatorBuilder::create(m_face, 500, 0, TEST_CONFIG_PATH "/" "validator.conf"))
+ : m_validatorFace(m_io, m_keyChain, {true, true})
+ , m_validator(NdnsValidatorBuilder::create(m_validatorFace, 500, 0,
+ TEST_CONFIG_PATH "/validator.conf"))
{
// generate a random cert
// check how does name-server test do
- // initlize all servers
- auto addServer = [&] (const Name& zoneName) {
- Face& face = m_forwarder.addFace();
+ // initialize all servers
+ auto addServer = [this] (const Name& zoneName) {
+ m_serverFaces.push_back(make_unique<util::DummyClientFace>(m_io, m_keyChain,
+ util::DummyClientFace::Options{true, true}));
+ m_serverFaces.back()->linkTo(m_validatorFace);
+
// validator is used only for check update signature
// no updates tested here, so validator will not be used
// passing m_validator is only for construct server
Name certName = CertHelper::getDefaultCertificateNameOfIdentity(m_keyChain,
Name(zoneName).append("NDNS"));
- auto server = make_shared<NameServer>(zoneName, certName, face,
+ auto server = make_shared<NameServer>(zoneName, certName, *m_serverFaces.back(),
m_session, m_keyChain, *m_validator);
- m_servers.push_back(server);
+ m_servers.push_back(std::move(server));
};
addServer(m_testName);
addServer(m_netName);
addServer(m_ndnsimName);
+
m_ndnsimCert = CertHelper::getDefaultCertificateNameOfIdentity(m_keyChain,
- Name(m_ndnsimName).append("NDNS"));
+ Name(m_ndnsimName).append("NDNS"));
m_randomCert = m_keyChain.createIdentity("/random/identity").getDefaultKey()
- .getDefaultCertificate().getName();
+ .getDefaultCertificate().getName();
advanceClocks(time::milliseconds(10), 1);
}
- ~ValidatorTestFixture()
- {
- m_face.getIoService().stop();
- m_face.shutdown();
- }
-
public:
- DummyForwarder m_forwarder;
- ndn::Face& m_face;
+ util::DummyClientFace m_validatorFace;
unique_ptr<security::v2::Validator> m_validator;
+ std::vector<unique_ptr<util::DummyClientFace>> m_serverFaces;
std::vector<shared_ptr<ndns::NameServer>> m_servers;
Name m_ndnsimCert;
Name m_randomCert;
};
-
BOOST_FIXTURE_TEST_CASE(Basic, ValidatorTestFixture)
{
SignatureInfo info;