Class DoSection
java.lang.Object
org.elasticsearch.test.rest.yaml.section.DoSection
- All Implemented Interfaces:
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 } }
-
Field Summary
Fields inherited from interface org.elasticsearch.test.rest.yaml.section.ExecutableSection
DEFAULT_EXECUTABLE_CONTEXTS, XCONTENT_REGISTRY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckResponseException(ClientYamlTestResponseException e, ClientYamlTestExecutionContext executionContext) voidcheckWarningHeaders(List<String> warningHeaders, String testPath) Check that the response contains only the warning headers that we expect.voidexecute(ClientYamlTestExecutionContext executionContext) Executes the section passing in the execution contextvoidfailIfHasCatch(ClientYamlTestResponse response) Warning headers that we allow from this response.Warning headers that we allow from this response.getCatch()Warning headers patterns that we expect from this response.Warning headers patterns that we expect from this response.org.elasticsearch.xcontent.XContentLocationGet the location in the test that this was defined.static DoSectionparse(org.elasticsearch.xcontent.XContentParser parser) voidsetAllowedWarningHeaders(List<String> allowedWarningHeaders) Set the warning headers that we expect from this response.voidsetAllowedWarningHeadersRegex(List<Pattern> allowedWarningHeadersRegex) Set the warning headers pattern that we expect from this response.voidsetApiCallSection(ApiCallSection apiCallSection) voidvoidsetExpectedWarningHeaders(List<String> expectedWarningHeaders) Set the warning headers that we expect from this response.voidsetExpectedWarningHeadersRegex(List<Pattern> expectedWarningHeadersRegex) Set the warning headers patterns that we expect from this response.
-
Constructor Details
-
DoSection
public DoSection(org.elasticsearch.xcontent.XContentLocation location)
-
-
Method Details
-
parse
- Throws:
IOException
-
getCatch
-
setCatch
-
getApiCallSection
-
setApiCallSection
-
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
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
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
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
Warning headers that we allow from this response. These warning headers don't cause the test to fail. Defaults to emptyList. -
getAllowedWarningHeadersRegex
Warning headers that we allow from this response. These warning headers don't cause the test to fail. Defaults to emptyList. -
setAllowedWarningHeaders
Set the warning headers that we expect from this response. These warning headers don't cause the test to fail. Defaults to emptyList. -
setAllowedWarningHeadersRegex
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:ExecutableSectionGet the location in the test that this was defined.- Specified by:
getLocationin interfaceExecutableSection
-
execute
Description copied from interface:ExecutableSectionExecutes the section passing in the execution context- Specified by:
executein interfaceExecutableSection- Throws:
IOException
-
failIfHasCatch
-
checkWarningHeaders
Check that the response contains only the warning headers that we expect. -
checkResponseException
public void checkResponseException(ClientYamlTestResponseException e, ClientYamlTestExecutionContext executionContext) throws IOException - Throws:
IOException
-