Package org.elasticsearch.test.rest.yaml
Class ClientYamlTestExecutionContext
java.lang.Object
org.elasticsearch.test.rest.yaml.ClientYamlTestExecutionContext
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.
-
Constructor Summary
ConstructorsConstructorDescriptionClientYamlTestExecutionContext(ClientYamlTestCandidate clientYamlTestCandidate, ClientYamlTestClient clientYamlTestClient, boolean randomizeContentType, Set<String> nodesVersions, TestFeatureService testFeatureService, Set<String> osSet) ClientYamlTestExecutionContext(ClientYamlTestCandidate clientYamlTestCandidate, ClientYamlTestClient clientYamlTestClient, boolean randomizeContentType, Set<String> nodesVersions, TestFeatureService testFeatureService, Set<String> osSet, BiPredicate<ClientYamlSuiteRestApi, ClientYamlSuiteRestApi.Path> pathPredicate) -
Method Summary
Modifier and TypeMethodDescriptioncallApi(String apiName, Map<String, String> params, List<Map<String, Object>> bodies, Map<String, String> headers) Calls an elasticsearch api with the parameters and request body provided as arguments.callApi(String apiName, Map<String, String> params, List<Map<String, Object>> bodies, Map<String, String> headers, NodeSelector nodeSelector) Calls an elasticsearch api with the parameters and request body provided as arguments.voidclear()Clears the last obtained response and the stashed fieldsprotected ClientYamlTestClientclientYamlTestClient(String apiName) clusterHasCapabilities(String method, String path, String parametersString, String capabilitiesString, boolean any) booleanclusterHasFeature(String featureId, boolean any) os()Extracts a specific value from the last saved responsestash()
-
Constructor Details
-
ClientYamlTestExecutionContext
public ClientYamlTestExecutionContext(ClientYamlTestCandidate clientYamlTestCandidate, ClientYamlTestClient clientYamlTestClient, boolean randomizeContentType, Set<String> nodesVersions, TestFeatureService testFeatureService, Set<String> osSet) -
ClientYamlTestExecutionContext
public ClientYamlTestExecutionContext(ClientYamlTestCandidate clientYamlTestCandidate, ClientYamlTestClient clientYamlTestClient, boolean randomizeContentType, Set<String> nodesVersions, TestFeatureService testFeatureService, Set<String> osSet, BiPredicate<ClientYamlSuiteRestApi, ClientYamlSuiteRestApi.Path> pathPredicate)
-
-
Method Details
-
callApi
public ClientYamlTestResponse callApi(String apiName, Map<String, String> params, List<Map<String, throws IOExceptionObject>> bodies, Map<String, String> headers) Calls an elasticsearch api with the parameters and request body provided as arguments. Saves the obtained response in the execution context.- Throws:
IOException
-
callApi
public ClientYamlTestResponse callApi(String apiName, Map<String, String> params, List<Map<String, throws IOExceptionObject>> bodies, Map<String, String> headers, NodeSelector nodeSelector) Calls an elasticsearch api with the parameters and request body provided as arguments. Saves the obtained response in the execution context.- Throws:
IOException
-
clientYamlTestClient
-
response
Extracts a specific value from the last saved response- Throws:
IOException
-
clear
public void clear()Clears the last obtained response and the stashed fields -
stash
-
nodesVersions
- Returns:
- the distinct node versions running in the cluster
-
os
-
getClientYamlTestCandidate
-
clusterHasFeature
-
clusterHasCapabilities
-