Class LoadTestModel<T>

    • Field Detail

      • DEFAULT_CHART_DATA_UPDATE_INTERVAL_MS

        public static final int DEFAULT_CHART_DATA_UPDATE_INTERVAL_MS
        See Also:
        Constant Field Values
      • LOG

        protected static final org.slf4j.Logger LOG
      • RANDOM

        protected static final Random RANDOM
    • Constructor Detail

      • LoadTestModel

        public LoadTestModel​(User user,
                             Collection<? extends UsageScenario<T>> usageScenarios,
                             int maximumThinkTime,
                             int loginDelayFactor,
                             int applicationBatchSize)
        Constructs a new LoadTestModel.
        Parameters:
        user - the default user to use when initializing applications
        usageScenarios - the usage scenarios to use
        maximumThinkTime - the maximum think time, by default the minimum think time is max / 2
        loginDelayFactor - the value with which to multiply the think time when delaying login
        applicationBatchSize - the number of applications to add in a batch
    • Method Detail

      • getUser

        public final User getUser()
        Specified by:
        getUser in interface LoadTest<T>
        Returns:
        the user to use when initializing new application instances
      • setUser

        public final void setUser​(User user)
        Specified by:
        setUser in interface LoadTest<T>
        Parameters:
        user - the user to use when initializing new application instances
      • title

        public String title()
        Description copied from interface: LoadTest
        The title of this LoadTest
        Specified by:
        title in interface LoadTest<T>
        Returns:
        the title
      • usageScenario

        public final UsageScenario<T> usageScenario​(String usageScenarioName)
        Specified by:
        usageScenario in interface LoadTest<T>
        Parameters:
        usageScenarioName - the scenario name
        Returns:
        the usage scenario
      • setWeight

        public final void setWeight​(String scenarioName,
                                    int weight)
        Description copied from interface: LoadTest
        Sets the random chooser weight for the given scenario
        Specified by:
        setWeight in interface LoadTest<T>
        Parameters:
        scenarioName - the name of the scenario
        weight - the new weight to assign to the scenario
      • isScenarioEnabled

        public final boolean isScenarioEnabled​(String scenarioName)
        Specified by:
        isScenarioEnabled in interface LoadTest<T>
        Parameters:
        scenarioName - the scenario name
        Returns:
        true if the scenario is enabled
      • setScenarioEnabled

        public final void setScenarioEnabled​(String scenarioName,
                                             boolean enabled)
        Specified by:
        setScenarioEnabled in interface LoadTest<T>
        Parameters:
        scenarioName - the scenario name
        enabled - true if the scenario should be enabled
      • scenarioDurationDataset

        public final org.jfree.data.xy.IntervalXYDataset scenarioDurationDataset​(String name)
        Specified by:
        scenarioDurationDataset in interface LoadTest<T>
        Parameters:
        name - the scenario name
        Returns:
        a dataset plotting the average scenario duration
      • thinkTimeDataset

        public final org.jfree.data.xy.XYDataset thinkTimeDataset()
        Specified by:
        thinkTimeDataset in interface LoadTest<T>
        Returns:
        a dataset plotting the think time
      • numberOfApplicationsDataset

        public final org.jfree.data.xy.XYDataset numberOfApplicationsDataset()
        Specified by:
        numberOfApplicationsDataset in interface LoadTest<T>
        Returns:
        a dataset plotting the number of active applications
      • usageScenarioDataset

        public final org.jfree.data.xy.XYDataset usageScenarioDataset()
        Specified by:
        usageScenarioDataset in interface LoadTest<T>
        Returns:
        a dataset plotting the number of runs each usage scenario is being run per second
      • usageScenarioFailureDataset

        public final org.jfree.data.xy.XYDataset usageScenarioFailureDataset()
        Specified by:
        usageScenarioFailureDataset in interface LoadTest<T>
        Returns:
        a dataset plotting the failure rate of each usage scenario
      • memoryUsageDataset

        public final org.jfree.data.xy.XYDataset memoryUsageDataset()
        Specified by:
        memoryUsageDataset in interface LoadTest<T>
        Returns:
        a dataset plotting the memory usage of this load test model
      • systemLoadDataset

        public final org.jfree.data.xy.XYDataset systemLoadDataset()
        Specified by:
        systemLoadDataset in interface LoadTest<T>
        Returns:
        a dataset plotting the system load of this load test model
      • resetChartData

        public final void resetChartData()
        Description copied from interface: LoadTest
        Resets the accumulated chart data
        Specified by:
        resetChartData in interface LoadTest<T>
      • getUpdateInterval

        public final int getUpdateInterval()
        Specified by:
        getUpdateInterval in interface LoadTest<T>
        Returns:
        the chart data update interval in milliseconds
      • setUpdateInterval

        public final void setUpdateInterval​(int updateInterval)
        Specified by:
        setUpdateInterval in interface LoadTest<T>
        Parameters:
        updateInterval - the chart data update interval in milliseconds
      • applicationCount

        public final int applicationCount()
        Specified by:
        applicationCount in interface LoadTest<T>
        Returns:
        the number of active applications
      • applicationBatchSizeValue

        public final Value<Integer> applicationBatchSizeValue()
        Specified by:
        applicationBatchSizeValue in interface LoadTest<T>
        Returns:
        the Value controlling the number of applications to initialize per batch
      • pausedState

        public final State pausedState()
        Specified by:
        pausedState in interface LoadTest<T>
        Returns:
        the state controlling the paused state of this load test
      • collectChartDataState

        public final State collectChartDataState()
        Specified by:
        collectChartDataState in interface LoadTest<T>
        Returns:
        the state controlling whether this load test collects chart data
      • shutdown

        public final void shutdown()
        Description copied from interface: LoadTest
        Removes all applications and exits
        Specified by:
        shutdown in interface LoadTest<T>
      • maximumThinkTimeValue

        public final Value<Integer> maximumThinkTimeValue()
        Specified by:
        maximumThinkTimeValue in interface LoadTest<T>
        Returns:
        the Value controlling the maximum number of milliseconds that should pass between work requests
      • minimumThinkTimeValue

        public final Value<Integer> minimumThinkTimeValue()
        Specified by:
        minimumThinkTimeValue in interface LoadTest<T>
        Returns:
        the Value controlling the minimum number of milliseconds that should pass between work requests
      • loginDelayFactorValue

        public final Value<Integer> loginDelayFactorValue()
        Description copied from interface: LoadTest
        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.
        Specified by:
        loginDelayFactorValue in interface LoadTest<T>
        Returns:
        the Value controlling the factor with which to multiply the think time when logging in
      • runScenario

        protected final void runScenario​(UsageScenario<T> usageScenario,
                                         T application)
        Runs the scenario with the given name on the given application
        Parameters:
        usageScenario - the scenario to run
        application - the application to use
      • addShutdownListener

        protected void addShutdownListener​(EventListener listener)
        Parameters:
        listener - a listener notified when this load test model has been shutdown.
      • createApplication

        protected abstract T createApplication()
        Returns:
        an initialized application.
        Throws:
        CancelException - in case the initialization was cancelled
      • disconnectApplication

        protected abstract void disconnectApplication​(T application)
        Parameters:
        application - the application to disconnect