#include <test_system.h>
Inherited by adtf::system::testing::giant::cSessionTestSystem.
|
| enum | tProtocolFamily { TCP_IPv4
, TCP_IPv6
, UDP_IPv4
, UDP_IPv6
} |
| |
|
| | 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, const std::string &strResources=ADTF_TESTING_MUTABLE_RESOURCES, const std::string &strResourcesOutputDirectory=ADTF_TESTING_BUILD_DIR) |
| |
| | 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, const std::string &strResources=ADTF_TESTING_MUTABLE_RESOURCES, const std::string &strResourcesOutputDirectory=ADTF_TESTING_BUILD_DIR) |
| |
| | ~cTestSystem () |
| |
| void | SetRunLevel (base::ant::tADTFRunLevel eRunlevel) |
| |
| base::ant::tADTFRunLevel | GetRunLevel () const |
| |
| void | LoadPlugin (const std::string &strPluginFileName, bool bCreateServices=true, base::ant::tADTFRunLevel nServicesRunlevel=base::tADTFRunLevel::RL_System) |
| |
| ucom::ant::object_ptr< ucom::ant::IService > | CreateService (const std::string &strClassId, const std::string &strObjectId, base::ant::tADTFRunLevel nRunlevel=base::tADTFRunLevel::RL_System) |
| |
| 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) |
| |
| 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) |
| |
| 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) |
| |
| std::string | GetUrl () const |
| |
| std::string | GetMutableResourceDirectory () const |
| |
|
| static void | SetCurDirectory (const std::string &strRelativePath, const std::string &strTestSourceDirectory=ADTF_TESTING_SOURCE_DIR) |
| |
| static void | SetMacro (const std::string &strName, const std::string &strValue) |
| |
| static uint16_t | GetAvailablePort (tProtocolFamily eFamily, const std::string &strInterface={}) |
| |
| static std::string | GetAvailableTestUrl () |
| |
|
|
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:
Example Usage
{
public:
cMyTestSystem()
{
}
};
Definition test_system.h:110
void SetRunLevel(base::ant::tADTFRunLevel eRunlevel)
void LoadPlugin(const std::string &strPluginFileName, bool bCreateServices=true, base::ant::tADTFRunLevel nServicesRunlevel=base::tADTFRunLevel::RL_System)
- Note
- Our adtf_add_catch_test() macro from mainpage_testing_pkg will define the ADTF_TESTING_ADTF_DIR and ADTF_TESTING_ADTF_DIR macros. If you use another testing framework make sure you either pass values directly to the constructor or add these definitions as well.
◆ cTestSystem() [1/2]
| adtf::system::testing::giant::cTestSystem::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, |
|
|
const std::string & | strResources = ADTF_TESTING_MUTABLE_RESOURCES, |
|
|
const std::string & | strResourcesOutputDirectory = ADTF_TESTING_BUILD_DIR ) |
Constructs a test system.
- Parameters
-
| [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 ';' separated list of plugin directories. The default is a macro that can be set by the test environment. |
| [in] | strResources | A ';' separated list of mutable test resources. Can be directories and/or files. The listed inputs will be copied to strResourcesOutputDirectory. |
| [in] | strResourcesOutputDirectory | The root directory where the listed inputs from strResources will be copied to. A unique folder name will be attached to the path. Mind that this unique folder is temporary! |
◆ cTestSystem() [2/2]
| adtf::system::testing::giant::cTestSystem::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, |
|
|
const std::string & | strResources = ADTF_TESTING_MUTABLE_RESOURCES, |
|
|
const std::string & | strResourcesOutputDirectory = ADTF_TESTING_BUILD_DIR ) |
Constructs a test system.
- Parameters
-
| [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 ';' separated list of plugin directories. The default is a macro that can be set by the test environment. |
| [in] | strResources | A ';' separated list of mutable test resources. Can be directories and/or files. The listed inputs will be copied to strResourcesOutputDirectory. |
| [in] | strResourcesOutputDirectory | The root directory where the listed inputs from strResources will be copied to. A unique folder name will be attached to the path. Mind that this unique folder is temporary! |
◆ ~cTestSystem()
| adtf::system::testing::giant::cTestSystem::~cTestSystem |
( |
| ) |
|
Destructor. If test sources have been copied using the Constructor, they will be deleted here.
◆ CreateService() [1/4]
Create a service instance with properties.
- Parameters
-
| [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. |
- Returns
- A pointer to the service instance.
- Exceptions
-
◆ CreateService() [2/4]
Create a service instance.
- Parameters
-
| [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. |
- Returns
- A pointer to the service instance.
- Exceptions
-
◆ CreateService() [3/4]
Load a plugin and create a service instance with properties.
- Parameters
-
| [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. |
- Returns
- A pointer to the service instance.
- Exceptions
-
- See also
- LoadPlugin().
◆ CreateService() [4/4]
Loads a plugin and creates a service instance.
- Parameters
-
| [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. |
- Returns
- A pointer to the service instance.
- Exceptions
-
- See also
- LoadPlugin().
◆ GetAvailablePort()
| static uint16_t adtf::system::testing::giant::cTestSystem::GetAvailablePort |
( |
tProtocolFamily | eFamily, |
|
|
const std::string & | strInterface = {} ) |
|
static |
- Parameters
-
| [in] | eFamily | The protocol family to retrieve a port for. |
| [in] | strInterface | The interface on which the port will be used, empty -> loopback. |
- Returns
- A port that is available and that can be bound by this process.
◆ GetAvailableTestUrl()
| static std::string adtf::system::testing::giant::cTestSystem::GetAvailableTestUrl |
( |
| ) |
|
|
static |
- Returns
- A unique URL that can be used to launch a session.
◆ GetMutableResourceDirectory()
| std::string adtf::system::testing::giant::cTestSystem::GetMutableResourceDirectory |
( |
| ) |
const |
Returns the path to the temporary directory that contains the test resources.
- Returns
- A std::string object containing the path to the created test resources directory. Is empty if nothing has been copied.
◆ GetRunLevel()
Helper function that returns the current runlevel.
- Returns
- The current runlevel.
◆ GetUrl()
| std::string adtf::system::testing::giant::cTestSystem::GetUrl |
( |
| ) |
const |
- Returns
- RPC URL passed to constructor in strUrl parameter, if any.
◆ LoadPlugin()
| void adtf::system::testing::giant::cTestSystem::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.
- Parameters
-
| [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. |
- Exceptions
-
◆ SetCurDirectory()
| static void adtf::system::testing::giant::cTestSystem::SetCurDirectory |
( |
const std::string & | strRelativePath, |
|
|
const std::string & | strTestSourceDirectory = ADTF_TESTING_SOURCE_DIR ) |
|
static |
Helper function to change the current working directory relative to the source directory.
- Parameters
-
| [in] | strRelativePath | The relative directory |
| [in] | strTestSourceDirectory | The source directory. The default is a macro that can be set by the test environment. |
◆ SetMacro()
| static void adtf::system::testing::giant::cTestSystem::SetMacro |
( |
const std::string & | strName, |
|
|
const std::string & | strValue ) |
|
static |
Set a macro value.
- Parameters
-
| [in] | strName | The name of the macro. |
| [in] | strValue | The value that the macro should resolve to. |
◆ SetRunLevel()
Helper function that changes the runlevel and throws errors via an exception.
- Parameters
-
| [in] | eRunlevel | The desired runlevel. |
- Exceptions
-
The documentation for this class was generated from the following file:
- src/libraries/systemsdk/include/adtfsystemsdk/testing/test_system.h