blob: 25ffe5751f24528f5f57e2af6a88fd3ad8f2acf9 [file] [log] [blame]
Junxiao Shi38f4ce92016-08-04 10:01:52 +00001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Davide Pesaventoe422f9e2022-06-03 01:30:23 -04002/*
3 * Copyright (c) 2014-2022, 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
Davide Pesaventoe422f9e2022-06-03 01:30:23 -040030namespace nfd::tools::nfdc::tests {
Junxiao Shi38f4ce92016-08-04 10:01:52 +000031
Junxiao Shi331ade72016-08-19 14:07:19 +000032BOOST_AUTO_TEST_SUITE(Nfdc)
Junxiao Shi1f481fa2017-01-26 15:14:43 +000033BOOST_FIXTURE_TEST_SUITE(TestChannelModule, StatusFixture<ChannelModule>)
Junxiao Shi38f4ce92016-08-04 10:01:52 +000034
35const std::string STATUS_XML = stripXmlSpaces(R"XML(
36 <channels>
37 <channel>
38 <localUri>tcp4://192.0.2.1:6363</localUri>
39 </channel>
40 <channel>
41 <localUri>ws://[::]:9696/NFD</localUri>
42 </channel>
43 </channels>
44)XML");
45
46const std::string STATUS_TEXT = std::string(R"TEXT(
47Channels:
48 tcp4://192.0.2.1:6363
49 ws://[::]:9696/NFD
50)TEXT").substr(1);
51
52BOOST_AUTO_TEST_CASE(Status)
53{
54 this->fetchStatus();
55 ChannelStatus payload1;
56 payload1.setLocalUri("tcp4://192.0.2.1:6363");
57 ChannelStatus payload2;
58 payload2.setLocalUri("ws://[::]:9696/NFD");
59 this->sendDataset("/localhost/nfd/faces/channels", payload1, payload2);
60 this->prepareStatusOutput();
61
62 BOOST_CHECK(statusXml.is_equal(STATUS_XML));
63 BOOST_CHECK(statusText.is_equal(STATUS_TEXT));
64}
65
66BOOST_AUTO_TEST_SUITE_END() // TestChannelModule
Junxiao Shi331ade72016-08-19 14:07:19 +000067BOOST_AUTO_TEST_SUITE_END() // Nfdc
Junxiao Shi38f4ce92016-08-04 10:01:52 +000068
Davide Pesaventoe422f9e2022-06-03 01:30:23 -040069} // namespace nfd::tools::nfdc::tests