Description
This method is used to execute a single loop of the GenRocket engine. Use this method when it is absolutely necessary to control each iteration of the data generation life cycle. Also, using this method requires a thorough knowledge of the API.
Requirements
- The GenRocket API requires loading a valid Scenario in order to do security validation of the organization, user and licensing.
Exceptions
The following GenRocket exceptions may be thrown by this method:
- If the runtime instance is currently running another Scenario.
- If the Scenario cannot be validated for any number of reasons.
- If the User profile cannot be validated for any number of reasons.
Runtime Method Signature
Use this method signature when directly accessing the GenRocket binary runtime.
public void scenarioExecuteLoop()
REST/Socket Payload Request
Use this API JSON request payload when making an API call to the GenRocket REST or Socket Engine.
{ "interfaceType": "Manual", "method": "scenarioExecuteLoop", "parameters": { } }
REST/Socket Payload Successful Payload Response
The API JSON response payload for this method will be empty.
{ "responseType": "OK", "data": "" }
Example Usage
In the example Groovy code below, the processData method does the following:
1. References an API instance for a given Scenario by retrieving the reference from a map of Scenarios via the domainName parameter.
2. Makes an API call to return the list of attribute name via the domainName parameter.
3. Removes the id attribute name from the list of attribute names.
4. Traverses the list of attribute names
a. Retrieves the value of for the current attributeName from the data map.
b. Concatenates the domainName with the attributeName to create the attribute's canonicalName
c. Replace the Attribute's Generator with a ConstantGen Generator with the new value.
5. Makes an API call to execute one loop of the Scenario.
void processData(String domainName, Map<String, String> data) { final EngineManual api = scenarios.get(domainName) final List<String> attributes = api.attributes(domainName) attributes.remove('id') attributes.each { attributeName -> final String value = data[attributeName] final String canonicalName = "${domainName}.${attributeName}".toString() api.generatorReplace(canonicalName, ConstantGen, 0, false, [value: value]) } api.scenarioExecuteLoop() }