Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Davide Pesavento | e422f9e | 2022-06-03 01:30:23 -0400 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2014-2022, Regents of the University of California, |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [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. |
| 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 Shi | 331ade7 | 2016-08-19 14:07:19 +0000 | [diff] [blame] | 26 | #include "nfdc/channel-module.hpp" |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 27 | |
Junxiao Shi | 1f481fa | 2017-01-26 15:14:43 +0000 | [diff] [blame] | 28 | #include "status-fixture.hpp" |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 29 | |
Davide Pesavento | e422f9e | 2022-06-03 01:30:23 -0400 | [diff] [blame] | 30 | namespace nfd::tools::nfdc::tests { |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 31 | |
Junxiao Shi | 331ade7 | 2016-08-19 14:07:19 +0000 | [diff] [blame] | 32 | BOOST_AUTO_TEST_SUITE(Nfdc) |
Junxiao Shi | 1f481fa | 2017-01-26 15:14:43 +0000 | [diff] [blame] | 33 | BOOST_FIXTURE_TEST_SUITE(TestChannelModule, StatusFixture<ChannelModule>) |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 34 | |
| 35 | const 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 | |
| 46 | const std::string STATUS_TEXT = std::string(R"TEXT( |
| 47 | Channels: |
| 48 | tcp4://192.0.2.1:6363 |
| 49 | ws://[::]:9696/NFD |
| 50 | )TEXT").substr(1); |
| 51 | |
| 52 | BOOST_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 | |
| 66 | BOOST_AUTO_TEST_SUITE_END() // TestChannelModule |
Junxiao Shi | 331ade7 | 2016-08-19 14:07:19 +0000 | [diff] [blame] | 67 | BOOST_AUTO_TEST_SUITE_END() // Nfdc |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 68 | |
Davide Pesavento | e422f9e | 2022-06-03 01:30:23 -0400 | [diff] [blame] | 69 | } // namespace nfd::tools::nfdc::tests |