35 #include <boost/test/unit_test.hpp> 39 std::vector<te::core::PluginInfo> v_pInfo;
57 std::unique_ptr<te::core::AbstractPluginEngine> cppengine(
nullptr);
73 BOOST_CHECK(plugin_engine.
id() ==
"C++");
74 BOOST_CHECK(plugin_engine.
name() ==
"Engine for plugins written in C++");
90 std::string p_manifest =
97 std::unique_ptr<te::core::AbstractPluginEngine> cppengine(
104 std::string p_manifest =
109 BOOST_CHECK_NO_THROW(plugin_engine.
load(p_info));
116 std::unique_ptr<te::core::AbstractPluginEngine> cppengine(
124 std::string p_manifest =
129 std::unique_ptr<te::core::AbstractPlugin> plugin(plugin_engine.
load(p_info));
131 BOOST_CHECK_NO_THROW(plugin->info());
133 BOOST_CHECK_NO_THROW(plugin->initialized());
135 BOOST_CHECK_NO_THROW(plugin->startup());
137 BOOST_CHECK_NO_THROW(plugin->shutdown());
139 BOOST_CHECK_NO_THROW(plugin_engine.
unload(std::move(plugin)));
151 pInfo1.
name =
"plugin1";
152 pInfo2.
name =
"plugin2";
153 pInfo3.
name =
"plugin3";
154 pInfo4.
name =
"plugin4";
161 std::vector<te::core::PluginInfo> v_pInfo;
162 v_pInfo.push_back(pInfo1);
163 v_pInfo.push_back(pInfo2);
164 v_pInfo.push_back(pInfo3);
165 v_pInfo.push_back(pInfo4);
169 BOOST_CHECK(v_pInfo[0].name ==
"plugin1");
171 BOOST_CHECK(v_pInfo[1].name ==
"plugin3");
173 BOOST_CHECK(v_pInfo[2].name ==
"plugin2");
175 BOOST_CHECK(v_pInfo[3].name ==
"plugin4");
183 pInfo1.
name =
"plugin1";
184 pInfo2.
name =
"plugin2";
189 std::vector<te::core::PluginInfo> v_pInfo;
190 v_pInfo.push_back(pInfo1);
191 v_pInfo.push_back(pInfo2);
210 std::vector<te::core::PluginInfo> pVec =
213 for(
auto plugin = pVec.rbegin(); plugin != pVec.rend(); ++plugin)
215 BOOST_CHECK_NO_THROW(
217 BOOST_CHECK_NO_THROW(
258 BOOST_AUTO_TEST_SUITE_END()
TECOREEXPORT void FinalizePluginSystem()
void insert(std::unique_ptr< AbstractPluginEngine > engine)
Register a new plugin engine.
Include files for Core Plugin Library.
An exception indicating an error when unloading a plugin.
TECOREEXPORT std::vector< PluginInfo > TopologicalSort(const std::vector< PluginInfo > &v_pinfo)
An exception indicating an error when loading a plugin.
void insert(const PluginInfo &pinfo)
Adds plugin with its plugin information to the list of unloaded plugins.
Basic information about a plugin.
void load(const std::string &plugin_name, const bool start=true)
It tries to load the informed plugin.
void remove(const std::string &engine_id)
Unregister the plugin engine.
virtual std::unique_ptr< AbstractPlugin > load(const PluginInfo &pinfo)=0
Load the informed plugin.
std::string name
The plugin name: an internal value used to identify the plugin in the system. Must be a unique value...
static PluginManager & instance()
Access the singleton.
Include files for Core Utility Library.
std::vector< te::core::PluginInfo > LoadPluginsInfo()
mydialect insert("+", new te::da::BinaryOpEncoder("+"))
AbstractPluginEngine & get(const std::string &engine_id) const
Find a plugin engine with the given id.
The base class for plugin engines.
std::vector< std::string > dependencies
The list of required plugins in order to launch the plugin.
virtual void unload(std::unique_ptr< AbstractPlugin > plugin)=0
Unload the informed plugin.
virtual const std::string & id() const =0
Every plugin engine must have a unique identifier.
An exception indicating an error when two or more plugins have cyclic dependecy.
An exception indicating that a given item was not found in a collection (or range).
BOOST_AUTO_TEST_SUITE(plugin_test_case) BOOST_AUTO_TEST_CASE(plugin_engine_test)
TECOREEXPORT PluginInfo JSONPluginInfoSerializer(const std::string &file_name)
A plugin finder that search for plugins in some special directories defined by compile time macros...
TECOREEXPORT std::string FindInTerraLibPath(const std::string &path)
Returns the path relative to a directory or file in the context of TerraLib.
TECOREEXPORT void InitializePluginSystem()
An exception indicating that a given argument is not valid, for instance if a given item already exis...
void clear()
Stop and unload all plugins, then clear the internal list of plugins.
virtual const std::string & name() const =0
The name of plugin engine with a brief title or description.
BOOST_AUTO_TEST_CASE(plugin_serializer_test)
std::vector< PluginInfo > getLoadedPlugins() const
Return the list of plugins that are loaded.
static PluginEngineManager & instance()
Access the singleton.