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
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 -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafter()Shuts down the EmbeddedSolrServer instance and clears the coreRootDirectory system property if necessaryorg.apache.solr.client.solrj.embedded.EmbeddedSolrServerProvides an EmbeddedSolrServer instance for administration actionsorg.apache.solr.core.CoreContainerorg.apache.solr.client.solrj.embedded.EmbeddedSolrServergetSolrClient(String collection) Provides a SolrClient instance for caller defined collection name.org.apache.solr.core.NodeConfig.NodeConfigBuildernewNodeConfigBuilder(Path solrHome) Returns a NodeConfigBuilder with default settings for test configurationvoidStarts the Solr server with the given solrHome.voidstartSolr(org.apache.solr.core.NodeConfig nodeConfig) Starts Solr with custom NodeConfigMethods inherited from class org.apache.solr.util.SolrClientTestRule
clearIndex, create, getSolrClient, newCollection, newCollection, startSolrMethods inherited from class org.junit.rules.ExternalResource
apply, before
-
Constructor Details
-
EmbeddedSolrServerTestRule
public EmbeddedSolrServerTestRule()
-
-
Method Details
-
after
protected void after()Shuts down the EmbeddedSolrServer instance and clears the coreRootDirectory system property if necessary- Overrides:
afterin classorg.junit.rules.ExternalResource
-
startSolr
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:
startSolrin classSolrClientTestRule
-
startSolr
public void startSolr(org.apache.solr.core.NodeConfig nodeConfig) Starts Solr with custom NodeConfig -
newNodeConfigBuilder
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- Overrides:
getAdminClientin classSolrClientTestRule
-
getSolrClient
Description copied from class:SolrClientTestRuleProvides a SolrClient instance for caller defined collection name. The caller doesn't need to close it- Specified by:
getSolrClientin classSolrClientTestRule
-
getCoreContainer
public org.apache.solr.core.CoreContainer getCoreContainer()
-