blob: 1f815ff63ca814b5e9335fa4af4c515e3101172f [file] [log] [blame]
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Junxiao Shi1f481fa2017-01-26 15:14:43 +00003 * Copyright (c) 2014-2017, Regents of the University of California,
Junxiao Shi38f4ce92016-08-04 10:01:52 +00004 * 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
Junxiao Shi331ade72016-08-19 14:07:19 +000026#include "nfdc/channel-module.hpp"
Junxiao Shi38f4ce92016-08-04 10:01:52 +000027
Junxiao Shi1f481fa2017-01-26 15:14:43 +000028#include "status-fixture.hpp"
Junxiao Shi38f4ce92016-08-04 10:01:52 +000029
30namespace nfd {
31namespace tools {
Junxiao Shi331ade72016-08-19 14:07:19 +000032namespace nfdc {
Junxiao Shi38f4ce92016-08-04 10:01:52 +000033namespace tests {
34
Junxiao Shi331ade72016-08-19 14:07:19 +000035BOOST_AUTO_TEST_SUITE(Nfdc)
Junxiao Shi1f481fa2017-01-26 15:14:43 +000036BOOST_FIXTURE_TEST_SUITE(TestChannelModule, StatusFixture<ChannelModule>)
Junxiao Shi38f4ce92016-08-04 10:01:52 +000037
38const std::string STATUS_XML = stripXmlSpaces(R"XML(
39 <channels>
40 <channel>
41 <localUri>tcp4://192.0.2.1:6363</localUri>
42 </channel>
43 <channel>
44 <localUri>ws://[::]:9696/NFD</localUri>
45 </channel>
46 </channels>
47)XML");
48
49const std::string STATUS_TEXT = std::string(R"TEXT(
50Channels:
51 tcp4://192.0.2.1:6363
52 ws://[::]:9696/NFD
53)TEXT").substr(1);
54
55BOOST_AUTO_TEST_CASE(Status)
56{
57 this->fetchStatus();
58 ChannelStatus payload1;
59 payload1.setLocalUri("tcp4://192.0.2.1:6363");
60 ChannelStatus payload2;
61 payload2.setLocalUri("ws://[::]:9696/NFD");
62 this->sendDataset("/localhost/nfd/faces/channels", payload1, payload2);
63 this->prepareStatusOutput();
64
65 BOOST_CHECK(statusXml.is_equal(STATUS_XML));
66 BOOST_CHECK(statusText.is_equal(STATUS_TEXT));
67}
68
69BOOST_AUTO_TEST_SUITE_END() // TestChannelModule
Junxiao Shi331ade72016-08-19 14:07:19 +000070BOOST_AUTO_TEST_SUITE_END() // Nfdc
Junxiao Shi38f4ce92016-08-04 10:01:52 +000071
72} // namespace tests
Junxiao Shi331ade72016-08-19 14:07:19 +000073} // namespace nfdc
Junxiao Shi38f4ce92016-08-04 10:01:52 +000074} // namespace tools
75} // namespace nfd