Class ExternalTestCluster

java.lang.Object
org.elasticsearch.test.TestCluster
org.elasticsearch.test.ExternalTestCluster
All Implemented Interfaces:
Closeable, AutoCloseable

public final class ExternalTestCluster extends TestCluster
External cluster to run the tests against. It is a pure immutable test cluster that allows to send requests to a pre-existing cluster and supports by nature all the needed test operations like wipeIndices etc.
  • Field Details

  • Constructor Details

    • ExternalTestCluster

      public ExternalTestCluster(Path tempDir, org.elasticsearch.common.settings.Settings additionalSettings, Collection<Class<? extends org.elasticsearch.plugins.Plugin>> pluginClasses, org.elasticsearch.common.transport.TransportAddress... transportAddresses)
  • Method Details

    • afterTest

      public void afterTest()
      Description copied from class: TestCluster
      This method should be executed during tear down, after each test (but after assertAfterTest)
      Specified by:
      afterTest in class TestCluster
    • client

      public org.elasticsearch.client.Client client()
      Description copied from class: TestCluster
      Returns a client connected to any node in the cluster
      Specified by:
      client in class TestCluster
    • size

      public int size()
      Description copied from class: TestCluster
      Returns the number of nodes in the cluster.
      Specified by:
      size in class TestCluster
    • numDataNodes

      public int numDataNodes()
      Description copied from class: TestCluster
      Returns the number of data nodes in the cluster.
      Specified by:
      numDataNodes in class TestCluster
    • numDataAndMasterNodes

      public int numDataAndMasterNodes()
      Description copied from class: TestCluster
      Returns the number of data and master eligible nodes in the cluster.
      Specified by:
      numDataAndMasterNodes in class TestCluster
    • httpAddresses

      public InetSocketAddress[] httpAddresses()
      Description copied from class: TestCluster
      Returns the http addresses of the nodes within the cluster. Can be used to run REST tests against the test cluster.
      Specified by:
      httpAddresses in class TestCluster
    • close

      public void close() throws IOException
      Description copied from class: TestCluster
      Closes the current cluster
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in class TestCluster
      Throws:
      IOException
    • ensureEstimatedStats

      public void ensureEstimatedStats()
      Description copied from class: TestCluster
      Ensures that any breaker statistics are reset to 0. The implementation is specific to the test cluster, because the act of checking some breaker stats can increase them.
      Specified by:
      ensureEstimatedStats in class TestCluster
    • getClients

      public Iterable<org.elasticsearch.client.Client> getClients()
      Description copied from class: TestCluster
      Returns an Iterable over all clients in this test cluster
      Specified by:
      getClients in class TestCluster
    • getNamedWriteableRegistry

      public org.elasticsearch.common.io.stream.NamedWriteableRegistry getNamedWriteableRegistry()
      Description copied from class: TestCluster
      Returns this clusters NamedWriteableRegistry this is needed to deserialize binary content from this cluster that might include custom named writeables
      Specified by:
      getNamedWriteableRegistry in class TestCluster
    • getClusterName

      public String getClusterName()
      Description copied from class: TestCluster
      Returns the cluster name
      Specified by:
      getClusterName in class TestCluster