blob: 23d2ab541a8f8b8ae1d6133de65215caea4cf86a [file] [log] [blame]
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -05001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2014-2018, The University of Memphis
4 *
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
9 * of the GNU General Public License as published by the Free Software Foundation,
10 * 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
14 * PURPOSE. See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * PSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 **/
19
20#include "full-producer.hpp"
21
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
27#include <iostream>
28
29namespace psync {
30
31using namespace ndn;
32using namespace std;
33
34BOOST_AUTO_TEST_SUITE(TestFullProducer)
35
36BOOST_AUTO_TEST_CASE(Constructor)
37{
38 util::DummyClientFace face({true, true});
39 BOOST_REQUIRE_NO_THROW(FullProducer(40, face, Name("/psync"), Name("/testUser"), nullptr));
40}
41
42BOOST_AUTO_TEST_CASE(OnInterest)
43{
44 Name syncPrefix("/psync"), userNode("/testUser");
45 util::DummyClientFace face({true, true});
46
47 FullProducer node(40, face, syncPrefix, userNode, nullptr);
48
49 Name syncInterestName(syncPrefix);
50 syncInterestName.append("malicious-IBF");
51
52 BOOST_REQUIRE_NO_THROW(node.onInterest(syncPrefix, Interest(syncInterestName)));
53}
54
55BOOST_AUTO_TEST_SUITE_END()
56
57} // namespace psync