blob: 8190446cb1f5ba8578998fcf8a727cb7d732f6c5 [file] [log] [blame]
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -05001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
Ashlesh Gawande0cf4b602019-01-18 15:58:17 -06003 * Copyright (c) 2014-2019, The University of Memphis
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -05004 *
5 * This file is part of PSync.
6 * See AUTHORS.md for complete list of PSync authors and contributors.
7 *
8 * PSync is free software: you can redistribute it and/or modify it under the terms
Ashlesh Gawande0cf4b602019-01-18 15:58:17 -06009 * of the GNU Lesser General Public License as published by the Free Software Foundation,
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -050010 * either version 3 of the License, or (at your option) any later version.
11 *
12 * PSync is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
Ashlesh Gawande0cf4b602019-01-18 15:58:17 -060014 * PURPOSE. See the GNU Lesser General Public License for more details.
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -050015 *
Ashlesh Gawande0cf4b602019-01-18 15:58:17 -060016 * You should have received a copy of the GNU Lesser General Public License along with
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -050017 * PSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 **/
19
Ashlesh Gawande78b94ad2018-12-13 15:29:19 -060020#include "PSync/full-producer.hpp"
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -050021
22#include <boost/test/unit_test.hpp>
23#include <ndn-cxx/name.hpp>
24#include <ndn-cxx/util/dummy-client-face.hpp>
25#include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
26
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -050027namespace psync {
28
29using namespace ndn;
30using namespace std;
31
32BOOST_AUTO_TEST_SUITE(TestFullProducer)
33
34BOOST_AUTO_TEST_CASE(Constructor)
35{
36 util::DummyClientFace face({true, true});
37 BOOST_REQUIRE_NO_THROW(FullProducer(40, face, Name("/psync"), Name("/testUser"), nullptr));
38}
39
40BOOST_AUTO_TEST_CASE(OnInterest)
41{
42 Name syncPrefix("/psync"), userNode("/testUser");
43 util::DummyClientFace face({true, true});
44
45 FullProducer node(40, face, syncPrefix, userNode, nullptr);
46
47 Name syncInterestName(syncPrefix);
48 syncInterestName.append("malicious-IBF");
49
Ashlesh Gawande40970d62018-11-01 11:24:17 -050050 BOOST_REQUIRE_NO_THROW(node.onSyncInterest(syncPrefix, Interest(syncInterestName)));
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -050051}
52
53BOOST_AUTO_TEST_SUITE_END()
54
55} // namespace psync