Package guru.mikelue.jdut.testng
Class YamlFactoryListenerBase
- java.lang.Object
-
- guru.mikelue.jdut.testng.YamlFactoryListenerBase
-
- Direct Known Subclasses:
IInvokedMethodYamlFactoryListener
,ISuiteYamlFactoryListener
,ITestContextYamlFactoryListener
public abstract class YamlFactoryListenerBase extends Object
Defines the basic, overridable method for constructing listeners.
This listener uses
The value of hash key onConcurrentHashMap
for building mapping betweenIAttributes
andDuetConductor
, so you should use the implementation of this listener in multi-thread environment with discretion.IAttributes
:- For
ITestContext
- Use suite name and test name - For
ISuite
- Use suite name - For
ITestResult
- Use canonical class name and method name
Main methods
buildDuetConductor(org.testng.IAttributes)
- Client must be implementing this methodbuildYamlConductorFactory(org.testng.IAttributes)
- Gets/builder singleton instance forYamlConductorFactory
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
YamlFactoryListenerBase()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Optional<DuetConductor>
buildDuetConductor(IAttributes attributes)
BuildsDuetConductor
(asOptional
), client should implements this method.protected YamlConductorFactory
buildYamlConductorFactory(IAttributes attributes)
protected void
duetConductorBuild(IAttributes attributes)
BybuildDuetConductor(org.testng.IAttributes)
, executesDuetConductor.build()
.
The conductor would be a new one frombuildDuetConductor(org.testng.IAttributes)
, which would be put into fedIAttributes
.protected void
duetConductorClean(IAttributes attributes)
ExecutesDuetConductor.clean()
keep inIAttributes
, which is saved byduetConductorBuild(org.testng.IAttributes)
.
The conductor would be cleaned.static DataSource
getDataSource(IAttributes attributes)
Gets the data source from attributeprotected org.slf4j.Logger
getLogger()
Gets the logger with name of implementing class.static DataSource
removeDataSource(IAttributes attributes)
Removes the data source from attributestatic void
setDataSource(IAttributes attributes, DataSource dataSource)
Sets the attribute for data source.
-
-
-
Method Detail
-
setDataSource
public static void setDataSource(IAttributes attributes, DataSource dataSource)
Sets the attribute for data source.- Parameters:
attributes
- The attributes to be setdataSource
- The initialized data source
-
getDataSource
public static DataSource getDataSource(IAttributes attributes)
Gets the data source from attribute- Parameters:
attributes
- The attribute may contain data source- Returns:
- The put data source
-
removeDataSource
public static DataSource removeDataSource(IAttributes attributes)
Removes the data source from attribute- Parameters:
attributes
- The attribute may contain data source- Returns:
- The data source put by
setDataSource(org.testng.IAttributes, javax.sql.DataSource)
-
buildYamlConductorFactory
protected YamlConductorFactory buildYamlConductorFactory(IAttributes attributes)
-
duetConductorBuild
protected final void duetConductorBuild(IAttributes attributes)
BybuildDuetConductor(org.testng.IAttributes)
, executesDuetConductor.build()
.
The conductor would be a new one frombuildDuetConductor(org.testng.IAttributes)
, which would be put into fedIAttributes
.- Parameters:
attributes
- The attribute object of TestNG
-
duetConductorClean
protected final void duetConductorClean(IAttributes attributes)
ExecutesDuetConductor.clean()
keep inIAttributes
, which is saved byduetConductorBuild(org.testng.IAttributes)
.
The conductor would be cleaned.- Parameters:
attributes
- The attribute object of TestNG
-
getLogger
protected org.slf4j.Logger getLogger()
Gets the logger with name of implementing class.- Returns:
- The logger
-
buildDuetConductor
protected abstract Optional<DuetConductor> buildDuetConductor(IAttributes attributes)
BuildsDuetConductor
(asOptional
), client should implements this method.- Parameters:
attributes
- The attribute object used for retrieve testing environment- Returns:
- The initialized conductor for testing
-
-