Record Class ScenarioFile
This shape is the contract between the designer and everything else: it is what a saved
acemq-workload-<name>-<date>.json contains, what the studio sends over its API, and
what the command line will read. One shape, so a scenario drawn on a screen runs unchanged in a
pipeline — which is the only reason a designer is worth building rather than another form over
a YAML file.
Records rather than the builder objects because a file is data. The builder is convenient in Java and hostile to a JSON parser, and a format that mirrors a fluent API is a format nobody can write by hand.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final recordstatic final recordAn exchange.static final recordWhat a node is asked to prove, in a file.static final recordstatic final recordA queue, its bindings and its consumers.static final recordHow to reach a broker over TLS. -
Constructor Summary
ConstructorsConstructorDescriptionScenarioFile(String name, String description, String broker, String management, List<ScenarioFile.ExchangeJson> exchanges, List<ScenarioFile.QueueJson> queues, List<ScenarioFile.ProducerJson> producers, String warmup, String runFor, Boolean declare, Map<String, Object> ui) A file written beforesecurity:existed.ScenarioFile(String name, String description, String broker, String management, List<ScenarioFile.ExchangeJson> exchanges, List<ScenarioFile.QueueJson> queues, List<ScenarioFile.ProducerJson> producers, String warmup, String runFor, Boolean declare, ScenarioFile.SecurityJson security, Map<String, Object> ui) Creates an instance of aScenarioFilerecord class. -
Method Summary
Modifier and TypeMethodDescriptionbroker()Returns the value of thebrokerrecord component.declare()Returns the value of thedeclarerecord component.Returns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theexchangesrecord component.static StringThe file name a saved scenario gets.final inthashCode()Returns a hash code value for this object.Returns the value of themanagementrecord component.name()Returns the value of thenamerecord component.static ScenarioFilestatic ScenarioFileof(Scenario scenario, String broker, String management, Map<String, Object> ui, ScenarioFile.SecurityJson security) The same, keeping a security block the caller already has.Returns the value of theproducersrecord component.queues()Returns the value of thequeuesrecord component.runFor()Returns the value of therunForrecord component.security()Returns the value of thesecurityrecord component.final StringtoString()Returns a string representation of this record class.ui()Returns the value of theuirecord component.warmup()Returns the value of thewarmuprecord component.
-
Constructor Details
-
ScenarioFile
public ScenarioFile(String name, String description, String broker, String management, List<ScenarioFile.ExchangeJson> exchanges, List<ScenarioFile.QueueJson> queues, List<ScenarioFile.ProducerJson> producers, String warmup, String runFor, Boolean declare, Map<String, Object> ui) A file written beforesecurity:existed. -
ScenarioFile
public ScenarioFile(String name, String description, String broker, String management, List<ScenarioFile.ExchangeJson> exchanges, List<ScenarioFile.QueueJson> queues, List<ScenarioFile.ProducerJson> producers, String warmup, String runFor, Boolean declare, ScenarioFile.SecurityJson security, Map<String, Object> ui) Creates an instance of aScenarioFilerecord class.- Parameters:
name- the value for thenamerecord componentdescription- the value for thedescriptionrecord componentbroker- the value for thebrokerrecord componentmanagement- the value for themanagementrecord componentexchanges- the value for theexchangesrecord componentqueues- the value for thequeuesrecord componentproducers- the value for theproducersrecord componentwarmup- the value for thewarmuprecord componentrunFor- the value for therunForrecord componentdeclare- the value for thedeclarerecord componentsecurity- the value for thesecurityrecord componentui- the value for theuirecord component
-
-
Method Details
-
toScenario
- Returns:
- this file as a scenario the engine can run
-
of
public static ScenarioFile of(Scenario scenario, String broker, String management, Map<String, Object> ui) - Parameters:
scenario- a scenariobroker- the URL it was designed against, or nullmanagement- its management URL, or nullui- whatever the designer wants to remember about layout- Returns:
- the same scenario as a file
-
of
public static ScenarioFile of(Scenario scenario, String broker, String management, Map<String, Object> ui, ScenarioFile.SecurityJson security) The same, keeping a security block the caller already has.A
Scenariodoes not carry one: how to reach a broker is a property of the file and of the run, not of the shape being run. So the four-argument form cannot preserve what it was never given, and silently wrotesecurity: nullinto every file it produced -- which is fine while nothing saves a file that had one, and stops being fine the moment something does. A queue'sbroker:survives that round trip; TLS did not, and the asymmetry made the loss look like it could not be happening.The password is not part of what survives:
ScenarioFile.SecurityJsondoes not serialise it.- Parameters:
scenario- what to write downbroker- the URL it ran against, or nullmanagement- the management URL, or nullui- whatever the interface wants to remember, or nullsecurity- the security block to keep, or null when there is none- Returns:
- the file
-
fileName
The file name a saved scenario gets.Named for what it is and when it was saved, because the alternative is six files called
scenario (3).json.- Parameters:
name- the scenario's nameat- when it was saved- Returns:
- a file name
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
broker
Returns the value of thebrokerrecord component.- Returns:
- the value of the
brokerrecord component
-
management
Returns the value of themanagementrecord component.- Returns:
- the value of the
managementrecord component
-
exchanges
Returns the value of theexchangesrecord component.- Returns:
- the value of the
exchangesrecord component
-
queues
Returns the value of thequeuesrecord component.- Returns:
- the value of the
queuesrecord component
-
producers
Returns the value of theproducersrecord component.- Returns:
- the value of the
producersrecord component
-
warmup
Returns the value of thewarmuprecord component.- Returns:
- the value of the
warmuprecord component
-
runFor
Returns the value of therunForrecord component.- Returns:
- the value of the
runForrecord component
-
declare
Returns the value of thedeclarerecord component.- Returns:
- the value of the
declarerecord component
-
security
Returns the value of thesecurityrecord component.- Returns:
- the value of the
securityrecord component
-
ui
Returns the value of theuirecord component.- Returns:
- the value of the
uirecord component
-