partial-producer: gather constructor args into Options struct
refs #5069
Change-Id: I9ac66d8c42be4fcfebbd718eeeb50a9009d75c54
diff --git a/tests/test-partial-producer.cpp b/tests/test-partial-producer.cpp
index 50d7386..5088915 100644
--- a/tests/test-partial-producer.cpp
+++ b/tests/test-partial-producer.cpp
@@ -41,7 +41,8 @@
BOOST_AUTO_TEST_CASE(RegisterPrefix)
{
Name syncPrefix("/psync"), userNode("/testUser");
- PartialProducer producer(m_face, m_keyChain, 40, syncPrefix, userNode);
+ PartialProducer producer(m_face, m_keyChain, syncPrefix, {});
+ producer.addUserNode(userNode);
m_face.processEvents(-1_ms);
@@ -55,7 +56,8 @@
BOOST_AUTO_TEST_CASE(PublishName)
{
Name syncPrefix("/psync"), userNode("/testUser"), nonUser("/testUser2");
- PartialProducer producer(m_face, m_keyChain, 40, syncPrefix, userNode);
+ PartialProducer producer(m_face, m_keyChain, syncPrefix, {});
+ producer.addUserNode(userNode);
BOOST_CHECK_EQUAL(producer.getSeqNo(userNode).value_or(-1), 0);
producer.publishName(userNode);
@@ -74,7 +76,8 @@
BOOST_AUTO_TEST_CASE(SameSyncInterest)
{
Name syncPrefix("/psync"), userNode("/testUser");
- PartialProducer producer(m_face, m_keyChain, 40, syncPrefix, userNode);
+ PartialProducer producer(m_face, m_keyChain, syncPrefix, {});
+ producer.addUserNode(userNode);
Name syncInterestName(syncPrefix);
syncInterestName.append("sync");
@@ -110,7 +113,8 @@
BOOST_AUTO_TEST_CASE(OnSyncInterest)
{
Name syncPrefix("/psync"), userNode("/testUser");
- PartialProducer producer(m_face, m_keyChain, 40, syncPrefix, userNode);
+ PartialProducer producer(m_face, m_keyChain, syncPrefix, {});
+ producer.addUserNode(userNode);
// Sync interest with no bloom filter attached
Name syncInterestName(syncPrefix);
diff --git a/tests/test-partial-sync.cpp b/tests/test-partial-sync.cpp
index 2526d2c..0efe4c8 100644
--- a/tests/test-partial-sync.cpp
+++ b/tests/test-partial-sync.cpp
@@ -37,7 +37,7 @@
protected:
PartialSyncFixture()
{
- producer = std::make_unique<PartialProducer>(face, m_keyChain, 40, syncPrefix, userPrefix);
+ producer = std::make_unique<PartialProducer>(face, m_keyChain, syncPrefix, PartialProducer::Options{});
addUserNodes("testUser", 10);
}
@@ -111,8 +111,7 @@
void
addUserNodes(const std::string& prefix, int numOfUserNodes)
{
- // zeroth is added through constructor
- for (int i = 1; i < numOfUserNodes; i++) {
+ for (int i = 0; i < numOfUserNodes; i++) {
producer->addUserNode(prefix + "-" + std::to_string(i));
}
}
@@ -291,8 +290,8 @@
face.unlink();
ndn::DummyClientFace face2(m_io, m_keyChain, {true, true});
- PartialProducer replicatedProducer(face2, m_keyChain, 40, syncPrefix, userPrefix);
- for (int i = 1; i < 10; i++) {
+ PartialProducer replicatedProducer(face2, m_keyChain, syncPrefix, {});
+ for (int i = 0; i < 10; i++) {
replicatedProducer.addUserNode("testUser-" + std::to_string(i));
}
advanceClocks(ndn::time::milliseconds(10));
diff --git a/tests/test-producer-base.cpp b/tests/test-producer-base.cpp
index 4886339..468c1d4 100644
--- a/tests/test-producer-base.cpp
+++ b/tests/test-producer-base.cpp
@@ -39,7 +39,8 @@
BOOST_AUTO_TEST_CASE(Basic)
{
Name userNode("/testUser");
- ProducerBase producerBase(m_face, m_keyChain, 40, Name("/psync"), userNode);
+ ProducerBase producerBase(m_face, m_keyChain, 40, Name("/psync"));
+ producerBase.addUserNode(userNode);
// Hash table size should be 40 + 40/2 = 60 (which is perfectly divisible by N_HASH = 3)
BOOST_CHECK_EQUAL(producerBase.m_iblt.getHashTable().size(), 60);
@@ -66,7 +67,8 @@
BOOST_AUTO_TEST_CASE(ApplicationNack)
{
- ProducerBase producerBase(m_face, m_keyChain, 40, Name("/psync"), Name("/testUser"));
+ ProducerBase producerBase(m_face, m_keyChain, 40, Name("/psync"));
+ producerBase.addUserNode("/testUser");
BOOST_CHECK_EQUAL(m_face.sentData.size(), 0);
producerBase.sendApplicationNack(Name("test"));