Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (c) 2014-2016, 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 | |
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 | |
| 28 | #include "module-fixture.hpp" |
| 29 | |
| 30 | namespace nfd { |
| 31 | namespace tools { |
Junxiao Shi | 331ade7 | 2016-08-19 14:07:19 +0000 | [diff] [blame] | 32 | namespace nfdc { |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 33 | namespace tests { |
| 34 | |
Junxiao Shi | 331ade7 | 2016-08-19 14:07:19 +0000 | [diff] [blame] | 35 | BOOST_AUTO_TEST_SUITE(Nfdc) |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 36 | BOOST_FIXTURE_TEST_SUITE(TestChannelModule, ModuleFixture<ChannelModule>) |
| 37 | |
| 38 | const 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 | |
| 49 | const std::string STATUS_TEXT = std::string(R"TEXT( |
| 50 | Channels: |
| 51 | tcp4://192.0.2.1:6363 |
| 52 | ws://[::]:9696/NFD |
| 53 | )TEXT").substr(1); |
| 54 | |
| 55 | BOOST_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 | |
| 69 | BOOST_AUTO_TEST_SUITE_END() // TestChannelModule |
Junxiao Shi | 331ade7 | 2016-08-19 14:07:19 +0000 | [diff] [blame] | 70 | BOOST_AUTO_TEST_SUITE_END() // Nfdc |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 71 | |
| 72 | } // namespace tests |
Junxiao Shi | 331ade7 | 2016-08-19 14:07:19 +0000 | [diff] [blame] | 73 | } // namespace nfdc |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 74 | } // namespace tools |
| 75 | } // namespace nfd |