15 #include <opc/managers/device_manager/id.h> 16 #include <opc/managers/property_tree/id.h> 18 #include <cppunit/extensions/HelperMacros.h> 19 #include <cppunit/config/SourcePrefix.h> 43 Common::AddonsManager::UniquePtr
Addons;
150 dmConfig.
Id = DeviceManager::ManagerId;
152 dmConfig.
Dependencies = std::vector<Common::AddonId>(1, PropertyTree::ManagerId);
153 CPPUNIT_ASSERT_NO_THROW(
Addons->Register(dmConfig));
156 ptConfig.
Id = PropertyTree::ManagerId;
158 CPPUNIT_ASSERT_NO_THROW(
Addons->Register(ptConfig));
160 CPPUNIT_ASSERT_NO_THROW(
Addons->Start());
163 std::shared_ptr<PropertyTreeAddon> propertyTree;
164 CPPUNIT_ASSERT_NO_THROW(propertyTree = Common::GetAddon<PropertyTreeAddon>(*
Addons, PropertyTree::ManagerId));
165 CPPUNIT_ASSERT(propertyTree);
166 CPPUNIT_ASSERT(propertyTree->IsInitialized());
168 CPPUNIT_ASSERT_NO_THROW(
Addons->Stop());
169 CPPUNIT_ASSERT(propertyTree->IsStopped());
179 dmConfig.
Id = DeviceManager::ManagerId;
181 dmConfig.
Dependencies = std::vector<Common::AddonId>(1, PropertyTree::ManagerId);
182 CPPUNIT_ASSERT_NO_THROW(
Addons->Register(dmConfig));
187 ptConfig.
Id = PropertyTree::ManagerId;
189 CPPUNIT_ASSERT_NO_THROW(
Addons->Register(ptConfig));
192 CPPUNIT_ASSERT_NO_THROW(
Addons->Start());
195 std::shared_ptr<PropertyTreeAddon> propertyTree;
196 CPPUNIT_ASSERT_NO_THROW(propertyTree = Common::GetAddon<PropertyTreeAddon>(*
Addons, PropertyTree::ManagerId));
197 CPPUNIT_ASSERT(propertyTree);
198 CPPUNIT_ASSERT(propertyTree->IsInitialized());
200 std::shared_ptr<DeviceIOManagerAddon> deviceManager;
201 CPPUNIT_ASSERT_NO_THROW(deviceManager = Common::GetAddon<DeviceIOManagerAddon>(*
Addons, DeviceManager::ManagerId));
202 CPPUNIT_ASSERT(deviceManager);
203 CPPUNIT_ASSERT(deviceManager->IsInitialized());
205 CPPUNIT_ASSERT_NO_THROW(
Addons->Stop());
206 CPPUNIT_ASSERT(propertyTree->IsStopped());
207 CPPUNIT_ASSERT(deviceManager->IsStopped());
Test of addons manager GNU LGPL.
Common::AddonsManager::UniquePtr Addons
virtual void Initialize(Common::AddonsManager &, const Common::AddonParameters &)
initialize addon.
virtual Common::Addon::UniquePtr CreateAddon()
Create instance of addon.
virtual void Initialize(Common::AddonsManager &, const Common::AddonParameters &)
initialize addon.
Common::Logger::SharedPtr Logger
AddonsManager::UniquePtr CreateAddonsManager(const Common::Logger::SharedPtr &logger)
Get instance of addons core.
bool IsInitialized() const
virtual void Stop()
Stopping addon work. After calling this method addon should throw exception on any calls...
virtual void Stop()
Stopping addon work. After calling this method addon should throw exception on any calls...
virtual Common::Addon::UniquePtr CreateAddon()
Create instance of addon.
unsigned InitializedAddonsCount
bool IsInitialized() const
CPPUNIT_TEST(TestTwoManagers)
CPPUNIT_TEST_SUITE_REGISTRATION(AddonsManagerTestCase)
std::shared_ptr< logger > stderr_color_mt(const std::string &logger_name)
CPPUNIT_TEST_SUITE(AddonsManagerTestCase)