Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Junxiao Shi | 221b6fe | 2016-07-14 18:21:56 +0000 | [diff] [blame^] | 3 | * Copyright (c) 2014-2016, Regents of the University of California, |
Alexander Afanasyev | 7c10b3b | 2015-01-20 12:24:27 -0800 | [diff] [blame] | 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. |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 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 | |
Spyridon Mastorakis | d0381c0 | 2015-02-19 10:29:41 -0800 | [diff] [blame] | 36 | BOOST_FIXTURE_TEST_SUITE(TestRibStatusPublisher, RibStatusPublisherFixture) |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 37 | |
| 38 | BOOST_AUTO_TEST_CASE(Basic) |
| 39 | { |
| 40 | Rib rib; |
| 41 | |
Vince Lehman | 218be0a | 2015-01-15 17:25:20 -0600 | [diff] [blame] | 42 | Route route; |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 43 | Name name("/"); |
Vince Lehman | 218be0a | 2015-01-15 17:25:20 -0600 | [diff] [blame] | 44 | route.faceId = 1; |
| 45 | route.origin = 128; |
| 46 | route.cost = 32; |
| 47 | route.flags = ndn::nfd::ROUTE_FLAG_CAPTURE; |
| 48 | rib.insert(name, route); |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 49 | |
Junxiao Shi | 221b6fe | 2016-07-14 18:21:56 +0000 | [diff] [blame^] | 50 | ndn::util::DummyClientFace face(getGlobalIoService(), m_keyChain); |
| 51 | RibStatusPublisher publisher(rib, face, "/localhost/nfd/rib/list", m_keyChain); |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 52 | |
| 53 | publisher.publish(); |
Junxiao Shi | 221b6fe | 2016-07-14 18:21:56 +0000 | [diff] [blame^] | 54 | face.processEvents(time::milliseconds(1)); |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 55 | |
Junxiao Shi | 221b6fe | 2016-07-14 18:21:56 +0000 | [diff] [blame^] | 56 | BOOST_REQUIRE_EQUAL(face.sentData.size(), 1); |
| 57 | decodeRibEntryBlock(face.sentData[0], name, route); |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | |
| 61 | BOOST_AUTO_TEST_SUITE_END() |
| 62 | |
| 63 | } // namespace tests |
| 64 | } // namespace rib |
| 65 | } // namespace nfd |