blob: 283ae2b15db262c2e4675b1d780d9126aa65070d [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/*
Davide Pesavento0d1d11c2022-04-11 22:11:34 -04003 * Copyright (c) 2013-2022 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"
Davide Pesavento0dc02012021-11-23 22:55:03 -050027
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070028#include <boost/filesystem.hpp>
29
Davide Pesavento0d1d11c2022-04-11 22:11:34 -040030namespace ndncert::tests {
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070031
Zhiyi Zhang5d80e1e2020-09-25 11:34:54 -070032class IdentityManagementTimeFixture : public UnitTestTimeFixture
33 , public IdentityManagementFixture
34{
35};
36
Zhiyi Zhangaf7c2902019-03-14 22:13:21 -070037class DatabaseFixture : public IdentityManagementTimeFixture
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070038{
39public:
40 DatabaseFixture()
41 {
Zhiyi Zhanga3e62bd2020-10-12 17:07:10 -070042 boost::filesystem::path parentDir{TMP_TESTS_PATH};
Zhiyi Zhang82e0c722020-10-14 17:51:29 -070043 dbDir = parentDir / "test-home" / ".ndncert";
Zhiyi Zhang42d992d2019-07-07 16:46:50 -070044 if (!boost::filesystem::exists(dbDir)) {
45 boost::filesystem::create_directory(dbDir);
46 }
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070047 }
48
49 ~DatabaseFixture()
50 {
51 boost::filesystem::remove_all(dbDir);
52 }
53
Zhiyi Zhanga3e62bd2020-10-12 17:07:10 -070054protected:
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070055 boost::filesystem::path dbDir;
56};
57
Davide Pesavento0d1d11c2022-04-11 22:11:34 -040058} // namespace ndncert::tests
Zhiyi Zhangae123bf2017-04-14 12:24:53 -070059
60#endif // NDNCERT_TESTS_DATABASE_FIXTURE_HPP