Package org.mockserver.model
Class Delay
java.lang.Object
org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
org.mockserver.model.Delay
- Author:
- jamesdbloom
-
Constructor Summary
ConstructorsConstructorDescriptionDelay(TimeUnit timeUnit, long value, DelayDistribution distribution) Delay(TimeUnit timeUnit, long value, DelayDistribution distribution, String template, HttpTemplate.TemplateType templateType) -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic Delaystatic DelaylonggetValue()booleanstatic Delaystatic Delaymilliseconds(long value) static Delayminutes(long value) longstatic Delayseconds(long value) static Delaytemplate(HttpTemplate.TemplateType templateType, String template) Creates an opt-in delay whose duration in milliseconds is computed by rendering the supplied template against the incoming request (the same request context exposed to response templates, e.g.static DelayMethods inherited from class org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
equals, fieldsExcludedFromEqualsAndHashCode, hashCode, toString
-
Constructor Details
-
Delay
-
Delay
-
Delay
public Delay(TimeUnit timeUnit, long value, DelayDistribution distribution, String template, HttpTemplate.TemplateType templateType)
-
-
Method Details
-
milliseconds
-
seconds
-
minutes
-
delay
-
uniform
-
logNormal
-
gaussian
-
template
Creates an opt-in delay whose duration in milliseconds is computed by rendering the supplied template against the incoming request (the same request context exposed to response templates, e.g.request.body,request.headers). The rendered output is parsed as a millisecond value, so e.g. larger request payloads can respond more slowly. When the template renders to a non-numeric or blank value the delay falls back to the staticvalue/timeUnitpair (which defaults to zero). OnlyHttpTemplate.TemplateType.VELOCITYandHttpTemplate.TemplateType.MUSTACHEare supported. -
getTimeUnit
-
getValue
public long getValue() -
getDistribution
-
getTemplate
-
getTemplateType
-
hasTemplate
public boolean hasTemplate()- Returns:
truewhen this delay computes its duration from a request template (seetemplate(HttpTemplate.TemplateType, String)).
-
sampleValueMillis
public long sampleValueMillis() -
applyDelay
public void applyDelay()
-