test_addon_manager.cpp
Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 #include "test_dynamic_addon_id.h"
00012 #include "test_dynamic_addon.h"
00013 
00014 #include <opc/common/addons_core/addon_manager.h>
00015 #include <opc/common/addons_core/dynamic_addon_factory.h>
00016 
00017 #include <gtest/gtest.h>
00018 
00019 using namespace Common;
00020 
00021 namespace
00022 {
00023 
00024 #ifndef DYNAMIC_ADDON_PATH
00025 #define DYNAMIC_ADDON_PATH "./libtest_dynamic_addon.so"
00026 #endif
00027 
00028 const char* modulePath = DYNAMIC_ADDON_PATH;
00029 
00030 }
00031 
00032 TEST(AddonManager, DISABLED_CanCreateDynamicAddons)
00033 {
00034   AddonsManager::UniquePtr addonsManager = CreateAddonsManager();
00035   AddonInformation config;
00036   config.Id = OpcCoreTests::TestDynamicAddonId;
00037   config.Factory = Common::CreateDynamicAddonFactory(modulePath);
00038   Common::Parameter param;
00039   param.Name = "name";
00040   param.Value = "value";
00041   config.Parameters.Parameters.push_back(param);
00042 
00043   addonsManager->Register(config);
00044   addonsManager->Start();
00045   Addon::SharedPtr addon = addonsManager->GetAddon(OpcCoreTests::TestDynamicAddonId);
00046   ASSERT_TRUE(static_cast<bool>(addon));
00047 
00048   OpcCoreTests::TestDynamicAddon::SharedPtr test = addonsManager->GetAddon<OpcCoreTests::TestDynamicAddon>(OpcCoreTests::TestDynamicAddonId);
00049   ASSERT_TRUE(static_cast<bool>(test));
00050   ASSERT_EQ(test->GetStringWithHello(), std::string("hello"));
00051   Common::AddonParameters params = test->GetParameters();
00052   ASSERT_EQ(params.Parameters.size(), 1);
00053   ASSERT_EQ(params.Parameters[0].Name, "name");
00054   ASSERT_EQ(params.Parameters[0].Value, "value");
00055 }
00056 


ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Sat Jun 8 2019 18:24:57