peizhen guo | 410e0e1 | 2014-08-12 13:24:14 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (c) 2014, Regents of the University of California |
| 4 | * |
| 5 | * This file is part of NSL (NDN Signature Logger). |
| 6 | * See AUTHORS.md for complete list of NSL authors and contributors. |
| 7 | * |
| 8 | * NSL 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 | * NSL 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 | * NSL, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 18 | * |
Yingdi Yu | 0c3e591 | 2015-03-17 14:22:38 -0700 | [diff] [blame] | 19 | * See AUTHORS.md for complete list of nsl authors and contributors. |
peizhen guo | 410e0e1 | 2014-08-12 13:24:14 -0700 | [diff] [blame] | 20 | */ |
peizhen guo | 410e0e1 | 2014-08-12 13:24:14 -0700 | [diff] [blame] | 21 | |
Yingdi Yu | 0c3e591 | 2015-03-17 14:22:38 -0700 | [diff] [blame] | 22 | #ifndef NSL_TESTS_DB_FIXTURE_HPP |
| 23 | #define NSL_TESTS_DB_FIXTURE_HPP |
| 24 | |
| 25 | #include "db.hpp" |
| 26 | #include <boost/filesystem.hpp> |
peizhen guo | 410e0e1 | 2014-08-12 13:24:14 -0700 | [diff] [blame] | 27 | |
| 28 | namespace nsl { |
Yingdi Yu | 0c3e591 | 2015-03-17 14:22:38 -0700 | [diff] [blame] | 29 | namespace tests { |
peizhen guo | 410e0e1 | 2014-08-12 13:24:14 -0700 | [diff] [blame] | 30 | |
Yingdi Yu | 0c3e591 | 2015-03-17 14:22:38 -0700 | [diff] [blame] | 31 | class DbFixture |
peizhen guo | 410e0e1 | 2014-08-12 13:24:14 -0700 | [diff] [blame] | 32 | { |
Yingdi Yu | 0c3e591 | 2015-03-17 14:22:38 -0700 | [diff] [blame] | 33 | public: |
| 34 | DbFixture() |
| 35 | : m_dbTmpPath(boost::filesystem::path(TEST_DB_PATH) / "DbTest") |
| 36 | { |
| 37 | db.open(m_dbTmpPath.c_str()); |
| 38 | } |
peizhen guo | 410e0e1 | 2014-08-12 13:24:14 -0700 | [diff] [blame] | 39 | |
Yingdi Yu | 0c3e591 | 2015-03-17 14:22:38 -0700 | [diff] [blame] | 40 | ~DbFixture() |
| 41 | { |
| 42 | boost::filesystem::remove_all(m_dbTmpPath); |
| 43 | } |
peizhen guo | 410e0e1 | 2014-08-12 13:24:14 -0700 | [diff] [blame] | 44 | |
Yingdi Yu | 0c3e591 | 2015-03-17 14:22:38 -0700 | [diff] [blame] | 45 | protected: |
| 46 | boost::filesystem::path m_dbTmpPath; |
| 47 | |
| 48 | public: |
| 49 | Db db; |
| 50 | }; |
| 51 | |
| 52 | } // namespace tests |
peizhen guo | 410e0e1 | 2014-08-12 13:24:14 -0700 | [diff] [blame] | 53 | } // namespace nsl |
Yingdi Yu | 0c3e591 | 2015-03-17 14:22:38 -0700 | [diff] [blame] | 54 | |
| 55 | #endif // NSL_TESTS_DB_FIXTURE_HPP |