ADTF
Loading...
Searching...
No Matches
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#ifndef ADTF_TESTING_MUTABLE_RESOURCES
30 #define ADTF_TESTING_MUTABLE_RESOURCES ""
31#endif
32
33#ifndef ADTF_TESTING_BUILD_DIR
34 #define ADTF_TESTING_BUILD_DIR ""
35#endif
36
37namespace adtf
38{
39namespace system
40{
41namespace testing
42{
43namespace giant
44{
45
47{
48public:
58 cTestResourceCopier(const std::string& strResources = ADTF_TESTING_MUTABLE_RESOURCES,
59 const std::string& strTargetRootDirectory = ADTF_TESTING_BUILD_DIR);
60
66
67public:
73 std::string GetResourceTargetDirectory() const;
74
75protected:
76 class cImplementation;
77 std::unique_ptr<cImplementation> m_pImplementation;
78};
79
110{
111public:
126 cTestSystem(const std::string& strUrl = "",
127 const std::vector<std::string>& oPlugins = {},
128 bool bCreateSessionManager = false,
129 const std::string& strAdtfDirectory = ADTF_TESTING_ADTF_DIR,
130 const std::string& strPluginDirectories = ADTF_TESTING_PLUGIN_DIRECTORIES,
131 const std::string& strResources = ADTF_TESTING_MUTABLE_RESOURCES,
132 const std::string& strResourcesOutputDirectory = ADTF_TESTING_BUILD_DIR);
133
149 cTestSystem(const std::string& strUrl,
150 const std::vector<std::string>& oPlugins,
151 bool bCreateSessionManager,
152 bool bCreateLoggingService,
153 const std::string& strAdtfDirectory = ADTF_TESTING_ADTF_DIR,
154 const std::string& strPluginDirectories = ADTF_TESTING_PLUGIN_DIRECTORIES,
155 const std::string& strResources = ADTF_TESTING_MUTABLE_RESOURCES,
156 const std::string& strResourcesOutputDirectory = ADTF_TESTING_BUILD_DIR);
162
169 static void SetCurDirectory(const std::string& strRelativePath,
170 const std::string& strTestSourceDirectory = ADTF_TESTING_SOURCE_DIR);
171
177 static void SetMacro(const std::string& strName, const std::string& strValue);
178
185
191
200 void LoadPlugin(const std::string& strPluginFileName,
201 bool bCreateServices = true,
202 base::ant::tADTFRunLevel nServicesRunlevel = base::tADTFRunLevel::RL_System);
203
213 CreateService(const std::string& strClassId,
214 const std::string& strObjectId,
215 base::ant::tADTFRunLevel nRunlevel = base::tADTFRunLevel::RL_System);
216
228 CreateService(const std::string& strPluginFileName,
229 const std::string& strClassId,
230 const std::string& strObjectId,
231 base::ant::tADTFRunLevel nRunlevel = base::tADTFRunLevel::RL_System);
232
243 const std::string& strObjectId,
244 base::ant::tADTFRunLevel nRunlevel,
245 const std::map<std::string, std::string>& oProperties);
246
258 ucom::ant::object_ptr<ucom::ant::IService> CreateService(const std::string& strPluginFileName,
259 const std::string& strClassId,
260 const std::string& strObjectId,
261 base::ant::tADTFRunLevel nRunlevel,
262 const std::map<std::string, std::string>& oProperties);
263
264 enum tProtocolFamily
265 {
266 TCP_IPv4,
267 TCP_IPv6,
268 UDP_IPv4,
269 UDP_IPv6,
270 };
271
277 static uint16_t GetAvailablePort(tProtocolFamily eFamily, const std::string& strInterface = {});
278
282 static std::string GetAvailableTestUrl();
283
287 std::string GetUrl() const;
288
294 std::string GetMutableResourceDirectory() const;
295
296protected:
297 class cImplementation;
298 std::unique_ptr<cImplementation> m_pImplementation;
299};
300
341{
342public:
355 cSessionTestSystem(const std::string& strUrl = "",
356 const std::string& strAdtfDirectory = ADTF_TESTING_ADTF_DIR,
357 const std::string& strPluginDirectories = ADTF_TESTING_PLUGIN_DIRECTORIES,
358 const std::string& strResources = ADTF_TESTING_MUTABLE_RESOURCES,
359 const std::string& strResourcesOutputDirectory = ADTF_TESTING_BUILD_DIR);
360
374 cSessionTestSystem(const std::string& strUrl,
375 bool bCreateLoggingService,
376 const std::string& strAdtfDirectory = ADTF_TESTING_ADTF_DIR,
377 const std::string& strPluginDirectories = ADTF_TESTING_PLUGIN_DIRECTORIES,
378 const std::string& strResources = ADTF_TESTING_MUTABLE_RESOURCES,
379 const std::string& strResourcesOutputDirectory = ADTF_TESTING_BUILD_DIR);
380
392 void SetEnvironmentFile(const std::string& strFileName, bool bPluginDiscovery = true);
393
402 void CreateSession(const std::string& strFileName);
403
412 void Exec(std::chrono::microseconds tmTimeout);
413
420 void Exec(int8_t nInitialRunlevel, std::function<void()> fnStartup);
421
429 void ExecTest(int8_t nInitialRunlevel, std::function<void()> fnTest);
430
438 void Exec(int8_t nInitialRunlevel, int8_t nAutoQuitLevel, std::function<void()> fnStartup);
439
444
449
454
462};
463
464} // namespace giant
465
469
470} // namespace testing
471} // namespace system
472} // namespace adtf
cSessionTestSystem(const std::string &strUrl="", 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)
cTestResourceCopier(const std::string &strResources=ADTF_TESTING_MUTABLE_RESOURCES, const std::string &strTargetRootDirectory=ADTF_TESTING_BUILD_DIR)
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)
void SetEnvironmentFile(const std::string &strFileName, bool bPluginDiscovery=true)
void Exec(int8_t nInitialRunlevel, int8_t nAutoQuitLevel, std::function< void()> fnStartup)
ucom::ant::object_ptr< streaming::ant::IStreamingGraph > GetStreamingGraph()
void Exec(int8_t nInitialRunlevel, std::function< void()> fnStartup)
void Exec(std::chrono::microseconds tmTimeout)
cSessionTestSystem(const std::string &strUrl, 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)
cSessionTestSystem(const std::string &strUrl="", 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)
ucom::ant::object_ptr< streaming::ant::INamedGraphObject > GetGraphObject(const std::string &name)
void CreateSession(const std::string &strFileName)
ucom::ant::object_ptr< services::ISession > GetSession()
void ExecTest(int8_t nInitialRunlevel, std::function< void()> fnTest)
ucom::ant::object_ptr< streaming::ant::IFilterGraph > GetFilterGraph()
cTestResourceCopier(const std::string &strResources=ADTF_TESTING_MUTABLE_RESOURCES, const std::string &strTargetRootDirectory=ADTF_TESTING_BUILD_DIR)
Definition test_system.h:110
void SetRunLevel(base::ant::tADTFRunLevel eRunlevel)
ucom::ant::object_ptr< ucom::ant::IService > CreateService(const std::string &strClassId, const std::string &strObjectId, base::ant::tADTFRunLevel nRunlevel=base::tADTFRunLevel::RL_System)
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)
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 GetMutableResourceDirectory() const
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)
static void SetMacro(const std::string &strName, const std::string &strValue)
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)
void LoadPlugin(const std::string &strPluginFileName, bool bCreateServices=true, base::ant::tADTFRunLevel nServicesRunlevel=base::tADTFRunLevel::RL_System)
static uint16_t GetAvailablePort(tProtocolFamily eFamily, const std::string &strInterface={})
static void SetCurDirectory(const std::string &strRelativePath, const std::string &strTestSourceDirectory=ADTF_TESTING_SOURCE_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)
base::ant::tADTFRunLevel GetRunLevel() const
Definition object_ptr.h:384
tADTFRunLevel
Definition adtf_runtime.h:23
Namespace for all testing functionality of the ADTF System SDK provided since v3.6.
Definition test_system.h:44
Namespace for all testing functionality of the ADTF System SDK.
Definition adtf_system.h:292
Namespace for the ADTF System SDK.
Definition adtf_service.h:14
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14