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 Details

  • 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()