BOOST_FIXTURE_TEST_CASE(DestroyFace, AuthorizedCommandFixture<FaceFixture>) { shared_ptr<DummyFace> dummy(make_shared<DummyFace>()); FaceTableFixture::m_faceTable.add(dummy); ControlParameters parameters; parameters.setFaceId(dummy->getId()); Block encodedParameters(parameters.wireEncode()); Name commandName("/localhost/nfd/faces"); commandName.append("destroy"); commandName.append(encodedParameters); shared_ptr<Interest> command(make_shared<Interest>(commandName)); generateCommand(*command); ndn::nfd::FaceEventNotification expectedFaceEvent; expectedFaceEvent.setKind(ndn::nfd::FACE_EVENT_DESTROYED) .setFaceId(dummy->getId()) .setRemoteUri(dummy->getRemoteUri().toString()) .setLocalUri(dummy->getLocalUri().toString()) .setFlags(0); getFace()->onReceiveData += bind(&FaceFixture::callbackDispatch, this, _1, command->getName(), 200, "Success", ref(encodedParameters), expectedFaceEvent); destroyFace(*command, parameters); BOOST_REQUIRE(didCallbackFire()); BOOST_REQUIRE(didReceiveNotication()); }
BOOST_FIXTURE_TEST_CASE(DestroyFace, AuthorizedCommandFixture<FaceFixture>) { shared_ptr<DummyFace> dummy(make_shared<DummyFace>()); FaceTableFixture::m_faceTable.add(dummy); ControlParameters parameters; parameters.setFaceId(dummy->getId()); Block encodedParameters(parameters.wireEncode()); Name commandName("/localhost/nfd/faces"); commandName.append("destroy"); commandName.append(encodedParameters); shared_ptr<Interest> command(make_shared<Interest>(commandName)); generateCommand(*command); ndn::nfd::FaceEventNotification expectedFaceEvent; expectedFaceEvent.setKind(ndn::nfd::FACE_EVENT_DESTROYED) .setFaceId(dummy->getId()) .setRemoteUri(dummy->getRemoteUri().toString()) .setLocalUri(dummy->getLocalUri().toString()) .setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL) .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT); getFace()->onReceiveData += [this, command, encodedParameters, expectedFaceEvent] (const Data& response) { this->callbackDispatch(response,command->getName(), 200, "Success", encodedParameters, expectedFaceEvent); }; destroyFace(*command, parameters); BOOST_REQUIRE(didCallbackFire()); BOOST_REQUIRE(didReceiveNotication()); }