new ResponseProviderByFile(file, options)
Provides responses by a single file with multiple responses defined in the file
Responses are loaded asynchronously but if a response is requested before being loaded
it will be immediately loaded and then skipped by the asychronous processing.
Parameters:
Name |
Type |
Description |
file |
String
|
The file to read all responses from |
options |
Object
|
Options for the file loading
Properties
Name |
Type |
Attributes |
Default |
Description |
preload |
Boolean
|
<optional>
|
false
|
Should the file be preloaded or only loaded when a response is requested. It is generally
more efficient to load only when the response is requested. |
fileEncoding |
String
|
<optional>
|
utf8
|
The encoding of the files |
responseBuilder |
ResponseBuilder
|
<optional>
|
DefaultResponseBuilder
|
The ResponseBuilder to use when building responses |
|
- Implements:
- Source:
- See:
-
Methods
processItem(items, itemId, fileName, options)
Processes the specific item and returns the result
Parameters:
Name |
Type |
Description |
items |
Map
|
Map of the items being processed |
itemId |
String
|
The Id of the item to process |
fileName |
String
|
The name of the file being processed |
options |
Object
|
Any options that are being passed to the ItemProcessor (can be null) |
- Implements:
- Source:
processItems(items, fileName, options)
Process a file that may have many responses in it. Converts each json response to a
Response and results
an array of the resulting responses
Parameters:
Name |
Type |
Description |
items |
Map
|
Map of the items being processed |
fileName |
String
|
The name of the file being processed |
options |
Object
|
Any options that are being passed to the ItemProcessor (can be null) |
- Implements:
- Source: