Package org.apache.solr.util
Class EmbeddedSolrServerTestRule
- java.lang.Object
-
- org.junit.rules.ExternalResource
-
- org.apache.solr.util.SolrClientTestRule
-
- org.apache.solr.util.EmbeddedSolrServerTestRule
-
- All Implemented Interfaces:
org.junit.rules.TestRule
public class EmbeddedSolrServerTestRule extends SolrClientTestRule
Provides an EmbeddedSolrServer for tests. It starts and stops the server and provides methods for creating collections and interacting with the server.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.util.SolrClientTestRule
SolrClientTestRule.NewCollectionBuilder
-
-
Constructor Summary
Constructors Constructor Description EmbeddedSolrServerTestRule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
after()
Shuts down the EmbeddedSolrServer instance and clears the coreRootDirectory system property if necessaryorg.apache.solr.client.solrj.embedded.EmbeddedSolrServer
getAdminClient()
Provides an EmbeddedSolrServer instance for administration actionsorg.apache.solr.core.CoreContainer
getCoreContainer()
org.apache.solr.client.solrj.embedded.EmbeddedSolrServer
getSolrClient(String name)
org.apache.solr.core.NodeConfig.NodeConfigBuilder
newNodeConfigBuilder(Path solrHome)
Returns a NodeConfigBuilder with default settings for test configurationvoid
startSolr(Path solrHome)
Starts the Solr server with the given solrHome.void
startSolr(org.apache.solr.core.NodeConfig nodeConfig)
Starts Solr with custom NodeConfig-
Methods inherited from class org.apache.solr.util.SolrClientTestRule
clearIndex, create, getSolrClient, newCollection, newCollection, startSolr
-
-
-
-
Method Detail
-
after
protected void after()
Shuts down the EmbeddedSolrServer instance and clears the coreRootDirectory system property if necessary- Overrides:
after
in classorg.junit.rules.ExternalResource
-
startSolr
public void startSolr(Path solrHome)
Starts the Solr server with the given solrHome. If solrHome contains a solr.xml file, it is used to configure the server. If not, a new NodeConfig is built with default settings for configuration.- Specified by:
startSolr
in classSolrClientTestRule
-
startSolr
public void startSolr(org.apache.solr.core.NodeConfig nodeConfig)
Starts Solr with custom NodeConfig
-
newNodeConfigBuilder
public org.apache.solr.core.NodeConfig.NodeConfigBuilder newNodeConfigBuilder(Path solrHome)
Returns a NodeConfigBuilder with default settings for test configuration
-
getAdminClient
public org.apache.solr.client.solrj.embedded.EmbeddedSolrServer getAdminClient()
Provides an EmbeddedSolrServer instance for administration actions- Specified by:
getAdminClient
in classSolrClientTestRule
-
getSolrClient
public org.apache.solr.client.solrj.embedded.EmbeddedSolrServer getSolrClient(String name)
- Specified by:
getSolrClient
in classSolrClientTestRule
-
getCoreContainer
public org.apache.solr.core.CoreContainer getCoreContainer()
-
-