Package fr.gouv.vitam.common.elasticsearch

# 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
  Modifier and Type
  Field
  Description
  `static String`
  `HOST`
  `static final int`
  `PORT`
  `static final String`
  `VITAM_CLUSTER`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ElasticsearchRule(String... indexesToBePurged)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ElasticsearchRule`
  `addIndexToBePurged(String indexName)`
  `protected void`
  `after()`
  `void`
  `close()`
  `boolean`
  `createIndex(String aliasName, String indexName, String mapping)`
  `void`
  `deleteIndexesWithoutClose()`
  `boolean`
  `existsIndex(String indexName)`
  `co.elastic.clients.elasticsearch.ElasticsearchClient`
  `getClient()`
  get the Client
  `static String`
  `getClusterName()`
  get the cluster name
  `static String`
  `getHost()`
  `static int`
  `getPort()`
  get the tcp port
  `void`
  `handleAfter()`
  Used when annotated @ClassRule
  `void`
  `handleAfter(Set<String> indexesToBePurged)`
  `void`
  `handlePurge(co.elastic.clients.elasticsearch.ElasticsearchClient client, String index, co.elastic.clients.elasticsearch._types.query_dsl.Query query)`
  `void`
  `purge(co.elastic.clients.elasticsearch.ElasticsearchClient client, String indexName)`
  `final void`
  `purgeIndex(co.elastic.clients.elasticsearch.ElasticsearchClient client, String indexName)`
  `void`
  `purgeIndices()`

  ### Methods inherited from class org.junit.rules.ExternalResource

  `apply, before`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### PORT

    public static final int PORT
    See Also:
      - Constant Field Values

  - ### HOST

    public static String HOST

  - ### VITAM_CLUSTER

    public static final String VITAM_CLUSTER
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### ElasticsearchRule

    public ElasticsearchRule(String... indexesToBePurged)

- ## Method Details

  - ### after

    protected void after()
    Overrides:
      `after` in class `org.junit.rules.ExternalResource`

  - ### purge

    public void purge(co.elastic.clients.elasticsearch.ElasticsearchClient client, String indexName)

  - ### handlePurge

    public void handlePurge(co.elastic.clients.elasticsearch.ElasticsearchClient client, String index, co.elastic.clients.elasticsearch._types.query_dsl.Query query)

  - ### existsIndex

    public boolean existsIndex(String indexName) throws IOException
    Throws:
      `IOException`

  - ### createIndex

    public boolean createIndex(String aliasName, String indexName, String mapping) throws IOException
    Throws:
      `IOException`

  - ### purgeIndex

    public final void purgeIndex(co.elastic.clients.elasticsearch.ElasticsearchClient client, String indexName)

  - ### deleteIndexesWithoutClose

    public void deleteIndexesWithoutClose()

  - ### purgeIndices

    public void purgeIndices()

  - ### addIndexToBePurged

    public ElasticsearchRule addIndexToBePurged(String indexName)

  - ### handleAfter

    public void handleAfter()
    Used when annotated @ClassRule

  - ### handleAfter

    public void handleAfter(Set<String> indexesToBePurged)

  - ### getClusterName

    public static String getClusterName()
    get the cluster name
    Returns:
      the vitam cluster name

  - ### getPort

    public static int getPort()
    get the tcp port
    Returns:
      TCP_PORT

  - ### getHost

    public static String getHost()

  - ### getClient

    public co.elastic.clients.elasticsearch.ElasticsearchClient getClient()
    get the Client
    Returns:
      the client

  - ### close

    public void close()