|
JTR 5.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 org.apache.log4j.Logger |
logger
|
| Constructor Summary | |
|---|---|
AbstractRunnerAncestor()
|
|
| Method Summary | |
|---|---|
void |
addMessage(java.lang.String msg)
This method allows the straight addition of a user-message to the outcome of each run. |
void |
afterTest()
|
void |
beforeTest()
This optional method must be implemented if the user-defined runner has to prepare one or more resources before executing its testing-logic. |
IRunnerClean |
clean()
This method cleans all the configurations/parameters assigned to the current IRunner. |
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. |
int |
getCurrentRun()
Read which run the runner is in. |
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 |
java.lang.String |
getFqn()
Obtains the runner FQN. |
int |
getInstanceCount()
Get the number of instances that must be active, according to the jtr.xml, during the test-suite. |
int |
getInstanceID()
Returns the progressive ID assigned to this runner instance at creation time. |
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 |
IStatFunction |
getStatFunction(java.lang.String paramName)
Returns the reference to the IStatFunction implementation
associated with the parameter named paramName, if present,
otherwies null is returned. |
int |
getSuccesses()
Get the number of successes. |
TestOutcomeTable |
getTestOutcomeTable()
Return the current TestOutcomeTable |
java.lang.String |
getUserMessage()
Read the content of the user-message. |
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. |
void |
run()
Implements the logic that manages the execution of every test. |
void |
setCurrentRun(int val)
Tell the runner the current run value. |
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 |
setFqn(java.lang.String name)
Assigns the runner its FQN. |
void |
setInstanceCount(int i)
Set the number of instances that must be active, according to the jtr.xml, during the test-suite. |
void |
setInstanceID(int id)
Sets the progressive ID assigned to this runner instance at creation time. |
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 |
setStatFunction(java.lang.String paramName,
IStatFunction f)
Sets the reference to the IStatFunction implementation
associated with the parameter named paramName. |
void |
setTestCompletionListener(ITestCompletionListener testComplLsnr)
This method assigns an ITestCompletionListener instance
to a runner in CLEAN state. |
void |
setTestOutcomeTable(TestOutcomeTable testOutcomeTable)
Set the current TestOutcomeTable |
protected abstract void |
specializedBeforeRunTest()
This method allows more specialized subclasses to perform preparatory activities right before the actual test is launched. Note: implementations of this method must always be final. |
| 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 |
|---|
receiveFailureNotification, test |
| Methods inherited from interface jtr.runners.IRunnerPooled |
|---|
cleanupResources |
| Field Detail |
|---|
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 IStatFunction getStatFunction(java.lang.String paramName)
IStatFunction implementation
associated with the parameter named paramName, if present,
otherwies null is returned.
getStatFunction in interface IRunnerCleanparamName -
public void setStatFunction(java.lang.String paramName,
IStatFunction f)
IStatFunction implementation
associated with the parameter named paramName.
setStatFunction in interface IRunnerCleanparamName - f - public void setEpoch(int epoch)
IRunner
setEpoch in interface IRunnerCleanepoch - The current epochpublic int getEpoch()
IRunner
getEpoch in interface IRunnerCleanpublic void setCurrentRun(int val)
setCurrentRun in interface IRunnerCleanval - public int getCurrentRun()
getCurrentRun in interface IRunnerCleanpublic 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 IRunnerCleanname - The namepublic java.lang.String getName()
IRunner
getName in interface IRunnerCleanpublic void setFqn(java.lang.String name)
setFqn in interface IRunnerCleanname - The FQNpublic java.lang.String getFqn()
getFqn in interface IRunnerCleanpublic java.lang.String getDefaultName()
this.getClass().getName()
getDefaultName in interface IRunnerCleanpublic EnterpriseConfig getEnterprise()
IRunner
getEnterprise in interface IRunnerCleanpublic void setEnterprise(EnterpriseConfig enterprise)
IRunner
setEnterprise in interface IRunnerCleanenterprise - The enterprise configurationpublic void setInstanceCount(int i)
setInstanceCount in interface IRunnerCleani - The number of instancespublic int getInstanceCount()
getInstanceCount in interface IRunnerCleanpublic void setInstanceID(int id)
[0..n-1] if the jtr.xml
states that there must be n instances of runners belonging to
a given category.
setInstanceID in interface IRunnerCleanid - public int getInstanceID()
[0..n-1] if the jtr.xml
states that there must be n instances of runners belonging to
a given category.
getInstanceID in interface IRunnerCleanpublic int getRuns()
IRunner
getRuns in interface IRunnerCleanpublic void setRuns(int runs)
IRunner
setRuns in interface IRunnerCleanruns - The number of runspublic long getSleepTime()
IRunner
getSleepTime in interface IRunnerCleanpublic void setSleepTime(long sleepTime)
IRunner
setSleepTime in interface IRunnerCleansleepTime - The sleep runDurationpublic void setParameters(ParametersMap params)
IRunner with its runtime parameters.
setParameters in interface IRunnerCleanparams - The parameterspublic ParametersMap getParameters()
IRunner
getParameters in interface IRunnerCleanpublic IRunnerPooled setPool(RunnerPool pool)
IRunner will belong to
setPool in interface IRunnerParameterizedpool - The pool
POOLED statepublic RunnerPool getPool()
IRunner belongs to
getPool in interface IRunnerPooledpublic IParamsAssigner getParamsAssigner()
IParamsAssigner in charge of assigning parameters
to the current IRunner
getParamsAssigner in interface IRunnerCleanpublic void setParamsAssigner(IParamsAssigner paramsAssigner)
IParamsAssigner in charge of assigning parameters
to the current IRunner
setParamsAssigner in interface IRunnerCleanparamsAssigner - IParamsAssignerpublic int getFailures()
getFailures in interface IRunnerpublic int getSuccesses()
getSuccesses in interface IRunnerpublic TestOutcomeTable getTestOutcomeTable()
TestOutcomeTable
getTestOutcomeTable in interface IRunnerCleanpublic void setTestOutcomeTable(TestOutcomeTable testOutcomeTable)
TestOutcomeTable
setTestOutcomeTable in interface IRunnerCleantestOutcomeTable - TestOutcomeTablepublic IOutcomeFactory getOutcomeFactory()
IOutcomeTable
getOutcomeFactory in interface IRunnerCleanpublic void setOutcomeFactory(IOutcomeFactory outcomeFactory)
IOutcomeTable
setOutcomeFactory in interface IRunnerCleanoutcomeFactory - 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 IRunnerCleantestComplLsnr - The listener instancepublic final void run()
IRunner.test() method
over concrete runner instances.jtr.runners.AbstractRunnerAncetor#specializedBeforeRunTest() method that
should always be defined as final.
run in interface java.lang.Runnablerun in interface IRunnerParameterizedrun in interface IRunnerPooledRunnable.run()
protected abstract void specializedBeforeRunTest()
throws java.lang.Throwable
final.
java.lang.Throwable
public void beforeTest()
throws java.lang.Throwable
beforeTest in interface IRunnerPooledjava.lang.Throwable
public void afterTest()
throws java.lang.Throwable
afterTest in interface IRunnerPooledjava.lang.Throwable
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 runpublic void addMessage(java.lang.String msg)
msg - public java.lang.String getUserMessage()
|
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 | |||||||||