blob: 55ba64f104c8fc25bc519c895f4f74e3c6a20899 [file] [log] [blame]
Vince Lehmancd16c832014-07-23 15:14:55 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Alexander Afanasyev7c10b3b2015-01-20 12:24:27 -08003 * Copyright (c) 2014-2015, 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.
Vince Lehmancd16c832014-07-23 15:14:55 -070010 *
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 Lehmancd16c832014-07-23 15:14:55 -070027#include "rib-status-publisher-common.hpp"
Junxiao Shi376f7372014-11-17 18:03:31 -070028
29#include "tests/test-common.hpp"
30#include <ndn-cxx/util/dummy-client-face.hpp>
Vince Lehmancd16c832014-07-23 15:14:55 -070031
32namespace nfd {
33namespace rib {
34namespace tests {
35
Spyridon Mastorakisd0381c02015-02-19 10:29:41 -080036BOOST_FIXTURE_TEST_SUITE(TestRibStatusPublisher, RibStatusPublisherFixture)
Vince Lehmancd16c832014-07-23 15:14:55 -070037
38BOOST_AUTO_TEST_CASE(Basic)
39{
40 Rib rib;
41
Vince Lehman218be0a2015-01-15 17:25:20 -060042 Route route;
Vince Lehmancd16c832014-07-23 15:14:55 -070043 Name name("/");
Vince Lehman218be0a2015-01-15 17:25:20 -060044 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 Lehmancd16c832014-07-23 15:14:55 -070049
50 ndn::KeyChain keyChain;
Junxiao Shi376f7372014-11-17 18:03:31 -070051 shared_ptr<ndn::util::DummyClientFace> face = ndn::util::makeDummyClientFace();
Vince Lehmancd16c832014-07-23 15:14:55 -070052 RibStatusPublisher publisher(rib, *face, "/localhost/nfd/rib/list", keyChain);
53
54 publisher.publish();
55 face->processEvents(time::milliseconds(1));
56
Junxiao Shi376f7372014-11-17 18:03:31 -070057 BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
Vince Lehman218be0a2015-01-15 17:25:20 -060058 decodeRibEntryBlock(face->sentDatas[0], name, route);
Vince Lehmancd16c832014-07-23 15:14:55 -070059}
60
61
62BOOST_AUTO_TEST_SUITE_END()
63
64} // namespace tests
65} // namespace rib
66} // namespace nfd