blob: 29a444b61bfb467fd3e2c97101ea661a02f4d795 [file] [log] [blame]
Junxiao Shi3160a3f2018-01-09 21:25:15 +00001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2014-2018, 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 "nfdc/cs-module.hpp"
27
28#include "status-fixture.hpp"
29
30#include <ndn-cxx/security/signing-helpers.hpp>
31
32namespace nfd {
33namespace tools {
34namespace nfdc {
35namespace tests {
36
37BOOST_AUTO_TEST_SUITE(Nfdc)
38BOOST_FIXTURE_TEST_SUITE(TestCsModule, StatusFixture<CsModule>)
39
40const std::string STATUS_XML = stripXmlSpaces(R"XML(
41 <cs>
42 <nHits>14363</nHits>
43 <nMisses>27462</nMisses>
44 </cs>
45)XML");
46
47const std::string STATUS_TEXT = std::string(R"TEXT(
48CS information:
49 nHits=14363 nMisses=27462
50)TEXT").substr(1);
51
52BOOST_AUTO_TEST_CASE(Status)
53{
54 this->fetchStatus();
55 CsInfo payload;
56 payload.setNHits(14363)
57 .setNMisses(27462);
58 this->sendDataset("/localhost/nfd/cs/info", payload);
59 this->prepareStatusOutput();
60
61 BOOST_CHECK(statusXml.is_equal(STATUS_XML));
62 BOOST_CHECK(statusText.is_equal(STATUS_TEXT));
63}
64
65BOOST_AUTO_TEST_SUITE_END() // TestCsModule
66BOOST_AUTO_TEST_SUITE_END() // Nfdc
67
68} // namespace tests
69} // namespace nfdc
70} // namespace tools
71} // namespace nfd