Package org.elasticsearch.test.rest
Class Stash
java.lang.Object
org.elasticsearch.test.rest.Stash
- All Implemented Interfaces:
org.elasticsearch.xcontent.ToXContent,org.elasticsearch.xcontent.ToXContentFragment
Allows to cache the last obtained test response and or part of it within variables
that can be used as input values in following requests and assertions.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.Params -
Field Summary
FieldsFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the previously stashed valuesbooleanTells whether a particular key needs to be looked up in the stash based on its name.Retrieves a value from the current stash.booleanisStashedValue(Object key) Tells whether a particular key represents exactly a stashed value reference.replaceStashedValues(Map<String, Object> map) Goes recursively against each map entry and replaces any string value starting with "$" with its corresponding value retrieved from the stashvoidstashValue(String key, Object value) Allows to saved a specific field in the stash as key-value pairorg.elasticsearch.xcontent.XContentBuildertoXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
EMPTY
-
-
Constructor Details
-
Stash
public Stash()
-
-
Method Details
-
stashValue
Allows to saved a specific field in the stash as key-value pair -
clear
public void clear()Clears the previously stashed values -
containsStashedValue
Tells whether a particular key needs to be looked up in the stash based on its name. Returns true if the string representation of the key either starts with$or contains a${...}reference. The stash contains fields eventually extracted from previous responses that can be reused as arguments for following requests (e.g. scroll_id) -
isStashedValue
Tells whether a particular key represents exactly a stashed value reference. Returns true if the string representation of the key either starts with$or consists only of a${...}reference. UnlikecontainsStashedValue(java.lang.Object), returns false if the key contains an a${...}reference within a longer string. -
getValue
Retrieves a value from the current stash. The stash contains fields eventually extracted from previous responses that can be reused as arguments for following requests (e.g. scroll_id)- Throws:
IOException
-
replaceStashedValues
Goes recursively against each map entry and replaces any string value starting with "$" with its corresponding value retrieved from the stash- Throws:
IOException
-
toXContent
public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceorg.elasticsearch.xcontent.ToXContent- Throws:
IOException
-