tests: use DummyClientFace from ndn-cxx
refs #2186
Change-Id: Ie6f959b846202f201514d757d12d96921fc19bd6
diff --git a/tests/core/notification-stream.cpp b/tests/core/notification-stream.cpp
index df3fc5b..e231427 100644
--- a/tests/core/notification-stream.cpp
+++ b/tests/core/notification-stream.cpp
@@ -27,8 +27,7 @@
#include "simple-notification.hpp"
#include "tests/test-common.hpp"
-#include "tests/dummy-client-face.hpp"
-
+#include <ndn-cxx/util/dummy-client-face.hpp>
namespace nfd {
namespace tests {
@@ -37,29 +36,29 @@
BOOST_AUTO_TEST_CASE(Post)
{
- shared_ptr<DummyClientFace> face = makeDummyClientFace();
+ shared_ptr<ndn::util::DummyClientFace> face = ndn::util::makeDummyClientFace();
ndn::KeyChain keyChain;
- NotificationStream<DummyClientFace> notificationStream(*face,
+ NotificationStream<ndn::util::DummyClientFace> notificationStream(*face,
"/localhost/nfd/NotificationStreamTest", keyChain);
SimpleNotification event1("msg1");
notificationStream.postNotification(event1);
face->processEvents();
- BOOST_REQUIRE_EQUAL(face->m_sentDatas.size(), 1);
- BOOST_CHECK_EQUAL(face->m_sentDatas[0].getName(),
+ BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
+ BOOST_CHECK_EQUAL(face->sentDatas[0].getName(),
"/localhost/nfd/NotificationStreamTest/%FE%00");
SimpleNotification decoded1;
- BOOST_CHECK_NO_THROW(decoded1.wireDecode(face->m_sentDatas[0].getContent().blockFromValue()));
+ BOOST_CHECK_NO_THROW(decoded1.wireDecode(face->sentDatas[0].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(decoded1.getMessage(), "msg1");
SimpleNotification event2("msg2");
notificationStream.postNotification(event2);
face->processEvents();
- BOOST_REQUIRE_EQUAL(face->m_sentDatas.size(), 2);
- BOOST_CHECK_EQUAL(face->m_sentDatas[1].getName(),
+ BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 2);
+ BOOST_CHECK_EQUAL(face->sentDatas[1].getName(),
"/localhost/nfd/NotificationStreamTest/%FE%01");
SimpleNotification decoded2;
- BOOST_CHECK_NO_THROW(decoded2.wireDecode(face->m_sentDatas[1].getContent().blockFromValue()));
+ BOOST_CHECK_NO_THROW(decoded2.wireDecode(face->sentDatas[1].getContent().blockFromValue()));
BOOST_CHECK_EQUAL(decoded2.getMessage(), "msg2");
}
diff --git a/tests/core/segment-publisher.cpp b/tests/core/segment-publisher.cpp
index 08fc226..565c314 100644
--- a/tests/core/segment-publisher.cpp
+++ b/tests/core/segment-publisher.cpp
@@ -24,13 +24,10 @@
*/
#include "core/segment-publisher.hpp"
-
-#include "tests/test-common.hpp"
-#include "tests/dummy-client-face.hpp"
-
#include <ndn-cxx/encoding/tlv.hpp>
-#include <boost/foreach.hpp>
+#include "tests/test-common.hpp"
+#include <ndn-cxx/util/dummy-client-face.hpp>
namespace nfd {
namespace tests {
@@ -38,10 +35,10 @@
NFD_LOG_INIT("SegmentPublisherTest");
template<int64_t N=10000>
-class TestSegmentPublisher : public SegmentPublisher<DummyClientFace>
+class TestSegmentPublisher : public SegmentPublisher<ndn::util::DummyClientFace>
{
public:
- TestSegmentPublisher(DummyClientFace& face,
+ TestSegmentPublisher(ndn::util::DummyClientFace& face,
const Name& prefix,
ndn::KeyChain& keyChain)
: SegmentPublisher(face, prefix, keyChain)
@@ -90,7 +87,7 @@
{
public:
SegmentPublisherFixture()
- : m_face(makeDummyClientFace())
+ : m_face(ndn::util::makeDummyClientFace())
, m_publisher(*m_face, "/localhost/nfd/SegmentPublisherFixture", m_keyChain)
{
}
@@ -134,7 +131,7 @@
}
protected:
- shared_ptr<DummyClientFace> m_face;
+ shared_ptr<ndn::util::DummyClientFace> m_face;
TestSegmentPublisher<N> m_publisher;
ndn::EncodingBuffer m_buffer;
ndn::KeyChain m_keyChain;
@@ -151,13 +148,13 @@
this->m_face->processEvents();
size_t nSegments = this->m_publisher.getTotalPayloadLength() /
- this->m_publisher.getMaxSegmentSize();
+ this->m_publisher.getMaxSegmentSize();
if (this->m_publisher.getTotalPayloadLength() % this->m_publisher.getMaxSegmentSize() != 0 ||
nSegments == 0)
++nSegments;
- BOOST_CHECK_EQUAL(this->m_face->m_sentDatas.size(), nSegments);
- BOOST_FOREACH(const Data& data, this->m_face->m_sentDatas) {
+ BOOST_CHECK_EQUAL(this->m_face->sentDatas.size(), nSegments);
+ for (const Data& data : this->m_face->sentDatas) {
this->validate(data);
}
}