ADTF  3.18.2
test_system.h
Go to the documentation of this file.
1 
7 #pragma once
8 
15 #include <string>
16 
17 #ifndef ADTF_TESTING_ADTF_DIR
18 #define ADTF_TESTING_ADTF_DIR ""
19 #endif
20 
21 #ifndef ADTF_TESTING_PLUGIN_DIRECTORIES
22 #define ADTF_TESTING_PLUGIN_DIRECTORIES ""
23 #endif
24 
25 #ifndef ADTF_TESTING_SOURCE_DIR
26 #define ADTF_TESTING_SOURCE_DIR ""
27 #endif
28 
29 namespace adtf
30 {
31 namespace system
32 {
33 namespace testing
34 {
35 namespace giant
36 {
37 
67 {
68  public:
77  cTestSystem(const std::string& strUrl = "",
78  const std::vector<std::string>& oPlugins = {},
79  bool bCreateSessionManager = false,
80  const std::string& strAdtfDirectory = ADTF_TESTING_ADTF_DIR,
81  const std::string& strPluginDirectories = ADTF_TESTING_PLUGIN_DIRECTORIES);
82 
92  cTestSystem(const std::string& strUrl,
93  const std::vector<std::string>& oPlugins,
94  bool bCreateSessionManager,
95  bool bCreateLoggingService,
96  const std::string& strAdtfDirectory = ADTF_TESTING_ADTF_DIR,
97  const std::string& strPluginDirectories = ADTF_TESTING_PLUGIN_DIRECTORIES);
102 
108  static void SetCurDirectory(const std::string& strRelativePath,
109  const std::string& strTestSourceDirectory = ADTF_TESTING_SOURCE_DIR);
110 
116  static void SetMacro(const std::string& strName, const std::string& strValue);
117 
124 
130 
138  void LoadPlugin(const std::string& strPluginFileName,
139  bool bCreateServices = true,
140  base::ant::tADTFRunLevel nServicesRunlevel = base::tADTFRunLevel::RL_System);
141 
151  const std::string& strObjectId,
152  base::ant::tADTFRunLevel nRunlevel = base::tADTFRunLevel::RL_System);
153 
164  ucom::ant::object_ptr<ucom::ant::IService> CreateService(const std::string& strPluginFileName,
165  const std::string& strClassId,
166  const std::string& strObjectId,
167  base::ant::tADTFRunLevel nRunlevel = base::tADTFRunLevel::RL_System);
168 
179  const std::string& strObjectId,
180  base::ant::tADTFRunLevel nRunlevel,
181  const std::map<std::string, std::string>& oProperties);
182 
194  ucom::ant::object_ptr<ucom::ant::IService> CreateService(const std::string& strPluginFileName,
195  const std::string& strClassId,
196  const std::string& strObjectId,
197  base::ant::tADTFRunLevel nRunlevel,
198  const std::map<std::string, std::string>& oProperties);
199 
200  protected:
201  class cImplementation;
202  std::unique_ptr<cImplementation> m_pImplementation;
203 };
204 
244 {
245  public:
252  cSessionTestSystem(const std::string& strUrl = "",
253  const std::string& strAdtfDirectory = ADTF_TESTING_ADTF_DIR,
254  const std::string& strPluginDirectories = ADTF_TESTING_PLUGIN_DIRECTORIES);
255 
263  cSessionTestSystem(const std::string& strUrl,
264  bool bCreateLoggingService,
265  const std::string& strAdtfDirectory = ADTF_TESTING_ADTF_DIR,
266  const std::string& strPluginDirectories = ADTF_TESTING_PLUGIN_DIRECTORIES);
267 
276  void SetEnvironmentFile(const std::string& strFileName);
277 
286  void CreateSession(const std::string& strFileName);
287 
296 
303  void Exec(int8_t nInitialRunlevel, std::function<void()> fnStartup);
304 
312  void ExecTest(int8_t nInitialRunlevel, std::function<void()> fnTest);
313 
318 
323 
328 
336 };
337 
338 }
339 
340 using giant::cTestSystem;
342 
343 }
344 }
345 }
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
This class allows you to create a test system based on an ADTF session.
Definition: test_system.h:244
ucom::ant::object_ptr< services::ant::ISession > GetSession()
ucom::ant::object_ptr< streaming::ant::IStreamingGraph > GetStreamingGraph()
void Exec(std::chrono::microseconds tmTimeout)
Executes a session for a given amount of time.
void ExecTest(int8_t nInitialRunlevel, std::function< void()> fnTest)
Execute a session, call a test function and shutdown the session afterwards.
ucom::ant::object_ptr< streaming::ant::IFilterGraph > GetFilterGraph()
void CreateSession(const std::string &strFileName)
Load and create a session.
void Exec(int8_t nInitialRunlevel, std::function< void()> fnStartup)
Executes a session and call the a callback function when ready.
void SetEnvironmentFile(const std::string &strFileName)
Set the adtfenvironment.
cSessionTestSystem(const std::string &strUrl, bool bCreateLoggingService, const std::string &strAdtfDirectory=ADTF_TESTING_ADTF_DIR, const std::string &strPluginDirectories=ADTF_TESTING_PLUGIN_DIRECTORIES)
Constructs a test system.
ucom::ant::object_ptr< streaming::ant::INamedGraphObject > GetGraphObject(const std::string &name)
Retrieve a graph object from the streaming/filter graph.
cSessionTestSystem(const std::string &strUrl="", const std::string &strAdtfDirectory=ADTF_TESTING_ADTF_DIR, const std::string &strPluginDirectories=ADTF_TESTING_PLUGIN_DIRECTORIES)
Constructs a test system.
This class enables you to setup an ADTF system where you can test your filters and services.
Definition: test_system.h:67
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.
base::ant::tADTFRunLevel GetRunLevel() const
Helper function that returns the current runlevel.
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.
static void SetMacro(const std::string &strName, const std::string &strValue)
Set a macro value.
void SetRunLevel(base::ant::tADTFRunLevel eRunlevel)
Helper function that changes the runlevel and throws errors via an exception.
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.
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.
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.
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.
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.
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.
Object pointer implementation used for reference counting on objects of type IObject.
Definition: object_ptr.h:163
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
tADTFRunLevel
The ADTF Runtime Level State are used to define a ADTF Runtime specialization for a adtf::ucom::ant::...
Definition: adtf_runtime.h:24
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.