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 -
Field Summary
Fields inherited from class org.apache.solr.util.SolrClientTestRule
backend -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidorg.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
after, clearIndex, createCollSolrCloud, createCollStandalone, getAdminClient, getBackend, getBaseUrl, getCoreContainer, getSolrClient, newCollection, newCollection, startSolrMethods inherited from class org.junit.rules.ExternalResource
apply, before
-
Constructor Details
-
EmbeddedSolrServerTestRule
public EmbeddedSolrServerTestRule()
-
-
Method Details
-
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 -
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
-
createColl
protected void createColl(SolrClientTestRule.NewCollectionBuilder b) throws org.apache.solr.client.solrj.SolrServerException, IOException Description copied from class:SolrClientTestRuleOverride to call eitherSolrClientTestRule.createCollSolrCloud(NewCollectionBuilder)orSolrClientTestRule.createCollStandalone(NewCollectionBuilder)- Specified by:
createCollin classSolrClientTestRule- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-