Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (c) 2014, Regents of the University of California, |
| 4 | * Arizona Board of Regents, |
| 5 | * Colorado State University, |
| 6 | * University Pierre & Marie Curie, Sorbonne University, |
| 7 | * Washington University in St. Louis, |
| 8 | * Beijing Institute of Technology, |
| 9 | * The University of Memphis |
| 10 | * |
| 11 | * This file is part of NFD (Named Data Networking Forwarding Daemon). |
| 12 | * See AUTHORS.md for complete list of NFD authors and contributors. |
| 13 | * |
| 14 | * NFD is free software: you can redistribute it and/or modify it under the terms |
| 15 | * of the GNU General Public License as published by the Free Software Foundation, |
| 16 | * either version 3 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 19 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 20 | * PURPOSE. See the GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License along with |
| 23 | * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 24 | */ |
| 25 | |
| 26 | #include "rib/rib-status-publisher.hpp" |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 27 | #include "rib-status-publisher-common.hpp" |
Junxiao Shi | 376f737 | 2014-11-17 18:03:31 -0700 | [diff] [blame] | 28 | |
| 29 | #include "tests/test-common.hpp" |
| 30 | #include <ndn-cxx/util/dummy-client-face.hpp> |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 31 | |
| 32 | namespace nfd { |
| 33 | namespace rib { |
| 34 | namespace tests { |
| 35 | |
| 36 | BOOST_FIXTURE_TEST_SUITE(RibStatusPublisherSuite, RibStatusPublisherFixture) |
| 37 | |
| 38 | BOOST_AUTO_TEST_CASE(Basic) |
| 39 | { |
| 40 | Rib rib; |
| 41 | |
| 42 | FaceEntry entry; |
| 43 | Name name("/"); |
| 44 | entry.faceId = 1; |
| 45 | entry.origin = 128; |
| 46 | entry.cost = 32; |
| 47 | entry.flags = ndn::nfd::ROUTE_FLAG_CAPTURE; |
| 48 | rib.insert(name, entry); |
| 49 | |
| 50 | ndn::KeyChain keyChain; |
Junxiao Shi | 376f737 | 2014-11-17 18:03:31 -0700 | [diff] [blame] | 51 | shared_ptr<ndn::util::DummyClientFace> face = ndn::util::makeDummyClientFace(); |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 52 | RibStatusPublisher publisher(rib, *face, "/localhost/nfd/rib/list", keyChain); |
| 53 | |
| 54 | publisher.publish(); |
| 55 | face->processEvents(time::milliseconds(1)); |
| 56 | |
Junxiao Shi | 376f737 | 2014-11-17 18:03:31 -0700 | [diff] [blame] | 57 | BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1); |
| 58 | decodeRibEntryBlock(face->sentDatas[0], name, entry); |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | |
| 62 | BOOST_AUTO_TEST_SUITE_END() |
| 63 | |
| 64 | } // namespace tests |
| 65 | } // namespace rib |
| 66 | } // namespace nfd |