Class MockNode

java.lang.Object
org.elasticsearch.node.Node
org.elasticsearch.node.MockNode
All Implemented Interfaces:
Closeable, AutoCloseable

public class MockNode extends org.elasticsearch.node.Node
A node for testing which allows:
  • Overriding Version.CURRENT
  • Adding test plugins that exist on the classpath
  • Field Summary

    Fields inherited from class org.elasticsearch.node.Node

    BREAKER_TYPE_KEY, INITIAL_STATE_TIMEOUT_SETTING, NODE_ATTRIBUTES, NODE_EXTERNAL_ID_SETTING, NODE_NAME_SETTING, WRITE_PORTS_FILE_SETTING
  • Constructor Summary

    Constructors
    Constructor
    Description
    MockNode(org.elasticsearch.common.settings.Settings settings, Collection<Class<? extends org.elasticsearch.plugins.Plugin>> classpathPlugins)
     
    MockNode(org.elasticsearch.common.settings.Settings settings, Collection<Class<? extends org.elasticsearch.plugins.Plugin>> classpathPlugins, boolean forbidPrivateIndexSettings)
     
    MockNode(org.elasticsearch.common.settings.Settings settings, Collection<Class<? extends org.elasticsearch.plugins.Plugin>> classpathPlugins, Path configPath, boolean forbidPrivateIndexSettings)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    configureNodeAndClusterIdStateListener(org.elasticsearch.cluster.service.ClusterService clusterService)
     
    protected org.elasticsearch.common.util.BigArrays
    createBigArrays(org.elasticsearch.common.util.PageCacheRecycler pageCacheRecycler, org.elasticsearch.indices.breaker.CircuitBreakerService circuitBreakerService)
     
    Collection<Class<? extends org.elasticsearch.plugins.Plugin>>
    The classpath plugins this node was constructed with.
    org.elasticsearch.common.io.stream.NamedWriteableRegistry
     
    protected org.elasticsearch.cluster.ClusterInfoService
    newClusterInfoService(org.elasticsearch.common.settings.Settings settings, org.elasticsearch.cluster.service.ClusterService clusterService, org.elasticsearch.threadpool.ThreadPool threadPool, org.elasticsearch.client.internal.node.NodeClient client)
     
    protected org.elasticsearch.http.HttpServerTransport
    newHttpTransport(org.elasticsearch.common.network.NetworkModule networkModule)
     
    protected org.elasticsearch.script.ScriptService
    newScriptService(org.elasticsearch.common.settings.Settings settings, Map<String,org.elasticsearch.script.ScriptEngine> engines, Map<String,org.elasticsearch.script.ScriptContext<?>> contexts, LongSupplier timeProvider)
     
    protected org.elasticsearch.search.SearchService
    newSearchService(org.elasticsearch.cluster.service.ClusterService clusterService, org.elasticsearch.indices.IndicesService indicesService, org.elasticsearch.threadpool.ThreadPool threadPool, org.elasticsearch.script.ScriptService scriptService, org.elasticsearch.common.util.BigArrays bigArrays, org.elasticsearch.search.fetch.FetchPhase fetchPhase, org.elasticsearch.node.ResponseCollectorService responseCollectorService, org.elasticsearch.indices.breaker.CircuitBreakerService circuitBreakerService, org.elasticsearch.indices.ExecutorSelector executorSelector)
     
    protected org.elasticsearch.transport.TransportService
    newTransportService(org.elasticsearch.common.settings.Settings settings, org.elasticsearch.transport.Transport transport, org.elasticsearch.threadpool.ThreadPool threadPool, org.elasticsearch.transport.TransportInterceptor interceptor, Function<org.elasticsearch.common.transport.BoundTransportAddress,org.elasticsearch.cluster.node.DiscoveryNode> localNodeFactory, org.elasticsearch.common.settings.ClusterSettings clusterSettings, Set<String> taskHeaders)
     
    protected void
    processRecoverySettings(org.elasticsearch.common.settings.ClusterSettings clusterSettings, org.elasticsearch.indices.recovery.RecoverySettings recoverySettings)
     

    Methods inherited from class org.elasticsearch.node.Node

    awaitClose, client, close, getEnvironment, getNodeEnvironment, getPluginsService, injector, isClosed, settings, start, validateNodeBeforeAcceptingRequests

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MockNode

      public MockNode(org.elasticsearch.common.settings.Settings settings, Collection<Class<? extends org.elasticsearch.plugins.Plugin>> classpathPlugins)
    • MockNode

      public MockNode(org.elasticsearch.common.settings.Settings settings, Collection<Class<? extends org.elasticsearch.plugins.Plugin>> classpathPlugins, boolean forbidPrivateIndexSettings)
    • MockNode

      public MockNode(org.elasticsearch.common.settings.Settings settings, Collection<Class<? extends org.elasticsearch.plugins.Plugin>> classpathPlugins, Path configPath, boolean forbidPrivateIndexSettings)
  • Method Details

    • getClasspathPlugins

      public Collection<Class<? extends org.elasticsearch.plugins.Plugin>> getClasspathPlugins()
      The classpath plugins this node was constructed with.
    • createBigArrays

      protected org.elasticsearch.common.util.BigArrays createBigArrays(org.elasticsearch.common.util.PageCacheRecycler pageCacheRecycler, org.elasticsearch.indices.breaker.CircuitBreakerService circuitBreakerService)
    • newSearchService

      protected org.elasticsearch.search.SearchService newSearchService(org.elasticsearch.cluster.service.ClusterService clusterService, org.elasticsearch.indices.IndicesService indicesService, org.elasticsearch.threadpool.ThreadPool threadPool, org.elasticsearch.script.ScriptService scriptService, org.elasticsearch.common.util.BigArrays bigArrays, org.elasticsearch.search.fetch.FetchPhase fetchPhase, org.elasticsearch.node.ResponseCollectorService responseCollectorService, org.elasticsearch.indices.breaker.CircuitBreakerService circuitBreakerService, org.elasticsearch.indices.ExecutorSelector executorSelector)
      Overrides:
      newSearchService in class org.elasticsearch.node.Node
    • newScriptService

      protected org.elasticsearch.script.ScriptService newScriptService(org.elasticsearch.common.settings.Settings settings, Map<String,org.elasticsearch.script.ScriptEngine> engines, Map<String,org.elasticsearch.script.ScriptContext<?>> contexts, LongSupplier timeProvider)
      Overrides:
      newScriptService in class org.elasticsearch.node.Node
    • newTransportService

      protected org.elasticsearch.transport.TransportService newTransportService(org.elasticsearch.common.settings.Settings settings, org.elasticsearch.transport.Transport transport, org.elasticsearch.threadpool.ThreadPool threadPool, org.elasticsearch.transport.TransportInterceptor interceptor, Function<org.elasticsearch.common.transport.BoundTransportAddress,org.elasticsearch.cluster.node.DiscoveryNode> localNodeFactory, org.elasticsearch.common.settings.ClusterSettings clusterSettings, Set<String> taskHeaders)
      Overrides:
      newTransportService in class org.elasticsearch.node.Node
    • processRecoverySettings

      protected void processRecoverySettings(org.elasticsearch.common.settings.ClusterSettings clusterSettings, org.elasticsearch.indices.recovery.RecoverySettings recoverySettings)
      Overrides:
      processRecoverySettings in class org.elasticsearch.node.Node
    • newClusterInfoService

      protected org.elasticsearch.cluster.ClusterInfoService newClusterInfoService(org.elasticsearch.common.settings.Settings settings, org.elasticsearch.cluster.service.ClusterService clusterService, org.elasticsearch.threadpool.ThreadPool threadPool, org.elasticsearch.client.internal.node.NodeClient client)
      Overrides:
      newClusterInfoService in class org.elasticsearch.node.Node
    • newHttpTransport

      protected org.elasticsearch.http.HttpServerTransport newHttpTransport(org.elasticsearch.common.network.NetworkModule networkModule)
      Overrides:
      newHttpTransport in class org.elasticsearch.node.Node
    • configureNodeAndClusterIdStateListener

      protected void configureNodeAndClusterIdStateListener(org.elasticsearch.cluster.service.ClusterService clusterService)
      Overrides:
      configureNodeAndClusterIdStateListener in class org.elasticsearch.node.Node
    • getNamedWriteableRegistry

      public org.elasticsearch.common.io.stream.NamedWriteableRegistry getNamedWriteableRegistry()