public class ElasticsearchAssertions
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ElasticsearchAssertions.ThrowableWrapper |
Constructor and Description |
---|
ElasticsearchAssertions() |
Modifier and Type | Method and Description |
---|---|
static void |
assertAcked(org.elasticsearch.action.support.master.AcknowledgedRequestBuilder<?,?,?> builder) |
static void |
assertAcked(org.elasticsearch.action.support.master.AcknowledgedResponse response) |
static void |
assertAcked(org.elasticsearch.action.admin.indices.delete.DeleteIndexRequestBuilder builder) |
static void |
assertAcked(org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse response) |
static void |
assertAliasesExist(org.elasticsearch.action.admin.indices.alias.exists.AliasesExistResponse aliasesExistResponse)
Assert that aliases exist
|
static void |
assertAliasesMissing(org.elasticsearch.action.admin.indices.alias.exists.AliasesExistResponse aliasesExistResponse)
Assert that aliases are missing
|
static void |
assertAllSuccessful(org.elasticsearch.action.support.broadcast.BroadcastResponse response) |
static void |
assertAllSuccessful(org.elasticsearch.action.search.SearchResponse response) |
static void |
assertBlocked(org.elasticsearch.action.ActionRequestBuilder builder)
Executes the request and fails if the request has not been blocked.
|
static void |
assertBlocked(org.elasticsearch.action.ActionRequestBuilder builder,
org.elasticsearch.cluster.block.ClusterBlock expectedBlock)
Executes the request and fails if the request has not been blocked by a specific
ClusterBlock . |
static void |
assertBlocked(org.elasticsearch.action.support.broadcast.BroadcastResponse replicatedBroadcastResponse)
Checks that all shard requests of a replicated broadcast request failed due to a cluster block
|
static <T extends org.apache.lucene.search.Query> |
assertBooleanSubQuery(org.apache.lucene.search.Query query,
java.lang.Class<T> subqueryType,
int i) |
static void |
assertDirectoryExists(java.nio.file.Path dir)
Check if a directory exists
|
static void |
assertExists(org.elasticsearch.action.get.GetResponse response) |
static void |
assertFailures(org.elasticsearch.action.percolate.PercolateResponse percolateResponse) |
static void |
assertFailures(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder,
org.elasticsearch.rest.RestStatus restStatus,
org.hamcrest.Matcher<java.lang.String> reasonMatcher) |
static void |
assertFailures(org.elasticsearch.action.search.SearchResponse searchResponse) |
static void |
assertFifthHit(org.elasticsearch.action.search.SearchResponse searchResponse,
org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher) |
static void |
assertFileExists(java.nio.file.Path file)
Check if a file exists
|
static void |
assertFileNotExists(java.nio.file.Path file)
Check if a file does not exist
|
static void |
assertFirstHit(org.elasticsearch.action.search.SearchResponse searchResponse,
org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher) |
static void |
assertFourthHit(org.elasticsearch.action.search.SearchResponse searchResponse,
org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher) |
static void |
assertHighlight(org.elasticsearch.search.SearchHit hit,
java.lang.String field,
int fragment,
int totalFragments,
org.hamcrest.Matcher<java.lang.String> matcher) |
static void |
assertHighlight(org.elasticsearch.search.SearchHit hit,
java.lang.String field,
int fragment,
org.hamcrest.Matcher<java.lang.String> matcher) |
static void |
assertHighlight(org.elasticsearch.action.search.SearchResponse resp,
int hit,
java.lang.String field,
int fragment,
int totalFragments,
org.hamcrest.Matcher<java.lang.String> matcher) |
static void |
assertHighlight(org.elasticsearch.action.search.SearchResponse resp,
int hit,
java.lang.String field,
int fragment,
org.hamcrest.Matcher<java.lang.String> matcher) |
static void |
assertHitCount(org.elasticsearch.action.search.SearchResponse countResponse,
long expectedHitCount) |
static void |
assertIndexTemplateExists(org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse templatesResponse,
java.lang.String name)
Assert that an index template exists
|
static void |
assertIndexTemplateMissing(org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse templatesResponse,
java.lang.String name)
Assert that an index template is missing
|
static void |
assertMatchCount(org.elasticsearch.action.percolate.PercolateResponse percolateResponse,
long expectedHitCount) |
static void |
assertNoFailures(org.elasticsearch.action.support.broadcast.BroadcastResponse response) |
static void |
assertNoFailures(org.elasticsearch.action.bulk.BulkResponse response) |
static void |
assertNoFailures(org.elasticsearch.action.search.SearchResponse searchResponse) |
static void |
assertNoSearchHits(org.elasticsearch.action.search.SearchResponse searchResponse) |
static void |
assertNotHighlighted(org.elasticsearch.action.search.SearchResponse resp,
int hit,
java.lang.String field) |
static void |
assertNoTimeout(org.elasticsearch.action.admin.cluster.health.ClusterHealthRequestBuilder requestBuilder) |
static void |
assertNoTimeout(org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse response) |
static void |
assertOrderedSearchHits(org.elasticsearch.action.search.SearchResponse searchResponse,
java.lang.String... ids) |
static void |
assertSearchHit(org.elasticsearch.search.SearchHit searchHit,
org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher) |
static void |
assertSearchHit(org.elasticsearch.action.search.SearchResponse searchResponse,
int number,
org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher) |
static void |
assertSearchHits(org.elasticsearch.action.search.SearchResponse searchResponse,
java.lang.String... ids) |
static org.elasticsearch.action.search.SearchResponse |
assertSearchResponse(org.elasticsearch.action.search.SearchRequestBuilder request)
Applies basic assertions on the SearchResponse.
|
static org.elasticsearch.action.search.SearchResponse |
assertSearchResponse(org.elasticsearch.action.search.SearchResponse response)
Applies basic assertions on the SearchResponse.
|
static void |
assertSecondHit(org.elasticsearch.action.search.SearchResponse searchResponse,
org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher) |
static void |
assertSortValues(org.elasticsearch.action.search.SearchResponse searchResponse,
java.lang.Object[]... sortValues) |
static void |
assertSuggestion(org.elasticsearch.search.suggest.Suggest searchSuggest,
int entry,
int ord,
java.lang.String key,
java.lang.String text) |
static void |
assertSuggestion(org.elasticsearch.search.suggest.Suggest searchSuggest,
int entry,
java.lang.String key,
int size,
java.lang.String... text)
Assert suggestion returns size suggestions and the first are the provided
text.
|
static void |
assertSuggestion(org.elasticsearch.search.suggest.Suggest searchSuggest,
int entry,
java.lang.String key,
java.lang.String... text)
Assert suggestion returns exactly the provided text.
|
static void |
assertSuggestionPhraseCollateMatchExists(org.elasticsearch.search.suggest.Suggest searchSuggest,
java.lang.String key,
int numberOfPhraseExists) |
static void |
assertSuggestionSize(org.elasticsearch.search.suggest.Suggest searchSuggest,
int entry,
int size,
java.lang.String key) |
static void |
assertThirdHit(org.elasticsearch.action.search.SearchResponse searchResponse,
org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher) |
static <E extends java.lang.Throwable> |
assertThrows(org.elasticsearch.action.ActionFuture future,
java.lang.Class<E> exceptionClass)
Run future.actionGet() and check that it throws an exception of the right type
|
static <E extends java.lang.Throwable> |
assertThrows(org.elasticsearch.action.ActionFuture future,
java.lang.Class<E> exceptionClass,
org.elasticsearch.rest.RestStatus status)
Run future.actionGet() and check that it throws an exception of the right type, with a given
RestStatus |
static <E extends java.lang.Throwable> |
assertThrows(org.elasticsearch.action.ActionFuture future,
java.lang.Class<E> exceptionClass,
org.elasticsearch.rest.RestStatus status,
java.lang.String extraInfo)
Run future.actionGet() and check that it throws an exception of the right type, optionally checking the exception's rest status
|
static <E extends java.lang.Throwable> |
assertThrows(org.elasticsearch.action.ActionFuture future,
java.lang.Class<E> exceptionClass,
java.lang.String extraInfo)
Run future.actionGet() and check that it throws an exception of the right type
|
static <E extends java.lang.Throwable> |
assertThrows(org.elasticsearch.action.ActionFuture future,
org.elasticsearch.rest.RestStatus status) |
static void |
assertThrows(org.elasticsearch.action.ActionFuture future,
org.elasticsearch.rest.RestStatus status,
java.lang.String extraInfo) |
static <E extends java.lang.Throwable> |
assertThrows(org.elasticsearch.action.ActionRequestBuilder<?,?,?> builder,
java.lang.Class<E> exceptionClass)
Run the request from a given builder and check that it throws an exception of the right type
|
static <E extends java.lang.Throwable> |
assertThrows(org.elasticsearch.action.ActionRequestBuilder<?,?,?> builder,
java.lang.Class<E> exceptionClass,
org.elasticsearch.rest.RestStatus status)
Run the request from a given builder and check that it throws an exception of the right type, with a given
RestStatus |
static <E extends java.lang.Throwable> |
assertThrows(org.elasticsearch.action.ActionRequestBuilder<?,?,?> builder,
java.lang.Class<E> exceptionClass,
java.lang.String extraInfo)
Run the request from a given builder and check that it throws an exception of the right type
|
static <E extends java.lang.Throwable> |
assertThrows(org.elasticsearch.action.ActionRequestBuilder<?,?,?> builder,
org.elasticsearch.rest.RestStatus status) |
static <E extends java.lang.Throwable> |
assertThrows(org.elasticsearch.action.ActionRequestBuilder<?,?,?> builder,
org.elasticsearch.rest.RestStatus status,
java.lang.String extraInfo) |
static void |
assertVersionSerializable(org.elasticsearch.common.io.stream.Streamable streamable) |
static void |
assertVersionSerializable(org.elasticsearch.Version version,
org.elasticsearch.common.io.stream.Streamable streamable) |
static void |
assertVersionSerializable(org.elasticsearch.Version version,
org.elasticsearch.common.io.stream.Streamable streamable,
org.elasticsearch.common.io.stream.NamedWriteableRegistry namedWriteableRegistry) |
static void |
assertVersionSerializable(org.elasticsearch.Version version,
java.lang.Throwable t) |
static java.lang.String |
formatShardStatus(org.elasticsearch.action.support.broadcast.BroadcastResponse response) |
static java.lang.String |
formatShardStatus(org.elasticsearch.action.search.SearchResponse response) |
static org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> |
hasId(java.lang.String id) |
static org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> |
hasIndex(java.lang.String index) |
static org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> |
hasScore(float score) |
static org.hamcrest.Matcher<HttpResponse> |
hasStatus(org.elasticsearch.rest.RestStatus restStatus) |
static org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> |
hasType(java.lang.String type) |
public static void assertAcked(org.elasticsearch.action.support.master.AcknowledgedRequestBuilder<?,?,?> builder)
public static void assertNoTimeout(org.elasticsearch.action.admin.cluster.health.ClusterHealthRequestBuilder requestBuilder)
public static void assertNoTimeout(org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse response)
public static void assertAcked(org.elasticsearch.action.support.master.AcknowledgedResponse response)
public static void assertAcked(org.elasticsearch.action.admin.indices.delete.DeleteIndexRequestBuilder builder)
public static void assertAcked(org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse response)
public static void assertBlocked(org.elasticsearch.action.ActionRequestBuilder builder)
builder
- the request builderpublic static void assertBlocked(org.elasticsearch.action.support.broadcast.BroadcastResponse replicatedBroadcastResponse)
replicatedBroadcastResponse
- the response that should only contain failed shard responsespublic static void assertBlocked(org.elasticsearch.action.ActionRequestBuilder builder, org.elasticsearch.cluster.block.ClusterBlock expectedBlock)
ClusterBlock
.builder
- the request builderexpectedBlock
- the expected blockpublic static java.lang.String formatShardStatus(org.elasticsearch.action.support.broadcast.BroadcastResponse response)
public static java.lang.String formatShardStatus(org.elasticsearch.action.search.SearchResponse response)
public static void assertNoSearchHits(org.elasticsearch.action.search.SearchResponse searchResponse)
public static void assertSearchHits(org.elasticsearch.action.search.SearchResponse searchResponse, java.lang.String... ids)
public static void assertSortValues(org.elasticsearch.action.search.SearchResponse searchResponse, java.lang.Object[]... sortValues)
public static void assertOrderedSearchHits(org.elasticsearch.action.search.SearchResponse searchResponse, java.lang.String... ids)
public static void assertHitCount(org.elasticsearch.action.search.SearchResponse countResponse, long expectedHitCount)
public static void assertMatchCount(org.elasticsearch.action.percolate.PercolateResponse percolateResponse, long expectedHitCount)
public static void assertExists(org.elasticsearch.action.get.GetResponse response)
public static void assertFirstHit(org.elasticsearch.action.search.SearchResponse searchResponse, org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher)
public static void assertSecondHit(org.elasticsearch.action.search.SearchResponse searchResponse, org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher)
public static void assertThirdHit(org.elasticsearch.action.search.SearchResponse searchResponse, org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher)
public static void assertFourthHit(org.elasticsearch.action.search.SearchResponse searchResponse, org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher)
public static void assertFifthHit(org.elasticsearch.action.search.SearchResponse searchResponse, org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher)
public static void assertSearchHit(org.elasticsearch.action.search.SearchResponse searchResponse, int number, org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher)
public static void assertNoFailures(org.elasticsearch.action.search.SearchResponse searchResponse)
public static void assertFailures(org.elasticsearch.action.search.SearchResponse searchResponse)
public static void assertNoFailures(org.elasticsearch.action.bulk.BulkResponse response)
public static void assertFailures(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder, org.elasticsearch.rest.RestStatus restStatus, org.hamcrest.Matcher<java.lang.String> reasonMatcher)
public static void assertFailures(org.elasticsearch.action.percolate.PercolateResponse percolateResponse)
public static void assertNoFailures(org.elasticsearch.action.support.broadcast.BroadcastResponse response)
public static void assertAllSuccessful(org.elasticsearch.action.support.broadcast.BroadcastResponse response)
public static void assertAllSuccessful(org.elasticsearch.action.search.SearchResponse response)
public static void assertSearchHit(org.elasticsearch.search.SearchHit searchHit, org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> matcher)
public static void assertHighlight(org.elasticsearch.action.search.SearchResponse resp, int hit, java.lang.String field, int fragment, org.hamcrest.Matcher<java.lang.String> matcher)
public static void assertHighlight(org.elasticsearch.action.search.SearchResponse resp, int hit, java.lang.String field, int fragment, int totalFragments, org.hamcrest.Matcher<java.lang.String> matcher)
public static void assertHighlight(org.elasticsearch.search.SearchHit hit, java.lang.String field, int fragment, org.hamcrest.Matcher<java.lang.String> matcher)
public static void assertHighlight(org.elasticsearch.search.SearchHit hit, java.lang.String field, int fragment, int totalFragments, org.hamcrest.Matcher<java.lang.String> matcher)
public static void assertNotHighlighted(org.elasticsearch.action.search.SearchResponse resp, int hit, java.lang.String field)
public static void assertSuggestionSize(org.elasticsearch.search.suggest.Suggest searchSuggest, int entry, int size, java.lang.String key)
public static void assertSuggestionPhraseCollateMatchExists(org.elasticsearch.search.suggest.Suggest searchSuggest, java.lang.String key, int numberOfPhraseExists)
public static void assertSuggestion(org.elasticsearch.search.suggest.Suggest searchSuggest, int entry, int ord, java.lang.String key, java.lang.String text)
public static void assertSuggestion(org.elasticsearch.search.suggest.Suggest searchSuggest, int entry, java.lang.String key, java.lang.String... text)
public static void assertSuggestion(org.elasticsearch.search.suggest.Suggest searchSuggest, int entry, java.lang.String key, int size, java.lang.String... text)
public static void assertIndexTemplateMissing(org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse templatesResponse, java.lang.String name)
public static void assertIndexTemplateExists(org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse templatesResponse, java.lang.String name)
public static void assertAliasesMissing(org.elasticsearch.action.admin.indices.alias.exists.AliasesExistResponse aliasesExistResponse)
public static void assertAliasesExist(org.elasticsearch.action.admin.indices.alias.exists.AliasesExistResponse aliasesExistResponse)
public static org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> hasId(java.lang.String id)
public static org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> hasType(java.lang.String type)
public static org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> hasIndex(java.lang.String index)
public static org.hamcrest.Matcher<org.elasticsearch.search.SearchHit> hasScore(float score)
public static org.hamcrest.Matcher<HttpResponse> hasStatus(org.elasticsearch.rest.RestStatus restStatus)
public static <T extends org.apache.lucene.search.Query> T assertBooleanSubQuery(org.apache.lucene.search.Query query, java.lang.Class<T> subqueryType, int i)
public static <E extends java.lang.Throwable> void assertThrows(org.elasticsearch.action.ActionRequestBuilder<?,?,?> builder, java.lang.Class<E> exceptionClass)
public static <E extends java.lang.Throwable> void assertThrows(org.elasticsearch.action.ActionRequestBuilder<?,?,?> builder, java.lang.Class<E> exceptionClass, org.elasticsearch.rest.RestStatus status)
RestStatus
public static <E extends java.lang.Throwable> void assertThrows(org.elasticsearch.action.ActionRequestBuilder<?,?,?> builder, java.lang.Class<E> exceptionClass, java.lang.String extraInfo)
extraInfo
- extra information to add to the failure messagepublic static <E extends java.lang.Throwable> void assertThrows(org.elasticsearch.action.ActionFuture future, java.lang.Class<E> exceptionClass)
public static <E extends java.lang.Throwable> void assertThrows(org.elasticsearch.action.ActionFuture future, java.lang.Class<E> exceptionClass, org.elasticsearch.rest.RestStatus status)
RestStatus
public static <E extends java.lang.Throwable> void assertThrows(org.elasticsearch.action.ActionFuture future, java.lang.Class<E> exceptionClass, java.lang.String extraInfo)
extraInfo
- extra information to add to the failure messagepublic static <E extends java.lang.Throwable> void assertThrows(org.elasticsearch.action.ActionFuture future, java.lang.Class<E> exceptionClass, @Nullable org.elasticsearch.rest.RestStatus status, @Nullable java.lang.String extraInfo)
exceptionClass
- expected exception classstatus
- RestStatus
to check for. Can be null to disable the checkextraInfo
- extra information to add to the failure message. Can be null.public static <E extends java.lang.Throwable> void assertThrows(org.elasticsearch.action.ActionRequestBuilder<?,?,?> builder, org.elasticsearch.rest.RestStatus status)
public static <E extends java.lang.Throwable> void assertThrows(org.elasticsearch.action.ActionRequestBuilder<?,?,?> builder, org.elasticsearch.rest.RestStatus status, java.lang.String extraInfo)
public static <E extends java.lang.Throwable> void assertThrows(org.elasticsearch.action.ActionFuture future, org.elasticsearch.rest.RestStatus status)
public static void assertThrows(org.elasticsearch.action.ActionFuture future, org.elasticsearch.rest.RestStatus status, java.lang.String extraInfo)
public static void assertVersionSerializable(org.elasticsearch.common.io.stream.Streamable streamable)
public static void assertVersionSerializable(org.elasticsearch.Version version, org.elasticsearch.common.io.stream.Streamable streamable)
public static void assertVersionSerializable(org.elasticsearch.Version version, org.elasticsearch.common.io.stream.Streamable streamable, org.elasticsearch.common.io.stream.NamedWriteableRegistry namedWriteableRegistry)
public static void assertVersionSerializable(org.elasticsearch.Version version, java.lang.Throwable t)
public static org.elasticsearch.action.search.SearchResponse assertSearchResponse(org.elasticsearch.action.search.SearchRequestBuilder request)
public static org.elasticsearch.action.search.SearchResponse assertSearchResponse(org.elasticsearch.action.search.SearchResponse response)
public static void assertFileExists(java.nio.file.Path file)
public static void assertFileNotExists(java.nio.file.Path file)
public static void assertDirectoryExists(java.nio.file.Path dir)