Package org.elasticsearch.test.rest.yaml
Class ClientYamlTestExecutionContext
java.lang.Object
org.elasticsearch.test.rest.yaml.ClientYamlTestExecutionContext
public class ClientYamlTestExecutionContext
extends java.lang.Object
Execution context passed across the REST tests.
Holds the REST client used to communicate with elasticsearch.
Caches the last obtained test response and allows to stash part of it within variables
that can be used as input values in following requests.
-
Method Summary
Modifier and Type Method Description ClientYamlTestResponse
callApi(java.lang.String apiName, java.util.Map<java.lang.String,java.lang.String> params, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> bodies, java.util.Map<java.lang.String,java.lang.String> headers)
Calls an elasticsearch api with the parameters and request body provided as arguments.ClientYamlTestResponse
callApi(java.lang.String apiName, java.util.Map<java.lang.String,java.lang.String> params, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> bodies, java.util.Map<java.lang.String,java.lang.String> headers, org.elasticsearch.client.NodeSelector nodeSelector)
Calls an elasticsearch api with the parameters and request body provided as arguments.void
clear()
Clears the last obtained response and the stashed fieldsorg.elasticsearch.Version
esVersion()
Returns the current es version as a stringorg.elasticsearch.Version
masterVersion()
java.lang.Object
response(java.lang.String path)
Extracts a specific value from the last saved responseStash
stash()
-
Method Details
-
callApi
public ClientYamlTestResponse callApi(java.lang.String apiName, java.util.Map<java.lang.String,java.lang.String> params, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> bodies, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOExceptionCalls an elasticsearch api with the parameters and request body provided as arguments. Saves the obtained response in the execution context.- Throws:
java.io.IOException
-
callApi
public ClientYamlTestResponse callApi(java.lang.String apiName, java.util.Map<java.lang.String,java.lang.String> params, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> bodies, java.util.Map<java.lang.String,java.lang.String> headers, org.elasticsearch.client.NodeSelector nodeSelector) throws java.io.IOExceptionCalls an elasticsearch api with the parameters and request body provided as arguments. Saves the obtained response in the execution context.- Throws:
java.io.IOException
-
response
public java.lang.Object response(java.lang.String path) throws java.io.IOExceptionExtracts a specific value from the last saved response- Throws:
java.io.IOException
-
clear
public void clear()Clears the last obtained response and the stashed fields -
stash
-
esVersion
public org.elasticsearch.Version esVersion()Returns the current es version as a string -
masterVersion
public org.elasticsearch.Version masterVersion()
-