src: Making use of DEPRECATED macro and updating library code not to use deprecated methods
Change-Id: Ibe17977e7fcbb759a26dbe1cfa3d472598e49bcc
diff --git a/examples/producer.cpp b/examples/producer.cpp
index d6ca248..acb214c 100644
--- a/examples/producer.cpp
+++ b/examples/producer.cpp
@@ -70,6 +70,7 @@
{
m_face.setInterestFilter("/localhost/testApp",
bind(&Producer::onInterest, this, _1, _2),
+ RegisterPrefixSuccessCallback(),
bind(&Producer::onRegisterFailed, this, _1, _2));
m_face.processEvents();
}
diff --git a/src/detail/face-impl.hpp b/src/detail/face-impl.hpp
index 52f9dd3..7913831 100644
--- a/src/detail/face-impl.hpp
+++ b/src/detail/face-impl.hpp
@@ -251,7 +251,10 @@
m_processEventsTimeoutTimer->cancel();
}
}
- onSuccess();
+
+ if (static_cast<bool>(onSuccess)) {
+ onSuccess();
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/encoding/block.hpp b/src/encoding/block.hpp
index d1a762f..c7e7b18 100644
--- a/src/encoding/block.hpp
+++ b/src/encoding/block.hpp
@@ -124,15 +124,15 @@
* @deprecated Use Block::fromStream instead
*/
explicit
- Block(std::istream& is)
+ DEPRECATED(Block(std::istream& is))
{
*this = Block::fromStream(is);
}
/*
- * @brief A helper version of a constructor to create Block from the stream.
+ * @brief Constructor Block from the stream
*/
- Block
+ static Block
fromStream(std::istream& is);
/**
diff --git a/src/exclude.cpp b/src/exclude.cpp
index 5dd6c5d..d2eed70 100644
--- a/src/exclude.cpp
+++ b/src/exclude.cpp
@@ -91,10 +91,8 @@
Exclude::excludeRange(const name::Component& from, const name::Component& to)
{
if (from >= to) {
- throw Error("Invalid exclude range [" +
- from.toEscapedString() + ", " +
- to.toEscapedString() +
- "] (for single name exclude use Exclude::excludeOne)");
+ throw Error("Invalid exclude range [" + from.toUri() + ", " + to.toUri() + "] "
+ "(for single name exclude use Exclude::excludeOne)");
}
iterator newFrom = m_exclude.lower_bound(from);
@@ -154,7 +152,7 @@
for (Exclude::const_reverse_iterator i = exclude.rbegin(); i != exclude.rend(); i++) {
if (!i->first.empty()) {
if (!empty) os << ",";
- os << i->first.toEscapedString();
+ os << i->first.toUri();
empty = false;
}
if (i->second) {
diff --git a/src/face.cpp b/src/face.cpp
index c2231c6..3fa693a 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -151,14 +151,9 @@
const Interest& tmpl,
const OnData& onData, const OnTimeout& onTimeout/* = OnTimeout()*/)
{
- return expressInterest(Interest(name,
- tmpl.getMinSuffixComponents(),
- tmpl.getMaxSuffixComponents(),
- tmpl.getExclude(),
- tmpl.getChildSelector(),
- tmpl.getMustBeFresh(),
- tmpl.getScope(),
- tmpl.getInterestLifetime()),
+ return expressInterest(Interest(tmpl)
+ .setName(name)
+ .setNonce(0),
onData, onTimeout);
}
diff --git a/src/face.hpp b/src/face.hpp
index 139ff28..ab7bb7e 100644
--- a/src/face.hpp
+++ b/src/face.hpp
@@ -112,8 +112,9 @@
* @throws ConfigFile::Error on configuration file parse failure
* @throws Face::Error on unsupported protocol
*/
+ DEPRECATED(
explicit
- Face(const shared_ptr<boost::asio::io_service>& ioService);
+ Face(const shared_ptr<boost::asio::io_service>& ioService));
/**
* @brief Create a new Face using the default transport (UnixTransport)
@@ -241,11 +242,12 @@
/**
* @deprecated Use the other overload
*/
+ DEPRECATED(
const RegisteredPrefixId*
setInterestFilter(const InterestFilter& interestFilter,
const OnInterest& onInterest,
const RegisterPrefixFailureCallback& onFailure,
- const IdentityCertificate& certificate = IdentityCertificate());
+ const IdentityCertificate& certificate = IdentityCertificate()));
/**
* @brief Set InterestFilter to dispatch incoming matching interest to onInterest
@@ -276,11 +278,12 @@
/**
* @deprecated Use the other overload
*/
+ DEPRECATED(
const RegisteredPrefixId*
setInterestFilter(const InterestFilter& interestFilter,
const OnInterest& onInterest,
const RegisterPrefixFailureCallback& onFailure,
- const Name& identity);
+ const Name& identity));
/**
* @brief Set InterestFilter to dispatch incoming matching interest to onInterest callback
@@ -445,8 +448,9 @@
*
* @deprecated Use getIoService instead
*/
+ DEPRECATED(
shared_ptr<boost::asio::io_service>
- ioService()
+ ioService())
{
return m_ioService;
}
diff --git a/src/interest.hpp b/src/interest.hpp
index c433ae8..ea23392 100644
--- a/src/interest.hpp
+++ b/src/interest.hpp
@@ -128,6 +128,7 @@
*
* Otherwise, Interest::shared_from_this() will throw an exception.
*/
+ DEPRECATED(
Interest(const Name& name,
int minSuffixComponents, int maxSuffixComponents,
const Exclude& exclude,
@@ -135,9 +136,14 @@
bool mustBeFresh,
int scope,
const time::milliseconds& interestLifetime,
- uint32_t nonce = 0)
+ uint32_t nonce = 0))
: m_name(name)
- , m_selectors(minSuffixComponents, maxSuffixComponents, exclude, childSelector, mustBeFresh)
+ , m_selectors(Selectors()
+ .setMinSuffixComponents(minSuffixComponents)
+ .setMaxSuffixComponents(maxSuffixComponents)
+ .setExclude(exclude)
+ .setChildSelector(childSelector)
+ .setMustBeFresh(mustBeFresh))
, m_nonce(nonce)
, m_scope(scope)
, m_interestLifetime(interestLifetime)
diff --git a/src/name-component.hpp b/src/name-component.hpp
index d58e4d6..751c490 100644
--- a/src/name-component.hpp
+++ b/src/name-component.hpp
@@ -194,8 +194,12 @@
*
* @param os The output stream to where write the URI escaped version *this
*/
+ DEPRECATED(
void
- toEscapedString(std::ostream& os) const;
+ toEscapedString(std::ostream& os) const)
+ {
+ return toUri(os);
+ }
/**
* @brief Convert *this by escaping characters according to the NDN URI Scheme
@@ -206,12 +210,11 @@
*
* @return The escaped string
*/
+ DEPRECATED(
std::string
- toEscapedString() const
+ toEscapedString() const)
{
- std::ostringstream result;
- toEscapedString(result);
- return result.str();
+ return toUri();
}
/**
@@ -222,10 +225,7 @@
* @param os The output stream to where write the URI escaped version *this
*/
void
- toUri(std::ostream& os) const
- {
- return toEscapedString(os);
- }
+ toUri(std::ostream& os) const;
/**
* @brief Convert *this by escaping characters according to the NDN URI Scheme
@@ -237,7 +237,9 @@
std::string
toUri() const
{
- return toEscapedString();
+ std::ostringstream os;
+ toUri(os);
+ return os.str();
}
/**
@@ -390,7 +392,7 @@
inline std::ostream&
operator<<(std::ostream& os, const Component& component)
{
- component.toEscapedString(os);
+ component.toUri(os);
return os;
}
@@ -468,7 +470,7 @@
inline void
-Component::toEscapedString(std::ostream& result) const
+Component::toUri(std::ostream& result) const
{
const uint8_t* valuePtr = value();
size_t valueSize = value_size();
diff --git a/src/name.hpp b/src/name.hpp
index 11a438d..8c348ac 100644
--- a/src/name.hpp
+++ b/src/name.hpp
@@ -534,7 +534,7 @@
{
for (Name::const_iterator i = name.begin(); i != name.end(); i++) {
os << "/";
- i->toEscapedString(os);
+ i->toUri(os);
}
}
return os;
diff --git a/src/security/identity-certificate.cpp b/src/security/identity-certificate.cpp
index 33e1e71..b3c544a 100644
--- a/src/security/identity-certificate.cpp
+++ b/src/security/identity-certificate.cpp
@@ -26,7 +26,7 @@
string idString("ID-CERT");
int i = name.size() - 1;
for (; i >= 0; i--) {
- if (name.get(i).toEscapedString() == idString)
+ if (name.get(i).toUri() == idString)
break;
}
@@ -36,7 +36,7 @@
string keyString("KEY");
size_t keyIndex = 0;
for (; keyIndex < name.size(); keyIndex++) {
- if (name.get(keyIndex).toEscapedString() == keyString)
+ if (name.get(keyIndex).toUri() == keyString)
break;
}
@@ -68,7 +68,7 @@
bool foundIdString = false;
size_t idCertComponentIndex = certificateName.size() - 1;
for (; idCertComponentIndex + 1 > 0; --idCertComponentIndex) {
- if (certificateName.get(idCertComponentIndex).toEscapedString() == idString)
+ if (certificateName.get(idCertComponentIndex).toUri() == idString)
{
foundIdString = true;
break;
@@ -83,7 +83,7 @@
bool foundKeyString = false;
size_t keyComponentIndex = 0;
for (; keyComponentIndex < tmpName.size(); keyComponentIndex++) {
- if (tmpName.get(keyComponentIndex).toEscapedString() == keyString)
+ if (tmpName.get(keyComponentIndex).toUri() == keyString)
{
foundKeyString = true;
break;
diff --git a/src/security/key-chain.cpp b/src/security/key-chain.cpp
index 67cdda6..18051c1 100644
--- a/src/security/key-chain.cpp
+++ b/src/security/key-chain.cpp
@@ -116,7 +116,7 @@
if (keyName.size() < 1)
return shared_ptr<IdentityCertificate>();
- std::string keyIdPrefix = keyName.get(-1).toEscapedString().substr(0, 4);
+ std::string keyIdPrefix = keyName.get(-1).toUri().substr(0, 4);
if (keyIdPrefix != "ksk-" && keyIdPrefix != "dsk-")
return shared_ptr<IdentityCertificate>();
diff --git a/src/security/sec-public-info-sqlite3.cpp b/src/security/sec-public-info-sqlite3.cpp
index 7f248d5..86256f8 100644
--- a/src/security/sec-public-info-sqlite3.cpp
+++ b/src/security/sec-public-info-sqlite3.cpp
@@ -233,7 +233,7 @@
if (keyName.empty())
throw Error("Incorrect key name " + keyName.toUri());
- string keyId = keyName.get(-1).toEscapedString();
+ string keyId = keyName.get(-1).toUri();
Name identityName = keyName.getPrefix(-1);
sqlite3_stmt* statement;
@@ -269,7 +269,7 @@
if (doesPublicKeyExist(keyName))
return;
- string keyId = keyName.get(-1).toEscapedString();
+ string keyId = keyName.get(-1).toUri();
Name identityName = keyName.getPrefix(-1);
addIdentity(identityName);
@@ -302,7 +302,7 @@
throw Error("SecPublicInfoSqlite3::getPublicKey Empty keyName");
}
- string keyId = keyName.get(-1).toEscapedString();
+ string keyId = keyName.get(-1).toUri();
Name identityName = keyName.getPrefix(-1);
sqlite3_stmt* statement;
@@ -364,7 +364,7 @@
// if (keyName.empty())
// return;
-// std::string keyId = keyName.get(-1).toEscapedString();
+// std::string keyId = keyName.get(-1).toUri();
// std::string identityName = keyName.getPrefix(-1).toUri();
// sqlite3_stmt* statement;
@@ -421,7 +421,7 @@
if (doesCertificateExist(certificateName))
return;
- string keyId = keyName.get(-1).toEscapedString();
+ string keyId = keyName.get(-1).toUri();
Name identity = keyName.getPrefix(-1);
// Insert the certificate
@@ -585,7 +585,7 @@
if (!doesPublicKeyExist(keyName))
throw Error("Key does not exist:" + keyName.toUri());
- string keyId = keyName.get(-1).toEscapedString();
+ string keyId = keyName.get(-1).toUri();
Name identityName = keyName.getPrefix(-1);
sqlite3_stmt* statement;
@@ -622,7 +622,7 @@
if (keyName.empty())
throw Error("SecPublicInfoSqlite3::getDefaultCertificateNameForKey wrong key");
- string keyId = keyName.get(-1).toEscapedString();
+ string keyId = keyName.get(-1).toUri();
Name identityName = keyName.getPrefix(-1);
sqlite3_stmt* statement;
@@ -657,7 +657,7 @@
throw Error("certificate does not exist:" + certificateName.toUri());
Name keyName = IdentityCertificate::certificateNameToPublicKeyName(certificateName);
- string keyId = keyName.get(-1).toEscapedString();
+ string keyId = keyName.get(-1).toUri();
Name identityName = keyName.getPrefix(-1);
sqlite3_stmt* statement;
@@ -812,7 +812,7 @@
Name identity = keyName.getPrefix(-1);
sqlite3_bind_text(stmt, 1, identity.toUri().c_str(), identity.toUri().size (), SQLITE_TRANSIENT);
- std::string baseKeyName = keyName.get(-1).toEscapedString();
+ std::string baseKeyName = keyName.get(-1).toUri();
sqlite3_bind_text(stmt, 2, baseKeyName.c_str(), baseKeyName.size(), SQLITE_TRANSIENT);
while (sqlite3_step(stmt) == SQLITE_ROW)
@@ -842,7 +842,7 @@
return;
string identity = keyName.getPrefix(-1).toUri();
- string keyId = keyName.get(-1).toEscapedString();
+ string keyId = keyName.get(-1).toUri();
sqlite3_stmt* stmt;
sqlite3_prepare_v2(m_database,
diff --git a/src/selectors.hpp b/src/selectors.hpp
index 4503c17..4e90ee7 100644
--- a/src/selectors.hpp
+++ b/src/selectors.hpp
@@ -36,10 +36,11 @@
/** @deprecated Selectors().setX(...).setY(...)
*/
+ DEPRECATED(
Selectors(int minSuffixComponents, int maxSuffixComponents,
const Exclude& exclude,
int childSelector,
- bool mustBeFresh)
+ bool mustBeFresh))
: m_minSuffixComponents(minSuffixComponents)
, m_maxSuffixComponents(maxSuffixComponents)
, m_exclude(exclude)
diff --git a/src/util/regex/regex-component-matcher.hpp b/src/util/regex/regex-component-matcher.hpp
index de0b6c9..fcc0ccc 100644
--- a/src/util/regex/regex-component-matcher.hpp
+++ b/src/util/regex/regex-component-matcher.hpp
@@ -99,7 +99,7 @@
if (m_isExactMatch)
{
boost::smatch subResult;
- std::string targetStr = name.get(offset).toEscapedString();
+ std::string targetStr = name.get(offset).toUri();
if (boost::regex_match(targetStr, subResult, m_componentRegex))
{
for (size_t i = 1; i < m_componentRegex.mark_count(); i++)
diff --git a/src/util/regex/regex-top-matcher.cpp b/src/util/regex/regex-top-matcher.cpp
index 3c95959..43cd169 100644
--- a/src/util/regex/regex-top-matcher.cpp
+++ b/src/util/regex/regex-top-matcher.cpp
@@ -196,7 +196,7 @@
for (Name::const_iterator it = name.begin(); it != name.end(); it++)
{
regexStr.append("<");
- regexStr.append(convertSpecialChar(it->toEscapedString()));
+ regexStr.append(convertSpecialChar(it->toUri()));
regexStr.append(">");
}
diff --git a/tests-integrated/security/test-validator-config.cpp b/tests-integrated/security/test-validator-config.cpp
index def5ae3..df1dd77 100644
--- a/tests-integrated/security/test-validator-config.cpp
+++ b/tests-integrated/security/test-validator-config.cpp
@@ -542,7 +542,7 @@
void
terminate(shared_ptr<Face> face)
{
- face->ioService()->stop();
+ face->getIoService().stop();
}
const RegisteredPrefixId* regPrefixId;
@@ -584,18 +584,20 @@
keyChain.addCertificateAsIdentityDefault(*nldCert);
shared_ptr<Face> face = make_shared<Face>();
- Face face2(face->ioService());
- Scheduler scheduler(*face->ioService());
+ Face face2(face->getIoService());
+ Scheduler scheduler(face->getIoService());
scheduler.scheduleEvent(time::seconds(1),
bind(&FacesFixture::terminate, this, face));
regPrefixId = face->setInterestFilter(sldCert->getName().getPrefix(-1),
- bind(&FacesFixture::onInterest, this, face, sldCert),
- bind(&FacesFixture::onRegFailed, this));
+ bind(&FacesFixture::onInterest, this, face, sldCert),
+ RegisterPrefixSuccessCallback(),
+ bind(&FacesFixture::onRegFailed, this));
regPrefixId2 = face->setInterestFilter(nldCert->getName().getPrefix(-1),
bind(&FacesFixture::onInterest2, this, face, nldCert),
+ RegisterPrefixSuccessCallback(),
bind(&FacesFixture::onRegFailed, this));
Name dataName1 = nld;
@@ -789,18 +791,20 @@
keyChain.addCertificateAsIdentityDefault(*nldCert);
shared_ptr<Face> face = make_shared<Face>();
- Face face2(face->ioService());
- Scheduler scheduler(*face->ioService());
+ Face face2(face->getIoService());
+ Scheduler scheduler(face->getIoService());
scheduler.scheduleEvent(time::seconds(1),
bind(&FacesFixture::terminate, this, face));
regPrefixId = face->setInterestFilter(sldCert->getName().getPrefix(-1),
- bind(&FacesFixture::onInterest, this, face, sldCert),
- bind(&FacesFixture::onRegFailed, this));
+ bind(&FacesFixture::onInterest, this, face, sldCert),
+ RegisterPrefixSuccessCallback(),
+ bind(&FacesFixture::onRegFailed, this));
regPrefixId2 = face->setInterestFilter(nldCert->getName().getPrefix(-1),
bind(&FacesFixture::onInterest2, this, face, nldCert),
+ RegisterPrefixSuccessCallback(),
bind(&FacesFixture::onRegFailed, this));
Name interestName1("/localhost/nrd/register/option/timestamp/nonce");
diff --git a/tests-integrated/test-faces.cpp b/tests-integrated/test-faces.cpp
index 1c2ef29..e99f0fc 100644
--- a/tests-integrated/test-faces.cpp
+++ b/tests-integrated/test-faces.cpp
@@ -161,13 +161,14 @@
BOOST_AUTO_TEST_CASE(SetFilter)
{
Face face;
- Face face2(face.ioService());
- Scheduler scheduler(*face.ioService());
+ Face face2(face.getIoService());
+ Scheduler scheduler(face.getIoService());
scheduler.scheduleEvent(time::milliseconds(300),
bind(&FacesFixture::terminate, this, ref(face)));
regPrefixId = face.setInterestFilter("/Hello/World",
bind(&FacesFixture::onInterest, this, ref(face), _1, _2),
+ RegisterPrefixSuccessCallback(),
bind(&FacesFixture::onRegFailed, this));
scheduler.scheduleEvent(time::milliseconds(200),
@@ -185,17 +186,19 @@
BOOST_AUTO_TEST_CASE(SetTwoFilters)
{
Face face;
- Face face2(face.ioService());
- Scheduler scheduler(*face.ioService());
+ Face face2(face.getIoService());
+ Scheduler scheduler(face.getIoService());
scheduler.scheduleEvent(time::seconds(1),
bind(&FacesFixture::terminate, this, ref(face)));
regPrefixId = face.setInterestFilter("/Hello/World",
bind(&FacesFixture::onInterest, this, ref(face), _1, _2),
+ RegisterPrefixSuccessCallback(),
bind(&FacesFixture::onRegFailed, this));
regPrefixId2 = face.setInterestFilter("/Los/Angeles/Lakers",
bind(&FacesFixture::onInterest2, this, ref(face), _1, _2),
+ RegisterPrefixSuccessCallback(),
bind(&FacesFixture::onRegFailed, this));
@@ -216,13 +219,14 @@
{
Face face;
Face face2(face.getIoService());
- Scheduler scheduler(*face.ioService());
+ Scheduler scheduler(face.getIoService());
scheduler.scheduleEvent(time::seconds(1),
bind(&FacesFixture::terminate, this, ref(face)));
regPrefixId = face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
bind(&FacesFixture::onInterestRegexError, this,
ref(face), _1, _2),
+ RegisterPrefixSuccessCallback(),
bind(&FacesFixture::onRegFailed, this));
scheduler.scheduleEvent(time::milliseconds(300),
@@ -236,13 +240,14 @@
{
Face face;
Face face2(face.getIoService());
- Scheduler scheduler(*face.ioService());
+ Scheduler scheduler(face.getIoService());
scheduler.scheduleEvent(time::seconds(2),
bind(&FacesFixture::terminate, this, ref(face)));
regPrefixId = face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
bind(&FacesFixture::onInterestRegex, this,
ref(face), _1, _2),
+ RegisterPrefixSuccessCallback(),
bind(&FacesFixture::onRegFailed, this));
scheduler.scheduleEvent(time::milliseconds(200),
@@ -289,13 +294,14 @@
BOOST_FIXTURE_TEST_CASE(RegisterUnregisterPrefix, FacesFixture2)
{
Face face;
- Scheduler scheduler(*face.ioService());
+ Scheduler scheduler(face.getIoService());
scheduler.scheduleEvent(time::seconds(2),
bind(&FacesFixture::terminate, this, ref(face)));
regPrefixId = face.setInterestFilter(InterestFilter("/Hello/World"),
bind(&FacesFixture::onInterest, this,
ref(face), _1, _2),
+ RegisterPrefixSuccessCallback(),
bind(&FacesFixture::onRegFailed, this));
scheduler.scheduleEvent(time::milliseconds(500),
@@ -350,8 +356,8 @@
BOOST_FIXTURE_TEST_CASE(RegisterPrefix, FacesFixture3)
{
Face face;
- Face face2(face.ioService());
- Scheduler scheduler(*face.ioService());
+ Face face2(face.getIoService());
+ Scheduler scheduler(face.getIoService());
scheduler.scheduleEvent(time::seconds(2),
bind(&FacesFixture::terminate, this, ref(face)));
@@ -384,7 +390,7 @@
{
Face face;
Face face2(face.getIoService());
- Scheduler scheduler(*face.ioService());
+ Scheduler scheduler(face.getIoService());
scheduler.scheduleEvent(time::seconds(2),
bind(&FacesFixture::terminate, this, ref(face)));
@@ -392,26 +398,30 @@
bind(&FacesFixture::onInterestRegex, this,
ref(face), _1, _2));
+ // prefix is not registered, and also does not match regex
scheduler.scheduleEvent(time::milliseconds(200),
bind(&FacesFixture::expressInterest, this,
- ref(face2), Name("/Hello/World/a"))); // shouldn't match
+ ref(face2), Name("/Hello/World/a")));
+ // matches regex, but prefix is not registered
scheduler.scheduleEvent(time::milliseconds(300),
bind(&FacesFixture::expressInterest, this,
- ref(face2), Name("/Hello/World/a/b"))); // should match
+ ref(face2), Name("/Hello/World/a/b")));
+ // matches regex, but prefix is not registered
scheduler.scheduleEvent(time::milliseconds(400),
bind(&FacesFixture::expressInterest, this,
- ref(face2), Name("/Hello/World/a/b/c"))); // should match
+ ref(face2), Name("/Hello/World/a/b/c")));
+ // prefix is not registered, and also does not match regex
scheduler.scheduleEvent(time::milliseconds(500),
bind(&FacesFixture::expressInterest, this,
- ref(face2), Name("/Hello/World/a/b/d"))); // should not match
+ ref(face2), Name("/Hello/World/a/b/d")));
BOOST_REQUIRE_NO_THROW(face.processEvents());
BOOST_CHECK_EQUAL(nRegFailures, 0);
- BOOST_CHECK_EQUAL(nInInterests, 4);
+ BOOST_CHECK_EQUAL(nInInterests, 0);
BOOST_CHECK_EQUAL(nTimeouts, 4);
BOOST_CHECK_EQUAL(nData, 0);
}
@@ -421,7 +431,7 @@
{
Face face;
Face face2(face.getIoService());
- Scheduler scheduler(*face.ioService());
+ Scheduler scheduler(face.getIoService());
scheduler.scheduleEvent(time::seconds(2),
bind(&FacesFixture::terminate, this, ref(face)));
diff --git a/tests/test-block.cpp b/tests/test-block.cpp
index a4183f9..49ce204 100644
--- a/tests/test-block.cpp
+++ b/tests/test-block.cpp
@@ -553,22 +553,23 @@
typedef boost::iostreams::stream<boost::iostreams::array_source> ArrayStream;
ArrayStream stream(reinterpret_cast<const char*>(TEST_BUFFER), sizeof(TEST_BUFFER));
+
Block testBlock;
- BOOST_REQUIRE_NO_THROW(testBlock = Block(stream));
+ BOOST_REQUIRE_NO_THROW(testBlock = Block::fromStream(stream));
BOOST_CHECK_EQUAL(testBlock.type(), 0);
BOOST_CHECK_EQUAL(testBlock.size(), 3);
BOOST_CHECK_EQUAL(testBlock.value_size(), 1);
BOOST_CHECK_EQUAL(*testBlock.wire(), 0x00);
BOOST_CHECK_EQUAL(*testBlock.value(), 0xfa);
- BOOST_REQUIRE_NO_THROW(testBlock = Block(stream));
+ BOOST_REQUIRE_NO_THROW(testBlock = Block::fromStream(stream));
BOOST_CHECK_EQUAL(testBlock.type(), 1);
BOOST_CHECK_EQUAL(testBlock.size(), 3);
BOOST_CHECK_EQUAL(testBlock.value_size(), 1);
BOOST_CHECK_EQUAL(*testBlock.wire(), 0x01);
BOOST_CHECK_EQUAL(*testBlock.value(), 0xfb);
- BOOST_CHECK_THROW(testBlock = Block(stream), Tlv::Error);
+ BOOST_CHECK_THROW(Block::fromStream(stream), Tlv::Error);
}
BOOST_AUTO_TEST_CASE(Equality)
diff --git a/tests/test-interest.cpp b/tests/test-interest.cpp
index 54efad4..75a4fb7 100644
--- a/tests/test-interest.cpp
+++ b/tests/test-interest.cpp
@@ -245,7 +245,7 @@
boost::iostreams::stream<boost::iostreams::array_source> is(
reinterpret_cast<const char *>(Interest1), sizeof(Interest1));
- Block interestBlock(is);
+ Block interestBlock = Block::fromStream(is);
ndn::Interest i;
BOOST_REQUIRE_NO_THROW(i.wireDecode(interestBlock));
diff --git a/tests/util/test-regex.cpp b/tests/util/test-regex.cpp
index 44279cd..668f5a4 100644
--- a/tests/util/test-regex.cpp
+++ b/tests/util/test-regex.cpp
@@ -36,7 +36,7 @@
bool res = cm->match(Name("/a/b/"), 0, 1);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 1);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
backRef = make_shared<RegexBackrefManager>();
cm = make_shared<RegexComponentMatcher>("a", backRef);
@@ -49,9 +49,9 @@
res = cm->match(Name("/ccc.cd/b/"), 0, 1);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 1);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("ccc.cd"));
- BOOST_CHECK_EQUAL(backRef->getBackref(0)->getMatchResult()[0].toEscapedString(), string("ccc"));
- BOOST_CHECK_EQUAL(backRef->getBackref(1)->getMatchResult()[0].toEscapedString(), string("cd"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("ccc.cd"));
+ BOOST_CHECK_EQUAL(backRef->getBackref(0)->getMatchResult()[0].toUri(), string("ccc"));
+ BOOST_CHECK_EQUAL(backRef->getBackref(1)->getMatchResult()[0].toUri(), string("cd"));
}
BOOST_AUTO_TEST_CASE(ComponentSetMatcher)
@@ -62,7 +62,7 @@
bool res = cm->match(Name("/a/b/"), 0, 1);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 1);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
res = cm->match(Name("/a/b/"), 1, 1);
BOOST_CHECK_EQUAL(res, false);
@@ -77,7 +77,7 @@
res = cm->match(Name("/a/b/d"), 1, 1);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 1);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("b"));
res = cm->match(Name("/a/b/d"), 2, 1);
BOOST_CHECK_EQUAL(res, false);
@@ -88,7 +88,7 @@
res = cm->match(Name("/b/d"), 1, 1);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 1);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("d"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("d"));
}
@@ -104,8 +104,8 @@
cm->match(Name("/a/b/c"), 0, 2);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
@@ -118,8 +118,8 @@
res = cm->match(Name("/a/b/c"), 0, 2);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
@@ -128,12 +128,12 @@
res = cm->match(Name("/a/b/c/d/e/f/"), 0, 6);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 6);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("c"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toEscapedString(), string("d"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[4].toEscapedString(), string("e"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[5].toEscapedString(), string("f"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toUri(), string("c"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toUri(), string("d"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[4].toUri(), string("e"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[5].toUri(), string("f"));
@@ -142,12 +142,12 @@
res = cm->match(Name("/a/b/c/d/e/f/"), 0, 6);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 6);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("c"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toEscapedString(), string("d"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[4].toEscapedString(), string("e"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[5].toEscapedString(), string("f"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toUri(), string("c"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toUri(), string("d"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[4].toUri(), string("e"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[5].toUri(), string("f"));
@@ -161,7 +161,7 @@
res = cm->match(Name("/a/b/c"), 0, 1);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 1);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
cm = make_shared<RegexRepeatMatcher>("<a>?", backRef, 3);
res = cm->match(Name("/a/b/c"), 0, 2);
@@ -179,9 +179,9 @@
res = cm->match(Name("/a/b/a/d/"), 0, 3);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 3);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toUri(), string("a"));
res = cm->match(Name("/a/b/a/d/"), 0, 4);
BOOST_CHECK_EQUAL(res, false);
@@ -194,15 +194,15 @@
res = cm->match(Name("/a/b/a/d/e/"), 0, 2);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
res = cm->match(Name("/a/b/a/d/e/"), 0, 3);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 3);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toUri(), string("a"));
res = cm->match(Name("/a/b/a/b/e/"), 0, 4);
BOOST_CHECK_EQUAL(res, false);
@@ -218,16 +218,16 @@
res = cm->match(Name("/a/b/a/d/e/"), 0, 2);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
res = cm->match(Name("/a/b/a/b/e/"), 0, 4);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 4);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toUri(), string("b"));
res = cm->match(Name("/a/b/a/d/e/"), 0, 1);
BOOST_CHECK_EQUAL(res, false);
@@ -244,13 +244,13 @@
res = cm->match(Name("/a/b/a/b/e/"), 0, 2);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
res = cm->match(Name("/a/b/a/d/e/"), 0, 1);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 1);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
res = cm->match(Name("/a/b/a/d/e/"), 0, 0);
BOOST_CHECK_EQUAL(res, true);
@@ -267,8 +267,8 @@
bool res = cm->match(Name("/a/b/c"), 0, 2);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
BOOST_CHECK_EQUAL(backRef->size(), 1);
backRef = make_shared<RegexBackrefManager>();
@@ -278,12 +278,12 @@
res = cm->match(Name("/a/b/c"), 0, 2);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
BOOST_CHECK_EQUAL(backRef->size(), 2);
- BOOST_CHECK_EQUAL(backRef->getBackref(0)->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(backRef->getBackref(0)->getMatchResult()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(backRef->getBackref(1)->getMatchResult()[0].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(backRef->getBackref(0)->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(backRef->getBackref(0)->getMatchResult()[1].toUri(), string("b"));
+ BOOST_CHECK_EQUAL(backRef->getBackref(1)->getMatchResult()[0].toUri(), string("b"));
}
BOOST_AUTO_TEST_CASE(BackRefMatcherAdvanced)
@@ -294,10 +294,10 @@
bool res = cm->match(Name("/a/b/c"), 0, 2);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
BOOST_CHECK_EQUAL(backRef->size(), 1);
- BOOST_CHECK_EQUAL(backRef->getBackref(0)->getMatchResult()[0].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(backRef->getBackref(0)->getMatchResult()[0].toUri(), string("b"));
}
BOOST_AUTO_TEST_CASE(BackRefMatcherAdvanced2)
@@ -308,13 +308,13 @@
bool res = cm->match(Name("/a/b/c"), 0, 3);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 3);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("c"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toUri(), string("c"));
BOOST_CHECK_EQUAL(backRef->size(), 2);
- BOOST_CHECK_EQUAL(backRef->getBackref(0)->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(backRef->getBackref(0)->getMatchResult()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(backRef->getBackref(1)->getMatchResult()[0].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(backRef->getBackref(0)->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(backRef->getBackref(0)->getMatchResult()[1].toUri(), string("b"));
+ BOOST_CHECK_EQUAL(backRef->getBackref(1)->getMatchResult()[0].toUri(), string("b"));
}
BOOST_AUTO_TEST_CASE(PatternListMatcher)
@@ -325,15 +325,15 @@
bool res = cm->match(Name("/a/b/c"), 0, 2);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
backRef = make_shared<RegexBackrefManager>();
cm = make_shared<RegexPatternListMatcher>("<>*<a>", backRef);
res = cm->match(Name("/a/b/c"), 0, 1);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 1);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
backRef = make_shared<RegexBackrefManager>();
cm = make_shared<RegexPatternListMatcher>("<>*<a>", backRef);
@@ -346,9 +346,9 @@
res = cm->match(Name("/a/b/c"), 0, 3);
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 3);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("c"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toUri(), string("c"));
}
@@ -359,28 +359,28 @@
bool res = cm->match(Name("/a/b/c/d"));
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 4);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("c"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toEscapedString(), string("d"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toUri(), string("c"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toUri(), string("d"));
cm = make_shared<RegexTopMatcher>("<b><c><d>$");
res = cm->match(Name("/a/b/c/d"));
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 4);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("c"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toEscapedString(), string("d"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toUri(), string("c"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toUri(), string("d"));
cm = make_shared<RegexTopMatcher>("^<a><b><c><d>$");
res = cm->match(Name("/a/b/c/d"));
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 4);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("c"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toEscapedString(), string("d"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toUri(), string("c"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toUri(), string("d"));
res = cm->match(Name("/a/b/c/d/e"));
BOOST_CHECK_EQUAL(res, false);
@@ -390,20 +390,20 @@
res = cm->match(Name("/a/b/c/d"));
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 4);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("c"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toEscapedString(), string("d"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toUri(), string("c"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toUri(), string("d"));
cm = make_shared<RegexTopMatcher>("<b><c>");
res = cm->match(Name("/a/b/c/d"));
BOOST_CHECK_EQUAL(res, true);
BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 4);
- BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("c"));
- BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toEscapedString(), string("d"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toUri(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toUri(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toUri(), string("c"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toUri(), string("d"));
}
BOOST_AUTO_TEST_CASE(TopMatcherAdvanced)
diff --git a/tools/ndnputchunks3.cpp b/tools/ndnputchunks3.cpp
index e6d74b2..66d0a8e 100644
--- a/tools/ndnputchunks3.cpp
+++ b/tools/ndnputchunks3.cpp
@@ -84,6 +84,7 @@
m_face.setInterestFilter(m_name,
bind(&Producer::onInterest, this, _1, _2),
+ RegisterPrefixSuccessCallback(),
bind(&Producer::onRegisterFailed, this, _1, _2));
m_face.processEvents();
}
diff --git a/tools/ndnsec-dsk-gen.hpp b/tools/ndnsec-dsk-gen.hpp
index d99ea2b..50cd76a 100644
--- a/tools/ndnsec-dsk-gen.hpp
+++ b/tools/ndnsec-dsk-gen.hpp
@@ -72,7 +72,7 @@
Name defaultCertName = keyChain.getDefaultCertificateNameForIdentity(identityName);
bool isDefaultDsk = false;
- if (defaultCertName.get(-3).toEscapedString().substr(0,4) == "dsk-")
+ if (defaultCertName.get(-3).toUri().substr(0,4) == "dsk-")
isDefaultDsk = true;
if (isDefaultDsk)
diff --git a/tools/tlvdump.cpp b/tools/tlvdump.cpp
index 5f5eac8..47752ae 100644
--- a/tools/tlvdump.cpp
+++ b/tools/tlvdump.cpp
@@ -97,7 +97,7 @@
if (block.elements().empty())
{
std::cout << " [[";
- ndn::name::Component(block.value(), block.value_size()).toEscapedString(std::cout);
+ ndn::name::Component(block.value(), block.value_size()).toUri(std::cout);
std::cout<< "]]";
}
std::cout << std::endl;
@@ -151,7 +151,7 @@
{
while (is.peek() != std::char_traits<char>::eof()) {
try {
- ndn::Block block(is);
+ ndn::Block block = ndn::Block::fromStream(is);
BlockPrinter(block, "");
// HexPrinter(block, "");
}