Alexander Afanasyev | fa2f662 | 2016-12-25 12:28:00 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Alexander Afanasyev | 1cf5c43 | 2017-01-13 23:22:15 -0800 | [diff] [blame^] | 3 | * Copyright (c) 2013-2017, Regents of the University of California. |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 4 | * |
Alexander Afanasyev | fa2f662 | 2016-12-25 12:28:00 -0800 | [diff] [blame] | 5 | * This file is part of ChronoShare, a decentralized file sharing application over NDN. |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 6 | * |
Alexander Afanasyev | fa2f662 | 2016-12-25 12:28:00 -0800 | [diff] [blame] | 7 | * ChronoShare is free software: you can redistribute it and/or modify it under the terms |
| 8 | * of the GNU General Public License as published by the Free Software Foundation, either |
| 9 | * version 3 of the License, or (at your option) any later version. |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 10 | * |
Alexander Afanasyev | fa2f662 | 2016-12-25 12:28:00 -0800 | [diff] [blame] | 11 | * ChronoShare is distributed in the hope that it will be useful, but WITHOUT ANY |
| 12 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 13 | * PARTICULAR PURPOSE. See the GNU General Public License for more details. |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 14 | * |
Alexander Afanasyev | fa2f662 | 2016-12-25 12:28:00 -0800 | [diff] [blame] | 15 | * You should have received copies of the GNU General Public License along with |
| 16 | * ChronoShare, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 17 | * |
| 18 | * See AUTHORS.md for complete list of ChronoShare authors and contributors. |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 19 | */ |
| 20 | |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 21 | #include "ccnx-wrapper.hpp" |
Alexander Afanasyev | f4cde4e | 2016-12-25 13:42:57 -0800 | [diff] [blame] | 22 | #include "fetch-manager.hpp" |
| 23 | #include "fetcher.hpp" |
Alexander Afanasyev | f4cde4e | 2016-12-25 13:42:57 -0800 | [diff] [blame] | 24 | #include "logging.hpp" |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 25 | #include <boost/make_shared.hpp> |
| 26 | #include <boost/test/unit_test.hpp> |
Alexander Afanasyev | 1d1cc83 | 2013-02-05 20:03:36 -0800 | [diff] [blame] | 27 | |
Alexander Afanasyev | 1cf5c43 | 2017-01-13 23:22:15 -0800 | [diff] [blame^] | 28 | _LOG_INIT(Test.FetchManager); |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 29 | |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame] | 30 | using namespace Ndnx; |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 31 | using namespace std; |
| 32 | using namespace boost; |
| 33 | |
| 34 | BOOST_AUTO_TEST_SUITE(TestFetchManager) |
| 35 | |
| 36 | struct FetcherTestData |
| 37 | { |
Zhenkai Zhu | 3d1beca | 2013-01-23 14:55:32 -0800 | [diff] [blame] | 38 | set<uint64_t> recvData; |
| 39 | set<uint64_t> recvContent; |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 40 | |
| 41 | set<Name> differentNames; |
| 42 | set<Name> segmentNames; |
| 43 | |
| 44 | bool m_done; |
| 45 | bool m_failed; |
| 46 | |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 47 | FetcherTestData() |
| 48 | : m_done(false) |
| 49 | , m_failed(false) |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 50 | { |
| 51 | } |
| 52 | |
| 53 | void |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 54 | onData(const Ccnx::Name& deviceName, const Ccnx::Name& basename, uint64_t seqno, Ccnx::PcoPtr pco) |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 55 | { |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 56 | _LOG_TRACE("onData: " << seqno); |
Alexander Afanasyev | 1d1cc83 | 2013-02-05 20:03:36 -0800 | [diff] [blame] | 57 | |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 58 | recvData.insert(seqno); |
| 59 | differentNames.insert(basename); |
Zhenkai Zhu | 3d1beca | 2013-01-23 14:55:32 -0800 | [diff] [blame] | 60 | Name name = basename; |
| 61 | name.appendComp(seqno); |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 62 | segmentNames.insert(name); |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 63 | |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 64 | BytesPtr data = pco->contentPtr(); |
Alexander Afanasyev | f278db3 | 2013-01-21 14:41:01 -0800 | [diff] [blame] | 65 | |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 66 | if (data->size() == sizeof(int)) { |
| 67 | recvContent.insert(*reinterpret_cast<const int*>(head(*data))); |
| 68 | } |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 69 | |
Alexander Afanasyev | 650ba28 | 2013-01-20 20:14:06 -0800 | [diff] [blame] | 70 | // cout << "<<< " << basename << ", " << name << ", " << seqno << endl; |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | void |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 74 | finish(const Ccnx::Name& deviceName, const Ccnx::Name& baseName) |
Zhenkai Zhu | 3d1beca | 2013-01-23 14:55:32 -0800 | [diff] [blame] | 75 | { |
| 76 | } |
| 77 | |
| 78 | void |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 79 | onComplete(Fetcher& fetcher) |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 80 | { |
| 81 | m_done = true; |
| 82 | // cout << "Done" << endl; |
| 83 | } |
| 84 | |
| 85 | void |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 86 | onFail(Fetcher& fetcher) |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 87 | { |
| 88 | m_failed = true; |
| 89 | // cout << "Failed" << endl; |
| 90 | } |
| 91 | }; |
| 92 | |
Yingdi Yu | f0b3de3 | 2013-07-11 12:59:00 -0700 | [diff] [blame] | 93 | void run() |
| 94 | { |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame] | 95 | NdnxWrapperPtr ndnx = make_shared<NdnxWrapper> (); |
Yingdi Yu | f0b3de3 | 2013-07-11 12:59:00 -0700 | [diff] [blame] | 96 | |
| 97 | Name baseName ("/base"); |
| 98 | Name deviceName ("/device"); |
| 99 | |
| 100 | for (int i = 0; i < 10; i++) |
| 101 | { |
| 102 | usleep(100000); |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame] | 103 | ndnx->publishData (Name (baseName)(i), reinterpret_cast<const unsigned char*> (&i), sizeof(int), 30); |
Yingdi Yu | f0b3de3 | 2013-07-11 12:59:00 -0700 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | for (int i = 11; i < 50; i++) |
| 107 | { |
| 108 | usleep(100000); |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame] | 109 | ndnx->publishData (Name (baseName)(i), reinterpret_cast<const unsigned char*> (&i), sizeof(int), 30); |
Yingdi Yu | f0b3de3 | 2013-07-11 12:59:00 -0700 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | } |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 113 | |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 114 | BOOST_AUTO_TEST_CASE(TestFetcher) |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 115 | { |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 116 | CcnxWrapperPtr ccnx = make_shared<CcnxWrapper>(); |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 117 | |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 118 | Name baseName("/base"); |
| 119 | Name deviceName("/device"); |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 120 | /* publish seqnos: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, <gap 5>, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, <gap 1>, 26 */ |
| 121 | // this will allow us to test our pipeline of 6 |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 122 | for (int i = 0; i < 10; i++) { |
| 123 | ccnx->publishData(Name(baseName)(i), reinterpret_cast<const unsigned char*>(&i), sizeof(int), 30); |
| 124 | } |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 125 | |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 126 | for (int i = 15; i < 25; i++) { |
| 127 | ccnx->publishData(Name(baseName)(i), reinterpret_cast<const unsigned char*>(&i), sizeof(int), 30); |
| 128 | } |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 129 | |
| 130 | int oneMore = 26; |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 131 | ccnx->publishData(Name(baseName)(oneMore), reinterpret_cast<const unsigned char*>(&oneMore), |
| 132 | sizeof(int), 30); |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 133 | |
| 134 | FetcherTestData data; |
Zhenkai Zhu | ab9215c | 2013-01-28 23:42:28 -0800 | [diff] [blame] | 135 | ExecutorPtr executor = make_shared<Executor>(1); |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 136 | executor->start(); |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 137 | |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 138 | Fetcher fetcher(ccnx, executor, bind(&FetcherTestData::onData, &data, _1, _2, _3, _4), |
| 139 | bind(&FetcherTestData::finish, &data, _1, _2), |
| 140 | bind(&FetcherTestData::onComplete, &data, _1), |
| 141 | bind(&FetcherTestData::onFail, &data, _1), deviceName, Name("/base"), 0, 26, |
| 142 | boost::posix_time::seconds(5)); // this time is not precise |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 143 | |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 144 | BOOST_CHECK_EQUAL(fetcher.IsActive(), false); |
| 145 | fetcher.RestartPipeline(); |
| 146 | BOOST_CHECK_EQUAL(fetcher.IsActive(), true); |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 147 | |
Alexander Afanasyev | 650ba28 | 2013-01-20 20:14:06 -0800 | [diff] [blame] | 148 | usleep(7000000); |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 149 | BOOST_CHECK_EQUAL(data.m_failed, true); |
| 150 | BOOST_CHECK_EQUAL(data.differentNames.size(), 1); |
| 151 | BOOST_CHECK_EQUAL(data.segmentNames.size(), 20); |
| 152 | BOOST_CHECK_EQUAL(data.recvData.size(), 20); |
| 153 | BOOST_CHECK_EQUAL(data.recvContent.size(), 20); |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 154 | |
Alexander Afanasyev | 650ba28 | 2013-01-20 20:14:06 -0800 | [diff] [blame] | 155 | { |
| 156 | ostringstream recvData; |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 157 | for (set<uint64_t>::iterator i = data.recvData.begin(); i != data.recvData.end(); i++) |
Alexander Afanasyev | 650ba28 | 2013-01-20 20:14:06 -0800 | [diff] [blame] | 158 | recvData << *i << ", "; |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 159 | |
Alexander Afanasyev | 650ba28 | 2013-01-20 20:14:06 -0800 | [diff] [blame] | 160 | ostringstream recvContent; |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 161 | for (set<uint64_t>::iterator i = data.recvContent.begin(); i != data.recvContent.end(); i++) |
Alexander Afanasyev | 650ba28 | 2013-01-20 20:14:06 -0800 | [diff] [blame] | 162 | recvContent << *i << ", "; |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 163 | |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 164 | BOOST_CHECK_EQUAL(recvData.str(), |
| 165 | "0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, "); |
| 166 | BOOST_CHECK_EQUAL(recvData.str(), recvContent.str()); |
Alexander Afanasyev | 650ba28 | 2013-01-20 20:14:06 -0800 | [diff] [blame] | 167 | } |
| 168 | |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 169 | BOOST_CHECK_EQUAL(fetcher.IsActive(), false); |
| 170 | fetcher.RestartPipeline(); |
| 171 | BOOST_CHECK_EQUAL(fetcher.IsActive(), true); |
Alexander Afanasyev | 650ba28 | 2013-01-20 20:14:06 -0800 | [diff] [blame] | 172 | |
| 173 | usleep(7000000); |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 174 | BOOST_CHECK_EQUAL(data.m_failed, true); |
Alexander Afanasyev | 650ba28 | 2013-01-20 20:14:06 -0800 | [diff] [blame] | 175 | |
| 176 | // publishing missing pieces |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 177 | for (int i = 0; i < 27; i++) { |
| 178 | ccnx->publishData(Name(baseName)(i), reinterpret_cast<const unsigned char*>(&i), sizeof(int), 1); |
| 179 | } |
| 180 | BOOST_CHECK_EQUAL(fetcher.IsActive(), false); |
| 181 | fetcher.RestartPipeline(); |
| 182 | BOOST_CHECK_EQUAL(fetcher.IsActive(), true); |
Alexander Afanasyev | 650ba28 | 2013-01-20 20:14:06 -0800 | [diff] [blame] | 183 | |
| 184 | usleep(1000000); |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 185 | BOOST_CHECK_EQUAL(data.m_done, true); |
Alexander Afanasyev | 650ba28 | 2013-01-20 20:14:06 -0800 | [diff] [blame] | 186 | |
| 187 | { |
| 188 | ostringstream recvData; |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 189 | for (set<uint64_t>::iterator i = data.recvData.begin(); i != data.recvData.end(); i++) |
Alexander Afanasyev | 650ba28 | 2013-01-20 20:14:06 -0800 | [diff] [blame] | 190 | recvData << *i << ", "; |
| 191 | |
| 192 | ostringstream recvContent; |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 193 | for (set<uint64_t>::iterator i = data.recvContent.begin(); i != data.recvContent.end(); i++) |
Alexander Afanasyev | 650ba28 | 2013-01-20 20:14:06 -0800 | [diff] [blame] | 194 | recvContent << *i << ", "; |
| 195 | |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 196 | BOOST_CHECK_EQUAL(recvData.str(), |
| 197 | "0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, "); |
| 198 | BOOST_CHECK_EQUAL(recvData.str(), recvContent.str()); |
Alexander Afanasyev | 650ba28 | 2013-01-20 20:14:06 -0800 | [diff] [blame] | 199 | } |
Alexander Afanasyev | 1d1cc83 | 2013-02-05 20:03:36 -0800 | [diff] [blame] | 200 | |
Alexander Afanasyev | eda3b7a | 2016-12-25 11:26:40 -0800 | [diff] [blame] | 201 | executor->shutdown(); |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 202 | } |
| 203 | |
Yingdi Yu | 57f667b | 2013-07-11 10:37:59 -0700 | [diff] [blame] | 204 | |
| 205 | BOOST_AUTO_TEST_CASE (TestFetcher2) |
| 206 | { |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame] | 207 | NdnxWrapperPtr ndnx = make_shared<NdnxWrapper> (); |
Yingdi Yu | 57f667b | 2013-07-11 10:37:59 -0700 | [diff] [blame] | 208 | |
| 209 | Name baseName ("/base"); |
| 210 | Name deviceName ("/device"); |
Yingdi Yu | 57f667b | 2013-07-11 10:37:59 -0700 | [diff] [blame] | 211 | |
Yingdi Yu | f0b3de3 | 2013-07-11 12:59:00 -0700 | [diff] [blame] | 212 | thread publishThread(run); |
Yingdi Yu | 57f667b | 2013-07-11 10:37:59 -0700 | [diff] [blame] | 213 | |
| 214 | FetcherTestData data; |
| 215 | ExecutorPtr executor = make_shared<Executor>(1); |
| 216 | executor->start (); |
| 217 | |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame] | 218 | Fetcher fetcher (ndnx, |
Yingdi Yu | 57f667b | 2013-07-11 10:37:59 -0700 | [diff] [blame] | 219 | executor, |
| 220 | bind (&FetcherTestData::onData, &data, _1, _2, _3, _4), |
| 221 | bind (&FetcherTestData::finish, &data, _1, _2), |
| 222 | bind (&FetcherTestData::onComplete, &data, _1), |
| 223 | bind (&FetcherTestData::onFail, &data, _1), |
Yingdi Yu | f0b3de3 | 2013-07-11 12:59:00 -0700 | [diff] [blame] | 224 | deviceName, baseName, 0, 49, |
Yingdi Yu | 57f667b | 2013-07-11 10:37:59 -0700 | [diff] [blame] | 225 | boost::posix_time::seconds (5)); // this time is not precise |
| 226 | |
| 227 | BOOST_CHECK_EQUAL (fetcher.IsActive (), false); |
| 228 | fetcher.RestartPipeline (); |
| 229 | BOOST_CHECK_EQUAL (fetcher.IsActive (), true); |
| 230 | |
Yingdi Yu | f0b3de3 | 2013-07-11 12:59:00 -0700 | [diff] [blame] | 231 | usleep(20000000); |
Yingdi Yu | 57f667b | 2013-07-11 10:37:59 -0700 | [diff] [blame] | 232 | BOOST_CHECK_EQUAL (data.m_failed, true); |
| 233 | |
| 234 | executor->shutdown (); |
| 235 | } |
| 236 | |
| 237 | |
| 238 | |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame] | 239 | // BOOST_AUTO_TEST_CASE (NdnxWrapperSelector) |
Alexander Afanasyev | 21a166e | 2013-01-20 16:04:41 -0800 | [diff] [blame] | 240 | // { |
| 241 | |
| 242 | // Closure closure (bind(dataCallback, _1, _2), bind(timeout, _1)); |
| 243 | |
| 244 | // Selectors selectors; |
| 245 | // selectors.interestLifetime(1); |
| 246 | |
| 247 | // string n1 = "/random/01"; |
| 248 | // c1->sendInterest(Name(n1), closure, selectors); |
| 249 | // sleep(2); |
| 250 | // c2->publishData(Name(n1), (const unsigned char *)n1.c_str(), n1.size(), 4); |
| 251 | // usleep(100000); |
| 252 | // BOOST_CHECK_EQUAL(g_timeout_counter, 1); |
| 253 | // BOOST_CHECK_EQUAL(g_dataCallback_counter, 0); |
| 254 | |
| 255 | // string n2 = "/random/02"; |
| 256 | // selectors.interestLifetime(2); |
| 257 | // c1->sendInterest(Name(n2), closure, selectors); |
| 258 | // sleep(1); |
| 259 | // c2->publishData(Name(n2), (const unsigned char *)n2.c_str(), n2.size(), 4); |
| 260 | // usleep(100000); |
| 261 | // BOOST_CHECK_EQUAL(g_timeout_counter, 1); |
| 262 | // BOOST_CHECK_EQUAL(g_dataCallback_counter, 1); |
| 263 | |
| 264 | // // reset |
| 265 | // g_dataCallback_counter = 0; |
| 266 | // g_timeout_counter = 0; |
| 267 | // } |
| 268 | |
| 269 | BOOST_AUTO_TEST_SUITE_END() |