blob: 8e16103e9ff72d0c67ec0a6fb82dc396c6fcea5f [file] [log] [blame]
Steve DiBenedetto2c2b8892014-02-27 11:46:48 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (C) 2014 Named Data Networking Project
4 * See COPYING for copyright and distribution information.
5 */
6
7#ifndef VALIDATION_COMMON_HPP
8#define VALIDATION_COMMON_HPP
9
10#include <ndn-cpp-dev/util/command-interest-generator.hpp>
11
12namespace nfd {
13namespace tests {
14
15// class ValidatedManagementFixture
16// {
17// public:
18// ValidatedManagementFixture()
19// : m_validator(make_shared<ndn::CommandInterestValidator>())
20// {
21// }
22
23// virtual
24// ~ValidatedManagementFixture()
25// {
26// }
27
28// protected:
29// shared_ptr<ndn::CommandInterestValidator> m_validator;
30// };
31
32
33template<typename T>
34class CommandFixture : public T
35{
36public:
37 virtual
38 ~CommandFixture()
39 {
40 m_keys.deleteIdentity(m_identityName);
41
42 }
43
44 void
45 generateCommand(Interest& interest)
46 {
47 m_generator.generateWithIdentity(interest, m_identityName);
48 }
49
50 const Name&
51 getIdentityName() const
52 {
53 return m_identityName;
54 }
55
56protected:
57 CommandFixture()
58 : m_identityName("/unit-test/CommandFixture/id"),
59 m_certificate(m_keys.getCertificate(m_keys.createIdentity(m_identityName)))
60 {
61
62 }
63
64protected:
65 ndn::KeyChain m_keys;
66 const Name m_identityName;
67 shared_ptr<ndn::IdentityCertificate> m_certificate;
68 ndn::CommandInterestGenerator m_generator;
69};
70
71template <typename T>
72class UnauthorizedCommandFixture : public CommandFixture<T>
73{
74public:
75 UnauthorizedCommandFixture()
76 {
77 }
78
79 virtual
80 ~UnauthorizedCommandFixture()
81 {
82 }
83};
84
85} //namespace tests
86} // namespace nfd
87
88#endif // VALIDATION_COMMON_HPP