Kea 2.2.0
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
14namespace isc {
15namespace test {
16
18struct 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
38 libraries_.clear();
39 }
40
46 bool result(false);
47 EXPECT_NO_THROW(result = isc::hooks::HooksManager::loadLibraries(libraries_));
48 return result;
49 }
50
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
static bool unloadLibraries()
Unload libraries.
static bool loadLibraries(const HookLibsCollection &libraries)
Load and reload libraries.
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:27
std::vector< HookLibInfo > HookLibsCollection
A storage for information about hook libraries.
Definition: libinfo.h:31
Defines the logger used by the top-level component of kea-lfc.
Test fixture for testing loading and unloading of hook libraries.
bool unloadLibraries()
Unloads all libraries.
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.
bool loadLibraries()
Load all libraries.
~LibLoadTest()
Destructor. Unloads any previously loaded libraries.
isc::hooks::HookLibsCollection libraries_
Libraries.
LibLoadTest()
Constructor. Unloads any previously loaded libraries.