Package org.testng.internal
Class ClonedMethod
- java.lang.Object
-
- org.testng.internal.ClonedMethod
-
- All Implemented Interfaces:
java.lang.Cloneable
,ITestNGMethod
public class ClonedMethod extends java.lang.Object implements ITestNGMethod
-
-
Field Summary
Fields Modifier and Type Field Description private int
m_currentInvocationCount
private long
m_date
private java.util.List<java.lang.Integer>
m_failedInvocationNumbers
private java.lang.String
m_id
private java.util.List<java.lang.Integer>
m_invocationNumbers
private java.lang.reflect.Method
m_javaMethod
private ITestNGMethod
m_method
-
Constructor Summary
Constructors Constructor Description ClonedMethod(ITestNGMethod method, java.lang.reflect.Method javaMethod)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFailedInvocationNumber(int number)
The list of invocation numbers that failed, which is only applicable for methods that have a data provider.void
addMethodDependedUpon(java.lang.String methodName)
boolean
canRunFromClass(IClass testClass)
ClonedMethod
clone()
java.util.Map<java.lang.String,java.lang.String>
findMethodParameters(XmlTest test)
java.lang.String[]
getAfterGroups()
java.lang.String[]
getBeforeGroups()
ConstructorOrMethod
getConstructorOrMethod()
int
getCurrentInvocationCount()
long
getDate()
java.lang.String
getDescription()
boolean
getEnabled()
java.util.List<java.lang.Integer>
getFailedInvocationNumbers()
java.lang.String[]
getGroups()
java.lang.String[]
getGroupsDependedUpon()
java.lang.String
getId()
java.lang.Object
getInstance()
long[]
getInstanceHashCodes()
Needed for serialization.int
getInterceptedPriority()
int
getInvocationCount()
java.util.List<java.lang.Integer>
getInvocationNumbers()
Which invocation numbers of this method should be used (only applicable if it uses a data provider).long
getInvocationTimeOut()
java.lang.String
getMethodName()
Returns the method name.java.lang.String[]
getMethodsDependedUpon()
java.lang.String
getMissingGroup()
int
getParameterInvocationCount()
int
getPriority()
The scheduling priority.java.lang.String
getQualifiedName()
getRealClass().getName() + "." + getMethodName()java.lang.Class<?>
getRealClass()
IRetryAnalyzer
getRetryAnalyzer(ITestResult result)
java.lang.Class<? extends IRetryAnalyzer>
getRetryAnalyzerClass()
int
getSuccessPercentage()
ITestClass
getTestClass()
int
getThreadPoolSize()
long
getTimeOut()
XmlTest
getXmlTest()
boolean
hasMoreInvocation()
boolean
ignoreMissingDependencies()
void
incrementCurrentInvocationCount()
boolean
isAfterClassConfiguration()
boolean
isAfterGroupsConfiguration()
boolean
isAfterMethodConfiguration()
boolean
isAfterSuiteConfiguration()
boolean
isAfterTestConfiguration()
boolean
isAlwaysRun()
boolean
isBeforeClassConfiguration()
boolean
isBeforeGroupsConfiguration()
boolean
isBeforeMethodConfiguration()
boolean
isBeforeSuiteConfiguration()
boolean
isBeforeTestConfiguration()
boolean
isTest()
void
setDate(long date)
void
setDescription(java.lang.String description)
void
setId(java.lang.String id)
void
setIgnoreMissingDependencies(boolean ignore)
void
setInterceptedPriority(int priority)
void
setInvocationCount(int count)
void
setInvocationNumbers(java.util.List<java.lang.Integer> count)
void
setMissingGroup(java.lang.String group)
void
setMoreInvocationChecker(java.util.concurrent.Callable<java.lang.Boolean> moreInvocationChecker)
void
setParameterInvocationCount(int n)
void
setPriority(int priority)
void
setRetryAnalyzerClass(java.lang.Class<? extends IRetryAnalyzer> clazz)
void
setSkipFailedInvocations(boolean skip)
void
setTestClass(ITestClass cls)
Sets the test class having this method.void
setThreadPoolSize(int threadPoolSize)
void
setTimeOut(long timeOut)
boolean
skipFailedInvocations()
java.lang.String
toString()
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.testng.ITestNGMethod
getAttributes, getDataProviderMethod, getFactoryMethodParamsInfo, getParameterTypes, hasAfterGroupsConfiguration, hasBeforeGroupsConfiguration, isDataDriven
-
-
-
-
Field Detail
-
m_method
private final ITestNGMethod m_method
-
m_javaMethod
private final java.lang.reflect.Method m_javaMethod
-
m_id
private java.lang.String m_id
-
m_currentInvocationCount
private int m_currentInvocationCount
-
m_date
private long m_date
-
m_invocationNumbers
private java.util.List<java.lang.Integer> m_invocationNumbers
-
m_failedInvocationNumbers
private final java.util.List<java.lang.Integer> m_failedInvocationNumbers
-
-
Constructor Detail
-
ClonedMethod
public ClonedMethod(ITestNGMethod method, java.lang.reflect.Method javaMethod)
-
-
Method Detail
-
addMethodDependedUpon
public void addMethodDependedUpon(java.lang.String methodName)
- Specified by:
addMethodDependedUpon
in interfaceITestNGMethod
-
canRunFromClass
public boolean canRunFromClass(IClass testClass)
- Specified by:
canRunFromClass
in interfaceITestNGMethod
- Parameters:
testClass
- The test class- Returns:
- true if this ITestNGMethod can be invoked from within IClass.
-
getAfterGroups
public java.lang.String[] getAfterGroups()
- Specified by:
getAfterGroups
in interfaceITestNGMethod
-
getBeforeGroups
public java.lang.String[] getBeforeGroups()
- Specified by:
getBeforeGroups
in interfaceITestNGMethod
-
getCurrentInvocationCount
public int getCurrentInvocationCount()
- Specified by:
getCurrentInvocationCount
in interfaceITestNGMethod
-
getDate
public long getDate()
- Specified by:
getDate
in interfaceITestNGMethod
-
getDescription
public java.lang.String getDescription()
- Specified by:
getDescription
in interfaceITestNGMethod
-
setDescription
public void setDescription(java.lang.String description)
- Specified by:
setDescription
in interfaceITestNGMethod
-
getEnabled
public boolean getEnabled()
- Specified by:
getEnabled
in interfaceITestNGMethod
-
getGroups
public java.lang.String[] getGroups()
- Specified by:
getGroups
in interfaceITestNGMethod
- Returns:
- The groups this method belongs to, possibly added to the groups declared on the class.
-
getGroupsDependedUpon
public java.lang.String[] getGroupsDependedUpon()
- Specified by:
getGroupsDependedUpon
in interfaceITestNGMethod
- Returns:
- The groups this method depends on, possibly added to the groups declared on the class.
-
getId
public java.lang.String getId()
- Specified by:
getId
in interfaceITestNGMethod
- Returns:
- The id of the thread this method was run in.
-
getInstanceHashCodes
public long[] getInstanceHashCodes()
Description copied from interface:ITestNGMethod
Needed for serialization.- Specified by:
getInstanceHashCodes
in interfaceITestNGMethod
- Returns:
- The hashcode of instances
-
getInstance
public java.lang.Object getInstance()
- Specified by:
getInstance
in interfaceITestNGMethod
-
getInvocationCount
public int getInvocationCount()
- Specified by:
getInvocationCount
in interfaceITestNGMethod
- Returns:
- the number of times this method needs to be invoked.
-
getInvocationTimeOut
public long getInvocationTimeOut()
- Specified by:
getInvocationTimeOut
in interfaceITestNGMethod
- Returns:
- The time under which all invocationCount methods need to complete by.
-
getMethodName
public java.lang.String getMethodName()
Description copied from interface:ITestNGMethod
Returns the method name. This is needed for serialization because methods are not Serializable.- Specified by:
getMethodName
in interfaceITestNGMethod
- Returns:
- the method name.
-
getMethodsDependedUpon
public java.lang.String[] getMethodsDependedUpon()
- Specified by:
getMethodsDependedUpon
in interfaceITestNGMethod
- Returns:
- The methods this method depends on, possibly added to the methods declared on the class.
-
getMissingGroup
public java.lang.String getMissingGroup()
- Specified by:
getMissingGroup
in interfaceITestNGMethod
- Returns:
- If a group was not found.
-
getParameterInvocationCount
public int getParameterInvocationCount()
- Specified by:
getParameterInvocationCount
in interfaceITestNGMethod
-
setMoreInvocationChecker
public void setMoreInvocationChecker(java.util.concurrent.Callable<java.lang.Boolean> moreInvocationChecker)
- Specified by:
setMoreInvocationChecker
in interfaceITestNGMethod
-
hasMoreInvocation
public boolean hasMoreInvocation()
- Specified by:
hasMoreInvocation
in interfaceITestNGMethod
-
getRealClass
public java.lang.Class<?> getRealClass()
- Specified by:
getRealClass
in interfaceITestNGMethod
- Returns:
- The real class on which this method was declared (can be different from getMethod().getDeclaringClass() if the test method was defined in a superclass).
-
getRetryAnalyzer
public IRetryAnalyzer getRetryAnalyzer(ITestResult result)
- Specified by:
getRetryAnalyzer
in interfaceITestNGMethod
-
setRetryAnalyzerClass
public void setRetryAnalyzerClass(java.lang.Class<? extends IRetryAnalyzer> clazz)
- Specified by:
setRetryAnalyzerClass
in interfaceITestNGMethod
-
getRetryAnalyzerClass
public java.lang.Class<? extends IRetryAnalyzer> getRetryAnalyzerClass()
- Specified by:
getRetryAnalyzerClass
in interfaceITestNGMethod
-
getSuccessPercentage
public int getSuccessPercentage()
- Specified by:
getSuccessPercentage
in interfaceITestNGMethod
- Returns:
- the success percentage for this method (between 0 and 100).
-
getTestClass
public ITestClass getTestClass()
- Specified by:
getTestClass
in interfaceITestNGMethod
-
getThreadPoolSize
public int getThreadPoolSize()
- Specified by:
getThreadPoolSize
in interfaceITestNGMethod
- Returns:
- the number of threads to be used when invoking the method on parallel
-
getTimeOut
public long getTimeOut()
- Specified by:
getTimeOut
in interfaceITestNGMethod
- Returns:
- The timeout in milliseconds.
-
setTimeOut
public void setTimeOut(long timeOut)
- Specified by:
setTimeOut
in interfaceITestNGMethod
-
ignoreMissingDependencies
public boolean ignoreMissingDependencies()
- Specified by:
ignoreMissingDependencies
in interfaceITestNGMethod
-
incrementCurrentInvocationCount
public void incrementCurrentInvocationCount()
- Specified by:
incrementCurrentInvocationCount
in interfaceITestNGMethod
-
isAfterClassConfiguration
public boolean isAfterClassConfiguration()
- Specified by:
isAfterClassConfiguration
in interfaceITestNGMethod
- Returns:
- true if this method was annotated with @Configuration and beforeClassMethod = false
-
isAfterGroupsConfiguration
public boolean isAfterGroupsConfiguration()
- Specified by:
isAfterGroupsConfiguration
in interfaceITestNGMethod
-
isAfterMethodConfiguration
public boolean isAfterMethodConfiguration()
- Specified by:
isAfterMethodConfiguration
in interfaceITestNGMethod
- Returns:
- true if this method was annotated with @Configuration and beforeTestMethod = false
-
isAfterSuiteConfiguration
public boolean isAfterSuiteConfiguration()
- Specified by:
isAfterSuiteConfiguration
in interfaceITestNGMethod
- Returns:
- true if this method was annotated with @Configuration and afterSuite = true
-
isAfterTestConfiguration
public boolean isAfterTestConfiguration()
- Specified by:
isAfterTestConfiguration
in interfaceITestNGMethod
- Returns:
true
if this method is an @AfterTest (@Configuration afterTest=true)
-
isAlwaysRun
public boolean isAlwaysRun()
- Specified by:
isAlwaysRun
in interfaceITestNGMethod
- Returns:
- true if this method is alwaysRun=true
-
isBeforeClassConfiguration
public boolean isBeforeClassConfiguration()
- Specified by:
isBeforeClassConfiguration
in interfaceITestNGMethod
- Returns:
- true if this method was annotated with @Configuration and beforeClassMethod = true
-
isBeforeGroupsConfiguration
public boolean isBeforeGroupsConfiguration()
- Specified by:
isBeforeGroupsConfiguration
in interfaceITestNGMethod
-
isBeforeMethodConfiguration
public boolean isBeforeMethodConfiguration()
- Specified by:
isBeforeMethodConfiguration
in interfaceITestNGMethod
- Returns:
- true if this method was annotated with @Configuration and beforeTestMethod = true
-
isBeforeSuiteConfiguration
public boolean isBeforeSuiteConfiguration()
- Specified by:
isBeforeSuiteConfiguration
in interfaceITestNGMethod
- Returns:
- true if this method was annotated with @Configuration and beforeSuite = true
-
isBeforeTestConfiguration
public boolean isBeforeTestConfiguration()
- Specified by:
isBeforeTestConfiguration
in interfaceITestNGMethod
- Returns:
true
if this method is a @BeforeTest (@Configuration beforeTest=true)
-
isTest
public boolean isTest()
- Specified by:
isTest
in interfaceITestNGMethod
- Returns:
- true if this method was annotated with @Test
-
setDate
public void setDate(long date)
- Specified by:
setDate
in interfaceITestNGMethod
-
setId
public void setId(java.lang.String id)
- Specified by:
setId
in interfaceITestNGMethod
-
setIgnoreMissingDependencies
public void setIgnoreMissingDependencies(boolean ignore)
- Specified by:
setIgnoreMissingDependencies
in interfaceITestNGMethod
-
setInvocationCount
public void setInvocationCount(int count)
- Specified by:
setInvocationCount
in interfaceITestNGMethod
-
setMissingGroup
public void setMissingGroup(java.lang.String group)
- Specified by:
setMissingGroup
in interfaceITestNGMethod
-
setParameterInvocationCount
public void setParameterInvocationCount(int n)
- Specified by:
setParameterInvocationCount
in interfaceITestNGMethod
-
setSkipFailedInvocations
public void setSkipFailedInvocations(boolean skip)
- Specified by:
setSkipFailedInvocations
in interfaceITestNGMethod
-
setTestClass
public void setTestClass(ITestClass cls)
Description copied from interface:ITestNGMethod
Sets the test class having this method. This is not necessarily the declaring class.- Specified by:
setTestClass
in interfaceITestNGMethod
- Parameters:
cls
- The test class having this method.
-
setThreadPoolSize
public void setThreadPoolSize(int threadPoolSize)
- Specified by:
setThreadPoolSize
in interfaceITestNGMethod
-
skipFailedInvocations
public boolean skipFailedInvocations()
- Specified by:
skipFailedInvocations
in interfaceITestNGMethod
-
clone
public ClonedMethod clone()
- Specified by:
clone
in interfaceITestNGMethod
- Overrides:
clone
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getInvocationNumbers
public java.util.List<java.lang.Integer> getInvocationNumbers()
Description copied from interface:ITestNGMethod
Which invocation numbers of this method should be used (only applicable if it uses a data provider). If this value is an empty list, use all the values returned from the data provider. These values are read from the XML file in the<include invocationNumbers="...">
tag.- Specified by:
getInvocationNumbers
in interfaceITestNGMethod
- Returns:
- The list of invocation numbers
-
setInvocationNumbers
public void setInvocationNumbers(java.util.List<java.lang.Integer> count)
- Specified by:
setInvocationNumbers
in interfaceITestNGMethod
-
getFailedInvocationNumbers
public java.util.List<java.lang.Integer> getFailedInvocationNumbers()
- Specified by:
getFailedInvocationNumbers
in interfaceITestNGMethod
-
addFailedInvocationNumber
public void addFailedInvocationNumber(int number)
Description copied from interface:ITestNGMethod
The list of invocation numbers that failed, which is only applicable for methods that have a data provider.- Specified by:
addFailedInvocationNumber
in interfaceITestNGMethod
- Parameters:
number
- The invocation number that failed
-
getPriority
public int getPriority()
Description copied from interface:ITestNGMethod
The scheduling priority. Lower priorities get scheduled first.- Specified by:
getPriority
in interfaceITestNGMethod
- Returns:
- The priority value
-
setPriority
public void setPriority(int priority)
- Specified by:
setPriority
in interfaceITestNGMethod
-
getInterceptedPriority
public int getInterceptedPriority()
- Specified by:
getInterceptedPriority
in interfaceITestNGMethod
-
setInterceptedPriority
public void setInterceptedPriority(int priority)
- Specified by:
setInterceptedPriority
in interfaceITestNGMethod
-
getXmlTest
public XmlTest getXmlTest()
- Specified by:
getXmlTest
in interfaceITestNGMethod
- Returns:
- the XmlTest this method belongs to.
-
getConstructorOrMethod
public ConstructorOrMethod getConstructorOrMethod()
- Specified by:
getConstructorOrMethod
in interfaceITestNGMethod
-
findMethodParameters
public java.util.Map<java.lang.String,java.lang.String> findMethodParameters(XmlTest test)
- Specified by:
findMethodParameters
in interfaceITestNGMethod
- Parameters:
test
- - TheXmlTest
object.- Returns:
- the parameters found in the include tag, if any
-
getQualifiedName
public java.lang.String getQualifiedName()
Description copied from interface:ITestNGMethod
getRealClass().getName() + "." + getMethodName()- Specified by:
getQualifiedName
in interfaceITestNGMethod
- Returns:
- qualified name for this method
-
-