Class MockNode

java.lang.Object
org.elasticsearch.node.Node
org.elasticsearch.node.MockNode
All Implemented Interfaces:
java.io.Closeable, java.lang.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, NODE_ATTRIBUTES, NODE_LOCAL_STORAGE_SETTING, NODE_NAME_SETTING, WRITE_PORTS_FILE_SETTING
  • Constructor Summary

    Constructors
    Constructor Description
    MockNode​(org.elasticsearch.common.settings.Settings settings, java.util.Collection<java.lang.Class<? extends org.elasticsearch.plugins.Plugin>> classpathPlugins)  
    MockNode​(org.elasticsearch.common.settings.Settings settings, java.util.Collection<java.lang.Class<? extends org.elasticsearch.plugins.Plugin>> classpathPlugins, boolean forbidPrivateIndexSettings)  
    MockNode​(org.elasticsearch.common.settings.Settings settings, java.util.Collection<java.lang.Class<? extends org.elasticsearch.plugins.Plugin>> classpathPlugins, java.nio.file.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)  
    java.util.Collection<java.lang.Class<? extends org.elasticsearch.plugins.Plugin>> getClasspathPlugins()
    The classpath plugins this node was constructed with.
    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.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, java.util.Map<java.lang.String,​org.elasticsearch.script.ScriptEngine> engines, java.util.Map<java.lang.String,​org.elasticsearch.script.ScriptContext<?>> contexts)  
    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)  
    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, java.util.function.Function<org.elasticsearch.common.transport.BoundTransportAddress,​org.elasticsearch.cluster.node.DiscoveryNode> localNodeFactory, org.elasticsearch.common.settings.ClusterSettings clusterSettings, java.util.Set<java.lang.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, createCircuitBreakerService, 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, java.util.Collection<java.lang.Class<? extends org.elasticsearch.plugins.Plugin>> classpathPlugins)
    • MockNode

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

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

    • getClasspathPlugins

      public java.util.Collection<java.lang.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)
      Overrides:
      newSearchService in class org.elasticsearch.node.Node
    • newScriptService

      protected org.elasticsearch.script.ScriptService newScriptService​(org.elasticsearch.common.settings.Settings settings, java.util.Map<java.lang.String,​org.elasticsearch.script.ScriptEngine> engines, java.util.Map<java.lang.String,​org.elasticsearch.script.ScriptContext<?>> contexts)
      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, java.util.function.Function<org.elasticsearch.common.transport.BoundTransportAddress,​org.elasticsearch.cluster.node.DiscoveryNode> localNodeFactory, org.elasticsearch.common.settings.ClusterSettings clusterSettings, java.util.Set<java.lang.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.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