public class RestTestExecutionContext
extends java.lang.Object
implements java.io.Closeable
Constructor and Description |
---|
RestTestExecutionContext(RestSpec restSpec) |
Modifier and Type | Method and Description |
---|---|
RestResponse |
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.
|
void |
clear()
Clears the last obtained response and the stashed fields
|
void |
close()
Closes the execution context and releases the underlying resources
|
org.elasticsearch.Version |
esVersion()
Returns the current es version as a string
|
void |
initClient(java.net.URL[] urls,
org.elasticsearch.common.settings.Settings settings)
Creates the embedded REST client when needed.
|
java.lang.Object |
response(java.lang.String path)
Extracts a specific value from the last saved response
|
Stash |
stash() |
public RestTestExecutionContext(RestSpec restSpec)
public RestResponse 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, RestException
RestException
- if the returned status code is non okjava.io.IOException
public java.lang.Object response(java.lang.String path) throws java.io.IOException
java.io.IOException
public void initClient(java.net.URL[] urls, org.elasticsearch.common.settings.Settings settings) throws java.io.IOException, RestException
java.io.IOException
RestException
public void clear()
public Stash stash()
public org.elasticsearch.Version esVersion()
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable