Class LoadShape


public class LoadShape extends ObjectWithJsonToString
A declarative, named load shape on a LoadProfile. A shape is a high-level description of a common traffic pattern (a SPIKE, a flight of STAIRS, a RAMP_HOLD) that LoadShapes.expand(org.mockserver.load.LoadShape) turns into the ordinary list of LoadStages the orchestrator already runs. A profile carries either an explicit stages list or a shape — when a shape is set and no explicit stages are present, LoadProfile.getStages() returns the expanded stages, so the orchestrator needs no changes.

Each shape drives one LoadShape.Metric: LoadShape.Metric.VU (concurrent virtual users, closed model) or LoadShape.Metric.RATE (arrival rate in iterations/second, open model). The numeric parameters are interpreted per LoadShape.Type — only the subset each type needs is read (see each type's javadoc on LoadShape.Type); the rest are ignored.

Parameters read per shape type
TypeParameters
LoadShape.Type.SPIKE baseline, peak, rampUpMillis, holdMillis, rampDownMillis, optional recoveryHoldMillis (hold at baseline after the down-ramp). curve shapes both ramps.
LoadShape.Type.STAIRS start, step, steps (count), stepDurationMillis (each step holds at its level — pure steps, no inter-step ramp).
LoadShape.Type.RAMP_HOLD target, rampMillis, holdMillis, optional curve (default RampCurve.LINEAR) — ramp 0 → target then hold target.
  • Constructor Details

    • LoadShape

      public LoadShape()
  • Method Details

    • loadShape

      public static LoadShape loadShape()
    • spike

      public static LoadShape spike(LoadShape.Metric metric, double baseline, double peak, long rampUpMillis, long holdMillis, long rampDownMillis)
      A SPIKE shape (no recovery hold).
    • stairs

      public static LoadShape stairs(LoadShape.Metric metric, double start, double step, int steps, long stepDurationMillis)
      A STAIRS shape.
    • rampHold

      public static LoadShape rampHold(LoadShape.Metric metric, double target, long rampMillis, long holdMillis)
      A RAMP_HOLD shape using RampCurve.LINEAR.
    • getType

      public LoadShape.Type getType()
    • withType

      public LoadShape withType(LoadShape.Type type)
    • getMetric

      public LoadShape.Metric getMetric()
    • withMetric

      public LoadShape withMetric(LoadShape.Metric metric)
    • getCurve

      public RampCurve getCurve()
    • withCurve

      public LoadShape withCurve(RampCurve curve)
    • getBaseline

      public Double getBaseline()
    • withBaseline

      public LoadShape withBaseline(Double baseline)
    • getPeak

      public Double getPeak()
    • withPeak

      public LoadShape withPeak(Double peak)
    • getRampUpMillis

      public Long getRampUpMillis()
    • withRampUpMillis

      public LoadShape withRampUpMillis(Long rampUpMillis)
    • getHoldMillis

      public Long getHoldMillis()
    • withHoldMillis

      public LoadShape withHoldMillis(Long holdMillis)
    • getRampDownMillis

      public Long getRampDownMillis()
    • withRampDownMillis

      public LoadShape withRampDownMillis(Long rampDownMillis)
    • getRecoveryHoldMillis

      public Long getRecoveryHoldMillis()
    • withRecoveryHoldMillis

      public LoadShape withRecoveryHoldMillis(Long recoveryHoldMillis)
    • getStart

      public Double getStart()
    • withStart

      public LoadShape withStart(Double start)
    • getStep

      public Double getStep()
    • withStep

      public LoadShape withStep(Double step)
    • getSteps

      public Integer getSteps()
    • withSteps

      public LoadShape withSteps(Integer steps)
    • getStepDurationMillis

      public Long getStepDurationMillis()
    • withStepDurationMillis

      public LoadShape withStepDurationMillis(Long stepDurationMillis)
    • getTarget

      public Double getTarget()
    • withTarget

      public LoadShape withTarget(Double target)
    • getRampMillis

      public Long getRampMillis()
    • withRampMillis

      public LoadShape withRampMillis(Long rampMillis)