tests: don't use makeDummyClientFace
refs #3383
Change-Id: Ia19d16b1f92c5f386c1bbdf3cb4c81aad24f36a0
diff --git a/tests/pib/cert-publicher.t.cpp b/tests/pib/cert-publicher.t.cpp
index a14731c..ca71e4c 100644
--- a/tests/pib/cert-publicher.t.cpp
+++ b/tests/pib/cert-publicher.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California.
+ * Copyright (c) 2014-2016, Regents of the University of California.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -37,7 +37,7 @@
CertPublisherFixture()
: tmpPath(boost::filesystem::path(TMP_TESTS_PATH) / "DbTest")
, db(tmpPath.c_str())
- , face(util::makeDummyClientFace(io, {true, true}))
+ , face(io, m_keyChain, {true, true})
{
}
@@ -49,7 +49,7 @@
boost::asio::io_service io;
boost::filesystem::path tmpPath;
PibDb db;
- shared_ptr<util::DummyClientFace> face;
+ util::DummyClientFace face;
};
BOOST_FIXTURE_TEST_SUITE(PibCertPublisher, CertPublisherFixture)
@@ -67,62 +67,62 @@
shared_ptr<IdentityCertificate> cert112 = m_keyChain.selfSign(keyName11);
Name certName112 = cert112->getName();
- CertPublisher certPublisher(*face, db);
+ CertPublisher certPublisher(face, db);
// Add a certificate
db.addCertificate(*cert111);
advanceClocks(io, time::milliseconds(2), 50);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 0);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 0);
auto interest111 = make_shared<Interest>(cert111->getName().getPrefix(-1));
- face->receive(*interest111);
+ face.receive(*interest111);
advanceClocks(io, time::milliseconds(2), 50);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
- BOOST_CHECK(face->sentDatas[0].wireEncode() == cert111->wireEncode());
- face->sentDatas.clear();
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+ BOOST_CHECK(face.sentData[0].wireEncode() == cert111->wireEncode());
+ face.sentData.clear();
// Add another certificate
db.addCertificate(*cert112);
advanceClocks(io, time::milliseconds(2), 50);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 0);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 0);
auto interest112 = make_shared<Interest>(cert112->getName().getPrefix(-1));
- face->receive(*interest112);
+ face.receive(*interest112);
advanceClocks(io, time::milliseconds(2), 50);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
- BOOST_CHECK(face->sentDatas[0].wireEncode() == cert111->wireEncode());
- face->sentDatas.clear();
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+ BOOST_CHECK(face.sentData[0].wireEncode() == cert111->wireEncode());
+ face.sentData.clear();
Exclude exclude;
exclude.excludeOne(cert111->getName().get(-1));
interest112->setExclude(exclude);
- face->receive(*interest112);
+ face.receive(*interest112);
advanceClocks(io, time::milliseconds(2), 50);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
- BOOST_CHECK(face->sentDatas[0].wireEncode() == cert112->wireEncode());
- face->sentDatas.clear();
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+ BOOST_CHECK(face.sentData[0].wireEncode() == cert112->wireEncode());
+ face.sentData.clear();
// delete a certificate
db.deleteCertificate(certName112);
- face->receive(*interest112);
+ face.receive(*interest112);
advanceClocks(io, time::milliseconds(2), 50);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 0);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 0);
- face->receive(*interest111);
+ face.receive(*interest111);
advanceClocks(io, time::milliseconds(2), 50);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
- BOOST_CHECK(face->sentDatas[0].wireEncode() == cert111->wireEncode());
- face->sentDatas.clear();
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+ BOOST_CHECK(face.sentData[0].wireEncode() == cert111->wireEncode());
+ face.sentData.clear();
// delete another certificate
db.deleteCertificate(certName111);
- face->receive(*interest112);
+ face.receive(*interest112);
advanceClocks(io, time::milliseconds(2), 50);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 0);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 0);
- face->receive(*interest111);
+ face.receive(*interest111);
advanceClocks(io, time::milliseconds(2), 50);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 0);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 0);
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/pib/pib.t.cpp b/tests/pib/pib.t.cpp
index 0bbeca9..f797d3c 100644
--- a/tests/pib/pib.t.cpp
+++ b/tests/pib/pib.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California.
+ * Copyright (c) 2014-2016, Regents of the University of California.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -39,7 +39,7 @@
public:
PibTestFixture()
: tmpPath(boost::filesystem::path(TMP_TESTS_PATH) / "PibTest")
- , face(util::makeDummyClientFace(io, {true, true}))
+ , face(io, m_keyChain, {true, true})
{
}
@@ -72,7 +72,7 @@
boost::asio::io_service io;
std::string owner;
boost::filesystem::path tmpPath;
- shared_ptr<util::DummyClientFace> face;
+ util::DummyClientFace face;
};
BOOST_FIXTURE_TEST_SUITE(PibPib, PibTestFixture)
@@ -82,7 +82,7 @@
// Create a PIB with full parameters
owner = "testUser";
- Pib pib(*face,
+ Pib pib(face,
tmpPath.string(),
m_keyChain.getTpm().getTpmLocator(),
owner);
@@ -105,12 +105,12 @@
GetParam param01;
shared_ptr<Interest> interest01 = generateUnsignedInterest(param01, owner);
- face->receive(*interest01);
+ face.receive(*interest01);
advanceClocks(io, time::milliseconds(10), 10);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibUser result01;
- BOOST_REQUIRE_NO_THROW(result01.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result01.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK(result01.getMgmtCert().wireEncode() == mgmtCert.wireEncode());
BOOST_CHECK_EQUAL(result01.getTpmLocator(), m_keyChain.getTpm().getTpmLocator());
}
@@ -129,19 +129,19 @@
shared_ptr<IdentityCertificate> testUserCert = m_keyChain.getCertificate(testUserCertName);
PibDb db(tmpPath.string());
- BOOST_CHECK_NO_THROW(Pib(*face, dbDir, tpmLocator, owner));
+ BOOST_CHECK_NO_THROW(Pib(face, dbDir, tpmLocator, owner));
db.updateMgmtCertificate(*testUserCert);
- BOOST_CHECK_NO_THROW(Pib(*face, dbDir, tpmLocator, owner));
- BOOST_CHECK_THROW(Pib(*face, dbDir, tpmLocator, "wrongUser"), Pib::Error);
+ BOOST_CHECK_NO_THROW(Pib(face, dbDir, tpmLocator, owner));
+ BOOST_CHECK_THROW(Pib(face, dbDir, tpmLocator, "wrongUser"), Pib::Error);
db.setTpmLocator(m_keyChain.getTpm().getTpmLocator());
- BOOST_CHECK_NO_THROW(Pib(*face, dbDir, tpmLocator, owner));
- BOOST_CHECK_THROW(Pib(*face, dbDir, "tpm-file:wrong", owner), Pib::Error);
+ BOOST_CHECK_NO_THROW(Pib(face, dbDir, tpmLocator, owner));
+ BOOST_CHECK_THROW(Pib(face, dbDir, "tpm-file:wrong", owner), Pib::Error);
advanceClocks(io, time::milliseconds(10));
m_keyChain.deleteIdentity(testUser);
- BOOST_CHECK_NO_THROW(Pib(*face, dbDir, tpmLocator, owner));
+ BOOST_CHECK_NO_THROW(Pib(face, dbDir, tpmLocator, owner));
}
BOOST_AUTO_TEST_CASE(InitCertTest3)
@@ -155,18 +155,18 @@
Name testUserCertName = m_keyChain.getDefaultCertificateNameForIdentity(testUser);
shared_ptr<IdentityCertificate> testUserCert = m_keyChain.getCertificate(testUserCertName);
- Pib pib1(*face, dbDir, tpmLocator, owner);
+ Pib pib1(face, dbDir, tpmLocator, owner);
BOOST_CHECK_EQUAL(pib1.getMgmtCert().getName().getPrefix(-3),
Name("/localhost/pib/testUser/mgmt/KEY"));
PibDb db(tmpPath.string());
db.updateMgmtCertificate(*testUserCert);
- Pib pib2(*face, dbDir, tpmLocator, owner);
+ Pib pib2(face, dbDir, tpmLocator, owner);
BOOST_CHECK_EQUAL(pib2.getMgmtCert().getName(), testUserCertName);
advanceClocks(io, time::milliseconds(10));
m_keyChain.deleteIdentity(testUser);
- Pib pib3(*face, dbDir, tpmLocator, owner);
+ Pib pib3(face, dbDir, tpmLocator, owner);
BOOST_CHECK(pib3.getMgmtCert().getName() != testUserCertName);
BOOST_CHECK_EQUAL(pib3.getMgmtCert().getName().getPrefix(-3),
Name("/localhost/pib/testUser/mgmt/KEY"));
@@ -176,7 +176,7 @@
{
owner = "alice";
- Pib pib(*face,
+ Pib pib(face,
tmpPath.string(),
m_keyChain.getTpm().getTpmLocator(),
owner);
@@ -231,39 +231,39 @@
GetParam param01;
shared_ptr<Interest> interest01 = generateUnsignedInterest(param01, owner);
- face->sentDatas.clear();
- face->receive(*interest01);
+ face.sentData.clear();
+ face.receive(*interest01);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest01->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibUser result01;
- BOOST_REQUIRE_NO_THROW(result01.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result01.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK(result01.getMgmtCert().wireEncode() == ownerMgmtCert.wireEncode());
GetParam param02;
shared_ptr<Interest> interest02 = generateUnsignedInterest(param02, "non-existing");
- face->sentDatas.clear();
- face->receive(*interest02);
+ face.sentData.clear();
+ face.receive(*interest02);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_CHECK(cache.find(interest02->getName()) == nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 0);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 0);
GetParam param03(TYPE_ID, testId);
shared_ptr<Interest> interest03 = generateUnsignedInterest(param03, owner);
- face->sentDatas.clear();
- face->receive(*interest03);
+ face.sentData.clear();
+ face.receive(*interest03);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest03->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibIdentity result03;
- BOOST_REQUIRE_NO_THROW(result03.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result03.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result03.getIdentity(), testId);
@@ -271,28 +271,28 @@
GetParam param04(TYPE_ID, wrongId);
shared_ptr<Interest> interest04 = generateUnsignedInterest(param04, owner);
- face->sentDatas.clear();
- face->receive(*interest04);
+ face.sentData.clear();
+ face.receive(*interest04);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest04->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result04;
- BOOST_REQUIRE_NO_THROW(result04.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result04.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result04.getErrorCode(), ERR_NON_EXISTING_ID);
GetParam param05(TYPE_KEY, testIdKeyName1);
shared_ptr<Interest> interest05 = generateUnsignedInterest(param05, owner);
- face->sentDatas.clear();
- face->receive(*interest05);
+ face.sentData.clear();
+ face.receive(*interest05);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest05->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibPublicKey result05;
- BOOST_REQUIRE_NO_THROW(result05.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result05.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result05.getKeyName(), testIdKeyName1);
@@ -300,28 +300,28 @@
GetParam param06(TYPE_KEY, wrongKeyName1);
shared_ptr<Interest> interest06 = generateUnsignedInterest(param06, owner);
- face->sentDatas.clear();
- face->receive(*interest06);
+ face.sentData.clear();
+ face.receive(*interest06);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest06->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result06;
- BOOST_REQUIRE_NO_THROW(result06.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result06.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result06.getErrorCode(), ERR_NON_EXISTING_KEY);
GetParam param07(TYPE_CERT, testIdCertName00);
shared_ptr<Interest> interest07 = generateUnsignedInterest(param07, owner);
- face->sentDatas.clear();
- face->receive(*interest07);
+ face.sentData.clear();
+ face.receive(*interest07);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest07->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibCertificate result07;
- BOOST_REQUIRE_NO_THROW(result07.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result07.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result07.getCertificate().getName(), testIdCertName00);
@@ -329,14 +329,14 @@
GetParam param08(TYPE_CERT, wrongCertName1);
shared_ptr<Interest> interest08 = generateUnsignedInterest(param08, owner);
- face->sentDatas.clear();
- face->receive(*interest08);
+ face.sentData.clear();
+ face.receive(*interest08);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest08->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result08;
- BOOST_REQUIRE_NO_THROW(result08.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result08.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result08.getErrorCode(), ERR_NON_EXISTING_CERT);
@@ -344,14 +344,14 @@
GetParam param09(TYPE_KEY, wrongKeyName2);
shared_ptr<Interest> interest09 = generateUnsignedInterest(param09, owner);
- face->sentDatas.clear();
- face->receive(*interest09);
+ face.sentData.clear();
+ face.receive(*interest09);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest09->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result09;
- BOOST_REQUIRE_NO_THROW(result09.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result09.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result09.getErrorCode(), ERR_WRONG_PARAM);
}
@@ -359,7 +359,7 @@
{
owner = "alice";
- Pib pib(*face,
+ Pib pib(face,
tmpPath.string(),
m_keyChain.getTpm().getTpmLocator(),
owner);
@@ -414,84 +414,84 @@
DefaultParam param11(TYPE_ID, TYPE_USER);
shared_ptr<Interest> interest11 = generateUnsignedInterest(param11, owner);
- face->sentDatas.clear();
- face->receive(*interest11);
+ face.sentData.clear();
+ face.receive(*interest11);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest11->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibIdentity result11;
- BOOST_REQUIRE_NO_THROW(result11.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result11.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result11.getIdentity(), testId);
DefaultParam param13(TYPE_ID, TYPE_ID);
shared_ptr<Interest> interest13 = generateUnsignedInterest(param13, owner);
- face->sentDatas.clear();
- face->receive(*interest13);
+ face.sentData.clear();
+ face.receive(*interest13);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest13->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result13;
- BOOST_REQUIRE_NO_THROW(result13.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result13.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result13.getErrorCode(), ERR_WRONG_PARAM);
DefaultParam param14(TYPE_KEY, TYPE_ID, testId);
shared_ptr<Interest> interest14 = generateUnsignedInterest(param14, owner);
- face->sentDatas.clear();
- face->receive(*interest14);
+ face.sentData.clear();
+ face.receive(*interest14);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest14->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibPublicKey result14;
- BOOST_REQUIRE_NO_THROW(result14.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result14.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result14.getKeyName(), testIdKeyName0);
DefaultParam param15(TYPE_CERT, TYPE_ID, testId);
shared_ptr<Interest> interest15 = generateUnsignedInterest(param15, owner);
- face->sentDatas.clear();
- face->receive(*interest15);
+ face.sentData.clear();
+ face.receive(*interest15);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest15->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibCertificate result15;
- BOOST_REQUIRE_NO_THROW(result15.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result15.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result15.getCertificate().getName(), testIdCertName00);
DefaultParam param16(TYPE_CERT, TYPE_USER);
shared_ptr<Interest> interest16 = generateUnsignedInterest(param16, owner);
- face->sentDatas.clear();
- face->receive(*interest16);
+ face.sentData.clear();
+ face.receive(*interest16);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest16->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibCertificate result16;
- BOOST_REQUIRE_NO_THROW(result16.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result16.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result16.getCertificate().getName(), testIdCertName00);
DefaultParam param17(TYPE_CERT, TYPE_KEY, testIdKeyName1);
shared_ptr<Interest> interest17 = generateUnsignedInterest(param17, owner);
- face->sentDatas.clear();
- face->receive(*interest17);
+ face.sentData.clear();
+ face.receive(*interest17);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest17->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibCertificate result17;
- BOOST_REQUIRE_NO_THROW(result17.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result17.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result17.getCertificate().getName(), testIdCertName10);
}
@@ -499,7 +499,7 @@
{
owner = "alice";
- Pib pib(*face,
+ Pib pib(face,
tmpPath.string(),
m_keyChain.getTpm().getTpmLocator(),
owner);
@@ -556,42 +556,42 @@
ListParam param21;
shared_ptr<Interest> interest21 = generateUnsignedInterest(param21, owner);
- face->sentDatas.clear();
- face->receive(*interest21);
+ face.sentData.clear();
+ face.receive(*interest21);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest21->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibNameList result21;
- BOOST_REQUIRE_NO_THROW(result21.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result21.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result21.getNameList().size(), 1);
ListParam param22(TYPE_ID, testId);
shared_ptr<Interest> interest22 = generateUnsignedInterest(param22, owner);
- face->sentDatas.clear();
- face->receive(*interest22);
+ face.sentData.clear();
+ face.receive(*interest22);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest22->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibNameList result22;
- BOOST_REQUIRE_NO_THROW(result22.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result22.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result22.getNameList().size(), 2);
ListParam param23(TYPE_ID, wrongId);
shared_ptr<Interest> interest23 = generateUnsignedInterest(param23, owner);
- face->sentDatas.clear();
- face->receive(*interest23);
+ face.sentData.clear();
+ face.receive(*interest23);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest23->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibNameList result23;
- BOOST_REQUIRE_NO_THROW(result23.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result23.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result23.getNameList().size(), 0);
}
@@ -600,7 +600,7 @@
// This test case is to check the access control of local management key
owner = "alice";
- Pib pib(*face,
+ Pib pib(face,
tmpPath.string(),
m_keyChain.getTpm().getTpmLocator(),
owner);
@@ -639,7 +639,7 @@
owner = "alice";
- Pib pib(*face,
+ Pib pib(face,
tmpPath.string(),
m_keyChain.getTpm().getTpmLocator(),
owner);
@@ -776,7 +776,7 @@
owner = "alice";
- Pib pib(*face,
+ Pib pib(face,
tmpPath.string(),
m_keyChain.getTpm().getTpmLocator(),
owner);
@@ -814,7 +814,7 @@
// This test case is to check the access control of regular key
owner = "alice";
- Pib pib(*face,
+ Pib pib(face,
tmpPath.string(),
m_keyChain.getTpm().getTpmLocator(),
owner);
@@ -908,7 +908,7 @@
{
owner = "alice";
- Pib pib(*face,
+ Pib pib(face,
tmpPath.string(),
m_keyChain.getTpm().getTpmLocator(),
owner);
@@ -931,14 +931,14 @@
UpdateParam param1(pibUser1);
auto interest1 = generateSignedInterest(param1, owner, db.getMgmtCertificate()->getName());
- face->sentDatas.clear();
- face->receive(*interest1);
+ face.sentData.clear();
+ face.receive(*interest1);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest1->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result;
- BOOST_REQUIRE_NO_THROW(result.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result.getErrorCode(), ERR_WRONG_PARAM);
// user name is correct, but signer is wrong, should fail
@@ -947,12 +947,12 @@
UpdateParam param2(pibUser2);
auto interest2 = generateSignedInterest(param2, owner, bobCertName);
- face->sentDatas.clear();
- face->receive(*interest2);
+ face.sentData.clear();
+ face.receive(*interest2);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_CHECK(cache.find(interest2->getName()) == nullptr); // verification should fail, no response
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 0);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 0);
// update an existing user with a new mgmt key, signed by the old mgmt key.
advanceClocks(io, time::milliseconds(100));
@@ -966,14 +966,14 @@
UpdateParam param3(pibUser3);
auto interest3 = generateSignedInterest(param3, owner, db.getMgmtCertificate()->getName());
- face->sentDatas.clear();
- face->receive(*interest3);
+ face.sentData.clear();
+ face.receive(*interest3);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest3->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result3;
- BOOST_REQUIRE_NO_THROW(result3.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result3.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result3.getErrorCode(), ERR_SUCCESS);
BOOST_CHECK(db.getMgmtCertificate()->wireEncode() == ownerSecondCert->wireEncode());
@@ -985,14 +985,14 @@
UpdateParam updateParam(*testIdCert, DEFAULT_OPT_USER);
auto interest4 = generateSignedInterest(updateParam, owner, ownerSecondCert->getName());
- face->sentDatas.clear();
- face->receive(*interest4);
+ face.sentData.clear();
+ face.receive(*interest4);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_REQUIRE(cache.find(interest4->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result4;
- BOOST_REQUIRE_NO_THROW(result4.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result4.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result4.getErrorCode(), ERR_SUCCESS);
BOOST_CHECK(pib.getDb().hasCertificate(testIdCertName));
@@ -1012,7 +1012,7 @@
{
owner = "alice";
- Pib pib(*face,
+ Pib pib(face,
tmpPath.string(),
m_keyChain.getTpm().getTpmLocator(),
owner);
@@ -1067,14 +1067,14 @@
UpdateParam param1(*cert000);
auto interest1 = generateSignedInterest(param1, owner, ownerMgmtCert.getName());
- face->sentDatas.clear();
- face->receive(*interest1);
+ face.sentData.clear();
+ face.receive(*interest1);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_CHECK(cache.find(interest1->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result1;
- BOOST_REQUIRE_NO_THROW(result1.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result1.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result1.getErrorCode(), ERR_SUCCESS);
BOOST_CHECK_EQUAL(db.hasIdentity(id0), true);
BOOST_CHECK_EQUAL(db.hasKey(keyName00), true);
@@ -1093,14 +1093,14 @@
UpdateParam param2(id1, DEFAULT_OPT_USER);
auto interest2 = generateSignedInterest(param2, owner, ownerMgmtCert.getName());
- face->sentDatas.clear();
- face->receive(*interest2);
+ face.sentData.clear();
+ face.receive(*interest2);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_CHECK(cache.find(interest2->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result2;
- BOOST_REQUIRE_NO_THROW(result2.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result2.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result2.getErrorCode(), ERR_SUCCESS);
BOOST_CHECK_EQUAL(db.getDefaultIdentity(), id1);
@@ -1108,14 +1108,14 @@
UpdateParam param3(keyName01, cert010->getPublicKeyInfo(), DEFAULT_OPT_ID);
auto interest3 = generateSignedInterest(param3, owner, ownerMgmtCert.getName());
- face->sentDatas.clear();
- face->receive(*interest3);
+ face.sentData.clear();
+ face.receive(*interest3);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_CHECK(cache.find(interest3->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result3;
- BOOST_REQUIRE_NO_THROW(result3.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result3.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result3.getErrorCode(), ERR_SUCCESS);
BOOST_CHECK_EQUAL(db.getDefaultKeyNameOfIdentity(id0), keyName01);
@@ -1123,14 +1123,14 @@
UpdateParam param4(*cert011, DEFAULT_OPT_KEY);
auto interest4 = generateSignedInterest(param4, owner, ownerMgmtCert.getName());
- face->sentDatas.clear();
- face->receive(*interest4);
+ face.sentData.clear();
+ face.receive(*interest4);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_CHECK(cache.find(interest4->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result4;
- BOOST_REQUIRE_NO_THROW(result4.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result4.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result4.getErrorCode(), ERR_SUCCESS);
BOOST_CHECK_EQUAL(db.getDefaultCertNameOfKey(keyName01), certName011);
@@ -1139,14 +1139,14 @@
UpdateParam param5(keyName11, cert110->getPublicKeyInfo());
auto interest5 = generateSignedInterest(param5, owner, cert100->getName());
- face->sentDatas.clear();
- face->receive(*interest5);
+ face.sentData.clear();
+ face.receive(*interest5);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_CHECK(cache.find(interest5->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result5;
- BOOST_REQUIRE_NO_THROW(result5.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result5.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result5.getErrorCode(), ERR_SUCCESS);
BOOST_CHECK_EQUAL(db.hasKey(keyName11), true);
@@ -1155,14 +1155,14 @@
UpdateParam param6(*cert101);
auto interest6 = generateSignedInterest(param6, owner, cert100->getName());
- face->sentDatas.clear();
- face->receive(*interest6);
+ face.sentData.clear();
+ face.receive(*interest6);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_CHECK(cache.find(interest6->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result6;
- BOOST_REQUIRE_NO_THROW(result6.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result6.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result6.getErrorCode(), ERR_SUCCESS);
BOOST_CHECK_EQUAL(db.hasCertificate(cert101->getName()), true);
}
@@ -1171,7 +1171,7 @@
{
owner = "alice";
- Pib pib(*face,
+ Pib pib(face,
tmpPath.string(),
m_keyChain.getTpm().getTpmLocator(),
owner);
@@ -1186,13 +1186,13 @@
DeleteParam param(Name(), TYPE_USER);
auto interest = generateSignedInterest(param, owner, ownerMgmtCert.getName());
- face->receive(*interest);
+ face.receive(*interest);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_CHECK(cache.find(interest->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result;
- BOOST_REQUIRE_NO_THROW(result.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result.getErrorCode(), ERR_WRONG_PARAM);
}
@@ -1200,7 +1200,7 @@
{
owner = "alice";
- Pib pib(*face,
+ Pib pib(face,
tmpPath.string(),
m_keyChain.getTpm().getTpmLocator(),
owner);
@@ -1242,14 +1242,14 @@
DeleteParam param1(testIdCertName11, TYPE_CERT);
auto interest1 = generateSignedInterest(param1, owner, testIdCertName11);
- face->sentDatas.clear();
- face->receive(*interest1);
+ face.sentData.clear();
+ face.receive(*interest1);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_CHECK(cache.find(interest1->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result1;
- BOOST_REQUIRE_NO_THROW(result1.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result1.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result1.getErrorCode(), ERR_SUCCESS);
BOOST_CHECK_EQUAL(db.hasCertificate(testIdCertName11), false);
@@ -1258,14 +1258,14 @@
DeleteParam param2(testIdKeyName1, TYPE_KEY);
auto interest2 = generateSignedInterest(param2, owner, testIdCertName11);
- face->sentDatas.clear();
- face->receive(*interest2);
+ face.sentData.clear();
+ face.receive(*interest2);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_CHECK(cache.find(interest2->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result2;
- BOOST_REQUIRE_NO_THROW(result2.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result2.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result2.getErrorCode(), ERR_SUCCESS);
BOOST_CHECK_EQUAL(db.hasKey(testIdKeyName1), false);
@@ -1275,14 +1275,14 @@
DeleteParam param3(testId, TYPE_ID);
auto interest3 = generateSignedInterest(param3, owner, testIdCertName11);
- face->sentDatas.clear();
- face->receive(*interest3);
+ face.sentData.clear();
+ face.receive(*interest3);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_CHECK(cache.find(interest3->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result3;
- BOOST_REQUIRE_NO_THROW(result3.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result3.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result3.getErrorCode(), ERR_WRONG_SIGNER);
BOOST_CHECK_EQUAL(db.hasIdentity(testId), true);
@@ -1290,14 +1290,14 @@
DeleteParam param4(testId, TYPE_ID);
auto interest4 = generateSignedInterest(param4, owner, testIdCertName00);
- face->sentDatas.clear();
- face->receive(*interest4);
+ face.sentData.clear();
+ face.receive(*interest4);
advanceClocks(io, time::milliseconds(10), 10);
BOOST_CHECK(cache.find(interest4->getName()) != nullptr);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
PibError result4;
- BOOST_REQUIRE_NO_THROW(result4.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
+ BOOST_REQUIRE_NO_THROW(result4.wireDecode(face.sentData[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(result4.getErrorCode(), ERR_SUCCESS);
BOOST_CHECK_EQUAL(db.hasIdentity(testId), false);
}
@@ -1307,7 +1307,7 @@
// Read Certificates;
owner = "alice";
- Pib pib(*face,
+ Pib pib(face,
tmpPath.string(),
m_keyChain.getTpm().getTpmLocator(),
owner);
@@ -1342,44 +1342,44 @@
auto interest10 = generateSignedInterest(param10, owner, ownerMgmtCert.getName());
auto interest11 = generateSignedInterest(param11, owner, ownerMgmtCert.getName());
- face->sentDatas.clear();
- face->receive(*interest00);
+ face.sentData.clear();
+ face.receive(*interest00);
advanceClocks(io, time::milliseconds(10), 10);
- face->receive(*interest01);
+ face.receive(*interest01);
advanceClocks(io, time::milliseconds(10), 10);
- face->receive(*interest10);
+ face.receive(*interest10);
advanceClocks(io, time::milliseconds(10), 10);
- face->receive(*interest11);
+ face.receive(*interest11);
advanceClocks(io, time::milliseconds(10), 10);
auto interest1 = make_shared<Interest>(testIdCertName11);
- face->sentDatas.clear();
- face->receive(*interest1);
+ face.sentData.clear();
+ face.receive(*interest1);
advanceClocks(io, time::milliseconds(10), 10);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
- BOOST_CHECK(face->sentDatas[0].wireEncode() == cert11->wireEncode());
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+ BOOST_CHECK(face.sentData[0].wireEncode() == cert11->wireEncode());
auto interest2 = make_shared<Interest>(testIdCertName11.getPrefix(-1));
- face->sentDatas.clear();
- face->receive(*interest2);
+ face.sentData.clear();
+ face.receive(*interest2);
advanceClocks(io, time::milliseconds(10), 10);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
- BOOST_CHECK_EQUAL(face->sentDatas[0].getName().getPrefix(-1),
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+ BOOST_CHECK_EQUAL(face.sentData[0].getName().getPrefix(-1),
cert11->getName().getPrefix(-1));
auto interest3 = make_shared<Interest>(testIdCertName11.getPrefix(-1));
pib.getDb().deleteCertificate(testIdCertName11);
- face->sentDatas.clear();
- face->receive(*interest3);
+ face.sentData.clear();
+ face.receive(*interest3);
advanceClocks(io, time::milliseconds(10), 10);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
- BOOST_CHECK(face->sentDatas[0].wireEncode() == cert10->wireEncode());
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+ BOOST_CHECK(face.sentData[0].wireEncode() == cert10->wireEncode());
auto interest4 = make_shared<Interest>(testIdCertName11);
- face->sentDatas.clear();
- face->receive(*interest4);
+ face.sentData.clear();
+ face.receive(*interest4);
advanceClocks(io, time::milliseconds(10), 10);
- BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 0);
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 0);
}
BOOST_AUTO_TEST_SUITE_END()