Integrate name change (add /ndn/multicast/ prefix). Additionally updated unit tests to test cases of
many torrent segments and many manifests.
Change-Id: Ieb3b3971fb09e31ddb15d85b5907ee7be41ef1ba
diff --git a/src/file-manifest.cpp b/src/file-manifest.cpp
index 2e6dcd2..6310b20 100644
--- a/src/file-manifest.cpp
+++ b/src/file-manifest.cpp
@@ -65,7 +65,7 @@
manifestPrefix.toUri() + " and " +
full_path.toUri()));
}
- ndn::Name manifestName = "/NTORRENT/";
+ ndn::Name manifestName = "/ndn/multicast/NTORRENT/";
// Rebuild the name to be the suffix from the matching component
for (auto it = (name_component_iter.base() - 1); full_path.end() != it; ++it) {
manifestName.append(*it);
@@ -204,7 +204,6 @@
{
BOOST_ASSERT(name != m_catalogPrefix);
BOOST_ASSERT(m_catalogPrefix.isPrefixOf(name));
- // TODO(msweatt) Change this to use the copy constructor once bug fixed in Name()
m_catalog.push_back(name.toUri());
}
diff --git a/src/file-manifest.hpp b/src/file-manifest.hpp
index 8366db2..e11b560 100644
--- a/src/file-manifest.hpp
+++ b/src/file-manifest.hpp
@@ -312,7 +312,7 @@
inline std::string
FileManifest::file_name() const
{
- return name().getSubName(1, name().size() - 2).toUri();
+ return name().getSubName(3, name().size() - 4).toUri();
}
diff --git a/src/main.cpp b/src/main.cpp
index c4240d9..2fd441d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -103,7 +103,7 @@
manifests.insert(manifests.end(), ms.first.begin(), ms.first.end());
}
auto torrentPrefix = fs::canonical(dataPath).filename().string();
- outputPath += torrentPrefix;
+ outputPath += ("/" + torrentPrefix);
auto torrentPath = outputPath + "/torrent_files/";
// write all the torrent segments
for (const TorrentFile& t : torrentSegments) {
diff --git a/src/torrent-file.cpp b/src/torrent-file.cpp
index 30957bf..e5ef53e 100644
--- a/src/torrent-file.cpp
+++ b/src/torrent-file.cpp
@@ -252,7 +252,7 @@
Name directoryPathName(directoryPath);
fs::recursive_directory_iterator directoryPtr(fs::system_complete(directoryPath).string());
- Name commonPrefix("/NTORRENT" +
+ Name commonPrefix("/ndn/multicast/NTORRENT" +
directoryPathName.getSubName(directoryPathName.size() - 1).toUri());
Name torrentName(commonPrefix.toUri() + "/torrent-file");
@@ -265,7 +265,7 @@
}
size_t manifestFileCounter = 0u;
for (const auto& fileName : fileNames) {
- Name manifestPrefix("/NTORRENT" +
+ Name manifestPrefix("/ndn/multicast/NTORRENT" +
directoryPathName.getSubName(directoryPathName.size() - 1).toUri());
std::pair<std::vector<FileManifest>, std::vector<Data>> currentManifestPair =
FileManifest::generate(fileName,
diff --git a/src/torrent-manager.cpp b/src/torrent-manager.cpp
index 110d90f..892228f 100644
--- a/src/torrent-manager.cpp
+++ b/src/torrent-manager.cpp
@@ -17,6 +17,7 @@
#include <string>
#include <unordered_map>
#include <vector>
+#include <boost/asio/io_service.hpp>
namespace fs = boost::filesystem;
@@ -32,7 +33,6 @@
security::KeyChain key_chain;
Name currSegmentFullName = initialSegmentName;
vector<TorrentFile> torrentSegments = IoUtil::load_directory<TorrentFile>(torrentFilePath);
-
// Starting with the initial segment name, verify the names, loading next name from torrentSegment
for (auto it = torrentSegments.begin(); it != torrentSegments.end(); ++it) {
TorrentFile& segment = *it;
@@ -169,10 +169,10 @@
// figure out the name of the torrent
Name torrentName;
if (m_torrentFileName.get(m_torrentFileName.size() - 2).isSequenceNumber()) {
- torrentName = m_torrentFileName.getSubName(1, m_torrentFileName.size() - 4);
+ torrentName = m_torrentFileName.getSubName(3, m_torrentFileName.size() - 6);
}
else {
- torrentName = m_torrentFileName.getSubName(1, m_torrentFileName.size() - 3);
+ torrentName = m_torrentFileName.getSubName(3, m_torrentFileName.size() - 5);
}
// TODO(spyros) Get update manager working
@@ -406,7 +406,6 @@
this->sendInterest();
if (m_pendingInterests.empty() && m_interestQueue->empty() && !m_seedFlag) {
shutdown();
- return;
}
};
@@ -520,6 +519,12 @@
bind(&TorrentManager::onRegisterFailed, this, _1, _2));
}
+void
+TorrentManager::shutdown()
+{
+ m_face->getIoService().stop();
+}
+
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
// Protected Helpers
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
@@ -650,7 +655,6 @@
this->sendInterest();
if (m_pendingInterests.empty() && m_interestQueue->empty() && !m_seedFlag) {
shutdown();
- return;
}
};
diff --git a/src/torrent-manager.hpp b/src/torrent-manager.hpp
index 12096c3..8c638dd 100644
--- a/src/torrent-manager.hpp
+++ b/src/torrent-manager.hpp
@@ -341,9 +341,9 @@
uint64_t m_sortingCounter;
// Keychain instance
shared_ptr<KeyChain> m_keyChain;
-
+ // A collection for all interests that have been sent for which we have not received a response
std::unordered_set<ndn::Name> m_pendingInterests;
-
+ // A queue to hold all interests for requested data that we have yet to send
shared_ptr<InterestQueue> m_interestQueue;
// TODO(spyros) Fix and reintegrate update handler
// // Update Handler instance
@@ -393,14 +393,6 @@
return findTorrentFileSegmentToDownload() == nullptr;
}
-inline
-void
-TorrentManager::shutdown()
-{
- // TODO(msweatt) Consider unregistering all prefix to exit more gracefully
- m_face->shutdown();
-}
-
} // end ntorrent
} // end ndn
diff --git a/tests/unit-tests/file-manifest.t.cpp b/tests/unit-tests/file-manifest.t.cpp
index 72316f8..f640548 100644
--- a/tests/unit-tests/file-manifest.t.cpp
+++ b/tests/unit-tests/file-manifest.t.cpp
@@ -334,21 +334,21 @@
bool d_shouldThrow;
} DATA [] = {
// Affirmative tests
- {1 , TEST_FILE_LEN, "tests/testdata/foo/bar.txt" , "/NTORRENT/foo/", true, false },
- {10 , 10 , "tests/testdata/foo/bar.txt" , "/NTORRENT/foo/", true, false },
- {10 , 1 , "tests/testdata/foo/bar.txt" , "/NTORRENT/foo/", true, false },
- {1 , 10 , "tests/testdata/foo/bar.txt" , "/NTORRENT/foo/", true, false },
- {1 , 1 , "tests/testdata/foo/bar.txt" , "/NTORRENT/foo/", true, false },
- {1024 , 1 , "tests/testdata/foo/bar1.txt", "/NTORRENT/foo/", true, false },
- {1024 , 100 , "tests/testdata/foo/bar1.txt", "/NTORRENT/foo/", true, false },
- {TEST_FILE_LEN, 1 , "tests/testdata/foo/bar.txt" , "/NTORRENT/foo/", true, false },
+ {1 , TEST_FILE_LEN, "tests/testdata/foo/bar.txt" , "/ndn/multicast/NTORRENT/foo/", true, false },
+ {10 , 10 , "tests/testdata/foo/bar.txt" , "/ndn/multicast/NTORRENT/foo/", true, false },
+ {10 , 1 , "tests/testdata/foo/bar.txt" , "/ndn/multicast/NTORRENT/foo/", true, false },
+ {1 , 10 , "tests/testdata/foo/bar.txt" , "/ndn/multicast/NTORRENT/foo/", true, false },
+ {1 , 1 , "tests/testdata/foo/bar.txt" , "/ndn/multicast/NTORRENT/foo/", true, false },
+ {1024 , 1 , "tests/testdata/foo/bar1.txt", "/ndn/multicast/NTORRENT/foo/", true, false },
+ {1024 , 100 , "tests/testdata/foo/bar1.txt", "/ndn/multicast/NTORRENT/foo/", true, false },
+ {TEST_FILE_LEN, 1 , "tests/testdata/foo/bar.txt" , "/ndn/multicast/NTORRENT/foo/", true, false },
// Negative tests
// non-existent file
- {128 , 128 , "tests/testdata/foo/fake.txt", "/NTORRENT/foo/", false, true },
+ {128 , 128 , "tests/testdata/foo/fake.txt", "/ndn/multicast/NTORRENT/foo/", false, true },
// prefix mismatch
- {128 , 128 , "tests/testdata/foo/bar.txt", "/NTORRENT/bar/", false, true },
+ {128 , 128 , "tests/testdata/foo/bar.txt", "/ndn/multicast/NTORRENT/bar/", false, true },
// scaling test
- // {10240 , 5120 , "tests/testdata/foo/huge_file", "/NTORRENT/foo/", false, false },
+ // {10240 , 5120 , "tests/testdata/foo/huge_file", "/ndn/multicast/NTORRENT/foo/", false, false },
// assertion failures (tests not supported on platforms)
// {0 , 128 , "tests/testdata/foo/bar.txt", "/NTORRENT/bar/", true },
// {128 , 0 , "tests/testdata/foo/bar.txt", "/NTORRENT/bar/", true },
diff --git a/tests/unit-tests/torrent-file.t.cpp b/tests/unit-tests/torrent-file.t.cpp
index 4ab3077..d96b1ff 100644
--- a/tests/unit-tests/torrent-file.t.cpp
+++ b/tests/unit-tests/torrent-file.t.cpp
@@ -127,35 +127,35 @@
BOOST_AUTO_TEST_CASE(CheckGettersSetters)
{
- TorrentFile file("/NTORRENT/linux15.01/torrent-file/AB2CDA",
- "/NTORRENT/linux15.01/torrent-file/segment2/AE321C",
- "/NTORRENT/linux15.01",
- {"/NTORRENT/linux15.01/file0/1A2B3C4D",
- "/NTORRENT/linux15.01/file1/2A3B4C5E"});
+ TorrentFile file("/ndn/multicast/NTORRENT/linux15.01/torrent-file/AB2CDA",
+ "/ndn/multicast/NTORRENT/linux15.01/torrent-file/segment2/AE321C",
+ "/ndn/multicast/NTORRENT/linux15.01",
+ {"/ndn/multicast/NTORRENT/linux15.01/file0/1A2B3C4D",
+ "/ndn/multicast/NTORRENT/linux15.01/file1/2A3B4C5E"});
- BOOST_CHECK_EQUAL(file.getName(), "/NTORRENT/linux15.01/torrent-file/AB2CDA");
+ BOOST_CHECK_EQUAL(file.getName(), "/ndn/multicast/NTORRENT/linux15.01/torrent-file/AB2CDA");
BOOST_CHECK_EQUAL(file.getCatalog().size(), 2);
BOOST_CHECK_EQUAL(*(file.getTorrentFilePtr()),
- "/NTORRENT/linux15.01/torrent-file/segment2/AE321C");
- BOOST_CHECK_EQUAL(file.getCatalog()[0], "/NTORRENT/linux15.01/file0/1A2B3C4D");
- BOOST_CHECK_EQUAL(file.getCatalog()[1], "/NTORRENT/linux15.01/file1/2A3B4C5E");
+ "/ndn/multicast/NTORRENT/linux15.01/torrent-file/segment2/AE321C");
+ BOOST_CHECK_EQUAL(file.getCatalog()[0], "/ndn/multicast/NTORRENT/linux15.01/file0/1A2B3C4D");
+ BOOST_CHECK_EQUAL(file.getCatalog()[1], "/ndn/multicast/NTORRENT/linux15.01/file1/2A3B4C5E");
- TorrentFile file2("/NTORRENT/linux15.01/torrent-file/AB2CDA",
- "/NTORRENT/linux15.01",
- {"/NTORRENT/linux15.01/file0/1A2B3C4D"});
+ TorrentFile file2("/ndn/multicast/NTORRENT/linux15.01/torrent-file/AB2CDA",
+ "/ndn/multicast/NTORRENT/linux15.01",
+ {"/ndn/multicast/NTORRENT/linux15.01/file0/1A2B3C4D"});
- BOOST_CHECK_EQUAL(file2.getName(), "/NTORRENT/linux15.01/torrent-file/AB2CDA");
+ BOOST_CHECK_EQUAL(file2.getName(), "/ndn/multicast/NTORRENT/linux15.01/torrent-file/AB2CDA");
BOOST_CHECK(!file2.getTorrentFilePtr());
BOOST_CHECK_EQUAL(file2.getCatalog().size(), 1);
}
BOOST_AUTO_TEST_CASE(CheckEncodeDecode)
{
- TorrentFile file("/NTORRENT/linux15.01/torrent-file/AB2CDA",
- "/NTORRENT/linux15.01/torrent-file/segment2/AE321C",
- "/NTORRENT/linux15.01",
- {"/NTORRENT/linux15.01/file0/1A2B3C4D",
- "/NTORRENT/linux15.01/file1/2A3B4C5E"});
+ TorrentFile file("/ndn/multicast/NTORRENT/linux15.01/torrent-file/AB2CDA",
+ "/ndn/multicast/NTORRENT/linux15.01/torrent-file/segment2/AE321C",
+ "/ndn/multicast/NTORRENT/linux15.01",
+ {"/ndn/multicast/NTORRENT/linux15.01/file0/1A2B3C4D",
+ "/ndn/multicast/NTORRENT/linux15.01/file1/2A3B4C5E"});
file.finalize();
KeyChain keyChain;
@@ -166,21 +166,21 @@
TorrentFile file2;
file2.wireDecode(wire);
- BOOST_CHECK_EQUAL(file2.getName(), "/NTORRENT/linux15.01/torrent-file/AB2CDA");
+ BOOST_CHECK_EQUAL(file2.getName(), "/ndn/multicast/NTORRENT/linux15.01/torrent-file/AB2CDA");
BOOST_CHECK_EQUAL(*(file2.getTorrentFilePtr()),
- "/NTORRENT/linux15.01/torrent-file/segment2/AE321C");
+ "/ndn/multicast/NTORRENT/linux15.01/torrent-file/segment2/AE321C");
BOOST_CHECK_EQUAL(file2.getCatalog().size(), 2);
- BOOST_CHECK_EQUAL(file2.getCatalog()[0], "/NTORRENT/linux15.01/file0/1A2B3C4D");
- BOOST_CHECK_EQUAL(file2.getCatalog()[1], "/NTORRENT/linux15.01/file1/2A3B4C5E");
- BOOST_CHECK_EQUAL(file2.getCommonPrefix(), "/NTORRENT/linux15.01");
+ BOOST_CHECK_EQUAL(file2.getCatalog()[0], "/ndn/multicast/NTORRENT/linux15.01/file0/1A2B3C4D");
+ BOOST_CHECK_EQUAL(file2.getCatalog()[1], "/ndn/multicast/NTORRENT/linux15.01/file1/2A3B4C5E");
+ BOOST_CHECK_EQUAL(file2.getCommonPrefix(), "/ndn/multicast/NTORRENT/linux15.01");
}
BOOST_AUTO_TEST_CASE(CheckEncodeDecodeNoTorrentFilePtr)
{
- TorrentFile file("/NTORRENT/linux15.01/torrent-file/AB2CDA",
- "/NTORRENT/linux15.01",
- {"/NTORRENT/linux15.01/file0/1A2B3C4D",
- "/NTORRENT/linux15.01/file1/2A3B4C5E"});
+ TorrentFile file("/ndn/multicast/NTORRENT/linux15.01/torrent-file/AB2CDA",
+ "/ndn/multicast/NTORRENT/linux15.01",
+ {"/ndn/multicast/NTORRENT/linux15.01/file0/1A2B3C4D",
+ "/ndn/multicast/NTORRENT/linux15.01/file1/2A3B4C5E"});
file.finalize();
KeyChain keyChain;
@@ -191,16 +191,16 @@
TorrentFile file2;
file2.wireDecode(wire);
- BOOST_CHECK_EQUAL(file2.getName(), "/NTORRENT/linux15.01/torrent-file/AB2CDA");
+ BOOST_CHECK_EQUAL(file2.getName(), "/ndn/multicast/NTORRENT/linux15.01/torrent-file/AB2CDA");
BOOST_CHECK(!file2.getTorrentFilePtr());
BOOST_CHECK_EQUAL(file2.getCatalog().size(), 2);
- BOOST_CHECK_EQUAL(file2.getCatalog()[0], "/NTORRENT/linux15.01/file0/1A2B3C4D");
- BOOST_CHECK_EQUAL(file2.getCatalog()[1], "/NTORRENT/linux15.01/file1/2A3B4C5E");
+ BOOST_CHECK_EQUAL(file2.getCatalog()[0], "/ndn/multicast/NTORRENT/linux15.01/file0/1A2B3C4D");
+ BOOST_CHECK_EQUAL(file2.getCatalog()[1], "/ndn/multicast/NTORRENT/linux15.01/file1/2A3B4C5E");
}
BOOST_AUTO_TEST_CASE(CheckEncodeDecodeEmptyTorrentFile)
{
- TorrentFile file("/NTORRENT/linux15.01/torrent-file/AB2CDA",
+ TorrentFile file("/ndn/multicast/NTORRENT/linux15.01/torrent-file/AB2CDA",
"",
{});
@@ -219,9 +219,9 @@
BOOST_AUTO_TEST_CASE(CheckEncodeDecodeEmptyCatalog)
{
- TorrentFile file("/NTORRENT/linux15.01/torrent-file/AB2CDA",
- "/NTORRENT/linux15.01/torrent-file/segment2/AE321C",
- "/NTORRENT/linux15.01",
+ TorrentFile file("/ndn/multicast/NTORRENT/linux15.01/torrent-file/AB2CDA",
+ "/ndn/multicast/NTORRENT/linux15.01/torrent-file/segment2/AE321C",
+ "/ndn/multicast/NTORRENT/linux15.01",
{});
file.finalize();
@@ -252,30 +252,30 @@
BOOST_AUTO_TEST_CASE(TestInsertErase)
{
- TorrentFile file("/NTORRENT/linux15.01/torrent-file/AB2CDA",
- "/NTORRENT/linux15.01/torrent-file/segment2/AE321C",
- "/NTORRENT/linux15.01",
- {"/NTORRENT/linux15.01/file0/1A2B3C4D",
- "/NTORRENT/linux15.01/file1/2A3B4C5E"});
+ TorrentFile file("/ndn/multicast/NTORRENT/linux15.01/torrent-file/AB2CDA",
+ "/ndn/multicast/NTORRENT/linux15.01/torrent-file/segment2/AE321C",
+ "/ndn/multicast/NTORRENT/linux15.01",
+ {"/ndn/multicast/NTORRENT/linux15.01/file0/1A2B3C4D",
+ "/ndn/multicast/NTORRENT/linux15.01/file1/2A3B4C5E"});
- file.erase("/NTORRENT/linux15.01/file0/1A2B3C4D");
- BOOST_CHECK_EQUAL(file.getCatalog()[0], "/NTORRENT/linux15.01/file1/2A3B4C5E");
+ file.erase("/ndn/multicast/NTORRENT/linux15.01/file0/1A2B3C4D");
+ BOOST_CHECK_EQUAL(file.getCatalog()[0], "/ndn/multicast/NTORRENT/linux15.01/file1/2A3B4C5E");
- file.erase("/NTORRENT/linux15.01/file1/2A3B4C5E");
+ file.erase("/ndn/multicast/NTORRENT/linux15.01/file1/2A3B4C5E");
BOOST_CHECK_EQUAL(file.getCatalog().size(), 0);
- file.insert("/NTORRENT/linux15.01/file3/AB34C5KA");
+ file.insert("/ndn/multicast/NTORRENT/linux15.01/file3/AB34C5KA");
BOOST_CHECK_EQUAL(file.getCatalog().size(), 1);
- BOOST_CHECK_EQUAL(file.getCatalog()[0], "/NTORRENT/linux15.01/file3/AB34C5KA");
+ BOOST_CHECK_EQUAL(file.getCatalog()[0], "/ndn/multicast/NTORRENT/linux15.01/file3/AB34C5KA");
}
BOOST_AUTO_TEST_CASE(TestInsertAndEncodeTwice)
{
- TorrentFile file("/NTORRENT/linux15.01/torrent-file/AB2CDA",
- "/NTORRENT/linux15.01/torrent-file/segment2/AE321C",
- "/NTORRENT/linux15.01",
- {"/NTORRENT/linux15.01/file0/1A2B3C4D",
- "/NTORRENT/linux15.01/file1/2A3B4C5E"});
+ TorrentFile file("/ndn/multicast/NTORRENT/linux15.01/torrent-file/AB2CDA",
+ "/ndn/multicast/NTORRENT/linux15.01/torrent-file/segment2/AE321C",
+ "/ndn/multicast/NTORRENT/linux15.01",
+ {"/ndn/multicast/NTORRENT/linux15.01/file0/1A2B3C4D",
+ "/ndn/multicast/NTORRENT/linux15.01/file1/2A3B4C5E"});
file.finalize();
KeyChain keyChain;
@@ -286,18 +286,18 @@
file2.wireDecode(wire);
BOOST_CHECK_EQUAL(file2.getCatalog().size(), 2);
- file.insert("/NTORRENT/linux15.01/file3/AB34C5KA");
- file.insert("/NTORRENT/linux15.01/file4/CB24C3GB");
+ file.insert("/ndn/multicast/NTORRENT/linux15.01/file3/AB34C5KA");
+ file.insert("/ndn/multicast/NTORRENT/linux15.01/file4/CB24C3GB");
file.finalize();
Block wire2 = file.wireEncode();
file2.wireDecode(wire2);
BOOST_CHECK_EQUAL(file2.getCatalog().size(), 4);
- BOOST_CHECK_EQUAL(file2.getCatalog()[0], "/NTORRENT/linux15.01/file0/1A2B3C4D");
- BOOST_CHECK_EQUAL(file2.getCatalog()[1], "/NTORRENT/linux15.01/file1/2A3B4C5E");
- BOOST_CHECK_EQUAL(file2.getCatalog()[2], "/NTORRENT/linux15.01/file3/AB34C5KA");
- BOOST_CHECK_EQUAL(file2.getCatalog()[3], "/NTORRENT/linux15.01/file4/CB24C3GB");
+ BOOST_CHECK_EQUAL(file2.getCatalog()[0], "/ndn/multicast/NTORRENT/linux15.01/file0/1A2B3C4D");
+ BOOST_CHECK_EQUAL(file2.getCatalog()[1], "/ndn/multicast/NTORRENT/linux15.01/file1/2A3B4C5E");
+ BOOST_CHECK_EQUAL(file2.getCatalog()[2], "/ndn/multicast/NTORRENT/linux15.01/file3/AB34C5KA");
+ BOOST_CHECK_EQUAL(file2.getCatalog()[3], "/ndn/multicast/NTORRENT/linux15.01/file4/CB24C3GB");
}
BOOST_AUTO_TEST_SUITE_END()
@@ -387,7 +387,7 @@
// Verify that each file torrent-file is signed
BOOST_CHECK_NO_THROW(it->getFullName());
BOOST_CHECK_EQUAL(it->getCommonPrefix(),
- Name("/NTORRENT" +
+ Name("/ndn/multicast/NTORRENT" +
directoryPathName.getSubName(
directoryPathName.size() - 1).toUri()));
BOOST_CHECK_EQUAL(*it, TorrentFile(it->wireEncode()));
diff --git a/tests/unit-tests/torrent-manager.t.cpp b/tests/unit-tests/torrent-manager.t.cpp
index 11a55ee..8f50a2a 100644
--- a/tests/unit-tests/torrent-manager.t.cpp
+++ b/tests/unit-tests/torrent-manager.t.cpp
@@ -156,9 +156,9 @@
size_t d_subManifestSize;
size_t d_dataPacketSize;
} DATA [] = {
- {"tests/testdata/foo", "/NTORRENT/foo/torrent-file/sha256digest=02c737fd4c6e7de4b4825b089f39700c2dfa8fd2bb2b91f09201e357c4463253", 1024, 1024, 1024},
- {"tests/testdata/foo", "/NTORRENT/foo/torrent-file/sha256digest=b88c054e87bcbb744726f7eaf79f95459b4fddce2caeb952f263a5ccbbfc9a7c", 128, 128, 128},
- // {"tests/testdata/foo", "/NTORRENT/foo/torrent-file/sha256digest=76df604f23bdf257d16de588f2941df261951552a5f4435a315f59c3b018a851", 1, 1, 128},
+ {"tests/testdata/foo", "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=9e0410fa477309b40a4ef9cb2bebe70ed2e9fa2defcb584979d768b3f6ced981", 1024, 1024, 1024},
+ {"tests/testdata/foo", "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=5351d424c7893158da35707258635d885725be0aa34321cf2e557afc2b785a76", 128, 128, 128},
+ {"tests/testdata/foo", "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=24ea5e5e3af6a548cc54c0d5b3573ecb18e247f1567a0d586c1d7c131b75181d", 1, 128, 128},
};
enum { NUM_DATA = sizeof DATA / sizeof *DATA };
for (int i = 0; i < NUM_DATA; ++i) {
@@ -230,7 +230,7 @@
BOOST_AUTO_TEST_CASE(CheckInitializeEmpty)
{
- TestTorrentManager manager("/NTORRENT/foo/torrent-file/sha256digest=02c737fd4c6e7de4b4825b089f39700c2dfa8fd2bb2b91f09201e357c4463253",
+ TestTorrentManager manager("/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=9e0410fa477309b40a4ef9cb2bebe70ed2e9fa2defcb584979d768b3f6ced981",
"tests/testdata/", face);
manager.Initialize();
@@ -253,9 +253,9 @@
size_t d_subManifestSize;
size_t d_dataPacketSize;
} DATA [] = {
- {"tests/testdata/foo", "/NTORRENT/foo/torrent-file/sha256digest=02c737fd4c6e7de4b4825b089f39700c2dfa8fd2bb2b91f09201e357c4463253", 1024, 1024, 1024},
- {"tests/testdata/foo", "/NTORRENT/foo/torrent-file/sha256digest=b88c054e87bcbb744726f7eaf79f95459b4fddce2caeb952f263a5ccbbfc9a7c", 128, 128, 128},
- // {"tests/testdata/foo", "/NTORRENT/foo/torrent-file/sha256digest=76df604f23bdf257d16de588f2941df261951552a5f4435a315f59c3b018a851", 1, 1, 128},
+ {"tests/testdata/foo", "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=9e0410fa477309b40a4ef9cb2bebe70ed2e9fa2defcb584979d768b3f6ced981", 1024, 1024, 1024},
+ {"tests/testdata/foo", "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=5351d424c7893158da35707258635d885725be0aa34321cf2e557afc2b785a76", 128, 128, 128},
+ {"tests/testdata/foo", "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=24ea5e5e3af6a548cc54c0d5b3573ecb18e247f1567a0d586c1d7c131b75181d", 1, 128, 128},
};
enum { NUM_DATA = sizeof DATA / sizeof *DATA };
for (int i = 0; i < NUM_DATA; ++i) {
@@ -316,9 +316,9 @@
size_t d_subManifestSize;
size_t d_dataPacketSize;
} DATA [] = {
- {"tests/testdata/foo", "/NTORRENT/foo/torrent-file/sha256digest=02c737fd4c6e7de4b4825b089f39700c2dfa8fd2bb2b91f09201e357c4463253", 1024, 1024, 1024},
- {"tests/testdata/foo", "/NTORRENT/foo/torrent-file/sha256digest=b88c054e87bcbb744726f7eaf79f95459b4fddce2caeb952f263a5ccbbfc9a7c", 128, 128, 128},
- // {"tests/testdata/foo", "/NTORRENT/foo/torrent-file/sha256digest=76df604f23bdf257d16de588f2941df261951552a5f4435a315f59c3b018a851", 1, 1, 128},
+ {"tests/testdata/foo", "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=9e0410fa477309b40a4ef9cb2bebe70ed2e9fa2defcb584979d768b3f6ced981", 1024, 1024, 1024},
+ {"tests/testdata/foo", "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=5351d424c7893158da35707258635d885725be0aa34321cf2e557afc2b785a76", 128, 128, 128},
+ {"tests/testdata/foo", "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=24ea5e5e3af6a548cc54c0d5b3573ecb18e247f1567a0d586c1d7c131b75181d", 1, 128, 128},
};
enum { NUM_DATA = sizeof DATA / sizeof *DATA };
for (int i = 0; i < NUM_DATA; ++i) {
@@ -402,7 +402,6 @@
// get torrent files and manifests
{
auto temp = TorrentFile::generate("tests/testdata/foo", 1, 10, 10, false);
-
torrentSegments = temp.first;
auto temp1 = temp.second;
temp1.pop_back(); // remove the manifests for the last file
@@ -412,8 +411,7 @@
}
}
}
-
- TestTorrentManager manager("/NTORRENT/foo/torrent-file/sha256digest=946b92641d2b87bf4f5913930be20e3789ff5fb5d72739614f93f677d90fbd9d",
+ TestTorrentManager manager("/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=521110d7a60e317e1f36029a414f0d98318f26553720ed50a26479fe4bf982b7",
filePath, face);
manager.Initialize();
@@ -466,7 +464,7 @@
}
}
- TestTorrentManager manager("/NTORRENT/foo/torrent-file/sha256digest=946b92641d2b87bf4f5913930be20e3789ff5fb5d72739614f93f677d90fbd9d",
+ TestTorrentManager manager("/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=521110d7a60e317e1f36029a414f0d98318f26553720ed50a26479fe4bf982b7",
filePath, face);
manager.Initialize();
@@ -528,7 +526,7 @@
BOOST_AUTO_TEST_CASE(TestDownloadingDataPackets)
{
std::string filePath = ".appdata/foo/";
- TestTorrentManager manager("/NTORRENT/foo/torrent-file/sha256digest=946b92641d2b87bf4f5913930be20e3789ff5fb5d72739614f93f677d90fbd9d",
+ TestTorrentManager manager("/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=521110d7a60e317e1f36029a414f0d98318f26553720ed50a26479fe4bf982b7",
filePath, face);
manager.Initialize();
@@ -575,7 +573,7 @@
BOOST_AUTO_TEST_CASE(TestFindTorrentFileSegmentToDownload1)
{
std::string filePath = ".appdata/foo/";
- TestTorrentManager manager("NTORRENT/test/torrent-file/sha256digest",
+ TestTorrentManager manager("/ndn/multicast/NTORRENT/test/torrent-file/sha256digest",
filePath, face);
manager.Initialize();
@@ -583,22 +581,22 @@
advanceClocks(time::milliseconds(1), 10);
manager.sendRoutablePrefixResponse();
- TorrentFile t1(Name("NTORRENT/test/torrent-file/sha256digest"),
- Name("NTORRENT/test/torrent-file/1/sha256digest"), Name("/test"),
+ TorrentFile t1(Name("/ndn/multicast/NTORRENT/test/torrent-file/sha256digest"),
+ Name("/ndn/multicast/NTORRENT/test/torrent-file/1/sha256digest"), Name("/test"),
{ Name("/manifest1") });
manager.pushTorrentSegment(t1);
- TorrentFile t2(Name("NTORRENT/test/torrent-file/1/sha256digest"),
- Name("NTORRENT/test/torrent-file/2/sha256digest"), Name("/test"),
+ TorrentFile t2(Name("/ndn/multicast/NTORRENT/test/torrent-file/1/sha256digest"),
+ Name("/ndn/multicast/NTORRENT/test/torrent-file/2/sha256digest"), Name("/test"),
{ Name("/manifest2"), Name("/manifest3") });
manager.pushTorrentSegment(t2);
- TorrentFile t3(Name("NTORRENT/test/torrent-file/3/sha256digest"),
- Name("NTORRENT/test/torrent-file/4/sha256digest"), Name("/test"),
+ TorrentFile t3(Name("/ndn/multicast/NTORRENT/test/torrent-file/3/sha256digest"),
+ Name("/ndn/multicast/NTORRENT/test/torrent-file/4/sha256digest"), Name("/test"),
{ Name("/manifest4"), Name("/manifest5") });
manager.pushTorrentSegment(t3);
- TorrentFile t4(Name("NTORRENT/test/torrent-file/4/sha256digest"), Name("/test"), {});
+ TorrentFile t4(Name("/ndn/multicast/NTORRENT/test/torrent-file/4/sha256digest"), Name("/test"), {});
manager.pushTorrentSegment(t4);
BOOST_CHECK(!(manager.findTorrentFileSegmentToDownload()));
@@ -621,7 +619,7 @@
BOOST_AUTO_TEST_CASE(TestFindTorrentFileSegmentToDownload2)
{
std::string filePath = ".appdata/foo/";
- TestTorrentManager manager("NTORRENT/test/torrent-file/0/sha256digest",
+ TestTorrentManager manager("/ndn/multicast/NTORRENT/test/torrent-file/0/sha256digest",
filePath, face);
manager.Initialize();
@@ -630,7 +628,7 @@
manager.sendRoutablePrefixResponse();
BOOST_CHECK_EQUAL(manager.findTorrentFileSegmentToDownload()->toUri(),
- "/NTORRENT/test/torrent-file/0/sha256digest");
+ "/ndn/multicast/NTORRENT/test/torrent-file/0/sha256digest");
fs::remove_all(filePath);
fs::remove_all(".appdata");
@@ -639,7 +637,7 @@
BOOST_AUTO_TEST_CASE(TestFindManifestSegmentToDownload1)
{
std::string filePath = ".appdata/foo/";
- TestTorrentManager manager("NTORRENT/test/torrent-file/sha256digest",
+ TestTorrentManager manager("/ndn/multicast/NTORRENT/test/torrent-file/sha256digest",
filePath, face);
manager.Initialize();
@@ -647,54 +645,54 @@
advanceClocks(time::milliseconds(1), 10);
manager.sendRoutablePrefixResponse();
- Name n1(Name("NTORRENT/test/file0"));
+ Name n1(Name("/ndn/multicast/NTORRENT/test/file0"));
n1.appendSequenceNumber(0);
- Name n2(Name("NTORRENT/test/file0"));
+ Name n2(Name("/ndn/multicast/NTORRENT/test/file0"));
n2.appendSequenceNumber(1);
- Name n3(Name("NTORRENT/test/file0"));
+ Name n3(Name("/ndn/multicast/NTORRENT/test/file0"));
n3.appendSequenceNumber(2);
- Name n4(Name("NTORRENT/test/file0"));
+ Name n4(Name("/ndn/multicast/NTORRENT/test/file0"));
n4.appendSequenceNumber(3);
- Name n5(Name("NTORRENT/test/file0"));
+ Name n5(Name("/ndn/multicast/NTORRENT/test/file0"));
n5.appendSequenceNumber(4);
- Name n6(Name("NTORRENT/test1/file0"));
+ Name n6(Name("/ndn/multicast/NTORRENT/test1/file0"));
n6.appendSequenceNumber(0);
- Name n7(Name("NTORRENT/test1/file0"));
+ Name n7(Name("/ndn/multicast/NTORRENT/test1/file0"));
n7.appendSequenceNumber(1);
// In theory, this may not be correct, but here let's suck it up for the sake
// of testing the function correctness
- Name n8(Name("NTORRENT/test1/file2"));
+ Name n8(Name("/ndn/multicast/NTORRENT/test1/file2"));
n8.appendSequenceNumber(0);
- Name n9(Name("NTORRENT/test1/file2"));
+ Name n9(Name("/ndn/multicast/NTORRENT/test1/file2"));
n9.appendSequenceNumber(1);
- FileManifest f1(n1, 50, Name("NTORRENT/test"), {}, make_shared<Name>(n2));
+ FileManifest f1(n1, 50, Name("/ndn/multicast/NTORRENT/test"), {}, make_shared<Name>(n2));
manager.pushFileManifestSegment(f1);
- FileManifest f2(n2, 50, Name("NTORRENT/test"), {}, make_shared<Name>(n3));
+ FileManifest f2(n2, 50, Name("/ndn/multicast/NTORRENT/test"), {}, make_shared<Name>(n3));
manager.pushFileManifestSegment(f2);
- FileManifest f3(n3, 50, Name("NTORRENT/test"), {}, make_shared<Name>(n4));
+ FileManifest f3(n3, 50, Name("/ndn/multicast/NTORRENT/test"), {}, make_shared<Name>(n4));
manager.pushFileManifestSegment(f3);
- FileManifest f4(n4, 50, Name("NTORRENT/test"), {}, make_shared<Name>(n5));
+ FileManifest f4(n4, 50, Name("/ndn/multicast/NTORRENT/test"), {}, make_shared<Name>(n5));
manager.pushFileManifestSegment(f4);
- FileManifest f5(n6, 50, Name("NTORRENT/test2"), {}, make_shared<Name>(n7));
+ FileManifest f5(n6, 50, Name("/ndn/multicast/NTORRENT/test2"), {}, make_shared<Name>(n7));
manager.pushFileManifestSegment(f5);
- FileManifest f6(n7, 50, Name("NTORRENT/test2"), {}, {});
+ FileManifest f6(n7, 50, Name("/ndn/multicast/NTORRENT/test2"), {}, {});
manager.pushFileManifestSegment(f6);
- FileManifest f7(n8, 50, Name("NTORRENT/test3"), {}, make_shared<Name>(n9));
+ FileManifest f7(n8, 50, Name("/ndn/multicast/NTORRENT/test3"), {}, make_shared<Name>(n9));
manager.pushFileManifestSegment(f7);
BOOST_CHECK_EQUAL(manager.findManifestSegmentToDownload(Name(n2.toUri() + "/sha256digest"))->toUri(), n5.toUri());
@@ -703,7 +701,7 @@
Name(n5.toUri() + "/sha256digest").toUri());
BOOST_CHECK(!(manager.findManifestSegmentToDownload(Name(n7.toUri() + "/sha256digest"))));
- Name n10(Name("NTORRENT/test1/file1"));
+ Name n10(Name("/ndn/multicast/NTORRENT/test1/file1"));
n10.appendSequenceNumber(1);
n10 = Name(n10.toUri() + "/sha256digest");
@@ -751,7 +749,7 @@
io::save(m, filename.string());
}
// Initialize manager
- TestTorrentManager manager("/NTORRENT/foo/torrent-file/sha256digest=a8a2e98cd943d895b8c4b12a208343bcf9344ce85a6376dc6f5754fe8f4a573e",
+ TestTorrentManager manager("/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=6114e56874fc01bf8f9c40fa652741a895eb922372f1baf039ccea64dacd2152",
filePath,
face);
@@ -854,7 +852,7 @@
io::save(m, filename.string());
}
// Initialize manager
- TestTorrentManager manager("/NTORRENT/foo/torrent-file/sha256digest=a8a2e98cd943d895b8c4b12a208343bcf9344ce85a6376dc6f5754fe8f4a573e",
+ TestTorrentManager manager("/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=6114e56874fc01bf8f9c40fa652741a895eb922372f1baf039ccea64dacd2152",
filePath,
face);
@@ -874,14 +872,14 @@
std::vector<bool> v3 = {true, false, false, false, false, false};
manager.setFileState(manifests[2].getFullName(), make_shared<fs::fstream>(), v3);
- Name p1("NTORRENT/foo/bar1.txt");
+ Name p1("/ndn/multicast/NTORRENT/foo/bar1.txt");
p1.appendSequenceNumber(0);
p1.appendSequenceNumber(0);
p1 = Name(p1.toUri() + "/sha256digest");
BOOST_CHECK(!(manager.hasDataPacket(p1)));
- Name p2("NTORRENT/foo/bar.txt");
+ Name p2("/ndn/multicast/NTORRENT/foo/bar.txt");
p2.appendSequenceNumber(0);
p2.appendSequenceNumber(0);
p2 = Name(p2.toUri() + "/sha256digest");
@@ -898,9 +896,9 @@
size_t d_subManifestSize;
size_t d_dataPacketSize;
} DATA [] = {
- {"tests/testdata/foo", "/NTORRENT/foo/torrent-file/sha256digest=02c737fd4c6e7de4b4825b089f39700c2dfa8fd2bb2b91f09201e357c4463253", 1024, 1024, 1024},
- {"tests/testdata/foo", "/NTORRENT/foo/torrent-file/sha256digest=b88c054e87bcbb744726f7eaf79f95459b4fddce2caeb952f263a5ccbbfc9a7c", 128, 128, 128},
- // {"tests/testdata/foo", "/NTORRENT/foo/torrent-file/sha256digest=76df604f23bdf257d16de588f2941df261951552a5f4435a315f59c3b018a851", 1, 1, 128},
+ {"tests/testdata/foo", "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=9e0410fa477309b40a4ef9cb2bebe70ed2e9fa2defcb584979d768b3f6ced981", 1024, 1024, 1024},
+ // {"tests/testdata/foo", "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=5351d424c7893158da35707258635d885725be0aa34321cf2e557afc2b785a76", 128, 128, 128},
+ // {"tests/testdata/foo", "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=24ea5e5e3af6a548cc54c0d5b3573ecb18e247f1567a0d586c1d7c131b75181d", 1, 128, 128},
};
enum { NUM_DATA = sizeof DATA / sizeof *DATA };
for (int i = 0; i < NUM_DATA; ++i) {
@@ -910,56 +908,56 @@
auto dataPacketSize = DATA[i].d_dataPacketSize;
auto subManifestSize = DATA[i].d_subManifestSize;
- vector<FileManifest> manifests;
- vector<TorrentFile> torrentSegments;
- std::string filePath = "tests/testdata/";
- std::vector<vector<Data>> fileData;
- // get torrent files and manifests
- {
+ vector<FileManifest> manifests;
+ vector<TorrentFile> torrentSegments;
+ std::string filePath = "tests/testdata/";
+ std::vector<vector<Data>> fileData;
+ // get torrent files and manifests
+ {
auto temp = TorrentFile::generate(directoryPath,
namesPerSegment,
subManifestSize,
dataPacketSize,
- false);
+ true);
torrentSegments = temp.first;
auto temp1 = temp.second;
for (const auto& ms : temp1) {
manifests.insert(manifests.end(), ms.first.begin(), ms.first.end());
fileData.push_back(ms.second);
}
- }
- // write the torrent segments and manifests to disk
- std::string dirPath = ".appdata/foo/";
- boost::filesystem::create_directories(dirPath);
- std::string torrentPath = dirPath + "torrent_files/";
- boost::filesystem::create_directory(torrentPath);
- auto fileNum = 0;
- for (const auto& t : torrentSegments) {
+ }
+ // write the torrent segments and manifests to disk
+ std::string dirPath = ".appdata/foo/";
+ boost::filesystem::create_directories(dirPath);
+ std::string torrentPath = dirPath + "torrent_files/";
+ boost::filesystem::create_directory(torrentPath);
+ auto fileNum = 0;
+ for (const auto& t : torrentSegments) {
fileNum++;
auto filename = torrentPath + to_string(fileNum);
io::save(t, filename);
- }
- auto manifestPath = dirPath + "manifests/";
- boost::filesystem::create_directory(manifestPath);
- for (const auto& m : manifests) {
+ }
+ auto manifestPath = dirPath + "manifests/";
+ boost::filesystem::create_directory(manifestPath);
+ for (const auto& m : manifests) {
fs::path filename = manifestPath + m.file_name() + "/" + to_string(m.submanifest_number());
boost::filesystem::create_directories(filename.parent_path());
io::save(m, filename.string());
- }
- // Initialize and verify
- TestTorrentManager manager(initialSegmentName,
- filePath,
- face);
+ }
+ // Initialize and verify
+ TestTorrentManager manager(initialSegmentName,
+ filePath,
+ face);
- manager.Initialize();
+ manager.Initialize();
- advanceClocks(time::milliseconds(1), 10);
- manager.sendRoutablePrefixResponse();
+ advanceClocks(time::milliseconds(1), 10);
+ manager.sendRoutablePrefixResponse();
- size_t nData = 0;
- BOOST_CHECK_EQUAL(0, face->sentData.size());
- // request all the torrent segments
- for (const auto& t : torrentSegments) {
+ size_t nData = 0;
+ BOOST_CHECK_EQUAL(0, face->sentData.size());
+ // request all the torrent segments
+ for (const auto& t : torrentSegments) {
Interest interest(t.getFullName(), time::milliseconds(50));
face->expressInterest(interest,
[&t](const Interest& i, const Data& d) {
@@ -979,54 +977,54 @@
// check that one piece of data is sent, and it is what was expected
BOOST_CHECK_EQUAL(++nData, face->sentData.size());
face->receive(face->sentData[nData - 1]);
- }
- // request all the file manifests
- for (const auto& m : manifests) {
- Interest interest(m.getFullName(), time::milliseconds(50));
- face->expressInterest(interest,
- [&m](const Interest& i, const Data& d) {
- FileManifest m1(d.wireEncode());
- BOOST_CHECK(m == d);
- BOOST_CHECK(m1 == m);
- },
- bind([] {
- BOOST_FAIL("Unexpected Nack");
- }),
- bind([] {
- BOOST_FAIL("Unexpected timeout");
- }));
- advanceClocks(time::milliseconds(1), 40);
- face->receive(interest);
- manager.processEvents(time::milliseconds(-1));
- // check that one piece of data is sent, and it is what was expected
- BOOST_CHECK_EQUAL(++nData, face->sentData.size());
- face->receive(face->sentData[nData - 1]);
- }
- // request all the data packets
- for (const auto& file : fileData) {
- for (const auto& data : file) {
- Interest interest(data.getFullName(), time::milliseconds(50));
- face->expressInterest(interest,
- [&data](const Interest& i, const Data& d) {
- BOOST_CHECK(data == d);
- },
- bind([] {
- BOOST_FAIL("Unexpected Nack");
- }),
- bind([] {
- BOOST_FAIL("Unexpected timeout");
- }));
- advanceClocks(time::milliseconds(1), 40);
- face->receive(interest);
- manager.processEvents(time::milliseconds(-1));
- // check that one piece of data is sent, and it is what was expected
- BOOST_CHECK_EQUAL(++nData, face->sentData.size());
- face->receive(face->sentData[nData - 1]);
- }
- }
- // clean up tests
- face->sentData.clear();
- fs::remove_all(".appdata/");
+ }
+ // request all the file manifests
+ for (const auto& m : manifests) {
+ Interest interest(m.getFullName(), time::milliseconds(50));
+ face->expressInterest(interest,
+ [&m](const Interest& i, const Data& d) {
+ FileManifest m1(d.wireEncode());
+ BOOST_CHECK(m == d);
+ BOOST_CHECK(m1 == m);
+ },
+ bind([] {
+ BOOST_FAIL("Unexpected Nack");
+ }),
+ bind([] {
+ BOOST_FAIL("Unexpected timeout");
+ }));
+ advanceClocks(time::milliseconds(1), 40);
+ face->receive(interest);
+ manager.processEvents(time::milliseconds(-1));
+ // check that one piece of data is sent, and it is what was expected
+ BOOST_CHECK_EQUAL(++nData, face->sentData.size());
+ face->receive(face->sentData[nData - 1]);
+ }
+ // request all the data packets
+ for (const auto& file : fileData) {
+ for (const auto& data : file) {
+ Interest interest(data.getFullName(), time::milliseconds(50));
+ face->expressInterest(interest,
+ [&data](const Interest& i, const Data& d) {
+ BOOST_CHECK(data == d);
+ },
+ bind([] {
+ BOOST_FAIL("Unexpected Nack");
+ }),
+ bind([] {
+ BOOST_FAIL("Unexpected timeout");
+ }));
+ advanceClocks(time::milliseconds(1), 40);
+ face->receive(interest);
+ manager.processEvents(time::milliseconds(-1));
+ // check that one piece of data is sent, and it is what was expected
+ BOOST_CHECK_EQUAL(++nData, face->sentData.size());
+ face->receive(face->sentData[nData - 1]);
+ }
+ }
+ // clean up tests
+ face->sentData.clear();
+ fs::remove_all(".appdata");
}
}
@@ -1038,7 +1036,7 @@
std::vector<Data> data;
std::string filePath = "tests/testdata/";
std::string dirPath = ".appdata/foo/";
- Name initialSegmentName = "/NTORRENT/foo/torrent-file/sha256digest=02c737fd4c6e7de4b4825b089f39700c2dfa8fd2bb2b91f09201e357c4463253";
+ Name initialSegmentName = "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=9e0410fa477309b40a4ef9cb2bebe70ed2e9fa2defcb584979d768b3f6ced981";
// get torrent files and manifests
{
auto temp = TorrentFile::generate("tests/testdata/foo",
@@ -1123,8 +1121,8 @@
size_t d_subManifestSize;
size_t d_dataPacketSize;
} DATA [] = {
- {"tests/testdata/foo", "/NTORRENT/foo/torrent-file/sha256digest=02c737fd4c6e7de4b4825b089f39700c2dfa8fd2bb2b91f09201e357c4463253", 1024, 1024, 1024},
- {"tests/testdata/foo", "/NTORRENT/foo/torrent-file/sha256digest=b88c054e87bcbb744726f7eaf79f95459b4fddce2caeb952f263a5ccbbfc9a7c", 128, 128, 128},
+ {"tests/testdata/foo", "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=9e0410fa477309b40a4ef9cb2bebe70ed2e9fa2defcb584979d768b3f6ced981", 1024, 1024, 1024},
+ {"tests/testdata/foo", "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=5351d424c7893158da35707258635d885725be0aa34321cf2e557afc2b785a76", 128, 128, 128},
};
enum { NUM_DATA = sizeof DATA / sizeof *DATA };
for (int i = 0; i < NUM_DATA; ++i) {
@@ -1238,8 +1236,8 @@
size_t d_subManifestSize;
size_t d_dataPacketSize;
} DATA [] = {
- {"tests/testdata/foo", "/NTORRENT/foo/torrent-file/sha256digest=02c737fd4c6e7de4b4825b089f39700c2dfa8fd2bb2b91f09201e357c4463253", 1024, 1024, 1024},
- {"tests/testdata/foo", "/NTORRENT/foo/torrent-file/sha256digest=96d900d6788465f9a7b00191581b004c910d74b3762d141ec0e82173731bc9f4", 1, 1, 1024},
+ {"tests/testdata/foo", "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=9e0410fa477309b40a4ef9cb2bebe70ed2e9fa2defcb584979d768b3f6ced981", 1024, 1024, 1024},
+ // {"tests/testdata/foo", "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=96d900d6788465f9a7b00191581b004c910d74b3762d141ec0e82173731bc9f4", 1, 1, 1024},
};
enum { NUM_DATA = sizeof DATA / sizeof *DATA };
for (int i = 0; i < NUM_DATA; ++i) {
@@ -1324,8 +1322,8 @@
size_t d_subManifestSize;
size_t d_dataPacketSize;
} DATA [] = {
- {"tests/testdata/foo", "/NTORRENT/foo/torrent-file/sha256digest=02c737fd4c6e7de4b4825b089f39700c2dfa8fd2bb2b91f09201e357c4463253", 1024, 1024, 1024},
- {"tests/testdata/foo", "/NTORRENT/foo/torrent-file/sha256digest=02c737fd4c6e7de4b4825b089f39700c2dfa8fd2bb2b91f09201e357c4463253", 128, 128, 1024},
+ {"tests/testdata/foo", "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=9e0410fa477309b40a4ef9cb2bebe70ed2e9fa2defcb584979d768b3f6ced981", 1024, 1024, 1024},
+ {"tests/testdata/foo", "/ndn/multicast/NTORRENT/foo/torrent-file/sha256digest=9e0410fa477309b40a4ef9cb2bebe70ed2e9fa2defcb584979d768b3f6ced981", 128, 128, 1024},
};
enum { NUM_DATA = sizeof DATA / sizeof *DATA };
for (int i = 0; i < NUM_DATA; ++i) {