Class MiniSolrCloudCluster.Builder

java.lang.Object
org.apache.solr.cloud.MiniSolrCloudCluster.Builder
Enclosing class:
MiniSolrCloudCluster

public static class MiniSolrCloudCluster.Builder extends Object
Builder class for a MiniSolrCloudCluster
  • Constructor Details

    • Builder

      public Builder(int nodeCount, Path baseDir)
      Create a builder
      Parameters:
      nodeCount - the number of nodes in the cluster
      baseDir - a base directory for the cluster
  • Method Details

    • withJettyConfig

      Use a JettyConfig.Builder to configure the cluster's jetty servers
    • withSolrXml

      public MiniSolrCloudCluster.Builder withSolrXml(String solrXml)
      Use the provided string as solr.xml content
    • withSolrXml

      public MiniSolrCloudCluster.Builder withSolrXml(Path solrXml)
      Read solr.xml from the provided path
    • withSecurityJson

      public MiniSolrCloudCluster.Builder withSecurityJson(Path securityJson)
      Configure the specified security.json for the MiniSolrCloudCluster
      Parameters:
      securityJson - The path specifying the security.json file
      Returns:
      the instance of MiniSolrCloudCluster.Builder
    • withSecurityJson

      public MiniSolrCloudCluster.Builder withSecurityJson(String securityJson)
      Configure the specified security.json for the MiniSolrCloudCluster
      Parameters:
      securityJson - The string specifying the security.json configuration
      Returns:
      the instance of MiniSolrCloudCluster.Builder
    • addConfig

      public MiniSolrCloudCluster.Builder addConfig(String configName, Path configPath)
      Upload a collection config before tests start
      Parameters:
      configName - the config name
      configPath - the path to the config files
    • withOverseer

      public MiniSolrCloudCluster.Builder withOverseer(boolean overseerEnabled)
      Force the cluster Collection and config state API execution as well as the cluster state update strategy to be either Overseer based or distributed. This method can be useful when debugging tests failing in only one of the two modes to have all local runs exhibit the issue, as well obviously for tests that are not compatible with one of the two modes. Alternatively, a system property can be used in lieu of this method.

      If this method is not called nor set via system property, the strategy being used will default to Overseer mode (overseerEnabled=true). However, note SolrCloudTestCase (above this) randomly chooses the mode.

      For tests that need to explicitly test distributed vs Overseer behavior, use this method to control which mode is used. The cluster property 'overseerEnabled' will be set accordingly.

      Parameters:
      overseerEnabled - When false, Collection and Config Set API commands are executed in a distributed way by nodes. When true, they are executed by Overseer.
    • withProperty

      public MiniSolrCloudCluster.Builder withProperty(String propertyName, String propertyValue)
      Set a cluster property
      Parameters:
      propertyName - the property name
      propertyValue - the property value
    • withMetrics

      public MiniSolrCloudCluster.Builder withMetrics(boolean trackJettyMetrics)
    • formatZkServer

      public MiniSolrCloudCluster.Builder formatZkServer(boolean formatZkServer)
    • configure

      public MiniSolrCloudCluster configure() throws Exception
      Configure and run the MiniSolrCloudCluster
      Throws:
      Exception - if an error occurs on startup
    • build

      public MiniSolrCloudCluster build() throws Exception
      Configure, run and return the MiniSolrCloudCluster
      Throws:
      Exception - if an error occurs on startup
    • withDefaultClusterProperty

      public MiniSolrCloudCluster.Builder withDefaultClusterProperty(String key, String value)
    • withTraceIdGenerationDisabled

      public MiniSolrCloudCluster.Builder withTraceIdGenerationDisabled()
      Disables the default/built-in simple trace ID generation/propagation.

      Tracers are registered as global singletons and if for example a test needs to use a MockTracer or a "real" Tracer, it needs to call this method so that the test setup doesn't accidentally reset the Tracer it wants to use.