blob: b1414ccc4a1886553ef091ba9b693551faf2cd77 [file] [log] [blame]
Vince Lehmancd16c832014-07-23 15:14:55 -07001/* -*- 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 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
36BOOST_FIXTURE_TEST_SUITE(RibStatusPublisherSuite, RibStatusPublisherFixture)
37
38BOOST_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 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);
58 decodeRibEntryBlock(face->sentDatas[0], name, entry);
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