Kea  2.1.7-git
lib_load_test_fixture.h
Go to the documentation of this file.
1 // Copyright (C) 2022 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef ISC_TESTUTILS_LIB_LOAD_TEST_FIXTURE_H
8 #define ISC_TESTUTILS_LIB_LOAD_TEST_FIXTURE_H
9 
10 #include <cc/data.h>
11 
12 #include <gtest/gtest.h>
13 
14 namespace isc {
15 namespace test {
16 
18 struct LibLoadTest : ::testing::Test {
22  }
23 
27  }
28 
33  void addLibrary(const std::string& library, isc::data::ConstElementPtr parameters) {
34  libraries_.push_back({library, parameters});
35  }
36 
37  void clearLibraries() {
38  libraries_.clear();
39  }
40 
45  bool loadLibraries() {
46  bool result(false);
47  EXPECT_NO_THROW(result = isc::hooks::HooksManager::loadLibraries(libraries_));
48  return result;
49  }
50 
55  bool unloadLibraries() {
56  bool result(false);
57  EXPECT_NO_THROW(result = isc::hooks::HooksManager::unloadLibraries());
58  return result;
59  }
60 
63 };
64 
65 } // namespace test
66 } // namespace isc
67 
68 #endif // ISC_TESTUTILS_LIB_LOAD_TEST_FIXTURE_H
void addLibrary(const std::string &library, isc::data::ConstElementPtr parameters)
Adds a library along with its parameters to the list of libraries to be loaded.
~LibLoadTest()
Destructor. Unloads any previously loaded libraries.
bool loadLibraries()
Load all libraries.
std::vector< HookLibInfo > HookLibsCollection
A storage for information about hook libraries.
Definition: libinfo.h:31
static bool unloadLibraries()
Unload libraries.
Test fixture for testing loading and unloading of hook libraries.
static bool loadLibraries(const HookLibsCollection &libraries)
Load and reload libraries.
bool unloadLibraries()
Unloads all libraries.
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:27
Defines the logger used by the top-level component of kea-lfc.
LibLoadTest()
Constructor. Unloads any previously loaded libraries.
isc::hooks::HookLibsCollection libraries_
Libraries.