Class ConfigurationGroupMethods


  • public class ConfigurationGroupMethods
    extends java.lang.Object
    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 Detail

      • m_beforeGroupsMethods

        private final java.util.Map<java.lang.String,​java.util.List<ITestNGMethod>> m_beforeGroupsMethods
        The list of beforeGroups methods keyed by the name of the group
      • beforeGroupsThatHaveAlreadyRun

        private final java.util.Map<java.lang.String,​java.util.concurrent.CountDownLatch> beforeGroupsThatHaveAlreadyRun
      • afterGroupsThatHaveAlreadyRun

        private final java.util.Set<java.lang.String> afterGroupsThatHaveAlreadyRun
      • m_afterGroupsMethods

        private final java.util.Map<java.lang.String,​java.util.List<ITestNGMethod>> m_afterGroupsMethods
        The list of afterGroups methods keyed by the name of the group
      • m_allMethods

        private final ITestNGMethod[] m_allMethods
        The list of all test methods
      • m_afterGroupsMap

        private volatile java.util.Map<java.lang.String,​java.util.List<ITestNGMethod>> m_afterGroupsMap
        A map that returns the last method belonging to the given group
    • Constructor Detail

      • ConfigurationGroupMethods

        public ConfigurationGroupMethods​(IContainer<ITestNGMethod> container,
                                         java.util.Map<java.lang.String,​java.util.List<ITestNGMethod>> beforeGroupsMethods,
                                         java.util.Map<java.lang.String,​java.util.List<ITestNGMethod>> afterGroupsMethods)
    • Method Detail

      • getBeforeGroupsMethods

        public java.util.Map<java.lang.String,​java.util.List<ITestNGMethod>> getBeforeGroupsMethods()
      • getAfterGroupsMethods

        public java.util.Map<java.lang.String,​java.util.List<ITestNGMethod>> getAfterGroupsMethods()
      • getBeforeGroupMethodsForGroup

        public java.util.List<ITestNGMethod> getBeforeGroupMethodsForGroup​(java.lang.String[] groups)
      • isAfterGroupAllowedToRunAfterTestMethod

        private boolean isAfterGroupAllowedToRunAfterTestMethod​(ITestNGMethod afterGroupMethod,
                                                                java.util.Set<java.lang.String> testMethodGroups)
      • removeBeforeGroups

        public void removeBeforeGroups​(java.lang.String[] groups)
      • removeAfterGroups

        public void removeAfterGroups​(java.util.Collection<java.lang.String> groups)
      • isLastMethodForGroup

        private boolean isLastMethodForGroup​(java.lang.String group,
                                             ITestNGMethod method)
        Parameters:
        group - The group name
        method - The test method
        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.
      • initializeAfterGroupsMap

        private java.util.Map<java.lang.String,​java.util.List<ITestNGMethod>> initializeAfterGroupsMap()
      • retrieve

        private static java.util.List<ITestNGMethod> retrieve​(java.util.Map<java.lang.String,​java.util.concurrent.CountDownLatch> tracker,
                                                              java.util.Map<java.lang.String,​java.util.List<ITestNGMethod>> map,
                                                              java.lang.String group)
      • retrieve

        private static java.util.List<ITestNGMethod> retrieve​(java.util.Set<java.lang.String> tracker,
                                                              java.util.Map<java.lang.String,​java.util.List<ITestNGMethod>> map,
                                                              java.lang.String group)