Class ETComClient
- java.lang.Object
-
- de.tracetronic.jenkins.plugins.ecutest.wrapper.com.ETComClient
-
- All Implemented Interfaces:
ComApplication
,AutoCloseable
public class ETComClient extends Object implements ComApplication, AutoCloseable
COM client to initialize a COM connection and to perform requests on application specific COM API.All threads from COM will be automatically released after closing the client or at the latest when finalizing occurred.
-
-
Constructor Summary
Constructors Constructor Description ETComClient()
Instantiates a newETComClient
by initializing theETComDispatch
with the configured COM settings.ETComClient(int timeout)
Instantiates a newETComClient
by initializing theETComDispatch
and waits for connection within the given timeout.ETComClient(String progId)
Instantiates a newETComClient
by initializing theETComDispatch
with given programmatic identifier and waits for connection within the default timeout.ETComClient(String progId, int timeout)
Instantiates a newETComClient
by initializing theETComDispatch
with given programmatic identifier and waits for connection within the given timeout.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
boolean
closePackage(String path)
Closes a package.boolean
closeProject(String path)
Closes a project.boolean
exit()
Same asexit(int)
but without timeout.boolean
exit(int timeout)
Exits the currently running instance of the application (Hard Exit), preferComApplication.quit(int)
instead.protected void
finalize()
ComAnalysisEnvironment
getAnalysisEnvironment()
Returns the analysis environment.ComCaches
getCaches()
Returns the cache module.ComTestBenchConfiguration
getCurrentTestBenchConfiguration()
Provides access to settings of the currently active test bench configuration file.ComTestConfiguration
getCurrentTestConfiguration()
Provides access to settings of the currently active test configuration file.List<String>
getLoadedPatches()
Queries the list of loaded patches of the COM-Application.String
getSetting(String settingName)
Queries the COM-Application setting value by name.ComTestEnvironment
getTestEnvironment()
Returns the test environment.ComTestManagement
getTestManagement()
Returns the test management module.String
getVersion()
Queries the COM-Application version.boolean
importProject(String path, String importPath, String importConfigPath, boolean replaceFiles)
Imports a project from an archive.boolean
isApplicationRunning()
Checks if the application process is running and ready to use.boolean
isStarted()
Returns whether the currently selected test configuration and testbench configuration are started.ComPackage
openPackage(String path)
Opens an existing package in COM-Application.ComProject
openProject(String path)
Same asopenProject(String, boolean, String)
but with default parameters.ComProject
openProject(String path, boolean execInCurrentPkgDir, String filterExpression)
Opens an existing project in COM-Application.boolean
openTestbenchConfiguration(String path)
Opens a test bench configuration file (*.tbc).boolean
openTestConfiguration(String path)
Opens a test configuration file (*.tcf).boolean
quit()
Same asquit(int)
but without timeout.boolean
quit(int timeout)
Exits the currently running instance of the application (Soft Exit).ComTestEnvironment
start()
Starts up the currently loaded test configuration and testbench configuration files.ComTestEnvironment
stop()
Stops the currently loaded test configuration and testbench configuration files.boolean
updateUserLibraries()
Update all user libraries.boolean
waitForIdle(int timeout)
Waits until the job count in the task manager reaches zero.
-
-
-
Constructor Detail
-
ETComClient
public ETComClient() throws ETComException
Instantiates a newETComClient
by initializing theETComDispatch
with the configured COM settings.- Throws:
ETComException
- in case of a COM exception or if the timeout is reached
-
ETComClient
public ETComClient(String progId) throws ETComException
Instantiates a newETComClient
by initializing theETComDispatch
with given programmatic identifier and waits for connection within the default timeout.- Parameters:
progId
- the programmatic identifier- Throws:
ETComException
- in case of a COM exception or if the timeout is reached
-
ETComClient
public ETComClient(int timeout) throws ETComException
Instantiates a newETComClient
by initializing theETComDispatch
and waits for connection within the given timeout.- Parameters:
timeout
- the timeout waiting for a connection- Throws:
ETComException
- in case of a COM exception or if the timeout is reached
-
ETComClient
public ETComClient(String progId, int timeout) throws ETComException
Instantiates a newETComClient
by initializing theETComDispatch
with given programmatic identifier and waits for connection within the given timeout.- Parameters:
progId
- the programmatic identifiertimeout
- the timeout waiting for a connection- Throws:
ETComException
- in case of a COM exception or if the timeout is reached
-
-
Method Detail
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
finalize
protected void finalize() throws Throwable
-
start
public ComTestEnvironment start() throws ETComException
Description copied from interface:ComApplication
Starts up the currently loaded test configuration and testbench configuration files.- Specified by:
start
in interfaceComApplication
- Returns:
- the
ComTestEnvironment
dispatch - Throws:
ETComException
- in case of a COM exception
-
stop
public ComTestEnvironment stop() throws ETComException
Description copied from interface:ComApplication
Stops the currently loaded test configuration and testbench configuration files.- Specified by:
stop
in interfaceComApplication
- Returns:
- the
ComTestEnvironment
dispatch - Throws:
ETComException
- in case of a COM exception
-
getTestEnvironment
public ComTestEnvironment getTestEnvironment() throws ETComException
Description copied from interface:ComApplication
Returns the test environment.- Specified by:
getTestEnvironment
in interfaceComApplication
- Returns:
- the
ComTestEnvironment
dispatch - Throws:
ETComException
- in case of a COM exception
-
getAnalysisEnvironment
public ComAnalysisEnvironment getAnalysisEnvironment() throws ETComException
Description copied from interface:ComApplication
Returns the analysis environment.- Specified by:
getAnalysisEnvironment
in interfaceComApplication
- Returns:
- the
ComAnalysisEnvironment
dispatch - Throws:
ETComException
- in case of a COM exception
-
getTestManagement
public ComTestManagement getTestManagement() throws ETComException
Description copied from interface:ComApplication
Returns the test management module.- Specified by:
getTestManagement
in interfaceComApplication
- Returns:
- the
ComTestEnvironment
dispatch - Throws:
ETComException
- in case of a COM exception
-
getCaches
public ComCaches getCaches() throws ETComException
Description copied from interface:ComApplication
Returns the cache module.- Specified by:
getCaches
in interfaceComApplication
- Returns:
- the
ComCaches
dispatch - Throws:
ETComException
- in case of a COM exception
-
isApplicationRunning
public boolean isApplicationRunning() throws ETComException
Description copied from interface:ComApplication
Checks if the application process is running and ready to use.- Specified by:
isApplicationRunning
in interfaceComApplication
- Returns:
true
if application is already running,false
otherwise- Throws:
ETComException
- in case of a COM exception
-
getVersion
public String getVersion() throws ETComException
Description copied from interface:ComApplication
Queries the COM-Application version.- Specified by:
getVersion
in interfaceComApplication
- Returns:
- the version string
- Throws:
ETComException
- in case of a COM exception
-
getSetting
public String getSetting(String settingName) throws ETComException
Description copied from interface:ComApplication
Queries the COM-Application setting value by name. Possible setting names are:- configPath
- errorLogFile
- generatorPath
- language
- logFile
- packagePath
- reportPath
- templatePath
- parameterPath
- traceStepPath
- userPyModulesPath
- utilityPath
- workspacePath
- offlineModelPath
- offlineSgbdPath
- offlineFiuPath
- settingsPath
- Specified by:
getSetting
in interfaceComApplication
- Parameters:
settingName
- the setting name- Returns:
- the setting value or
null
if not defined - Throws:
ETComException
- in case of a COM exception
-
getLoadedPatches
public List<String> getLoadedPatches() throws ETComException
Description copied from interface:ComApplication
Queries the list of loaded patches of the COM-Application.- Specified by:
getLoadedPatches
in interfaceComApplication
- Returns:
- the list of loaded patches
- Throws:
ETComException
- in case of a COM exception
-
quit
public boolean quit() throws ETComException
Same asquit(int)
but without timeout. Must be used for ecu.test below version 8.0.- Returns:
true
if successful- Throws:
ETComException
- in case of a COM exception- See Also:
quit(int)
-
quit
public boolean quit(int timeout) throws ETComException
Description copied from interface:ComApplication
Exits the currently running instance of the application (Soft Exit). The optional timeout parameter was introduced with ecu.test 8.0.- Specified by:
quit
in interfaceComApplication
- Parameters:
timeout
- the timeout in seconds before giving up to wait for application shutdown and raising an exception- Returns:
true
if successful- Throws:
ETComException
- in case of a COM exception
-
exit
public boolean exit() throws ETComException
Same asexit(int)
but without timeout. Must be used for ecu.test below version 8.0.- Returns:
true
if successful- Throws:
ETComException
- in case of a COM exception- See Also:
exit(int)
-
exit
public boolean exit(int timeout) throws ETComException
Description copied from interface:ComApplication
Exits the currently running instance of the application (Hard Exit), preferComApplication.quit(int)
instead. The optional timeout parameter was introduced with ecu.test 8.0.- Specified by:
exit
in interfaceComApplication
- Parameters:
timeout
- the timeout in seconds before giving up to wait for application shutdown and raising an exception- Returns:
true
if successful- Throws:
ETComException
- in case of a COM exception
-
openPackage
public ComPackage openPackage(String path) throws ETComException
Description copied from interface:ComApplication
Opens an existing package in COM-Application.- Specified by:
openPackage
in interfaceComApplication
- Parameters:
path
- the full path name of the package to open- Returns:
- the
ComPackage
dispatch, if the package is successfully opened,null
otherwise - Throws:
ETComException
- in case of a COM exception
-
closePackage
public boolean closePackage(String path) throws ETComException
Description copied from interface:ComApplication
Closes a package.- Specified by:
closePackage
in interfaceComApplication
- Parameters:
path
- the full path name of the package to close- Returns:
true
if the package was closed,false
otherwise- Throws:
ETComException
- in case of a COM exception
-
openProject
public ComProject openProject(String path) throws ETComException
Same asopenProject(String, boolean, String)
but with default parameters.- Parameters:
path
- the full path name of the project to open- Returns:
- the
ComProject
dispatch, if the project is successfully opened,null
otherwise - Throws:
ETComException
- in case of a COM exception- See Also:
openProject(String, boolean, String)
-
openProject
public ComProject openProject(String path, boolean execInCurrentPkgDir, String filterExpression) throws ETComException
Description copied from interface:ComApplication
Opens an existing project in COM-Application.- Specified by:
openProject
in interfaceComApplication
- Parameters:
path
- the full path name of the project to openexecInCurrentPkgDir
- defines whether relative references in the project are resolved starting from the current workspaces package directory or from the project file locationfilterExpression
- a valid filter expression (see the main help document, section 'Projects')- Returns:
- the
ComProject
dispatch, if the project is successfully opened,null
otherwise - Throws:
ETComException
- in case of a COM exception
-
closeProject
public boolean closeProject(String path) throws ETComException
Description copied from interface:ComApplication
Closes a project.- Specified by:
closeProject
in interfaceComApplication
- Parameters:
path
- the full path name of the project to close- Returns:
true
if the project was closed,false
otherwise- Throws:
ETComException
- in case of a COM exception
-
importProject
public boolean importProject(String path, String importPath, String importConfigPath, boolean replaceFiles) throws ETComException
Description copied from interface:ComApplication
Imports a project from an archive.- Specified by:
importProject
in interfaceComApplication
- Parameters:
path
- the full path name of the project to importimportPath
- the full path name or a relative directory to the default package directory as the projects/packages destination directoryimportConfigPath
- the full path name or a relative directory to the default configuration directory as the configurations destination directoryreplaceFiles
- specifies whether files of same name should be replaced or left untouched- Returns:
- the
ComPackage
dispatch, if the project was successfully imported,null
otherwise - Throws:
ETComException
- in case of a COM exception
-
openTestbenchConfiguration
public boolean openTestbenchConfiguration(String path) throws ETComException
Description copied from interface:ComApplication
Opens a test bench configuration file (*.tbc).- Specified by:
openTestbenchConfiguration
in interfaceComApplication
- Parameters:
path
- the full path name of the test bench configuration file to open- Returns:
true
if the configuration was successfully opened,false
otherwise- Throws:
ETComException
- in case of a COM exception
-
openTestConfiguration
public boolean openTestConfiguration(String path) throws ETComException
Description copied from interface:ComApplication
Opens a test configuration file (*.tcf).- Specified by:
openTestConfiguration
in interfaceComApplication
- Parameters:
path
- the full path name of the test configuration file to open- Returns:
true
if the configuration was successfully opened,false
otherwise- Throws:
ETComException
- in case of a COM exception
-
getCurrentTestConfiguration
public ComTestConfiguration getCurrentTestConfiguration() throws ETComException
Description copied from interface:ComApplication
Provides access to settings of the currently active test configuration file.- Specified by:
getCurrentTestConfiguration
in interfaceComApplication
- Returns:
- the
ComTestConfiguration
dispatch - Throws:
ETComException
- in case of a COM exception
-
getCurrentTestBenchConfiguration
public ComTestBenchConfiguration getCurrentTestBenchConfiguration() throws ETComException
Description copied from interface:ComApplication
Provides access to settings of the currently active test bench configuration file.- Specified by:
getCurrentTestBenchConfiguration
in interfaceComApplication
- Returns:
- the
ComTestBenchConfiguration
dispatch - Throws:
ETComException
- in case of a COM exception
-
isStarted
public boolean isStarted() throws ETComException
Description copied from interface:ComApplication
Returns whether the currently selected test configuration and testbench configuration are started.- Specified by:
isStarted
in interfaceComApplication
- Returns:
true
if configurations are started,false
otherwise- Throws:
ETComException
- in case of a COM exception
-
waitForIdle
public boolean waitForIdle(int timeout) throws ETComException
Description copied from interface:ComApplication
Waits until the job count in the task manager reaches zero. The timeout parameter specifies the maximum waiting time in seconds.- Specified by:
waitForIdle
in interfaceComApplication
- Parameters:
timeout
- the timeout in seconds- Returns:
true
if a job count of zero was reached within the timeout- Throws:
ETComException
- in case of a COM exception
-
updateUserLibraries
public boolean updateUserLibraries() throws ETComException
Description copied from interface:ComApplication
Update all user libraries. Only possible if neither a test nor the analysis is running.- Specified by:
updateUserLibraries
in interfaceComApplication
- Returns:
true
if success,false
otherwise- Throws:
ETComException
- in case of a COM exception
-
-