net.sourceforge.basher
Class BasherContext

java.lang.Object
  extended by net.sourceforge.basher.BasherContext

public class BasherContext
extends Object

Defines the context parameters for a performance or testing run.

Version:
$Revision$
Author:
Johan Lindquist

Constructor Summary
BasherContext()
           
 
Method Summary
 boolean equals(Object o)
           
 String getBeanShellScriptDirectory()
          Retrieves the Beanshell directory that should be used for initialization scripts.
 long getCooldownDuration()
          Retrieves the duration (in seconds) of the cooldown run.
 String getExcludes()
          Sets the includes expression for tasks to be included in the run defined by this context.
 ExecutionType getExecutionType()
           
 String getIncludes()
          Retrieves the includes expression for tasks to be included in the run defined by this context.
 int getInitialNumberThreads()
          Retrieves the number of threads which the run should start with.
 long getMarkAverageInterval()
          Retrieves the interval between average calculations (in seconds).
 int getMaxNumberThreads()
          Retrieves the maximum number of threads allowed in the run.
 String getName()
          Retrieves the name of this Basher context.
 ProfilerContext getProfilerContext()
           
 String getReportDirectory()
          Retrieves the report directory to be used for the running.
If not set, this defaults to 'target/basher-reports'.
 long getRunDuration()
          Retrieves the duration (in seconds) of the run.
 String getRunIdentifier()
          Retrieves the run identifier to use.
 long getSetupDuration()
          Retrieves the duration (in seconds) of the setup run.
 long getStartCollectionFrom()
          Retrieves the time (in seconds) when statistics collection should begin.
 long getStopCollectionAfter()
          Retrieves the time (in seconds) when statistics collection should stop.
 int getTaskMaxDelay()
          Retrieves the maximum delay between running tasks.
 int getTaskMinDelay()
          Retrieves the minimum delay between running tasks.
 long getTeardownDuration()
          Sets the duration (in seconds) of the tear-down run.
 int getThreadIncrementCount()
          Sets the number of threads should be added for each threadIncrementInterval allowed in the run.
If not set, this defaults to 0 (don't add any)
 int getThreadIncrementInterval()
          Retrieves the interval (in seconds) between each attempt at adding more threads.
 long getWarmupDuration()
          Retrieves the duration (in seconds) of the warm-up run.
 boolean isManuallyControlled()
          Flag indicating whether or not the run is controlled by the user, through the APIs or BeanShell.
 void setBeanShellScriptDirectory(String beanShellScriptDirectory)
          Sets the Beanshell directory that should be used for initialization scripts.
 void setCooldownDuration(long cooldownDuration)
          Sets the duration (in seconds) of the cooldown run.
 void setExcludes(String excludes)
          Sets the includes expression for tasks to be included in the run defined by this context.
 void setExecutionType(ExecutionType executionType)
           
 void setIncludes(String includes)
          Sets the includes expression for tasks to be included in the run defined by this context.
 void setInitialNumberThreads(int initialNumberThreads)
          Sets the number of threads which the run should start with.
If not set, this defaults to 10
 void setManuallyControlled(boolean manuallyControlled)
          Flag indicating whether or not the run is controlled by the user.
 void setMarkAverageInterval(long markAverageInterval)
          Sets the interval between average calculations (in seconds).
 void setMaxNumberThreads(int maxNumberThreads)
          Sets the maximum number of threads allowed in the run.
 void setName(String name)
          Sets the name of this Basher context.
 void setProfilerContext(ProfilerContext profilerContext)
           
 void setReportDirectory(String reportDirectory)
          Sets the report directory to be used for the running.
If not set, this defaults to 'target/basher-reports'.
 void setRunDuration(long runDuration)
          Sets the duration (in seconds) of the run.
 void setRunIdentifier(String runIdentifier)
          Specifies the run identifier to use.
 void setSetupDuration(long setupDuration)
          Sets the duration (in seconds) of the setup run.
 void setStartCollectionFrom(long startCollectionFrom)
          Sets the time (in seconds) when statistics collection should begin.
 void setStopCollectionAfter(long stopCollectionAfter)
          Sets the time (in seconds) when statistics collection should stop.
 void setTaskMaxDelay(int taskMaxDelay)
          Sets the maximum delay between running tasks.
 void setTaskMinDelay(int taskMinDelay)
          Sets the minimum delay between running tasks.
 void setTeardownDuration(long teardownDuration)
          Sets the duration (in seconds) of the tear-down run.
 void setThreadIncrementCount(int threadIncrementCount)
          Retrieves the number of threads should be added for each threadIncrementInterval allowed in the run.
If not set, this defaults to 0 (don't add any)
 void setThreadIncrementInterval(int threadIncrementInterval)
          Sets the interval (in seconds) between each attempt at adding more threads.
 void setWarmupDuration(long warmupDuration)
          Sets the duration (in seconds) of the warm-up run.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasherContext

public BasherContext()
Method Detail

getIncludes

public String getIncludes()
Retrieves the includes expression for tasks to be included in the run defined by this context. Defined as a comma separated strings of task names (fully qualified package + task name). Wild-cards allowed. e.g. An expression of net.sourceforge.* would retrieve all tasks under the net.sourceforge package

Returns:
The include expression

setIncludes

public void setIncludes(String includes)
Sets the includes expression for tasks to be included in the run defined by this context. Defined as a comma separated strings of task names (fully qualified package + task name). Wild-cards allowed. e.g. An expression of net.sourceforge.* would retrieve all tasks under the net.sourceforge package

Parameters:
includes - The include expression

getExcludes

public String getExcludes()
Sets the includes expression for tasks to be included in the run defined by this context. Defined as a comma separated strings of task names (fully qualified package + task name). Wild-cards allowed. e.g. An expression of net.sourceforge.* would retrieve all tasks under the net.sourceforge package

Returns:
The exclude expression

setExcludes

public void setExcludes(String excludes)
Sets the includes expression for tasks to be included in the run defined by this context. Defined as a comma separated strings of task names (fully qualified package + task name). Wild-cards allowed. e.g. An expression of net.sourceforge.* would retrieve all tasks under the net.sourceforge package


getWarmupDuration

public long getWarmupDuration()
Retrieves the duration (in seconds) of the warm-up run. The length defined here defines how long tasks (and the JVM) are run as part of warm-up.
If not set, this default to 0 seconds (no warm-up).

Returns:
The duration (in seconds) of the setup run

setWarmupDuration

public void setWarmupDuration(long warmupDuration)
Sets the duration (in seconds) of the warm-up run. The length defined here defines how long tasks (and the JVM) are run as part of the warm-up phase.
If not set, this default to 0 seconds (no warm-up).

Parameters:
warmupDuration - The duration (in seconds) of the setup run

getTeardownDuration

public long getTeardownDuration()
Sets the duration (in seconds) of the tear-down run. The length defined here defines how long tasks (and the JVM) are run as part of the tear-down phase.
If not set, this default to 0 seconds (no tear-down).

Returns:
The duration (in seconds) of the setup run

setTeardownDuration

public void setTeardownDuration(long teardownDuration)
Sets the duration (in seconds) of the tear-down run. The length defined here defines how long tasks (and the JVM) are run as part of the tear-down phase.
If not set, this default to 0 seconds (no tear-down).

Parameters:
teardownDuration - The duration (in seconds) of the setup run

getBeanShellScriptDirectory

public String getBeanShellScriptDirectory()
Retrieves the Beanshell directory that should be used for initialization scripts. This is relative to the working directory or a full path.
If not set, this defaults to 'src/test/basher-scripts'.

Returns:
The path of the Beanshell directory

setBeanShellScriptDirectory

public void setBeanShellScriptDirectory(String beanShellScriptDirectory)
Sets the Beanshell directory that should be used for initialization scripts. This is relative to the working directory or a full path.
If not set, this defaults to 'src/test/basher-scripts'.

Parameters:
beanShellScriptDirectory - The BeanShell directory to use

getStartCollectionFrom

public long getStartCollectionFrom()
Retrieves the time (in seconds) when statistics collection should begin. This time is relative to the start of the run.

Returns:
The time, relative from the start of the run, when collection should start

setStartCollectionFrom

public void setStartCollectionFrom(long startCollectionFrom)
Sets the time (in seconds) when statistics collection should begin. This time is relative to the start of the run.

Parameters:
startCollectionFrom - The time, relative from the start of the run, when collection should start

getStopCollectionAfter

public long getStopCollectionAfter()
Retrieves the time (in seconds) when statistics collection should stop. This time is relative to the start of the run.

Returns:
The time, relative from the start of the run, when collection should stop

setStopCollectionAfter

public void setStopCollectionAfter(long stopCollectionAfter)
Sets the time (in seconds) when statistics collection should stop. This time is relative to the start of the run.

Parameters:
stopCollectionAfter - The time, relative from the start of the run, when collection should stop

getInitialNumberThreads

public int getInitialNumberThreads()
Retrieves the number of threads which the run should start with. Defaults to 10

Returns:
The number of threads the run should start with

setInitialNumberThreads

public void setInitialNumberThreads(int initialNumberThreads)
Sets the number of threads which the run should start with.
If not set, this defaults to 10

Parameters:
initialNumberThreads - The number of threads the run should start with

getMaxNumberThreads

public int getMaxNumberThreads()
Retrieves the maximum number of threads allowed in the run. Defaults to 0 (unlimited). This is mainly taken into account in combination with setThreadIncrementCount(int) and setThreadIncrementInterval(int).

Returns:
The number of threads the run should start with

setMaxNumberThreads

public void setMaxNumberThreads(int maxNumberThreads)
Sets the maximum number of threads allowed in the run. This is mainly taken into account in combination with setThreadIncrementCount(int) and setThreadIncrementInterval(int).
If not set, this defaults to 0 (unlimited).

Parameters:
maxNumberThreads - The number of threads the run should start with

getThreadIncrementCount

public int getThreadIncrementCount()
Sets the number of threads should be added for each threadIncrementInterval allowed in the run.
If not set, this defaults to 0 (don't add any)

Returns:
The number of threads to add

setThreadIncrementCount

public void setThreadIncrementCount(int threadIncrementCount)
Retrieves the number of threads should be added for each threadIncrementInterval allowed in the run.
If not set, this defaults to 0 (don't add any)

Parameters:
threadIncrementCount - The number of threads to add

getThreadIncrementInterval

public int getThreadIncrementInterval()
Retrieves the interval (in seconds) between each attempt at adding more threads. This will be done up till the maxNumberThreads is reached.
If not set, this defaults to 0 (don't increment)

Returns:
The interval between adding threads (in seconds)

setThreadIncrementInterval

public void setThreadIncrementInterval(int threadIncrementInterval)
Sets the interval (in seconds) between each attempt at adding more threads. This will be done, adding number of threads each time, until the maxNumberThreads limit is reached.
If not set, this defaults to 0 (don't increment)

Parameters:
threadIncrementInterval - The interval between adding threads (in seconds)

getTaskMinDelay

public int getTaskMinDelay()
Retrieves the minimum delay between running tasks. This is mainly used to stagger the tasks.
If not set, this defaults to 0 (no delay).

Returns:
The minimum task delay (in milliseconds)

setTaskMinDelay

public void setTaskMinDelay(int taskMinDelay)
Sets the minimum delay between running tasks. This is mainly used to stagger the tasks.
If not set, this defaults to 0 (no delay).

Parameters:
taskMinDelay - The maximum task delay (in milliseconds)

getTaskMaxDelay

public int getTaskMaxDelay()
Retrieves the maximum delay between running tasks. This is mainly used to stagger the tasks.
If not set, this defaults to 0 (no delay).

Returns:
The maximum task delay (in milliseconds)

setTaskMaxDelay

public void setTaskMaxDelay(int taskMaxDelay)
Sets the maximum delay between running tasks. This is mainly used to stagger the tasks.
If not set, this defaults to 0 (no delay).

Parameters:
taskMaxDelay - The maximum task delay (in milliseconds)

getMarkAverageInterval

public long getMarkAverageInterval()
Retrieves the interval between average calculations (in seconds).

Returns:
The time between average calculations (in seconds)

setMarkAverageInterval

public void setMarkAverageInterval(long markAverageInterval)
Sets the interval between average calculations (in seconds).

Parameters:
markAverageInterval - The time between average calculations (in seconds)

getName

public String getName()
Retrieves the name of this Basher context.

Returns:
The name of the context

setName

public void setName(String name)
Sets the name of this Basher context.

Parameters:
name - The name of the Basher context

getReportDirectory

public String getReportDirectory()
Retrieves the report directory to be used for the running.
If not set, this defaults to 'target/basher-reports'.

Returns:
The report directory

setReportDirectory

public void setReportDirectory(String reportDirectory)
Sets the report directory to be used for the running.
If not set, this defaults to 'target/basher-reports'.

Parameters:
reportDirectory - The report directory

getSetupDuration

public long getSetupDuration()
Retrieves the duration (in seconds) of the setup run. The length defined here defines how long tasks (and the JVM) are run (and how 'warmed up' the JVM could be before starting statistics collection).
If not set, this default to 10 seconds.

Returns:
The duration (in seconds) of the setup run

setSetupDuration

public void setSetupDuration(long setupDuration)
Sets the duration (in seconds) of the setup run. The length defined here defines how long tasks (and the JVM) are run (and how 'warmed up' the JVM could be before starting statistics collection).
If not set, this default to 10 seconds.

Parameters:
setupDuration - The duration (in seconds) of the setup run

getRunDuration

public long getRunDuration()
Retrieves the duration (in seconds) of the run. The length defined here defines how long statistics are collected for.

Returns:
The duration (in seconds) of the run

setRunDuration

public void setRunDuration(long runDuration)
Sets the duration (in seconds) of the run. The length defined here defines how long statistics are collected for.

Parameters:
runDuration - The duration (in seconds) of the run

getCooldownDuration

public long getCooldownDuration()
Retrieves the duration (in seconds) of the cooldown run. The length defined here defines how long tasks are run for after stopping collection.
If not set, this default to 10 seconds.

Returns:
The duration (in seconds) of the setup run

setCooldownDuration

public void setCooldownDuration(long cooldownDuration)
Sets the duration (in seconds) of the cooldown run. The length defined here defines how long tasks are run for after stopping collection.
If not set, this default to 10 seconds.

Parameters:
cooldownDuration - The duration (in seconds) of the setup run

getExecutionType

public ExecutionType getExecutionType()
Returns:

setExecutionType

public void setExecutionType(ExecutionType executionType)
Parameters:
executionType -

getRunIdentifier

public String getRunIdentifier()
Retrieves the run identifier to use. If not specified, one will be generated.

Returns:
The run identifier

setRunIdentifier

public void setRunIdentifier(String runIdentifier)
Specifies the run identifier to use. If not set, one will be generated

Parameters:
runIdentifier - The run identifier

isManuallyControlled

public boolean isManuallyControlled()
Flag indicating whether or not the run is controlled by the user, through the APIs or BeanShell. This defaults to false, runs being controlled by Basher.

Returns:
True if the user controls the runs, otherwise false

setManuallyControlled

public void setManuallyControlled(boolean manuallyControlled)
Flag indicating whether or not the run is controlled by the user. This defaults to false, runs being controlled by Basher.

Parameters:
manuallyControlled - True if the user should control the runs, otherwise false

getProfilerContext

public ProfilerContext getProfilerContext()
Returns:

setProfilerContext

public void setProfilerContext(ProfilerContext profilerContext)
Parameters:
profilerContext -

equals

public boolean equals(Object o)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2006-2010 Basher Team. All Rights Reserved.