Class SolrTestCaseJ4

    • Field Detail

      • SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICYFACTORY

        public static final String SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICYFACTORY
        See Also:
        Constant Field Values
      • coreName

        protected static String coreName
      • DEFAULT_CONNECTION_TIMEOUT

        public static int DEFAULT_CONNECTION_TIMEOUT
      • solrTestRules

        public org.junit.rules.TestRule solrTestRules
      • DEAD_HOST_1

        public static final String DEAD_HOST_1
        a "dead" host, if you try to connect to it, it will likely fail fast please consider using mocks and not real networking to simulate failure
        See Also:
        Constant Field Values
      • DEAD_HOST_2

        public static final String DEAD_HOST_2
        a "dead" host, if you try to connect to it, it will likely fail fast please consider using mocks and not real networking to simulate failure
        See Also:
        Constant Field Values
      • DEAD_HOST_3

        public static final String DEAD_HOST_3
        a "dead" host, if you try to connect to it, it will likely fail fast please consider using mocks and not real networking to simulate failure
        See Also:
        Constant Field Values
      • configString

        protected static String configString
      • schemaString

        protected static String schemaString
      • testSolrHome

        protected static Path testSolrHome
      • solrConfig

        protected static org.apache.solr.core.SolrConfig solrConfig
      • h

        protected static TestHarness h
        Harness initialized by create[Default]Core[Container].

        For use in test methods as needed.

      • lrf

        protected static TestHarness.LocalRequestFactory lrf
        LocalRequestFactory initialized by create[Default]Core[Container] using sensible defaults.

        For use in test methods as needed.

      • initCoreDataDir

        @Deprecated
        protected static volatile File initCoreDataDir
        Deprecated.
        use initAndGetDataDir instead of directly accessing this variable
        The directory used as the dataDir for the TestHarness unless hdfsDataDir is non null.

        Will be set to null by deleteCore() and re-initialized as needed by createCore(). In the event of a test failure, the contents will be left on disk.

        See Also:
        LuceneTestCase.createTempDir(String), initAndGetDataDir()
      • hdfsDataDir

        protected static String hdfsDataDir
      • USE_NUMERIC_POINTS_SYSPROP

        public static final String USE_NUMERIC_POINTS_SYSPROP
        The name of a sysprop that can be set by users when running tests to force the types of numerics used for test classes that do not have the SolrTestCaseJ4.SuppressPointFields annotation:
        • If unset, then a random variable will be used to decide the type of numerics.
        • If set to true then Points based numerics will be used.
        • If set to false (or any other string) then Trie based numerics will be used.
        See Also:
        NUMERIC_POINTS_SYSPROP, Constant Field Values
      • NUMERIC_DOCVALUES_SYSPROP

        public static final String NUMERIC_DOCVALUES_SYSPROP
        The name of a sysprop that will be either true or false indicating if docValues should be used on a numeric field. This property string should be used in the docValues attribute of (most) numeric fieldTypes in schemas, and by default will be randomized by this class in a @BeforeClass. Subclasses that need to force specific behavior can use System.setProperty(NUMERIC_DOCVALUES_SYSPROP,"true") to override the default randomization.
        See Also:
        randomizeNumericTypesProperties(), Constant Field Values
      • RANDOMIZED_NUMERIC_FIELDTYPES

        protected static final Map<Class<?>,​String> RANDOMIZED_NUMERIC_FIELDTYPES
        A Map of "primitive" java "numeric" types and the string name of the class used in the corresponding schema fieldType declaration.

        Example: java.util.Date => "solr.DatePointField"

        See Also:
        randomizeNumericTypesProperties()
    • Constructor Detail

      • SolrTestCaseJ4

        public SolrTestCaseJ4()
    • Method Detail

      • assertExceptionThrownWithMessageContaining

        protected void assertExceptionThrownWithMessageContaining​(Class<? extends Throwable> expectedType,
                                                                  List<String> expectedStrings,
                                                                  org.apache.lucene.tests.util.LuceneTestCase.ThrowingRunnable runnable)
      • setupTestCases

        public static void setupTestCases()
      • resetGlobalTracer

        public static void resetGlobalTracer()
        GlobalTracer is initialized by org.apache.solr.core.TracerConfigurator by org.apache.solr.core.CoreContainer. Tests may need to reset it in the beginning of a test if it might have differing configuration from other tests in the same suite. It's also important to call ExecutorUtil.resetThreadLocalProviders().
      • teardownTestCases

        public static void teardownTestCases()
                                      throws Exception
        Throws:
        Exception
      • assumeWorkingMockito

        public static void assumeWorkingMockito()
        Assumes that Mockito/Bytebuddy is available and can be used to mock classes (e.g., fails if Java version is too new).
      • initClassLogLevels

        public static void initClassLogLevels()
      • initMethodLogLevels

        public void initMethodLogLevels()
      • restoreMethodLogLevels

        public void restoreMethodLogLevels()
      • isSSLMode

        protected static boolean isSSLMode()
      • useFactory

        public static void useFactory​(String factory)
                               throws Exception
        Use a different directory factory. Passing "null" sets to an FS-based factory
        Throws:
        Exception
      • buildJettyConfig

        protected static JettyConfig buildJettyConfig​(String context)
      • buildUrl

        protected static String buildUrl​(int port,
                                         String context)
      • whitespaceMockTokenizer

        protected static org.apache.lucene.tests.analysis.MockTokenizer whitespaceMockTokenizer​(Reader input)
                                                                                         throws IOException
        Throws:
        IOException
      • whitespaceMockTokenizer

        protected static org.apache.lucene.tests.analysis.MockTokenizer whitespaceMockTokenizer​(String input)
                                                                                         throws IOException
        Throws:
        IOException
      • setupNoCoreTest

        public static void setupNoCoreTest​(Path solrHome,
                                           String xmlStr)
                                    throws Exception
        Call this from @BeforeClass to set up the test harness and update handler with no cores.
        Parameters:
        solrHome - The solr home directory.
        xmlStr - - the text of an XML file to use. If null, use the what's the absolute minimal file.
        Throws:
        Exception - Lost of file-type things can go wrong.
      • newRandomConfig

        public static void newRandomConfig()
        Sets system properties to allow generation of random configurations of solrconfig.xml and schema.xml. Sets properties used on LuceneTestCase.newIndexWriterConfig(org.apache.lucene.analysis.Analyzer) and base schema.xml (Point Fields)
      • setUp

        public void setUp()
                   throws Exception
        Overrides:
        setUp in class org.apache.lucene.tests.util.LuceneTestCase
        Throws:
        Exception
      • tearDown

        public void tearDown()
                      throws Exception
        Overrides:
        tearDown in class org.apache.lucene.tests.util.LuceneTestCase
        Throws:
        Exception
      • initAndGetDataDir

        protected static File initAndGetDataDir()
        Subclasses may call this method to access the "dataDir" that will be used by initCore(java.lang.String, java.lang.String) (either prior to or after the core is created).

        If the dataDir has not yet been initialized when this method is called, this method will do so. Calling deleteCore() will "reset" the value, such that subsequent calls will re-initialize a new value. All directories returned by any calls to this method will automatically be cleaned up per LuceneTestCase.createTempDir()

        NOTE: calling this method is not requried, it will be implicitly called as needed when initializing cores. Callers that don't care about using initCore(java.lang.String, java.lang.String) and just want a temporary directory to put data in sould instead be using LuceneTestCase.createTempDir() directly.

        See Also:
        initCoreDataDir
      • initCore

        public static void initCore​(String config,
                                    String schema)
                             throws Exception
        Call initCore in @BeforeClass to instantiate a solr core in your test class. deleteCore will be called for you via SolrTestCaseJ4 @AfterClass
        Throws:
        Exception
      • initCore

        public static void initCore​(String config,
                                    String schema,
                                    String solrHome)
                             throws Exception
        Call initCore in @BeforeClass to instantiate a solr core in your test class. deleteCore will be called for you via SolrTestCaseJ4 @AfterClass
        Throws:
        Exception
      • initCore

        public static void initCore​(String config,
                                    String schema,
                                    String solrHome,
                                    String pCoreName)
                             throws Exception
        Call initCore in @BeforeClass to instantiate a solr core in your test class. deleteCore will be called for you via SolrTestCaseJ4 @AfterClass
        Throws:
        Exception
      • startTrackingSearchers

        public static void startTrackingSearchers()
      • ignoreException

        @Deprecated
        public static void ignoreException​(String pattern)
        Deprecated.
        use a ErrorLogMuter instead
        Causes any ERROR log messages matching with a substring matching the regex pattern to be filtered out by the ROOT logger
        See Also:
        resetExceptionIgnores()
      • getClassName

        protected static String getClassName()
      • getSimpleClassName

        protected static String getSimpleClassName()
      • getSchemaFile

        public static String getSchemaFile()
        Subclasses must define this method to return the name of the schema.xml they wish to use.
      • getSolrConfigFile

        public static String getSolrConfigFile()
        Subclasses must define this method to return the name of the solrconfig.xml they wish to use.
      • createCore

        public static void createCore()
      • createCoreContainer

        public static org.apache.solr.core.CoreContainer createCoreContainer​(Path solrHome,
                                                                             String solrXML)
      • createCoreContainer

        public static org.apache.solr.core.CoreContainer createCoreContainer​(org.apache.solr.core.NodeConfig config,
                                                                             org.apache.solr.core.CoresLocator locator)
      • createCoreContainer

        public static org.apache.solr.core.CoreContainer createCoreContainer​(String coreName,
                                                                             String dataDir,
                                                                             String solrConfig,
                                                                             String schema)
      • createDefaultCoreContainer

        public static org.apache.solr.core.CoreContainer createDefaultCoreContainer​(Path solrHome)
      • hasInitException

        public static boolean hasInitException​(String message)
      • hasInitException

        public static boolean hasInitException​(Class<? extends Exception> exceptionType)
      • postSetUp

        public void postSetUp()
        Subclasses that override setUp can optionally call this method to log the fact that their setUp process has ended.
      • preTearDown

        public void preTearDown()
        Subclasses that override tearDown can optionally call this method to log the fact that the tearDown process has started. This is necessary since subclasses will want to call super.tearDown() at the *end* of their tearDown method.
      • assertU

        public static void assertU​(String update)
        Validates an update XML String is successful
      • assertU

        public static void assertU​(String message,
                                   String update)
        Validates an update XML String is successful
      • assertFailedU

        public static void assertFailedU​(String update)
        Validates an update XML String failed
      • assertFailedU

        public static void assertFailedU​(String message,
                                         String update)
        Validates an update XML String failed
      • assertQ

        public static void assertQ​(org.apache.solr.request.SolrQueryRequest req,
                                   String... tests)
        Validates a query matches some XPath test expressions and closes the query
      • assertQ

        public static void assertQ​(String message,
                                   org.apache.solr.request.SolrQueryRequest req,
                                   String... tests)
        Validates a query matches some XPath test expressions and closes the query
      • JQ

        public static String JQ​(org.apache.solr.request.SolrQueryRequest req)
                         throws Exception
        Makes a query request and returns the JSON string response
        Throws:
        Exception
      • assertJQ

        public static String assertJQ​(org.apache.solr.request.SolrQueryRequest req,
                                      double delta,
                                      String... tests)
                               throws Exception
        Validates a query matches some JSON test expressions and closes the query. The text expression is of the form path:JSON. The Noggit JSON parser used accepts single quoted strings and bare strings to allow easy embedding in Java Strings.

        Please use this with care: this makes it easy to match complete structures, but doing so can result in fragile tests if you are matching more than what you want to test.

        Parameters:
        req - Solr request to execute
        delta - tolerance allowed in comparing float/double values
        tests - JSON path expression + '==' + expected value
        Returns:
        The request response as a JSON String if all test patterns pass
        Throws:
        Exception
      • assertQEx

        public static void assertQEx​(String message,
                                     org.apache.solr.request.SolrQueryRequest req,
                                     int code)
        Makes sure a query throws a SolrException with the listed response code
      • assertQEx

        public static void assertQEx​(String message,
                                     org.apache.solr.request.SolrQueryRequest req,
                                     org.apache.solr.common.SolrException.ErrorCode code)
      • assertQEx

        public static void assertQEx​(String failMessage,
                                     String exceptionMessage,
                                     org.apache.solr.request.SolrQueryRequest req,
                                     org.apache.solr.common.SolrException.ErrorCode code)
        Makes sure a query throws a SolrException with the listed response code and expected message
        Parameters:
        failMessage - The assert message to show when the query doesn't throw the expected exception
        exceptionMessage - A substring of the message expected in the exception
        req - Solr request
        code - expected error code for the query
      • adoc

        public static String adoc​(org.apache.solr.common.SolrInputDocument sdoc)
        Generates a simple <add><doc>... XML String with no options
      • params

        public static org.apache.solr.common.params.ModifiableSolrParams params​(String... params)
        Generates the correct SolrParams from an even list of strings. A string in an even position will represent the name of a parameter, while the following string at position (i+1) will be the assigned value.
        Parameters:
        params - an even list of strings
        Returns:
        the ModifiableSolrParams generated from the given list of strings.
      • req

        public static org.apache.solr.request.SolrQueryRequest req​(String... q)
        Generates a SolrQueryRequest using the LocalRequestFactory
        See Also:
        lrf
      • req

        public static org.apache.solr.request.SolrQueryRequest req​(String[] params,
                                                                   String... moreParams)
        Generates a SolrQueryRequest using the LocalRequestFactory
        See Also:
        lrf
      • req

        public static org.apache.solr.request.SolrQueryRequest req​(org.apache.solr.common.params.SolrParams params,
                                                                   String... moreParams)
        Generates a SolrQueryRequest
      • clearIndex

        public void clearIndex()
        Does a low level delete of all docs in the index.

        The behavior of this method is slightly different then doing a normal *:* DBQ because it takes advantage of internal methods to ensure all index data is wiped, regardless of optimistic concurrency version constraints -- making it suitable for tests that create synthetic versions, and/or require a completely pristine index w/o any field metdata.

        See Also:
        deleteByQueryAndGetVersion(java.lang.String, org.apache.solr.common.params.SolrParams)
      • updateJ

        public static String updateJ​(String json,
                                     org.apache.solr.common.params.SolrParams args)
                              throws Exception
        Send JSON update commands
        Throws:
        Exception
      • sdoc

        public static org.apache.solr.common.SolrInputDocument sdoc​(Object... fieldsAndValues)
      • sdocWithChildren

        public org.apache.solr.common.SolrInputDocument sdocWithChildren​(String id,
                                                                         String version)
      • sdocWithChildren

        public org.apache.solr.common.SolrInputDocument sdocWithChildren​(String id,
                                                                         String version,
                                                                         int childCount)
      • sdocWithChildren

        public org.apache.solr.common.SolrInputDocument sdocWithChildren​(Integer id,
                                                                         String version,
                                                                         int childCount)
      • sdocs

        public static List<org.apache.solr.common.SolrInputDocument> sdocs​(org.apache.solr.common.SolrInputDocument... docs)
      • json

        public static String json​(String testJSON)
        Converts "test JSON" strings into JSON parseable by our JSON parser. For example, this method changed single quoted strings into double quoted strings before the parser could natively handle them.

        This transformation is automatically applied to JSON test strings (like assertJQ).

      • json

        public static String json​(org.apache.solr.common.SolrInputDocument doc)
        Creates JSON from a SolrInputDocument. Doesn't currently handle boosts.
        See Also:
        json(SolrInputDocument,CharArr)
      • json

        public static void json​(org.apache.solr.common.SolrInputDocument doc,
                                org.noggit.CharArr out)
        Appends to the out array with JSON from the doc. Doesn't currently handle boosts, but does recursively handle child documents
      • jsonAdd

        public static String jsonAdd​(org.apache.solr.common.SolrInputDocument... docs)
        Creates a JSON add command from a SolrInputDocument list. Doesn't currently handle boosts.
      • jsonDelId

        public static String jsonDelId​(Object... ids)
        Creates a JSON delete command from an id list
      • jsonDelQ

        public static String jsonDelQ​(String... queries)
        Creates a JSON deleteByQuery command
      • addAndGetVersion

        public static Long addAndGetVersion​(org.apache.solr.common.SolrInputDocument sdoc,
                                            org.apache.solr.common.params.SolrParams params)
                                     throws Exception
        Throws:
        Exception
      • deleteAndGetVersion

        public static Long deleteAndGetVersion​(String id,
                                               org.apache.solr.common.params.SolrParams params)
                                        throws Exception
        Throws:
        Exception
      • deleteByQueryAndGetVersion

        public static Long deleteByQueryAndGetVersion​(String q,
                                                      org.apache.solr.common.params.SolrParams params)
                                               throws Exception
        Throws:
        Exception
      • assertResponseValues

        public static void assertResponseValues​(org.apache.solr.client.solrj.response.SolrResponseBase rsp,
                                                Object... assertions)
      • createComparator

        public static Comparator<SolrTestCaseJ4.Doc> createComparator​(String field,
                                                                      boolean asc,
                                                                      boolean sortMissingLast,
                                                                      boolean sortMissingFirst,
                                                                      boolean sortMissingAsZero)
      • TEST_HOME

        public static String TEST_HOME()
      • TEST_PATH

        public static Path TEST_PATH()
      • TEST_COLL1_CONF

        public static Path TEST_COLL1_CONF()
      • configset

        public static Path configset​(String name)
      • assertFieldValues

        public static void assertFieldValues​(org.apache.solr.common.SolrDocumentList documents,
                                             String fieldName,
                                             Object... expectedValues)
        Fails if the number of documents in the given SolrDocumentList differs from the given number of expected values, or if any of the values in the given field don't match the expected values in the same order.
      • compareSolrDocument

        public boolean compareSolrDocument​(Object expected,
                                           Object actual)
      • compareSolrDocumentList

        public boolean compareSolrDocumentList​(Object expected,
                                               Object actual)
      • compareSolrInputDocument

        public boolean compareSolrInputDocument​(Object expected,
                                                Object actual)
      • assertSolrInputFieldEquals

        public boolean assertSolrInputFieldEquals​(Object expected,
                                                  Object actual)
      • skewed

        public static Object skewed​(Object likely,
                                    Object unlikely)
        Returns likely most (1/10) of the time, otherwise unlikely
      • getCloudHttp2SolrClient

        public static org.apache.solr.client.solrj.impl.CloudHttp2SolrClient getCloudHttp2SolrClient​(MiniSolrCloudCluster cluster)
        This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use the CloudHttp2SolrClient.Builder class directly
      • getCloudSolrClient

        public static org.apache.solr.client.solrj.impl.CloudSolrClient getCloudSolrClient​(String zkHost)
        This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use the CloudSolrClient.Builder class directly
      • getCloudSolrClient

        public static org.apache.solr.client.solrj.impl.CloudSolrClient getCloudSolrClient​(MiniSolrCloudCluster cluster)
        This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use the CloudSolrClient.Builder class directly
      • getCloudSolrClient

        public static org.apache.solr.client.solrj.impl.CloudSolrClient getCloudSolrClient​(String zkHost,
                                                                                           org.apache.http.client.HttpClient httpClient)
        This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use the CloudSolrClient.Builder class directly
      • getCloudSolrClient

        public static org.apache.solr.client.solrj.impl.CloudSolrClient getCloudSolrClient​(String zkHost,
                                                                                           boolean shardLeadersOnly)
        This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use the CloudSolrClient.Builder class directly
      • getCloudSolrClient

        public static org.apache.solr.client.solrj.impl.CloudSolrClient getCloudSolrClient​(String zkHost,
                                                                                           boolean shardLeadersOnly,
                                                                                           int socketTimeoutMillis)
        This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use the CloudSolrClient.Builder class directly
      • getCloudSolrClient

        public static org.apache.solr.client.solrj.impl.CloudSolrClient getCloudSolrClient​(String zkHost,
                                                                                           boolean shardLeadersOnly,
                                                                                           int connectionTimeoutMillis,
                                                                                           int socketTimeoutMillis)
        This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use the CloudSolrClient.Builder class directly
      • getCloudSolrClient

        public static org.apache.solr.client.solrj.impl.CloudSolrClient getCloudSolrClient​(String zkHost,
                                                                                           boolean shardLeadersOnly,
                                                                                           org.apache.http.client.HttpClient httpClient)
        This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use the CloudSolrClient.Builder class directly
      • getCloudSolrClient

        public static org.apache.solr.client.solrj.impl.CloudSolrClient getCloudSolrClient​(String zkHost,
                                                                                           boolean shardLeadersOnly,
                                                                                           org.apache.http.client.HttpClient httpClient,
                                                                                           int connectionTimeoutMillis,
                                                                                           int socketTimeoutMillis)
        This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use the CloudSolrClient.Builder class directly
      • getConcurrentUpdateSolrClient

        public static org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient getConcurrentUpdateSolrClient​(String baseSolrUrl,
                                                                                                                 int queueSize,
                                                                                                                 int threadCount)
        This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use the ConcurrentUpdateSolrClient.Builder class directly
      • getConcurrentUpdateSolrClient

        public static org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient getConcurrentUpdateSolrClient​(String baseSolrUrl,
                                                                                                                 int queueSize,
                                                                                                                 int threadCount,
                                                                                                                 int connectionTimeoutMillis)
        This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use the ConcurrentUpdateSolrClient.Builder class directly
      • getConcurrentUpdateSolrClient

        public static org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient getConcurrentUpdateSolrClient​(String baseSolrUrl,
                                                                                                                 org.apache.http.client.HttpClient httpClient,
                                                                                                                 int queueSize,
                                                                                                                 int threadCount)
        This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use the ConcurrentUpdateSolrClient.Builder class directly
      • getLBHttpSolrClient

        public static org.apache.solr.client.solrj.impl.LBHttpSolrClient getLBHttpSolrClient​(org.apache.http.client.HttpClient client,
                                                                                             String... solrUrls)
        This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use the LBHttpSolrClient.Builder class directly
      • getLBHttpSolrClient

        public static org.apache.solr.client.solrj.impl.LBHttpSolrClient getLBHttpSolrClient​(org.apache.http.client.HttpClient client,
                                                                                             int connectionTimeoutMillis,
                                                                                             int socketTimeoutMillis,
                                                                                             String... solrUrls)
        This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use the LBHttpSolrClient.Builder class directly
      • getLBHttpSolrClient

        public static org.apache.solr.client.solrj.impl.LBHttpSolrClient getLBHttpSolrClient​(String... solrUrls)
                                                                                      throws MalformedURLException
        This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use the LBHttpSolrClient.Builder class directly
        Throws:
        MalformedURLException
      • getHttpClient

        @Deprecated
        public static org.apache.http.client.HttpClient getHttpClient​(String url)
        Deprecated.
        This method creates a HttpClient from a URL.
      • getHttp1SolrClient

        public static org.apache.solr.client.solrj.impl.HttpSolrClient getHttp1SolrClient​(String url)
        This method creates a basic HttpSolrClient. Tests that want to control the creation process should use the HttpSolrClient.Builder class directly
      • getHttp2SolrClient

        public static org.apache.solr.client.solrj.impl.Http2SolrClient getHttp2SolrClient​(String url)
        This method creates a basic Http2SolrClient. Tests that want to control the creation process should use the Http2SolrClient.Builder class directly
      • getHttpSolrClient

        public static org.apache.solr.client.solrj.impl.HttpSolrClient getHttpSolrClient​(String url,
                                                                                         org.apache.http.client.HttpClient httpClient,
                                                                                         org.apache.solr.client.solrj.ResponseParser responseParser,
                                                                                         boolean compression)
        This method creates a basic HttpSolrClient. Tests that want to control the creation process should use the HttpSolrClient.Builder class directly
      • getHttpSolrClient

        public static org.apache.solr.client.solrj.impl.HttpSolrClient getHttpSolrClient​(String url,
                                                                                         org.apache.http.client.HttpClient httpClient,
                                                                                         org.apache.solr.client.solrj.ResponseParser responseParser)
        This method creates a basic HttpSolrClient. Tests that want to control the creation process should use the HttpSolrClient.Builder class directly
      • getHttpSolrClient

        public static org.apache.solr.client.solrj.impl.HttpSolrClient getHttpSolrClient​(String url,
                                                                                         org.apache.http.client.HttpClient httpClient)
        This method creates a basic HttpSolrClient. Tests that want to control the creation process should use the HttpSolrClient.Builder class directly
      • getHttpSolrClient

        public static org.apache.solr.client.solrj.impl.HttpSolrClient getHttpSolrClient​(String url,
                                                                                         org.apache.http.client.HttpClient httpClient,
                                                                                         int connectionTimeoutMillis)
        This method creates a basic HttpSolrClient. Tests that want to control the creation process should use the HttpSolrClient.Builder class directly
      • getHttpSolrClient

        public static org.apache.solr.client.solrj.impl.HttpSolrClient getHttpSolrClient​(String url)
        This method creates a basic HttpSolrClient. Tests that want to control the creation process should use the HttpSolrClient.Builder class directly
      • getHttpSolrClient

        public static org.apache.solr.client.solrj.impl.HttpSolrClient getHttpSolrClient​(String url,
                                                                                         int connectionTimeoutMillis)
        This method creates a basic HttpSolrClient. Tests that want to control the creation process should use the HttpSolrClient.Builder class directly
      • getHttpSolrClient

        public static org.apache.solr.client.solrj.impl.HttpSolrClient getHttpSolrClient​(String url,
                                                                                         int connectionTimeoutMillis,
                                                                                         int socketTimeoutMillis)
        This method creates a basic HttpSolrClient. Tests that want to control the creation process should use the HttpSolrClient.Builder class directly
      • randomDate

        public static String randomDate()
        Returns a randomly generated Date in the appropriate Solr external (input) format
        See Also:
        randomSkewedDate()
      • randomSkewedDate

        public static String randomSkewedDate()
        Returns a Date such that all results from this method always have the same values for year+month+day+hour+minute but the seconds are randomized. This can be helpful for indexing documents with random date values that are biased for a narrow window (one day) to test collisions/overlaps
        See Also:
        randomDate()
      • randomXmlUsableUnicodeString

        public static String randomXmlUsableUnicodeString()
        We want "realistic" unicode strings beyond simple ascii, but because our updates use XML we need to ensure we don't get "special" code block.
      • getSaferTestName

        protected String getSaferTestName()
      • systemSetPropertySolrTestsMergePolicyFactory

        protected static void systemSetPropertySolrTestsMergePolicyFactory​(String value)
      • systemClearPropertySolrTestsMergePolicyFactory

        protected static void systemClearPropertySolrTestsMergePolicyFactory()
      • systemSetPropertySolrDisableUrlAllowList

        @Deprecated
        protected static void systemSetPropertySolrDisableUrlAllowList​(String value)
        Deprecated.
      • systemClearPropertySolrDisableUrlAllowList

        @Deprecated
        protected static void systemClearPropertySolrDisableUrlAllowList()
        Deprecated.
      • pickRandom

        @SafeVarargs
        protected static <T> T pickRandom​(T... options)
      • createDistributedUpdateProcessor

        public static org.apache.solr.update.processor.DistributedUpdateProcessor createDistributedUpdateProcessor​(org.apache.solr.request.SolrQueryRequest req,
                                                                                                                   org.apache.solr.response.SolrQueryResponse rsp,
                                                                                                                   org.apache.solr.update.processor.UpdateRequestProcessor next)