Class DoSection

java.lang.Object
org.elasticsearch.test.rest.yaml.section.DoSection
All Implemented Interfaces:
ExecutableSection

public class DoSection extends Object implements ExecutableSection
Represents a do section: - do: catch: missing headers: Authorization: Basic user:pass Content-Type: application/json warnings|warnings_regex: - Stuff is deprecated, yo - Don't use deprecated stuff - Please, stop. It hurts. - The non _regex version exact matches against the warning text and no need to worry about escaped quotes or backslashes - The _regex version matches against the raw value of the warning text which may include backlashes and quotes escaped allowed_warnings|allowed_warnings_regex: - Maybe this warning shows up - But it isn't actually required for the test to pass. - The non _regex version should be preferred for simplicity and performance. update: index: test_1 type: test id: 1 body: { doc: { foo: bar } }
  • Constructor Details

    • DoSection

      public DoSection(org.elasticsearch.xcontent.XContentLocation location)
  • Method Details

    • parse

      public static DoSection parse(org.elasticsearch.xcontent.XContentParser parser) throws IOException
      Throws:
      IOException
    • getCatch

      public String getCatch()
    • setCatch

      public void setCatch(String param)
    • getApiCallSection

      public ApiCallSection getApiCallSection()
    • setApiCallSection

      public void setApiCallSection(ApiCallSection apiCallSection)
    • getExpectedWarningHeaders

      public List<String> getExpectedWarningHeaders()
      Warning headers patterns that we expect from this response. If the headers don't match exactly this request is considered to have failed. Defaults to emptyList.
    • getExpectedWarningHeadersRegex

      public List<Pattern> getExpectedWarningHeadersRegex()
      Warning headers patterns that we expect from this response. If the headers don't match this request is considered to have failed. Defaults to emptyList.
    • setExpectedWarningHeaders

      public void setExpectedWarningHeaders(List<String> expectedWarningHeaders)
      Set the warning headers that we expect from this response. If the headers don't match exactly this request is considered to have failed. Defaults to emptyList.
    • setExpectedWarningHeadersRegex

      public void setExpectedWarningHeadersRegex(List<Pattern> expectedWarningHeadersRegex)
      Set the warning headers patterns that we expect from this response. If the headers don't match this request is considered to have failed. Defaults to emptyList.
    • getAllowedWarningHeaders

      public List<String> getAllowedWarningHeaders()
      Warning headers that we allow from this response. These warning headers don't cause the test to fail. Defaults to emptyList.
    • getAllowedWarningHeadersRegex

      public List<Pattern> getAllowedWarningHeadersRegex()
      Warning headers that we allow from this response. These warning headers don't cause the test to fail. Defaults to emptyList.
    • setAllowedWarningHeaders

      public void setAllowedWarningHeaders(List<String> allowedWarningHeaders)
      Set the warning headers that we expect from this response. These warning headers don't cause the test to fail. Defaults to emptyList.
    • setAllowedWarningHeadersRegex

      public void setAllowedWarningHeadersRegex(List<Pattern> allowedWarningHeadersRegex)
      Set the warning headers pattern that we expect from this response. These warning headers don't cause the test to fail. Defaults to emptyList.
    • getLocation

      public org.elasticsearch.xcontent.XContentLocation getLocation()
      Description copied from interface: ExecutableSection
      Get the location in the test that this was defined.
      Specified by:
      getLocation in interface ExecutableSection
    • execute

      public void execute(ClientYamlTestExecutionContext executionContext) throws IOException
      Description copied from interface: ExecutableSection
      Executes the section passing in the execution context
      Specified by:
      execute in interface ExecutableSection
      Throws:
      IOException
    • failIfHasCatch

      public void failIfHasCatch(ClientYamlTestResponse response)
    • checkWarningHeaders

      public void checkWarningHeaders(List<String> warningHeaders, String testPath)
      Check that the response contains only the warning headers that we expect.
    • checkResponseException

      public void checkResponseException(ClientYamlTestResponseException e, ClientYamlTestExecutionContext executionContext) throws IOException
      Throws:
      IOException