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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddIndexToBePurged(String indexName) protected voidafter()voidclose()booleancreateIndex(String aliasName, String indexName, String mapping) voidbooleanexistsIndex(String indexName) co.elastic.clients.elasticsearch.ElasticsearchClientget the Clientstatic Stringget the cluster namestatic StringgetHost()static intgetPort()get the tcp portvoidUsed when annotated @ClassRulevoidhandleAfter(Set<String> indexesToBePurged) voidhandlePurge(co.elastic.clients.elasticsearch.ElasticsearchClient client, String index, co.elastic.clients.elasticsearch._types.query_dsl.Query query) voidfinal voidpurgeIndex(co.elastic.clients.elasticsearch.ElasticsearchClient client, String indexName) voidMethods 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:
afterin 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()
-