Change namespace of DummyClientFace, Signal, Segmenter

refs #3940

Change-Id: Id014e1487bfaceac96e97af51dcfd77c4964ef11
This commit is contained in:
Junxiao Shi committed 2023-08-11 08:05:23 +00:00
1 parent 88b7bbd797
commit c5f5eb1f14
13 files changed
+61 -55

No files matched your search

+3 -3
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, The University of Memphis
* Copyright (c) 2014-2023, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -118,7 +118,7 @@ Consumer::sendHelloInterest()
m_helloFetcher->stop();
}
using ndn::util::SegmentFetcher;
using ndn::SegmentFetcher;
SegmentFetcher::Options options;
options.interestLifetime = m_helloInterestLifetime;
options.maxTimeout = m_helloInterestLifetime;
@@ -204,7 +204,7 @@ Consumer::sendSyncInterest()
m_syncFetcher->stop();
}
using ndn::util::SegmentFetcher;
using ndn::SegmentFetcher;
SegmentFetcher::Options options;
options.interestLifetime = m_syncInterestLifetime;
options.maxTimeout = m_syncInterestLifetime;
+3 -3
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, The University of Memphis
* Copyright (c) 2014-2023, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -202,8 +202,8 @@ PSYNC_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
ndn::random::RandomNumberEngine& m_rng;
std::uniform_int_distribution<> m_rangeUniformRandom;
std::shared_ptr<ndn::util::SegmentFetcher> m_helloFetcher;
std::shared_ptr<ndn::util::SegmentFetcher> m_syncFetcher;
std::shared_ptr<ndn::SegmentFetcher> m_helloFetcher;
std::shared_ptr<ndn::SegmentFetcher> m_syncFetcher;
};
} // namespace psync
+2 -2
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, The University of Memphis
* Copyright (c) 2014-2023, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -100,7 +100,7 @@ FullProducer::sendSyncInterest()
ndn::Interest syncInterest(syncInterestName);
using ndn::util::SegmentFetcher;
using ndn::SegmentFetcher;
SegmentFetcher::Options options;
options.interestLifetime = m_syncInterestLifetime;
options.maxTimeout = m_syncInterestLifetime;
+2 -2
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, The University of Memphis
* Copyright (c) 2014-2023, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -189,7 +189,7 @@ private:
std::uniform_int_distribution<> m_jitter{100, 500};
ndn::Name m_outstandingInterestName;
ndn::ScopedRegisteredPrefixHandle m_registeredPrefix;
std::shared_ptr<ndn::util::SegmentFetcher> m_fetcher;
std::shared_ptr<ndn::SegmentFetcher> m_fetcher;
uint64_t m_incomingFace = 0;
};
+2 -2
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, The University of Memphis
* Copyright (c) 2014-2023, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -62,7 +62,7 @@ public:
private:
ndn::Face& m_face;
ndn::Scheduler m_scheduler;
ndn::util::Segmenter m_segmenter;
ndn::Segmenter m_segmenter;
PSYNC_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
ndn::InMemoryStorageFifo m_ims;
+5 -5
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, The University of Memphis
* Copyright (c) 2014-2023, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -26,13 +26,13 @@
namespace psync {
using namespace ndn;
using ndn::Name;
BOOST_AUTO_TEST_SUITE(TestConsumer)
BOOST_AUTO_TEST_CASE(AddSubscription)
{
util::DummyClientFace face;
ndn::DummyClientFace face;
Consumer consumer(Name("/psync"), face,
[] (const auto&) {},
[] (const auto&) {},
@@ -47,7 +47,7 @@ BOOST_AUTO_TEST_CASE(AddSubscription)
BOOST_AUTO_TEST_CASE(RemoveSubscription)
{
util::DummyClientFace face;
ndn::DummyClientFace face;
Consumer consumer(Name("/psync"), face,
[] (const auto&) {},
[] (const auto&) {},
@@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(RemoveSubscription)
BOOST_FIXTURE_TEST_CASE(ConstantTimeoutForFirstSegment, tests::IoFixture)
{
util::DummyClientFace face(m_io);
ndn::DummyClientFace face(m_io);
Consumer consumer(Name("/psync"), face,
[] (const auto&) {},
[] (const auto&) {},
+5 -4
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, The University of Memphis
* Copyright (c) 2014-2023, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -28,12 +28,13 @@
namespace psync {
using namespace ndn;
using ndn::Interest;
using ndn::Name;
class FullProducerFixture : public tests::IoFixture, public tests::KeyChainFixture
{
protected:
util::DummyClientFace m_face{m_io, m_keyChain, {true, true}};
ndn::DummyClientFace m_face{m_io, m_keyChain, {true, true}};
};
BOOST_FIXTURE_TEST_SUITE(TestFullProducer, FullProducerFixture)
@@ -71,7 +72,7 @@ BOOST_AUTO_TEST_CASE(OnSyncDataDecodeFailure)
node.m_iblt.appendToName(syncInterestName);
Interest syncInterest(syncInterestName);
auto badCompress = std::make_shared<const Buffer>(5);
auto badCompress = std::make_shared<const ndn::Buffer>(5);
BOOST_CHECK_NO_THROW(node.onSyncData(syncInterest, badCompress));
const uint8_t test[] = {'t', 'e', 's', 't'};
+8 -7
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, The University of Memphis
* Copyright (c) 2014-2023, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -31,7 +31,8 @@
namespace psync {
using namespace ndn;
using ndn::Interest;
using ndn::Name;
class FullSyncFixture : public tests::IoFixture, public tests::KeyChainFixture
{
@@ -41,8 +42,8 @@ protected:
{
BOOST_ASSERT(id >= 0 && id < MAX_NODES);
userPrefixes[id] = "/userPrefix" + std::to_string(id);
faces[id] = std::make_unique<util::DummyClientFace>(m_io, m_keyChain,
util::DummyClientFace::Options{true, true});
faces[id] = std::make_unique<ndn::DummyClientFace>(m_io, m_keyChain,
ndn::DummyClientFace::Options{true, true});
nodes[id] = std::make_unique<FullProducer>(*faces[id], m_keyChain, 40, syncPrefix, userPrefixes[id],
[] (const auto&) {});
}
@@ -174,7 +175,7 @@ protected:
const Name syncPrefix = "/psync";
static constexpr int MAX_NODES = 4;
std::array<Name, MAX_NODES> userPrefixes;
std::array<std::unique_ptr<util::DummyClientFace>, MAX_NODES> faces;
std::array<std::unique_ptr<ndn::DummyClientFace>, MAX_NODES> faces;
std::array<std::unique_ptr<FullProducer>, MAX_NODES> nodes;
static constexpr uint64_t NOT_EXIST = std::numeric_limits<uint64_t>::max();
};
@@ -467,7 +468,7 @@ BOOST_AUTO_TEST_CASE(DelayedSecondSegment)
int i = 0;
detail::State state;
std::shared_ptr<Buffer> compressed;
std::shared_ptr<ndn::Buffer> compressed;
do {
auto prefixToPublish = makeSubPrefix(0, i++);
nodes[0]->addUserNode(prefixToPublish);
@@ -477,7 +478,7 @@ BOOST_AUTO_TEST_CASE(DelayedSecondSegment)
auto block = state.wireEncode();
compressed = detail::compress(nodes[0]->m_contentCompression, block);
} while (compressed->size() < (MAX_NDN_PACKET_SIZE >> 1));
} while (compressed->size() < (ndn::MAX_NDN_PACKET_SIZE >> 1));
advanceClocks(10_ms, 100);
+3 -3
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, The University of Memphis
* Copyright (c) 2014-2023, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -25,7 +25,7 @@
namespace psync {
namespace detail {
using namespace ndn;
using ndn::Name;
BOOST_AUTO_TEST_SUITE(TestIBLT)
@@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(NameAppendAndExtract)
Name malformedName("/test");
auto compressed = compress(CompressionScheme::DEFAULT,
malformedName.wireEncode().value_bytes());
malformedName.append(name::Component(std::move(compressed)));
malformedName.append(Name::Component(std::move(compressed)));
IBLT rcvd2(size, CompressionScheme::DEFAULT);
BOOST_CHECK_THROW(rcvd2.initialize(malformedName.at(-1)), IBLT::Error);
}
+6 -5
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, The University of Memphis
* Copyright (c) 2014-2023, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -27,12 +27,13 @@
namespace psync {
using namespace ndn;
using ndn::Interest;
using ndn::Name;
class PartialProducerFixture : public tests::KeyChainFixture
{
protected:
util::DummyClientFace m_face{m_keyChain, {true, true}};
ndn::DummyClientFace m_face{m_keyChain, {true, true}};
};
BOOST_FIXTURE_TEST_SUITE(TestPartialProducer, PartialProducerFixture)
@@ -46,8 +47,8 @@ BOOST_AUTO_TEST_CASE(RegisterPrefix)
BOOST_REQUIRE_EQUAL(m_face.sentInterests.size(), 1);
auto interest = m_face.sentInterests.front();
BOOST_CHECK_EQUAL(interest.getName().at(3), name::Component("register"));
nfd::ControlParameters params(interest.getName().at(4).blockFromValue());
BOOST_CHECK_EQUAL(interest.getName().at(3), Name::Component("register"));
ndn::nfd::ControlParameters params(interest.getName().at(4).blockFromValue());
BOOST_CHECK_EQUAL(params.getName(), syncPrefix);
}
+9 -8
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, The University of Memphis
* Copyright (c) 2014-2023, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -29,7 +29,8 @@
namespace psync {
using namespace ndn;
using ndn::Interest;
using ndn::Name;
class PartialSyncFixture : public tests::IoFixture, public tests::KeyChainFixture
{
@@ -52,8 +53,8 @@ protected:
void
addConsumer(int id, const std::vector<std::string>& subscribeTo, bool linkToProducer = true)
{
consumerFaces[id] = std::make_unique<util::DummyClientFace>(m_io, m_keyChain,
util::DummyClientFace::Options{true, true});
consumerFaces[id] = std::make_unique<ndn::DummyClientFace>(m_io, m_keyChain,
ndn::DummyClientFace::Options{true, true});
if (linkToProducer) {
face.linkTo(*consumerFaces[id]);
}
@@ -132,7 +133,7 @@ protected:
}
protected:
util::DummyClientFace face{m_io, m_keyChain, {true, true}};
ndn::DummyClientFace face{m_io, m_keyChain, {true, true}};
const Name syncPrefix{"psync"};
const Name userPrefix{"testUser-0"};
@@ -140,7 +141,7 @@ protected:
std::map<Name, uint64_t> oldSeqMap;
std::array<std::unique_ptr<Consumer>, 3> consumers;
std::array<std::unique_ptr<util::DummyClientFace>, 3> consumerFaces;
std::array<std::unique_ptr<ndn::DummyClientFace>, 3> consumerFaces;
int numHelloDataRcvd = 0;
int numSyncDataRcvd = 0;
};
@@ -289,7 +290,7 @@ BOOST_AUTO_TEST_CASE(ReplicatedProducer)
// Link to first producer goes down
face.unlink();
util::DummyClientFace face2(m_io, m_keyChain, {true, true});
ndn::DummyClientFace face2(m_io, m_keyChain, {true, true});
PartialProducer replicatedProducer(face2, m_keyChain, 40, syncPrefix, userPrefix);
for (int i = 1; i < 10; i++) {
replicatedProducer.addUserNode("testUser-" + std::to_string(i));
@@ -339,7 +340,7 @@ BOOST_AUTO_TEST_CASE(ApplicationNack)
bool nackRcvd = false;
for (const auto& data : face.sentData) {
if (data.getContentType() == tlv::ContentType_Nack) {
if (data.getContentType() == ndn::tlv::ContentType_Nack) {
nackRcvd = true;
break;
}
+4 -4
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, The University of Memphis
* Copyright (c) 2014-2023, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -26,12 +26,12 @@
namespace psync {
using namespace ndn;
using ndn::Name;
class ProducerBaseFixture : public tests::KeyChainFixture
{
protected:
util::DummyClientFace m_face;
ndn::DummyClientFace m_face;
};
BOOST_FIXTURE_TEST_SUITE(TestProducerBase, ProducerBaseFixture)
@@ -73,7 +73,7 @@ BOOST_AUTO_TEST_CASE(ApplicationNack)
m_face.processEvents(10_ms);
BOOST_REQUIRE_EQUAL(m_face.sentData.size(), 1);
BOOST_CHECK_EQUAL(m_face.sentData.front().getContentType(), tlv::ContentType_Nack);
BOOST_CHECK_EQUAL(m_face.sentData.front().getContentType(), ndn::tlv::ContentType_Nack);
}
BOOST_AUTO_TEST_SUITE_END()
+9 -7
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, The University of Memphis
* Copyright (c) 2014-2023, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -30,14 +30,16 @@
namespace psync {
using namespace ndn;
using namespace ndn::time_literals;
using ndn::Interest;
using ndn::Name;
class SegmentPublisherFixture : public tests::IoFixture, public tests::KeyChainFixture
{
protected:
SegmentPublisherFixture()
{
m_face.setInterestFilter(InterestFilter("/hello/world"),
m_face.setInterestFilter(ndn::InterestFilter("/hello/world"),
bind(&SegmentPublisherFixture::onInterest, this, _2),
[] (auto&&...) { BOOST_CHECK(false); });
advanceClocks(10_ms);
@@ -55,7 +57,7 @@ protected:
void
expressInterest(const Interest& interest)
{
fetcher = util::SegmentFetcher::start(m_face, interest, security::getAcceptAllValidator());
fetcher = ndn::SegmentFetcher::start(m_face, interest, ndn::security::getAcceptAllValidator());
fetcher->onComplete.connect([this] (auto&&...) { numComplete++; });
fetcher->onError.connect([] (auto&&...) { BOOST_CHECK(false); });
@@ -80,16 +82,16 @@ protected:
}
protected:
util::DummyClientFace m_face{m_io, m_keyChain, {true, true}};
ndn::DummyClientFace m_face{m_io, m_keyChain, {true, true}};
SegmentPublisher publisher{m_face, m_keyChain};
std::shared_ptr<util::SegmentFetcher> fetcher;
std::shared_ptr<ndn::SegmentFetcher> fetcher;
Name dataName;
detail::State state;
int numComplete = 0;
int numRepliesFromStore = 0;
static constexpr time::milliseconds freshness = 1_s;
static constexpr ndn::time::milliseconds freshness = 1_s;
};
BOOST_FIXTURE_TEST_SUITE(TestSegmentPublisher, SegmentPublisherFixture)