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 fields
    org.elasticsearch.Version esVersion()
    Returns the current es version as a string
    org.elasticsearch.Version masterVersion()  
    java.lang.Object response​(java.lang.String path)
    Extracts a specific value from the last saved response
    Stash stash()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.IOException
      Calls 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.IOException
      Calls 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.IOException
      Extracts 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

      public Stash stash()
    • esVersion

      public org.elasticsearch.Version esVersion()
      Returns the current es version as a string
    • masterVersion

      public org.elasticsearch.Version masterVersion()