Alexander Afanasyev | c169a81 | 2014-05-20 20:37:29 -0400 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 2 | /** |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 3 | * Copyright (c) 2013-2016 Regents of the University of California. |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 4 | * |
| 5 | * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 6 | * |
Alexander Afanasyev | c169a81 | 2014-05-20 20:37:29 -0400 | [diff] [blame] | 7 | * ndn-cxx library is free software: you can redistribute it and/or modify it under the |
| 8 | * terms of the GNU Lesser General Public License as published by the Free Software |
| 9 | * Foundation, either version 3 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY |
| 12 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 13 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received copies of the GNU General Public License and GNU Lesser |
| 16 | * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see |
| 17 | * <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | * See AUTHORS.md for complete list of ndn-cxx authors and contributors. |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 20 | */ |
| 21 | |
| 22 | #include "management/nfd-controller.hpp" |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 23 | #include "management/nfd-control-response.hpp" |
| 24 | |
Alexander Afanasyev | 258ec2b | 2014-05-14 16:15:37 -0700 | [diff] [blame] | 25 | #include <boost/tuple/tuple.hpp> |
| 26 | |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 27 | #include "nfd-controller-fixture.hpp" |
Junxiao Shi | b1990df | 2015-11-05 00:14:44 +0000 | [diff] [blame] | 28 | #include "../make-interest-data.hpp" |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 29 | |
| 30 | namespace ndn { |
| 31 | namespace nfd { |
Alexander Afanasyev | 4abdbf1 | 2014-08-11 12:48:54 -0700 | [diff] [blame] | 32 | namespace tests { |
| 33 | |
Junxiao Shi | 85d9083 | 2016-08-04 03:19:46 +0000 | [diff] [blame] | 34 | using namespace ndn::tests; |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 35 | |
Junxiao Shi | b1990df | 2015-11-05 00:14:44 +0000 | [diff] [blame] | 36 | BOOST_AUTO_TEST_SUITE(Management) |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 37 | |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 38 | class CommandFixture : public ControllerFixture |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 39 | { |
| 40 | protected: |
| 41 | CommandFixture() |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 42 | : succeedCallback(bind(&CommandFixture::succeed, this, _1)) |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 43 | { |
| 44 | } |
| 45 | |
| 46 | private: |
| 47 | void |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 48 | succeed(const ControlParameters& parameters) |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 49 | { |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 50 | succeeds.push_back(parameters); |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | protected: |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 54 | Controller::CommandSucceedCallback succeedCallback; |
| 55 | std::vector<ControlParameters> succeeds; |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 56 | }; |
| 57 | |
Junxiao Shi | 600f711 | 2016-07-16 11:57:18 +0000 | [diff] [blame] | 58 | // This test suite focuses on ControlCommand functionality of Controller. |
| 59 | // Individual commands are tested in nfd-control-command.t.cpp |
| 60 | // StatusDataset functionality is tested in nfd-status-dataset.t.cpp |
Junxiao Shi | b1990df | 2015-11-05 00:14:44 +0000 | [diff] [blame] | 61 | BOOST_FIXTURE_TEST_SUITE(TestNfdController, CommandFixture) |
| 62 | |
Junxiao Shi | 600f711 | 2016-07-16 11:57:18 +0000 | [diff] [blame] | 63 | BOOST_AUTO_TEST_CASE(Success) |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 64 | { |
| 65 | ControlParameters parameters; |
Junxiao Shi | 5de006b | 2014-10-26 20:20:52 -0700 | [diff] [blame] | 66 | parameters.setUri("tcp4://192.0.2.1:6363"); |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 67 | |
| 68 | BOOST_CHECK_NO_THROW(controller.start<FaceCreateCommand>( |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 69 | parameters, succeedCallback, failCallback)); |
Junxiao Shi | 600f711 | 2016-07-16 11:57:18 +0000 | [diff] [blame] | 70 | this->advanceClocks(time::milliseconds(1)); |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 71 | |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 72 | BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1); |
| 73 | const Interest& requestInterest = face.sentInterests[0]; |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 74 | |
| 75 | FaceCreateCommand command; |
Junxiao Shi | 5de006b | 2014-10-26 20:20:52 -0700 | [diff] [blame] | 76 | BOOST_CHECK(Name("/localhost/nfd/faces/create").isPrefixOf(requestInterest.getName())); |
| 77 | // 9 components: ndn:/localhost/nfd/faces/create/<parameters>/<signed Interest x4> |
Junxiao Shi | 6a90f37 | 2014-10-13 20:29:30 -0700 | [diff] [blame] | 78 | BOOST_REQUIRE_EQUAL(requestInterest.getName().size(), 9); |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 79 | ControlParameters request; |
| 80 | // 4th component: <parameters> |
Junxiao Shi | 6a90f37 | 2014-10-13 20:29:30 -0700 | [diff] [blame] | 81 | BOOST_REQUIRE_NO_THROW(request.wireDecode(requestInterest.getName().at(4).blockFromValue())); |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 82 | BOOST_CHECK_NO_THROW(command.validateRequest(request)); |
| 83 | BOOST_CHECK_EQUAL(request.getUri(), parameters.getUri()); |
Junxiao Shi | 415b17c | 2014-11-12 00:43:25 -0700 | [diff] [blame] | 84 | BOOST_CHECK_EQUAL(requestInterest.getInterestLifetime(), CommandOptions::DEFAULT_TIMEOUT); |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 85 | |
| 86 | ControlParameters responseBody; |
| 87 | responseBody.setUri("tcp4://192.0.2.1:6363") |
Yukai Tu | d93c5fc | 2015-08-25 11:37:16 +0800 | [diff] [blame] | 88 | .setFaceId(22) |
| 89 | .setFacePersistency(ndn::nfd::FacePersistency::FACE_PERSISTENCY_PERSISTENT); |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 90 | ControlResponse responsePayload(201, "created"); |
| 91 | responsePayload.setBody(responseBody.wireEncode()); |
| 92 | |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 93 | auto responseData = makeData(requestInterest.getName()); |
Junxiao Shi | b1990df | 2015-11-05 00:14:44 +0000 | [diff] [blame] | 94 | responseData->setContent(responsePayload.wireEncode()); |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 95 | face.receive(*responseData); |
Alexander Afanasyev | d3a55b2 | 2014-11-18 19:23:28 -0800 | [diff] [blame] | 96 | |
Junxiao Shi | 600f711 | 2016-07-16 11:57:18 +0000 | [diff] [blame] | 97 | this->advanceClocks(time::milliseconds(1)); |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 98 | |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 99 | BOOST_CHECK_EQUAL(failCodes.size(), 0); |
| 100 | BOOST_REQUIRE_EQUAL(succeeds.size(), 1); |
| 101 | BOOST_CHECK_EQUAL(succeeds.back().getUri(), responseBody.getUri()); |
| 102 | BOOST_CHECK_EQUAL(succeeds.back().getFaceId(), responseBody.getFaceId()); |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 103 | } |
| 104 | |
Junxiao Shi | 600f711 | 2016-07-16 11:57:18 +0000 | [diff] [blame] | 105 | BOOST_AUTO_TEST_CASE(SuccessNoCallback) |
| 106 | { |
| 107 | ControlParameters parameters; |
| 108 | parameters.setUri("tcp4://192.0.2.1:6363"); |
| 109 | |
| 110 | controller.start<FaceCreateCommand>(parameters, nullptr, failCallback); |
| 111 | this->advanceClocks(time::milliseconds(1)); |
| 112 | |
| 113 | BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1); |
| 114 | const Interest& requestInterest = face.sentInterests[0]; |
| 115 | |
| 116 | ControlParameters responseBody; |
| 117 | responseBody.setUri("tcp4://192.0.2.1:6363") |
| 118 | .setFaceId(22) |
| 119 | .setFacePersistency(ndn::nfd::FacePersistency::FACE_PERSISTENCY_PERSISTENT); |
| 120 | ControlResponse responsePayload(201, "created"); |
| 121 | responsePayload.setBody(responseBody.wireEncode()); |
| 122 | |
| 123 | auto responseData = makeData(requestInterest.getName()); |
| 124 | responseData->setContent(responsePayload.wireEncode()); |
| 125 | face.receive(*responseData); |
| 126 | |
| 127 | BOOST_CHECK_NO_THROW(this->advanceClocks(time::milliseconds(1))); |
| 128 | |
| 129 | BOOST_CHECK_EQUAL(failCodes.size(), 0); |
| 130 | } |
| 131 | |
| 132 | BOOST_AUTO_TEST_CASE(OptionsPrefix) |
| 133 | { |
| 134 | ControlParameters parameters; |
| 135 | parameters.setName("/ndn/com/example"); |
| 136 | parameters.setFaceId(400); |
| 137 | |
| 138 | CommandOptions options; |
| 139 | options.setPrefix("/localhop/net/example/router1/nfd"); |
| 140 | |
| 141 | BOOST_CHECK_NO_THROW(controller.start<RibRegisterCommand>( |
| 142 | parameters, succeedCallback, failCallback, options)); |
| 143 | this->advanceClocks(time::milliseconds(1)); |
| 144 | |
| 145 | BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1); |
| 146 | const Interest& requestInterest = face.sentInterests[0]; |
| 147 | |
| 148 | FaceCreateCommand command; |
| 149 | BOOST_CHECK(Name("/localhop/net/example/router1/nfd/rib/register").isPrefixOf( |
| 150 | requestInterest.getName())); |
| 151 | } |
| 152 | |
| 153 | BOOST_AUTO_TEST_CASE(InvalidRequest) |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 154 | { |
| 155 | ControlParameters parameters; |
| 156 | parameters.setName("ndn:/should-not-have-this-field"); |
| 157 | // Uri is missing |
| 158 | |
| 159 | BOOST_CHECK_THROW(controller.start<FaceCreateCommand>( |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 160 | parameters, succeedCallback, failCallback), |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 161 | ControlCommand::ArgumentError); |
| 162 | } |
| 163 | |
Junxiao Shi | 600f711 | 2016-07-16 11:57:18 +0000 | [diff] [blame] | 164 | BOOST_AUTO_TEST_CASE(ErrorCode) |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 165 | { |
| 166 | ControlParameters parameters; |
Junxiao Shi | 5de006b | 2014-10-26 20:20:52 -0700 | [diff] [blame] | 167 | parameters.setUri("tcp4://192.0.2.1:6363"); |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 168 | |
| 169 | BOOST_CHECK_NO_THROW(controller.start<FaceCreateCommand>( |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 170 | parameters, succeedCallback, failCallback)); |
Junxiao Shi | 600f711 | 2016-07-16 11:57:18 +0000 | [diff] [blame] | 171 | this->advanceClocks(time::milliseconds(1)); |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 172 | |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 173 | BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1); |
| 174 | const Interest& requestInterest = face.sentInterests[0]; |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 175 | |
| 176 | ControlResponse responsePayload(401, "Not Authenticated"); |
| 177 | |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 178 | auto responseData = makeData(requestInterest.getName()); |
Junxiao Shi | b1990df | 2015-11-05 00:14:44 +0000 | [diff] [blame] | 179 | responseData->setContent(responsePayload.wireEncode()); |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 180 | face.receive(*responseData); |
Junxiao Shi | 600f711 | 2016-07-16 11:57:18 +0000 | [diff] [blame] | 181 | this->advanceClocks(time::milliseconds(1)); |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 182 | |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 183 | BOOST_CHECK_EQUAL(succeeds.size(), 0); |
| 184 | BOOST_REQUIRE_EQUAL(failCodes.size(), 1); |
| 185 | BOOST_CHECK_EQUAL(failCodes.back(), 401); |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 186 | } |
| 187 | |
Junxiao Shi | 600f711 | 2016-07-16 11:57:18 +0000 | [diff] [blame] | 188 | BOOST_AUTO_TEST_CASE(InvalidResponse) |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 189 | { |
| 190 | ControlParameters parameters; |
Junxiao Shi | 5de006b | 2014-10-26 20:20:52 -0700 | [diff] [blame] | 191 | parameters.setUri("tcp4://192.0.2.1:6363"); |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 192 | |
| 193 | BOOST_CHECK_NO_THROW(controller.start<FaceCreateCommand>( |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 194 | parameters, succeedCallback, failCallback)); |
Junxiao Shi | 600f711 | 2016-07-16 11:57:18 +0000 | [diff] [blame] | 195 | this->advanceClocks(time::milliseconds(1)); |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 196 | |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 197 | BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1); |
| 198 | const Interest& requestInterest = face.sentInterests[0]; |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 199 | |
| 200 | ControlParameters responseBody; |
| 201 | responseBody.setUri("tcp4://192.0.2.1:6363") |
| 202 | .setName("ndn:/should-not-have-this-field"); |
| 203 | // FaceId is missing |
| 204 | ControlResponse responsePayload(201, "created"); |
| 205 | responsePayload.setBody(responseBody.wireEncode()); |
| 206 | |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 207 | auto responseData = makeData(requestInterest.getName()); |
Junxiao Shi | b1990df | 2015-11-05 00:14:44 +0000 | [diff] [blame] | 208 | responseData->setContent(responsePayload.wireEncode()); |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 209 | face.receive(*responseData); |
Junxiao Shi | 600f711 | 2016-07-16 11:57:18 +0000 | [diff] [blame] | 210 | this->advanceClocks(time::milliseconds(1)); |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 211 | |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 212 | BOOST_CHECK_EQUAL(succeeds.size(), 0); |
| 213 | BOOST_REQUIRE_EQUAL(failCodes.size(), 1); |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 214 | } |
| 215 | |
Junxiao Shi | 600f711 | 2016-07-16 11:57:18 +0000 | [diff] [blame] | 216 | BOOST_AUTO_TEST_CASE(Nack) |
Junxiao Shi | b1990df | 2015-11-05 00:14:44 +0000 | [diff] [blame] | 217 | { |
| 218 | ControlParameters parameters; |
| 219 | parameters.setUri("tcp4://192.0.2.1:6363"); |
| 220 | |
| 221 | BOOST_CHECK_NO_THROW(controller.start<FaceCreateCommand>( |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 222 | parameters, succeedCallback, failCallback)); |
Junxiao Shi | 600f711 | 2016-07-16 11:57:18 +0000 | [diff] [blame] | 223 | this->advanceClocks(time::milliseconds(1)); |
Junxiao Shi | b1990df | 2015-11-05 00:14:44 +0000 | [diff] [blame] | 224 | |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 225 | BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1); |
| 226 | const Interest& requestInterest = face.sentInterests[0]; |
Junxiao Shi | b1990df | 2015-11-05 00:14:44 +0000 | [diff] [blame] | 227 | |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 228 | auto responseNack = makeNack(requestInterest, lp::NackReason::NO_ROUTE); |
Alexander Afanasyev | 9bdbb83 | 2015-12-30 12:54:22 -0800 | [diff] [blame] | 229 | face.receive(responseNack); |
Junxiao Shi | 600f711 | 2016-07-16 11:57:18 +0000 | [diff] [blame] | 230 | this->advanceClocks(time::milliseconds(1)); |
Junxiao Shi | b1990df | 2015-11-05 00:14:44 +0000 | [diff] [blame] | 231 | |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 232 | BOOST_REQUIRE_EQUAL(failCodes.size(), 1); |
| 233 | BOOST_CHECK_EQUAL(failCodes.back(), Controller::ERROR_NACK); |
Junxiao Shi | b1990df | 2015-11-05 00:14:44 +0000 | [diff] [blame] | 234 | } |
| 235 | |
Junxiao Shi | 600f711 | 2016-07-16 11:57:18 +0000 | [diff] [blame] | 236 | BOOST_AUTO_TEST_CASE(Timeout) |
Junxiao Shi | 5de006b | 2014-10-26 20:20:52 -0700 | [diff] [blame] | 237 | { |
| 238 | ControlParameters parameters; |
| 239 | parameters.setUri("tcp4://192.0.2.1:6363"); |
| 240 | |
| 241 | CommandOptions options; |
| 242 | options.setTimeout(time::milliseconds(50)); |
| 243 | |
| 244 | BOOST_CHECK_NO_THROW(controller.start<FaceCreateCommand>( |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 245 | parameters, succeedCallback, failCallback, options)); |
Junxiao Shi | 600f711 | 2016-07-16 11:57:18 +0000 | [diff] [blame] | 246 | this->advanceClocks(time::milliseconds(1), 101); // Face's PIT granularity is 100ms |
Junxiao Shi | 5de006b | 2014-10-26 20:20:52 -0700 | [diff] [blame] | 247 | |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 248 | BOOST_REQUIRE_EQUAL(failCodes.size(), 1); |
| 249 | BOOST_CHECK_EQUAL(failCodes.back(), Controller::ERROR_TIMEOUT); |
Junxiao Shi | 5de006b | 2014-10-26 20:20:52 -0700 | [diff] [blame] | 250 | } |
| 251 | |
Junxiao Shi | 600f711 | 2016-07-16 11:57:18 +0000 | [diff] [blame] | 252 | BOOST_AUTO_TEST_CASE(FailureNoCallback) |
| 253 | { |
| 254 | ControlParameters parameters; |
| 255 | parameters.setUri("tcp4://192.0.2.1:6363"); |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 256 | |
Junxiao Shi | 600f711 | 2016-07-16 11:57:18 +0000 | [diff] [blame] | 257 | CommandOptions options; |
| 258 | options.setTimeout(time::milliseconds(50)); |
| 259 | |
| 260 | controller.start<FaceCreateCommand>(parameters, succeedCallback, nullptr, options); |
| 261 | BOOST_CHECK_NO_THROW(this->advanceClocks(time::milliseconds(100), 10)); |
| 262 | // timeout |
| 263 | |
| 264 | BOOST_CHECK_EQUAL(succeeds.size(), 0); |
| 265 | } |
| 266 | |
| 267 | BOOST_AUTO_TEST_SUITE_END() // TestNfdController |
| 268 | BOOST_AUTO_TEST_SUITE_END() // Management |
Junxiao Shi | 034c188 | 2016-06-24 18:06:51 +0000 | [diff] [blame] | 269 | |
Alexander Afanasyev | 4abdbf1 | 2014-08-11 12:48:54 -0700 | [diff] [blame] | 270 | } // namespace tests |
Junxiao Shi | 7b6b79d | 2014-03-26 20:59:35 -0700 | [diff] [blame] | 271 | } // namespace nfd |
| 272 | } // namespace ndn |