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

public abstract class AbstractUsageScenario<T> extends Object implements UsageScenario<T>
An abstract usage scenario.
  • Constructor Details

    • AbstractUsageScenario

      protected AbstractUsageScenario()
      Instantiates a new UsageScenario using the simple class name as scenario name
    • AbstractUsageScenario

      protected AbstractUsageScenario(String name)
      Instantiates a new UsageScenario with the given name
      Parameters:
      name - the scenario name
    • AbstractUsageScenario

      protected AbstractUsageScenario(String name, int maximumTimeMs)
      Instantiates a new UsageScenario with the given name
      Parameters:
      name - the scenario name
      maximumTimeMs - the maximum time in milliseconds this scenario should take to run
  • Method Details

    • name

      public final String name()
      Specified by:
      name in interface UsageScenario<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 interface UsageScenario<T>
      Returns:
      the warning time
    • successfulRunCount

      public final int successfulRunCount()
      Specified by:
      successfulRunCount in interface UsageScenario<T>
      Returns:
      the number of times this scenario has been successfully run
    • unsuccessfulRunCount

      public final int unsuccessfulRunCount()
      Specified by:
      unsuccessfulRunCount in interface UsageScenario<T>
      Returns:
      the number of times this scenario has been unsuccessfully run
    • totalRunCount

      public final int totalRunCount()
      Specified by:
      totalRunCount in interface UsageScenario<T>
      Returns:
      the total number of times this scenario has been run
    • exceptions

      public final List<Throwable> exceptions()
      Specified by:
      exceptions in interface UsageScenario<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 interface UsageScenario<T>
    • clearExceptions

      public final void clearExceptions()
      Description copied from interface: UsageScenario
      Clears the exceptions that have been collected so far
      Specified by:
      clearExceptions in interface UsageScenario<T>
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • run

      public final UsageScenario.RunResult run(T application)
      Description copied from interface: UsageScenario
      Runs this scenario with the given application
      Specified by:
      run in interface UsageScenario<T>
      Parameters:
      application - the application to use
      Returns:
      the run result
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • defaultWeight

      public int defaultWeight()
      Specified by:
      defaultWeight in interface UsageScenario<T>
      Returns:
      the default weight for this scenario, 1 by default
    • perform

      protected abstract void perform(T application) throws Exception
      Runs a set of actions on the given application.
      Parameters:
      application - the application
      Throws:
      Exception - in case of an exception
    • prepare

      protected void prepare(T application)
      Called before this scenario is run, override to prepare the application for each run
      Parameters:
      application - the application
    • cleanup

      protected void cleanup(T application)
      Called after this scenario has been run, override to clean up the application after each run
      Parameters:
      application - the application