blob: 598e30452c979177a816019cd496cac1c21ff849 [file] [log] [blame]
Zhiyi Zhangae123bf2017-04-14 12:24:53 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Zhiyi Zhang42d992d2019-07-07 16:46:50 -07002/*
Zhiyi Zhang63123172020-10-12 14:24:44 -07003 * Copyright (c) 2013-2020 Regents of the University of California.
Zhiyi Zhangae123bf2017-04-14 12:24:53 -07004 *
Zhiyi Zhang42d992d2019-07-07 16:46:50 -07005 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
Zhiyi Zhangae123bf2017-04-14 12:24:53 -07006 *
Zhiyi Zhang42d992d2019-07-07 16:46:50 -07007 * 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.
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070010 *
Zhiyi Zhang42d992d2019-07-07 16:46:50 -070011 * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070012 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
Zhiyi Zhang42d992d2019-07-07 16:46:50 -070013 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070014 *
Zhiyi Zhang42d992d2019-07-07 16:46:50 -070015 * 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/>.
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070018 *
Zhiyi Zhang42d992d2019-07-07 16:46:50 -070019 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070020 */
21
22#ifndef NDNCERT_TESTS_DATABASE_FIXTURE_HPP
23#define NDNCERT_TESTS_DATABASE_FIXTURE_HPP
24
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070025#include "identity-management-fixture.hpp"
Zhiyi Zhang5d80e1e2020-09-25 11:34:54 -070026#include "unit-test-time-fixture.hpp"
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070027#include <boost/filesystem.hpp>
28
29namespace ndn {
30namespace ndncert {
31namespace tests {
32
Zhiyi Zhang5d80e1e2020-09-25 11:34:54 -070033class IdentityManagementTimeFixture : public UnitTestTimeFixture
34 , public IdentityManagementFixture
35{
36};
37
Zhiyi Zhangaf7c2902019-03-14 22:13:21 -070038class DatabaseFixture : public IdentityManagementTimeFixture
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070039{
40public:
41 DatabaseFixture()
42 {
Zhiyi Zhanga3e62bd2020-10-12 17:07:10 -070043 boost::filesystem::path parentDir{TMP_TESTS_PATH};
Zhiyi Zhang82e0c722020-10-14 17:51:29 -070044 dbDir = parentDir / "test-home" / ".ndncert";
Zhiyi Zhang42d992d2019-07-07 16:46:50 -070045 if (!boost::filesystem::exists(dbDir)) {
46 boost::filesystem::create_directory(dbDir);
47 }
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070048 }
49
50 ~DatabaseFixture()
51 {
52 boost::filesystem::remove_all(dbDir);
53 }
54
Zhiyi Zhanga3e62bd2020-10-12 17:07:10 -070055protected:
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070056 boost::filesystem::path dbDir;
57};
58
59} // namespace tests
60} // namespace ndncert
61} // namespace ndn
62
63#endif // NDNCERT_TESTS_DATABASE_FIXTURE_HPP