Top Description Fields Constructors Methods
org.testng.internal

public Class ConfigurationGroupMethods

extends Object
Class Inheritance
Imports
java.util.Arrays, .Collection, .Collections, .HashSet, .List, .Map, .Objects, .Set, java.util.concurrent.ConcurrentHashMap, .CountDownLatch, java.util.stream.Collectors, org.testng.ITestNGMethod, org.testng.collections.CollectionUtils, .Lists, .Maps, org.testng.log4testng.Logger

This class wraps access to beforeGroups and afterGroups methods, since they are passed around the various invokers and potentially modified in different threads.
Since
5.3 (Mar 2, 2006)

Field Summary

Modifier and TypeField and Description
private final AutoCloseableLock
private final Set<String>
private final AutoCloseableLock
private final Map<String, CountDownLatch>
private volatile Map<String, List<ITestNGMethod>>
m_afterGroupsMap

A map that returns the last method belonging to the given group

private final Map<String, List<ITestNGMethod>>
m_afterGroupsMethods

The list of afterGroups methods keyed by the name of the group

private final ITestNGMethod[]
m_allMethods

The list of all test methods

private final Map<String, List<ITestNGMethod>>
m_beforeGroupsMethods

The list of beforeGroups methods keyed by the name of the group

Constructor Summary

AccessConstructor and Description
public
ConfigurationGroupMethods(IContainer<ITestNGMethod> container, Map<String, List<ITestNGMethod>> beforeGroupsMethods, Map<String, List<ITestNGMethod>> afterGroupsMethods)

Method Summary

Modifier and TypeMethod and Description
public List<ITestNGMethod>
public Map<String, List<ITestNGMethod>>
public List<ITestNGMethod>
public Map<String, List<ITestNGMethod>>
private Map<String, List<ITestNGMethod>>
private boolean
isAfterGroupAllowedToRunAfterTestMethod(ITestNGMethod afterGroupMethod, Set<String> testMethodGroups)

private boolean

Returns:

true if the passed method is the last to run for the group. This method is used to figure out when is the right time to invoke afterGroups methods.
isLastMethodForGroup
(String
The group name
group
,
ITestNGMethod
The test method
method
)

public void
public void
private static List<ITestNGMethod>
private static List<ITestNGMethod>
retrieve(Set<String> tracker, Map<String, List<ITestNGMethod>> map, String group)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

afterGroupsback to summary
private final AutoCloseableLock afterGroups
afterGroupsThatHaveAlreadyRunback to summary
private final Set<String> afterGroupsThatHaveAlreadyRun
beforeGroupsback to summary
private final AutoCloseableLock beforeGroups
beforeGroupsThatHaveAlreadyRunback to summary
private final Map<String, CountDownLatch> beforeGroupsThatHaveAlreadyRun
m_afterGroupsMapback to summary
private volatile Map<String, List<ITestNGMethod>> m_afterGroupsMap

A map that returns the last method belonging to the given group

m_afterGroupsMethodsback to summary
private final Map<String, List<ITestNGMethod>> m_afterGroupsMethods

The list of afterGroups methods keyed by the name of the group

m_allMethodsback to summary
private final ITestNGMethod[] m_allMethods

The list of all test methods

m_beforeGroupsMethodsback to summary
private final Map<String, List<ITestNGMethod>> m_beforeGroupsMethods

The list of beforeGroups methods keyed by the name of the group

Constructor Detail

ConfigurationGroupMethodsback to summary
public ConfigurationGroupMethods(IContainer<ITestNGMethod> container, Map<String, List<ITestNGMethod>> beforeGroupsMethods, Map<String, List<ITestNGMethod>> afterGroupsMethods)

Method Detail

getAfterGroupMethodsback to summary
public List<ITestNGMethod> getAfterGroupMethods(ITestNGMethod testMethod)
getAfterGroupsMethodsback to summary
public Map<String, List<ITestNGMethod>> getAfterGroupsMethods()
getBeforeGroupMethodsForGroupback to summary
public List<ITestNGMethod> getBeforeGroupMethodsForGroup(String[] groups)
getBeforeGroupsMethodsback to summary
public Map<String, List<ITestNGMethod>> getBeforeGroupsMethods()
initializeAfterGroupsMapback to summary
private Map<String, List<ITestNGMethod>> initializeAfterGroupsMap()
isAfterGroupAllowedToRunAfterTestMethodback to summary
private boolean isAfterGroupAllowedToRunAfterTestMethod(ITestNGMethod afterGroupMethod, Set<String> testMethodGroups)
isLastMethodForGroupback to summary
private boolean isLastMethodForGroup(String group, ITestNGMethod method)
Parameters
group:String

The group name

method:ITestNGMethod

The test method

Returns:boolean

true if the passed method is the last to run for the group. This method is used to figure out when is the right time to invoke afterGroups methods.

removeAfterGroupsback to summary
public void removeAfterGroups(Collection<String> groups)
removeBeforeGroupsback to summary
public void removeBeforeGroups(String[] groups)
retrieveback to summary
private static List<ITestNGMethod> retrieve(Map<String, CountDownLatch> tracker, Map<String, List<ITestNGMethod>> map, String group)
retrieveback to summary
private static List<ITestNGMethod> retrieve(Set<String> tracker, Map<String, List<ITestNGMethod>> map, String group)