test_addon_manager.cpp
Go to the documentation of this file.
1 
11 #include "test_dynamic_addon_id.h"
12 #include "test_dynamic_addon.h"
13 
16 
17 #include <gtest/gtest.h>
18 
19 using namespace Common;
20 
21 namespace
22 {
23 
24 #ifndef DYNAMIC_ADDON_PATH
25 #define DYNAMIC_ADDON_PATH "./libtest_dynamic_addon.so"
26 #endif
27 
28 const char * modulePath = DYNAMIC_ADDON_PATH;
29 
30 }
31 
32 TEST(AddonManager, DISABLED_CanCreateDynamicAddons)
33 {
34  auto logger = spdlog::stderr_color_mt("test");
35  logger->set_level(spdlog::level::info);
36  AddonsManager::UniquePtr addonsManager = CreateAddonsManager(logger);
37  AddonInformation config;
41  param.Name = "name";
42  param.Value = "value";
43  config.Parameters.Parameters.push_back(param);
44 
45  addonsManager->Register(config);
46  addonsManager->Start();
47  Addon::SharedPtr addon = addonsManager->GetAddon(OpcCoreTests::TestDynamicAddonId);
48  ASSERT_TRUE(static_cast<bool>(addon));
49 
50  OpcCoreTests::TestDynamicAddon::SharedPtr test = addonsManager->GetAddon<OpcCoreTests::TestDynamicAddon>(OpcCoreTests::TestDynamicAddonId);
51  ASSERT_TRUE(static_cast<bool>(test));
52  ASSERT_EQ(test->GetStringWithHello(), std::string("hello"));
53  Common::AddonParameters params = test->GetParameters();
54  ASSERT_EQ(params.Parameters.size(), 1);
55  ASSERT_EQ(params.Parameters[0].Name, "name");
56  ASSERT_EQ(params.Parameters[0].Value, "value");
57 }
58 
bool param(const std::string &param_name, T &param_val, const T &default_val)
Addon interface definition GNU LGPL.
const char TestDynamicAddonId[]
Definition: test.py:1
const char * modulePath
std::shared_ptr< AddonFactory > Factory
Definition: addon_manager.h:32
AddonsManager::UniquePtr CreateAddonsManager(const Common::Logger::SharedPtr &logger)
Get instance of addons core.
TEST(AddonManager, DISABLED_CanCreateDynamicAddons)
#define ASSERT_TRUE(condition)
AddonParameters Parameters
Definition: addon_manager.h:34
AddonFactory::UniquePtr CreateDynamicAddonFactory(const char *modulePath)
#define ASSERT_EQ(val1, val2)
#define DYNAMIC_ADDON_PATH
std::shared_ptr< logger > stderr_color_mt(const std::string &logger_name)
Definition: spdlog_impl.h:150
std::vector< Parameter > Parameters


ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Tue Jan 19 2021 03:12:08