Class AbstractUsageScenario<T>
java.lang.Object
is.codion.swing.common.model.tools.loadtest.AbstractUsageScenario<T>
- Type Parameters:
T
- the application type used to run this scenario
- All Implemented Interfaces:
UsageScenario<T>
- Direct Known Subclasses:
AbstractEntityUsageScenario
,QueryLoadTestModel.QueryScenario
An abstract usage scenario.
-
Nested Class Summary
Nested classes/interfaces inherited from interface is.codion.swing.common.model.tools.loadtest.UsageScenario
UsageScenario.RunResult
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Instantiates a new UsageScenario using the simple class name as scenario nameprotected
AbstractUsageScenario
(String name) Instantiates a new UsageScenario with the given nameprotected
AbstractUsageScenario
(String name, int maximumTimeMs) Instantiates a new UsageScenario with the given name -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Called after this scenario has been run, override to clean up the application after each runfinal void
Clears the exceptions that have been collected so farint
final boolean
final int
hashCode()
final int
The maximum time in milliseconds this scenario can run before issuing a warning.final String
name()
protected abstract void
Runs a set of actions on the given application.protected void
Called before this scenario is run, override to prepare the application for each runfinal void
Resets the run countersfinal UsageScenario.RunResult
Runs this scenario with the given applicationfinal int
final String
toString()
final int
final int
-
Constructor Details
-
AbstractUsageScenario
protected AbstractUsageScenario()Instantiates a new UsageScenario using the simple class name as scenario name -
AbstractUsageScenario
Instantiates a new UsageScenario with the given name- Parameters:
name
- the scenario name
-
AbstractUsageScenario
Instantiates a new UsageScenario with the given name- Parameters:
name
- the scenario namemaximumTimeMs
- the maximum time in milliseconds this scenario should take to run
-
-
Method Details
-
name
- Specified by:
name
in interfaceUsageScenario<T>
- Returns:
- the name of this scenario
-
maximumTime
public final int maximumTime()Description copied from interface:UsageScenario
The maximum time in milliseconds this scenario can run before issuing a warning.- Specified by:
maximumTime
in interfaceUsageScenario<T>
- Returns:
- the warning time
-
successfulRunCount
public final int successfulRunCount()- Specified by:
successfulRunCount
in interfaceUsageScenario<T>
- Returns:
- the number of times this scenario has been successfully run
-
unsuccessfulRunCount
public final int unsuccessfulRunCount()- Specified by:
unsuccessfulRunCount
in interfaceUsageScenario<T>
- Returns:
- the number of times this scenario has been unsuccessfully run
-
totalRunCount
public final int totalRunCount()- Specified by:
totalRunCount
in interfaceUsageScenario<T>
- Returns:
- the total number of times this scenario has been run
-
exceptions
- Specified by:
exceptions
in interfaceUsageScenario<T>
- Returns:
- any exceptions that have occurred during a run
-
resetRunCount
public final void resetRunCount()Description copied from interface:UsageScenario
Resets the run counters- Specified by:
resetRunCount
in interfaceUsageScenario<T>
-
clearExceptions
public final void clearExceptions()Description copied from interface:UsageScenario
Clears the exceptions that have been collected so far- Specified by:
clearExceptions
in interfaceUsageScenario<T>
-
toString
-
run
Description copied from interface:UsageScenario
Runs this scenario with the given application- Specified by:
run
in interfaceUsageScenario<T>
- Parameters:
application
- the application to use- Returns:
- the run result
-
hashCode
public final int hashCode() -
equals
-
defaultWeight
public int defaultWeight()- Specified by:
defaultWeight
in interfaceUsageScenario<T>
- Returns:
- the default weight for this scenario, 1 by default
-
perform
Runs a set of actions on the given application.- Parameters:
application
- the application- Throws:
Exception
- in case of an exception
-
prepare
Called before this scenario is run, override to prepare the application for each run- Parameters:
application
- the application
-
cleanup
Called after this scenario has been run, override to clean up the application after each run- Parameters:
application
- the application
-