Class ElasticsearchRule
java.lang.Object
org.junit.rules.ExternalResource
fr.gouv.vitam.common.elasticsearch.ElasticsearchRule
- All Implemented Interfaces:
org.junit.rules.TestRule
public class ElasticsearchRule
extends org.junit.rules.ExternalResource
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddIndexToBePurged
(String indexName) protected void
after()
void
close()
boolean
createIndex
(String aliasName, String indexName, String mapping) void
boolean
existsIndex
(String indexName) co.elastic.clients.elasticsearch.ElasticsearchClient
get the Clientstatic String
get the cluster namestatic String
getHost()
static int
getPort()
get the tcp portvoid
Used when annotated @ClassRulevoid
handleAfter
(Set<String> indexesToBePurged) void
handlePurge
(co.elastic.clients.elasticsearch.ElasticsearchClient client, String index, co.elastic.clients.elasticsearch._types.query_dsl.Query query) void
final void
purgeIndex
(co.elastic.clients.elasticsearch.ElasticsearchClient client, String indexName) void
Methods inherited from class org.junit.rules.ExternalResource
apply, before
-
Field Details
-
PORT
public static final int PORT- See Also:
-
HOST
-
VITAM_CLUSTER
- See Also:
-
-
Constructor Details
-
ElasticsearchRule
-
-
Method Details
-
after
protected void after()- Overrides:
after
in classorg.junit.rules.ExternalResource
-
purge
-
handlePurge
public void handlePurge(co.elastic.clients.elasticsearch.ElasticsearchClient client, String index, co.elastic.clients.elasticsearch._types.query_dsl.Query query) -
existsIndex
- Throws:
IOException
-
createIndex
- Throws:
IOException
-
purgeIndex
public final void purgeIndex(co.elastic.clients.elasticsearch.ElasticsearchClient client, String indexName) -
deleteIndexesWithoutClose
public void deleteIndexesWithoutClose() -
purgeIndices
public void purgeIndices() -
addIndexToBePurged
-
handleAfter
public void handleAfter()Used when annotated @ClassRule -
handleAfter
-
getClusterName
get the cluster name- Returns:
- the vitam cluster name
-
getPort
public static int getPort()get the tcp port- Returns:
- TCP_PORT
-
getHost
-
getClient
public co.elastic.clients.elasticsearch.ElasticsearchClient getClient()get the Client- Returns:
- the client
-
close
public void close()
-