java.lang.Object
com.agentforge4j.testkit.scenario.ScenarioScriptLoader
Loads a scenario's fake-llm script into a
FakeScript from a JSON string, a filesystem
path, or a classpath resource. The catalog scenario script.json is the fake-llm script
schema verbatim, so it is parsed directly by FakeScriptParser with no adapter.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a loader with a defaultFakeScriptParser.ScenarioScriptLoader(FakeScriptParser parser) Creates a loader over the given parser. -
Method Summary
Modifier and TypeMethodDescriptionfromClasspath(String resource) Reads and parses a script from a classpath resource.Parses a script from a JSON string.Reads and parses a script from a filesystem path.
-
Constructor Details
-
ScenarioScriptLoader
public ScenarioScriptLoader()Creates a loader with a defaultFakeScriptParser. -
ScenarioScriptLoader
Creates a loader over the given parser.- Parameters:
parser- the script parser; must not benull
-
-
Method Details
-
fromJson
Parses a script from a JSON string.- Parameters:
json- the script JSON; must not be blank- Returns:
- the parsed script
- Throws:
IllegalArgumentException- if the JSON is malformed or violates the script schema
-
fromPath
Reads and parses a script from a filesystem path.- Parameters:
path- the script file; must not benull- Returns:
- the parsed script
-
fromClasspath
Reads and parses a script from a classpath resource.- Parameters:
resource- the absolute classpath resource path (e.g./scenarios/x/script.json); must not be blank- Returns:
- the parsed script
-