ADTF
3.18.2
|
This class enables you to setup an ADTF system where you can test your filters and services. More...
Public Member Functions | |
cTestSystem (const std::string &strUrl="", const std::vector< std::string > &oPlugins={}, bool bCreateSessionManager=false, const std::string &strAdtfDirectory=ADTF_TESTING_ADTF_DIR, const std::string &strPluginDirectories=ADTF_TESTING_PLUGIN_DIRECTORIES) | |
Constructs a test system. More... | |
cTestSystem (const std::string &strUrl, const std::vector< std::string > &oPlugins, bool bCreateSessionManager, bool bCreateLoggingService, const std::string &strAdtfDirectory=ADTF_TESTING_ADTF_DIR, const std::string &strPluginDirectories=ADTF_TESTING_PLUGIN_DIRECTORIES) | |
Constructs a test system. More... | |
~cTestSystem () | |
Destructor. | |
void | SetRunLevel (base::ant::tADTFRunLevel eRunlevel) |
Helper function that changes the runlevel and throws errors via an exception. More... | |
base::ant::tADTFRunLevel | GetRunLevel () const |
Helper function that returns the current runlevel. More... | |
void | LoadPlugin (const std::string &strPluginFileName, bool bCreateServices=true, base::ant::tADTFRunLevel nServicesRunlevel=base::tADTFRunLevel::RL_System) |
Load a plugin and optionally create instances of all found ADTF Service classes. More... | |
ucom::ant::object_ptr< ucom::ant::IService > | CreateService (const std::string &strClassId, const std::string &strObjectId, base::ant::tADTFRunLevel nRunlevel=base::tADTFRunLevel::RL_System) |
Create a service instance. More... | |
ucom::ant::object_ptr< ucom::ant::IService > | CreateService (const std::string &strPluginFileName, const std::string &strClassId, const std::string &strObjectId, base::ant::tADTFRunLevel nRunlevel=base::tADTFRunLevel::RL_System) |
Loads a plugin and creates a service instance. More... | |
ucom::ant::object_ptr< ucom::ant::IService > | CreateService (const std::string &strClassId, const std::string &strObjectId, base::ant::tADTFRunLevel nRunlevel, const std::map< std::string, std::string > &oProperties) |
Create a service instance with properties. More... | |
ucom::ant::object_ptr< ucom::ant::IService > | CreateService (const std::string &strPluginFileName, const std::string &strClassId, const std::string &strObjectId, base::ant::tADTFRunLevel nRunlevel, const std::map< std::string, std::string > &oProperties) |
Load a plugin and create a service instance with properties. More... | |
Static Public Member Functions | |
static void | SetCurDirectory (const std::string &strRelativePath, const std::string &strTestSourceDirectory=ADTF_TESTING_SOURCE_DIR) |
Helper function to change the current working directory relative to the source directory. More... | |
static void | SetMacro (const std::string &strName, const std::string &strValue) |
Set a macro value. More... | |
Protected Attributes | |
std::unique_ptr< cImplementation > | m_pImplementation |
This class enables you to setup an ADTF system where you can test your filters and services.
This can be used in your test fixtures by subclassing and seting up the system in the constructor. Please have a look at the example tests that are provided:
Definition at line 66 of file test_system.h.
cTestSystem | ( | const std::string & | strUrl = "" , |
const std::vector< std::string > & | oPlugins = {} , |
||
bool | bCreateSessionManager = false , |
||
const std::string & | strAdtfDirectory = ADTF_TESTING_ADTF_DIR , |
||
const std::string & | strPluginDirectories = ADTF_TESTING_PLUGIN_DIRECTORIES |
||
) |
Constructs a test system.
[in] | strUrl | If set the RPC object registry will be created and listen at the given URL. |
[in] | oPlugins | A list of plugins that should be loaded. LoadPlugin() will be called for each. |
[in] | bCreateSessionManager | Whether or not to create a session manager. |
[in] | strAdtfDirectory | The ADTF root directory. The default is a macro that can be set by the test environment. |
[in] | strPluginDirectories | A ';' seperated list of plugin directories. The default is a macro that can be set by the test environment. |
cTestSystem | ( | const std::string & | strUrl, |
const std::vector< std::string > & | oPlugins, | ||
bool | bCreateSessionManager, | ||
bool | bCreateLoggingService, | ||
const std::string & | strAdtfDirectory = ADTF_TESTING_ADTF_DIR , |
||
const std::string & | strPluginDirectories = ADTF_TESTING_PLUGIN_DIRECTORIES |
||
) |
Constructs a test system.
[in] | strUrl | If set the RPC object registry will be created and listen at the given URL. |
[in] | oPlugins | A list of plugins that should be loaded. LoadPlugin() will be called for each. |
[in] | bCreateSessionManager | Whether or not to create a session manager. |
[in] | bCreateLoggingService | Whether or not to create a logging service. |
[in] | strAdtfDirectory | The ADTF root directory. The default is a macro that can be set by the test environment. |
[in] | strPluginDirectories | A ';' seperated list of plugin directories. The default is a macro that can be set by the test environment. |
ucom::ant::object_ptr<ucom::ant::IService> CreateService | ( | const std::string & | strClassId, |
const std::string & | strObjectId, | ||
base::ant::tADTFRunLevel | nRunlevel, | ||
const std::map< std::string, std::string > & | oProperties | ||
) |
Create a service instance with properties.
[in] | strClassId | The class id of the service. |
[in] | strObjectId | The object name with which the instance is registered at the runtime. |
[in] | nRunlevel | The service will be initialized at the given runlevel. |
[in] | oProperties | Name value pairs that will be set at the services configuration interface. |
tResult | if an error occurred. |
ucom::ant::object_ptr<ucom::ant::IService> CreateService | ( | const std::string & | strClassId, |
const std::string & | strObjectId, | ||
base::ant::tADTFRunLevel | nRunlevel = base::tADTFRunLevel::RL_System |
||
) |
Create a service instance.
[in] | strClassId | The class id of the service. |
[in] | strObjectId | The object name with which the instance is registered at the runtime. |
[in] | nRunlevel | The service will be initialized at the given runlevel. |
tResult | if an error occurred. |
ucom::ant::object_ptr<ucom::ant::IService> CreateService | ( | const std::string & | strPluginFileName, |
const std::string & | strClassId, | ||
const std::string & | strObjectId, | ||
base::ant::tADTFRunLevel | nRunlevel, | ||
const std::map< std::string, std::string > & | oProperties | ||
) |
Load a plugin and create a service instance with properties.
[in] | strPluginFileName | The plugin filename. |
[in] | strClassId | The class id of the service. |
[in] | strObjectId | The object name with which the instance is registered at the runtime. |
[in] | nRunlevel | The service will be initialized at the given runlevel. |
[in] | oProperties | Name value pairs that will be set at the services configuration interface. |
tResult | if an error occurred. |
ucom::ant::object_ptr<ucom::ant::IService> CreateService | ( | const std::string & | strPluginFileName, |
const std::string & | strClassId, | ||
const std::string & | strObjectId, | ||
base::ant::tADTFRunLevel | nRunlevel = base::tADTFRunLevel::RL_System |
||
) |
Loads a plugin and creates a service instance.
[in] | strPluginFileName | The plugin filename. |
[in] | strClassId | The class id of the service. |
[in] | strObjectId | The object name with which the instance is registered at the runtime. |
[in] | nRunlevel | The service will be initialized at the given runlevel. |
tResult | if an error occurred. |
base::ant::tADTFRunLevel GetRunLevel | ( | ) | const |
Helper function that returns the current runlevel.
void LoadPlugin | ( | const std::string & | strPluginFileName, |
bool | bCreateServices = true , |
||
base::ant::tADTFRunLevel | nServicesRunlevel = base::tADTFRunLevel::RL_System |
||
) |
Load a plugin and optionally create instances of all found ADTF Service classes.
[in] | strPluginFileName | The file name of the plugin. Relative filenames will be resolved within the plugin directories set during construction. |
[in] | bCreateServices | Whether or not to create instances of services or not. |
[in] | nServicesRunlevel | If services are created, they will be initialized at the given runlevel. |
tResult | if an error occurred. |
|
static |
Helper function to change the current working directory relative to the source directory.
[in] | strRelativePath | The relative directory |
[in] | strTestSourceDirectory | The source directory. The default is a macro that can be set by the test environment. |
|
static |
Set a macro value.
[in] | strName | The name of the macro. |
[in] | strValue | The value that the macro should resolve to. |
void SetRunLevel | ( | base::ant::tADTFRunLevel | eRunlevel | ) |
Helper function that changes the runlevel and throws errors via an exception.
[in] | eRunlevel | The desired runlevel. |
tResult | if an error occurred. |