Class 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.
    • Constructor Detail

      • EmbeddedSolrServerTestRule

        public EmbeddedSolrServerTestRule()
    • Method Detail

      • after

        protected void after()
        Shuts down the EmbeddedSolrServer instance and clears the coreRootDirectory system property if necessary
        Overrides:
        after in class org.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 class SolrClientTestRule
      • 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 class SolrClientTestRule
      • getCoreContainer

        public org.apache.solr.core.CoreContainer getCoreContainer()