org.jminor.common.model
Class LoadTestModel.AbstractUsageScenario<T>

java.lang.Object
  extended by org.jminor.common.model.LoadTestModel.AbstractUsageScenario<T>
All Implemented Interfaces:
Serializable, LoadTest.UsageScenario<T>
Direct Known Subclasses:
EntityLoadTestModel.AbstractEntityUsageScenario, QueryLoadTestModel.QueryScenario
Enclosing class:
LoadTestModel<T>

public abstract static class LoadTestModel.AbstractUsageScenario<T>
extends Object
implements LoadTest.UsageScenario<T>

An abstract usage scenario.

See Also:
Serialized Form

Constructor Summary
LoadTestModel.AbstractUsageScenario()
          Instantiates a new UsageScenario using the simple class name as scenario name
LoadTestModel.AbstractUsageScenario(String name)
          Instantiates a new UsageScenario with the given name
 
Method Summary
protected  void cleanup(Object application)
          Called after this scenario has been run, override to cleanup the application after each run
 void clearExceptions()
          Clears the exceptions that have been collected so far
 boolean equals(Object obj)
          
 int getDefaultWeight()
          
 List<LoadTest.ScenarioException> getExceptions()
          
 String getName()
          
 int getSuccessfulRunCount()
          
 int getTotalRunCount()
          
 int getUnsuccessfulRunCount()
          
 int hashCode()
          
protected abstract  void performScenario(T application)
          Runs a set of actions on the given application.
protected  void prepare(Object application)
          Called before this scenario is run, override to prepare the application for each run
 void resetRunCount()
          Resets the run counters
 void run(T application)
          Runs this scenario with the given application
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LoadTestModel.AbstractUsageScenario

public LoadTestModel.AbstractUsageScenario()
Instantiates a new UsageScenario using the simple class name as scenario name


LoadTestModel.AbstractUsageScenario

public LoadTestModel.AbstractUsageScenario(String name)
Instantiates a new UsageScenario with the given name

Parameters:
name - the scenario name
Method Detail

getName

public final String getName()

Specified by:
getName in interface LoadTest.UsageScenario<T>
Returns:
the name of this scenario

getSuccessfulRunCount

public final int getSuccessfulRunCount()

Specified by:
getSuccessfulRunCount in interface LoadTest.UsageScenario<T>
Returns:
the number of times this scenario has been successfully run

getUnsuccessfulRunCount

public final int getUnsuccessfulRunCount()

Specified by:
getUnsuccessfulRunCount in interface LoadTest.UsageScenario<T>
Returns:
the number of times this scenario has been unsuccessfully run

getTotalRunCount

public final int getTotalRunCount()

Specified by:
getTotalRunCount in interface LoadTest.UsageScenario<T>
Returns:
the total number of times this scenario has been run

getExceptions

public List<LoadTest.ScenarioException> getExceptions()

Specified by:
getExceptions in interface LoadTest.UsageScenario<T>
Returns:
any exceptions that have occurred during a run

resetRunCount

public final void resetRunCount()
Resets the run counters

Specified by:
resetRunCount in interface LoadTest.UsageScenario<T>

clearExceptions

public void clearExceptions()
Clears the exceptions that have been collected so far

Specified by:
clearExceptions in interface LoadTest.UsageScenario<T>

toString

public final String toString()
Overrides:
toString in class Object
Returns:
the name of this scenario

run

public final void run(T application)
               throws LoadTest.ScenarioException
Runs this scenario with the given application

Specified by:
run in interface LoadTest.UsageScenario<T>
Parameters:
application - the application to use
Throws:
LoadTest.ScenarioException - in case of an exception

hashCode

public final int hashCode()

Overrides:
hashCode in class Object

equals

public final boolean equals(Object obj)

Overrides:
equals in class Object

getDefaultWeight

public int getDefaultWeight()

Specified by:
getDefaultWeight in interface LoadTest.UsageScenario<T>
Returns:
the default weight for this scenario, 1 by default

performScenario

protected abstract void performScenario(T application)
                                 throws LoadTest.ScenarioException
Runs a set of actions on the given application.

Parameters:
application - the application
Throws:
ScenarioException - in case of an exception
LoadTest.ScenarioException

prepare

protected void prepare(Object application)
Called before this scenario is run, override to prepare the application for each run

Parameters:
application - the application

cleanup

protected void cleanup(Object application)
Called after this scenario has been run, override to cleanup the application after each run

Parameters:
application - the application