Package org.apache.solr.cloud
Class MiniSolrCloudCluster.Builder
java.lang.Object
org.apache.solr.cloud.MiniSolrCloudCluster.Builder
- Enclosing class:
MiniSolrCloudCluster
Builder class for a MiniSolrCloudCluster
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionUpload a collection config before tests startbuild()Configure, run and return theMiniSolrCloudClusterConfigure and run theMiniSolrCloudClusterformatZkServer(boolean formatZkServer) withDefaultClusterProperty(String key, String value) Use a JettyConfig.Builder to configure the cluster's jetty serverswithMetrics(boolean trackJettyMetrics) 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.withProperty(String propertyName, String propertyValue) Set a cluster propertywithSecurityJson(String securityJson) Configure the specified security.json for the MiniSolrCloudClusterwithSecurityJson(Path securityJson) Configure the specified security.json for the MiniSolrCloudClusterwithSolrXml(String solrXml) Use the provided string as solr.xml contentwithSolrXml(Path solrXml) Read solr.xml from the provided pathDisables the default/built-in simple trace ID generation/propagation.
-
Constructor Details
-
Builder
Create a builder- Parameters:
nodeCount- the number of nodes in the clusterbaseDir- a base directory for the cluster
-
-
Method Details
-
withJettyConfig
Use a JettyConfig.Builder to configure the cluster's jetty servers -
withSolrXml
Use the provided string as solr.xml content -
withSolrXml
Read solr.xml from the provided path -
withSecurityJson
Configure the specified security.json for the MiniSolrCloudCluster- Parameters:
securityJson- The path specifying the security.json file- Returns:
- the instance of MiniSolrCloudCluster.Builder
-
withSecurityJson
Configure the specified security.json for the MiniSolrCloudCluster- Parameters:
securityJson- The string specifying the security.json configuration- Returns:
- the instance of MiniSolrCloudCluster.Builder
-
addConfig
Upload a collection config before tests start- Parameters:
configName- the config nameconfigPath- the path to the config files
-
withOverseer
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- Whenfalse, Collection and Config Set API commands are executed in a distributed way by nodes. Whentrue, they are executed by Overseer.
-
withProperty
Set a cluster property- Parameters:
propertyName- the property namepropertyValue- the property value
-
withMetrics
-
formatZkServer
-
configure
Configure and run theMiniSolrCloudCluster- Throws:
Exception- if an error occurs on startup
-
build
Configure, run and return theMiniSolrCloudCluster- Throws:
Exception- if an error occurs on startup
-
withDefaultClusterProperty
-
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.
-