|
JTR 4.0 API Documentation | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjtr.runners.AbstractRunnerAncestor
public abstract class AbstractRunnerAncestor
This base abstract class is the ancestor common to every JTR abstract runner. It is not meant to be available to test-suite developers.
Field Summary | |
---|---|
protected int |
epoch
|
protected org.apache.log4j.Logger |
logger
|
protected IParamsAssigner |
paramsAssigner
|
protected RunnerPool |
pool
|
Constructor Summary | |
---|---|
AbstractRunnerAncestor()
|
Method Summary | |
---|---|
IRunnerClean |
clean()
This method cleans all the configurations/parameters assigned to the current IRunner . |
protected void |
doRunTest()
This method is in charge of actually starting the test by calling the user defined test() method over the user-defined
runner instances. |
void |
enrichOutcome(IOutcome outcome)
This abstract method must be used either when the user needs to enrich the given outcome with a JTR UserObject or in case the default IOutcomeFactory
has been replaced with a custom one. |
java.lang.String |
getDefaultName()
Get the default name provided by this.getClass().getName() |
EnterpriseConfig |
getEnterprise()
Return the enterprise configuration assigned to the current IRunner |
int |
getEpoch()
Return the current epoch assigned to the IRunner |
int |
getFailures()
Get the number of failures |
int |
getInstanceCount()
Get the number of instances that must be active, according to the jtr.xml, during the test-suite. |
java.lang.String |
getName()
Return the name of the IRunner |
IOutcomeFactory |
getOutcomeFactory()
Get the current IOutcomeTable |
ParametersMap |
getParameters()
Return the set of runtime parameters configured for the IRunner |
IParamsAssigner |
getParamsAssigner()
Get the IParamsAssigner in charge of assigning parameters
to the current IRunner |
RunnerPool |
getPool()
Get the pool this IRunner belongs to |
int |
getRuns()
Return the number of runs assigned to the IRunner |
long |
getSleepTime()
Get the sleep runDuration assigned to this IRunner |
int |
getSuccesses()
Get the number of successes. |
TestOutcomeTable |
getTestOutcomeTable()
Return the current TestOutcomeTable |
protected void |
handleFailure(int run,
java.lang.Throwable t)
Whenever an exception is caught during the execution of the test() method of the IRunner interface, the
AbstractRunner takes care of instantiating a new
IOutcome and of adding it to the current
TestOutcomeTable .Once this steps have been performed, the receiveFailureNotification(Throwable,String)" of the
IRunner interface is called. |
protected void |
initializeTimers()
Thie method is required to prevent that errors happening before the doRunTest() method is invoked have negative impacts on the computation of the time spent during tests. |
void |
setEnterprise(EnterpriseConfig enterprise)
Assign the given enterprise configuration to the current IRunner |
void |
setEpoch(int epoch)
Assign the current epoch to the IRunner |
void |
setInstanceCount(int i)
Set the number of instances that must be active, according to the jtr.xml, during the test-suite. |
void |
setName(java.lang.String name)
Set the name of the IRunner . |
void |
setOutcomeFactory(IOutcomeFactory outcomeFactory)
Set the current IOutcomeTable |
void |
setParameters(ParametersMap params)
Provides the IRunner with its runtime parameters. |
void |
setParamsAssigner(IParamsAssigner paramsAssigner)
Set the IParamsAssigner in charge of assigning parameters
to the current IRunner |
IRunnerPooled |
setPool(RunnerPool pool)
Set the pool this IRunner will belong to |
void |
setRuns(int runs)
Set the number of runs assigned to the IRunner |
void |
setSleepTime(long sleepTime)
Get the sleep runDuration assigned to this IRunner |
void |
setTestCompletionListener(ITestCompletionListener testComplLsnr)
This method assigns an ITestCompletionListener instance
to a runner in CLEAN state. |
void |
setTestOutcomeTable(TestOutcomeTable testOutcomeTable)
Set the current TestOutcomeTable |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface jtr.runners.IRunner |
---|
getCurrentRun, receiveFailureNotification, test |
Methods inherited from interface jtr.runners.IRunnerPooled |
---|
cleanupResources, run |
Field Detail |
---|
protected int epoch
protected IParamsAssigner paramsAssigner
protected RunnerPool pool
protected org.apache.log4j.Logger logger
Constructor Detail |
---|
public AbstractRunnerAncestor()
Method Detail |
---|
public IRunnerClean clean()
IRunner
. It should be overridden by an
application-level runner using the delegation pattern for adding the
clean up of resources. This method is invoked every time an
IRunner
implementation completes one of its runs. It is
used for reinitializing a runner between two consecutive runs if this is
required by the associated assignment policy (i.e. cyclic).IRunnerPooled.cleanupResources()
method instead.
CLEAN
state.IRunnerPooled.cleanupResources()
public void setEpoch(int epoch)
IRunner
setEpoch
in interface IRunnerPooled
epoch
- The current epochpublic int getEpoch()
IRunner
getEpoch
in interface IRunnerPooled
public void setName(java.lang.String name)
IRunner
. This is by default its FQN
followed by an increasing integer stating that this is the i-th
IRunner
of that class.
setName
in interface IRunnerClean
name
- The namepublic java.lang.String getName()
IRunner
getName
in interface IRunnerClean
public java.lang.String getDefaultName()
this.getClass().getName()
getDefaultName
in interface IRunnerClean
public EnterpriseConfig getEnterprise()
IRunner
getEnterprise
in interface IRunnerClean
public void setEnterprise(EnterpriseConfig enterprise)
IRunner
setEnterprise
in interface IRunnerClean
enterprise
- The enterprise configurationpublic void setInstanceCount(int i)
setInstanceCount
in interface IRunnerClean
i
- The number of instancespublic int getInstanceCount()
getInstanceCount
in interface IRunnerClean
public int getRuns()
IRunner
getRuns
in interface IRunnerClean
public void setRuns(int runs)
IRunner
setRuns
in interface IRunnerClean
runs
- The number of runspublic long getSleepTime()
IRunner
getSleepTime
in interface IRunnerClean
public void setSleepTime(long sleepTime)
IRunner
setSleepTime
in interface IRunnerClean
sleepTime
- The sleep runDurationpublic void setParameters(ParametersMap params)
IRunner
with its runtime parameters.
setParameters
in interface IRunnerClean
params
- The parameterspublic ParametersMap getParameters()
IRunner
getParameters
in interface IRunnerClean
public IRunnerPooled setPool(RunnerPool pool)
IRunner
will belong to
setPool
in interface IRunnerParameterized
pool
- The pool
POOLED
statepublic RunnerPool getPool()
IRunner
belongs to
getPool
in interface IRunnerPooled
public IParamsAssigner getParamsAssigner()
IParamsAssigner
in charge of assigning parameters
to the current IRunner
getParamsAssigner
in interface IRunnerClean
public void setParamsAssigner(IParamsAssigner paramsAssigner)
IParamsAssigner
in charge of assigning parameters
to the current IRunner
setParamsAssigner
in interface IRunnerClean
paramsAssigner
- IParamsAssignerpublic int getFailures()
getFailures
in interface IRunner
public int getSuccesses()
getSuccesses
in interface IRunner
public TestOutcomeTable getTestOutcomeTable()
TestOutcomeTable
getTestOutcomeTable
in interface IRunnerClean
public void setTestOutcomeTable(TestOutcomeTable testOutcomeTable)
TestOutcomeTable
setTestOutcomeTable
in interface IRunnerClean
testOutcomeTable
- TestOutcomeTablepublic IOutcomeFactory getOutcomeFactory()
IOutcomeTable
getOutcomeFactory
in interface IRunnerClean
public void setOutcomeFactory(IOutcomeFactory outcomeFactory)
IOutcomeTable
setOutcomeFactory
in interface IRunnerClean
outcomeFactory
- IOutcomeFactorypublic void setTestCompletionListener(ITestCompletionListener testComplLsnr)
ITestCompletionListener
instance
to a runner in CLEAN
state. This assignment can be performed
for just one time in a JTR test-session for each runner instance.null
for runner instances started on JTR passive-nodes.
setTestCompletionListener
in interface IRunnerClean
testComplLsnr
- The listener instanceprotected final void doRunTest() throws java.lang.Throwable
test()
method over the user-defined
runner instances. Doing this, runDuration information is collected and
at the end of the run, a new IOutcome
instance is obtained
from the configured IOutcomeFactory
. Thus the outcome
is passed to the enrichOutcome()
method.enrichOutcome()
method.enrichOutcome()
method can alse be used to
set a user-message into each run's outcome.
java.lang.Throwable
protected final void initializeTimers()
protected final void handleFailure(int run, java.lang.Throwable t)
test()
method of the IRunner
interface, the
AbstractRunner
takes care of instantiating a new
IOutcome
and of adding it to the current
TestOutcomeTable
.receiveFailureNotification(Throwable,String)"
of the
IRunner
interface is called. At this point your custom
IRunner
gets notified of the exception and can decide what
to do with it.
run
- The run of the exceptiont
- The exceptioinpublic void enrichOutcome(IOutcome outcome)
IOutcomeFactory
has been replaced with a custom one. Responsability of this method is filling in the
provided IOutcome
instance. That instance will then be put into the
TestOutcomeTable
by the JTR runtime.
outcome
- The empty outcome of a single run
|
The JTR Project is licensed under GPL version 2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |