Steve DiBenedetto | 9f6c364 | 2014-03-10 17:02:27 -0600 | [diff] [blame^] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2014 Named Data Networking Project |
| 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
| 7 | #include "face-status-publisher-common.hpp" |
| 8 | |
| 9 | namespace nfd { |
| 10 | namespace tests { |
| 11 | |
| 12 | NFD_LOG_INIT("FaceStatusPublisherTest"); |
| 13 | |
| 14 | BOOST_FIXTURE_TEST_SUITE(MgmtFaceManager, FaceStatusPublisherFixture) |
| 15 | |
| 16 | BOOST_AUTO_TEST_CASE(TestFaceStatusPublisher) |
| 17 | { |
| 18 | Name commandName("/localhost/nfd/faces/list"); |
| 19 | shared_ptr<Interest> command(make_shared<Interest>(commandName)); |
| 20 | |
| 21 | // MAX_SEGMENT_SIZE == 4400, FaceStatus size with filler counters is 55 |
| 22 | // 55 divides 4400 (== 80), so only use 79 FaceStatuses and then two smaller ones |
| 23 | // to force a FaceStatus to span Data packets |
| 24 | for (int i = 0; i < 79; i++) |
| 25 | { |
| 26 | shared_ptr<TestCountersFace> dummy(make_shared<TestCountersFace>()); |
| 27 | |
| 28 | uint64_t filler = std::numeric_limits<uint64_t>::max() - 1; |
| 29 | dummy->setCounters(filler, filler, filler, filler); |
| 30 | |
| 31 | m_referenceFaces.push_front(dummy); |
| 32 | |
| 33 | add(dummy); |
| 34 | } |
| 35 | |
| 36 | for (int i = 0; i < 2; i++) |
| 37 | { |
| 38 | shared_ptr<TestCountersFace> dummy(make_shared<TestCountersFace>()); |
| 39 | uint64_t filler = std::numeric_limits<uint32_t>::max() - 1; |
| 40 | dummy->setCounters(filler, filler, filler, filler); |
| 41 | |
| 42 | m_referenceFaces.push_front(dummy); |
| 43 | |
| 44 | add(dummy); |
| 45 | } |
| 46 | |
| 47 | ndn::EncodingBuffer buffer; |
| 48 | |
| 49 | m_face->onReceiveData += |
| 50 | bind(&FaceStatusPublisherFixture::decodeFaceStatusBlock, this, _1); |
| 51 | |
| 52 | m_publisher.publish(); |
| 53 | BOOST_REQUIRE(m_finished); |
| 54 | } |
| 55 | |
| 56 | BOOST_AUTO_TEST_SUITE_END() |
| 57 | |
| 58 | } // namespace tests |
| 59 | } // namespace nfd |