- Type Parameters:
T- the type of application used by this load test.
public interface LoadTest<T>
Specifies a class for running multiple application instances for load testing purposes.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceHandles running a load test applicationstatic interfaceBuilds aLoadTest.static interfaceSpecifies a load test usage scenario. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a batch of applications.voidaddShutdownListener(Runnable listener) is.codion.common.value.Value<Integer>is.codion.common.value.ValueObserver<Integer>static <T> LoadTest.Builder<T>booleanisScenarioEnabled(String scenarioName) is.codion.common.value.Value<Integer>This value controls the factor with which to multiply the think time when logging in, this helps spread the application logins when creating a batch of application.is.codion.common.value.Value<Integer>is.codion.common.value.Value<Integer>name()is.codion.common.state.Statepaused()voidRemoves one batch of applications.is.codion.common.event.EventObserver<LoadTest.Scenario.Result>voidsetScenarioEnabled(String scenarioName, boolean enabled) voidSets the random chooser weight for the given scenariovoidshutdown()Removes all applications and exitsvoidstop(LoadTest.ApplicationRunner applicationRunner) is.codion.common.value.Value<is.codion.common.user.User>user()
-
Field Details
-
DEFAULT_MINIMUM_THINKTIME
static final int DEFAULT_MINIMUM_THINKTIME- See Also:
-
DEFAULT_MAXIMUM_THINKTIME
static final int DEFAULT_MAXIMUM_THINKTIME- See Also:
-
DEFAULT_LOGIN_DELAY_FACTOR
static final int DEFAULT_LOGIN_DELAY_FACTOR- See Also:
-
DEFAULT_APPLICATION_BATCH_SIZE
static final int DEFAULT_APPLICATION_BATCH_SIZE- See Also:
-
-
Method Details
-
shutdown
void shutdown()Removes all applications and exits -
stop
- Parameters:
applicationRunner- the application runner to stop
-
user
is.codion.common.value.Value<is.codion.common.user.User> user()- Returns:
- the user to use when initializing new application instances
-
name
- Returns:
- the load test name, or an empty Optional if none is available
-
setWeight
Sets the random chooser weight for the given scenario- Parameters:
scenarioName- the name of the scenarioweight- the new weight to assign to the scenario
-
isScenarioEnabled
- Parameters:
scenarioName- the scenario name- Returns:
- true if the scenario is enabled
-
setScenarioEnabled
- Parameters:
scenarioName- the scenario nameenabled- true if the scenario should be enabled
-
scenarios
Collection<LoadTest.Scenario<T>> scenarios()- Returns:
- the usage scenarios used by this load test.
-
scenario
- Parameters:
scenarioName- the scenario name- Returns:
- the usage scenario
-
resultEvent
is.codion.common.event.EventObserver<LoadTest.Scenario.Result> resultEvent()- Returns:
- an observer notified each time a run result is produced
-
addShutdownListener
- Parameters:
listener- a listener notified when this load test model has been shutdown.
-
applicationBatchSize
is.codion.common.value.Value<Integer> applicationBatchSize()- Returns:
- the Value controlling the number of applications to initialize per batch
-
paused
is.codion.common.state.State paused()- Returns:
- the state controlling the paused state of this load test
-
maximumThinkTime
is.codion.common.value.Value<Integer> maximumThinkTime()- Returns:
- the Value controlling the maximum number of milliseconds that should pass between work requests
-
minimumThinkTime
is.codion.common.value.Value<Integer> minimumThinkTime()- Returns:
- the Value controlling the minimum number of milliseconds that should pass between work requests
-
loginDelayFactor
is.codion.common.value.Value<Integer> loginDelayFactor()This value controls the factor with which to multiply the think time when logging in, this helps spread the application logins when creating a batch of application.- Returns:
- the Value controlling the factor with which to multiply the think time when logging in
-
applications
Map<LoadTest.ApplicationRunner,T> applications()- Returns:
- the applications
-
applicationCount
is.codion.common.value.ValueObserver<Integer> applicationCount()- Returns:
- an observer notified each time the application count changes
-
addApplicationBatch
void addApplicationBatch()Adds a batch of applications.- See Also:
-
removeApplicationBatch
void removeApplicationBatch()Removes one batch of applications.- See Also:
-
scenarioChooser
ItemRandomizer<LoadTest.Scenario<T>> scenarioChooser()- Returns:
- the randomizer used to select scenarios
-
builder
static <T> LoadTest.Builder<T> builder(Function<is.codion.common.user.User, T> applicationFactory, Consumer<T> closeApplication) - Type Parameters:
T- the application type- Parameters:
applicationFactory- the application factorycloseApplication- closes an application- Returns:
- a new builder
-