Class AsyncApiHttpExpectationGenerator
java.lang.Object
org.mockserver.async.controlplane.AsyncApiHttpExpectationGenerator
Generates HTTP mock
Expectations from a parsed AsyncAPI spec so that the
example messages each channel describes can be served over plain HTTP — without
standing up a live Kafka / MQTT / AMQP broker.
For each channel in the spec one GET expectation is produced that responds
with the schema-aware example payload (the same payload the broker publisher would
send), at a path derived from the channel name. This is the import analogue of the
broker-publishing flow in AsyncApiControlPlaneImpl.load(String); it reuses
the existing AsyncApiParser and MessageExampleGenerator rather than
re-deriving examples.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionParse the request body and return the generated expectations.generateSerialized(String requestBody) Parse the request body and return the generated expectations serialized as a JSON array string in the standard MockServer expectation format.
-
Constructor Details
-
AsyncApiHttpExpectationGenerator
public AsyncApiHttpExpectationGenerator()
-
-
Method Details
-
generateSerialized
Parse the request body and return the generated expectations serialized as a JSON array string in the standard MockServer expectation format.- Parameters:
requestBody- a plain AsyncAPI spec (JSON/YAML) or a JSON wrapper{"spec": "...", "channelPathPrefix": "..."}- Returns:
- a JSON array string of expectations
- Throws:
IllegalArgumentException- if the body is empty or the spec cannot be parsed
-
generate
Parse the request body and return the generated expectations.- Parameters:
requestBody- a plain AsyncAPI spec (JSON/YAML) or a JSON wrapper{"spec": "...", "channelPathPrefix": "..."}- Returns:
- one expectation per channel
- Throws:
IllegalArgumentException- if the body is empty or the spec cannot be parsed
-