Package org.apache.solr
Class SolrTestCaseJ4
- java.lang.Object
-
- org.junit.Assert
-
- org.apache.lucene.util.LuceneTestCase
-
- org.apache.solr.SolrTestCaseJ4
-
- Direct Known Subclasses:
AbstractBadConfigTestBase,AbstractZkTestCase,BaseDistributedSearchTestCase,MultiSolrCloudTestCase,SolrCloudTestCase,SolrJettyTestBase,SolrTestCaseHS,UpdateProcessorTestBase
@SuppressSysoutChecks(bugUrl="Solr dumps tons of logs to console.") @SuppressFileSystems("ExtrasFS") @RandomizeSSL public abstract class SolrTestCaseJ4 extends org.apache.lucene.util.LuceneTestCaseA junit4 Solr test harness that extends LuceneTestCaseJ4. To change which core is used when loading the schema and solrconfig.xml, simply invoke theinitCore(String, String, String, String)method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSolrTestCaseJ4.CloudSolrClientBuilderA variant ofCloudSolrClient.Builderthat will randomize some internal settings.static classSolrTestCaseJ4.Docstatic classSolrTestCaseJ4.Fldprotected static classSolrTestCaseJ4.FldTypestatic classSolrTestCaseJ4.FValstatic classSolrTestCaseJ4.IRangestatic classSolrTestCaseJ4.IValsstatic classSolrTestCaseJ4.IValsPercentstatic interfaceSolrTestCaseJ4.SuppressPointFieldsAnnotation for test classes that want to disable PointFields.static interfaceSolrTestCaseJ4.SuppressSSLAnnotation for test classes that want to disable SSLstatic classSolrTestCaseJ4.SValstatic classSolrTestCaseJ4.Valsstatic classSolrTestCaseJ4.XmlDocNecessary to make method signatures un-ambiguous-
Nested classes/interfaces inherited from class org.apache.lucene.util.LuceneTestCase
org.apache.lucene.util.LuceneTestCase.AwaitsFix, org.apache.lucene.util.LuceneTestCase.BadApple, org.apache.lucene.util.LuceneTestCase.Monster, org.apache.lucene.util.LuceneTestCase.Nightly, org.apache.lucene.util.LuceneTestCase.Slow, org.apache.lucene.util.LuceneTestCase.SuppressCodecs, org.apache.lucene.util.LuceneTestCase.SuppressFileSystems, org.apache.lucene.util.LuceneTestCase.SuppressFsync, org.apache.lucene.util.LuceneTestCase.SuppressReproduceLine, org.apache.lucene.util.LuceneTestCase.SuppressSysoutChecks, org.apache.lucene.util.LuceneTestCase.SuppressTempFileChecks, org.apache.lucene.util.LuceneTestCase.ThrowingRunnable, org.apache.lucene.util.LuceneTestCase.Weekly
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringconfigStringprotected static StringCORE_PROPERTIES_FILENAMEprotected static StringcoreNamestatic intDEFAULT_CONNECTION_TIMEOUTstatic StringDEFAULT_TEST_COLLECTION_NAMEstatic StringDEFAULT_TEST_CORENAMEprotected static TestHarnesshHarness initialized by create[Default]Core[Container].protected static StringhdfsDataDirprotected static FileinitCoreDataDirThe directory used to story the index managed by the TestHarnessprotected static TestHarness.LocalRequestFactorylrfLocalRequestFactory initialized by create[Default]Core[Container] using sensible defaults.static StringNUMERIC_DOCVALUES_SYSPROPThe name of a sysprop that will be eithertrueorfalseindicating if docValues should be used on a numeric field.static StringNUMERIC_POINTS_SYSPROPThe name of a sysprop that will eithertrueorfalseindicating if numeric points fields are currently in use, depending on the user specified value ofUSE_NUMERIC_POINTS_SYSPROPand/or theSolrTestCaseJ4.SuppressPointFieldsannotation and/or randomization.static SolrTestCaseJ4.IRangeONE_ONEprotected static Map<Class,String>RANDOMIZED_NUMERIC_FIELDTYPESA Map of "primitive" java "numeric" types and the string name of theclassused in the corresponding schema fieldType declaration.protected static StringschemaStringstatic org.junit.rules.TestRulesolrClassRulesprotected static org.apache.solr.core.SolrConfigsolrConfigorg.junit.rules.TestRulesolrTestRulesprotected static SSLTestConfigsslConfigstatic StringSYSTEM_PROPERTY_SOLR_DISABLE_SHARDS_WHITELISTDeprecated.static StringSYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICYFACTORYprotected static ExecutorServicetestExecutorprotected static PathtestSolrHomestatic StringUPDATELOG_SYSPROPstatic StringUSE_NUMERIC_POINTS_SYSPROPThe 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 theSolrTestCaseJ4.SuppressPointFieldsannotation: If unset, then a random variable will be used to decide the type of numerics. If set totruethen Points based numerics will be used. If set tofalse(or any other string) then Trie based numerics will be used.static SolrTestCaseJ4.IRangeZERO_ONEstatic SolrTestCaseJ4.IRangeZERO_TWO-
Fields inherited from class org.apache.lucene.util.LuceneTestCase
assertsAreEnabled, classRules, DEFAULT_LINE_DOCS_FILE, INFOSTREAM, JENKINS_LARGE_LINE_DOCS_FILE, LEAVE_TEMPORARY, MAYBE_CACHE_POLICY, RANDOM_MULTIPLIER, ruleChain, suiteFailureMarker, SYSPROP_AWAITSFIX, SYSPROP_BADAPPLES, SYSPROP_FAILFAST, SYSPROP_MAXFAILURES, SYSPROP_MONSTER, SYSPROP_NIGHTLY, SYSPROP_SLOW, SYSPROP_WEEKLY, TEST_ASSERTS_ENABLED, TEST_AWAITSFIX, TEST_BADAPPLES, TEST_CODEC, TEST_DIRECTORY, TEST_DOCVALUESFORMAT, TEST_LINE_DOCS_FILE, TEST_MONSTER, TEST_NIGHTLY, TEST_POSTINGSFORMAT, TEST_SLOW, TEST_THROTTLING, TEST_WEEKLY, VERBOSE
-
-
Constructor Summary
Constructors Constructor Description SolrTestCaseJ4()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Stringadd(SolrTestCaseJ4.XmlDoc doc, String... args)Generates an <add><doc>...static LongaddAndGetVersion(org.apache.solr.common.SolrInputDocument sdoc, org.apache.solr.common.params.SolrParams params)static voidaddDoc(String doc, String updateRequestProcessorChain)static Stringadoc(String... fieldsAndValues)Generates a simple <add><doc>...static Stringadoc(org.apache.solr.common.SolrInputDocument sdoc)Generates a simple <add><doc>...static voidassertFailedU(String update)Validates an update XML String failedstatic voidassertFailedU(String message, String update)Validates an update XML String failedstatic voidassertFieldValues(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.static StringassertJQ(org.apache.solr.request.SolrQueryRequest req, double delta, String... tests)Validates a query matches some JSON test expressions and closes the query.static StringassertJQ(org.apache.solr.request.SolrQueryRequest req, String... tests)Validates a query matches some JSON test expressions using the default double delta tolerance.static voidassertNonBlockingRandomGeneratorAvailable()static voidassertQ(String message, org.apache.solr.request.SolrQueryRequest req, String... tests)Validates a query matches some XPath test expressions and closes the querystatic voidassertQ(org.apache.solr.request.SolrQueryRequest req, String... tests)Validates a query matches some XPath test expressions and closes the querystatic voidassertQEx(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 messagestatic voidassertQEx(String message, org.apache.solr.request.SolrQueryRequest req, int code)Makes sure a query throws a SolrException with the listed response codestatic voidassertQEx(String message, org.apache.solr.request.SolrQueryRequest req, org.apache.solr.common.SolrException.ErrorCode code)booleanassertSolrInputFieldEquals(Object expected, Object actual)static voidassertU(String update)Validates an update XML String is successfulstatic voidassertU(String message, String update)Validates an update XML String is successfulstatic voidassertXmlFile(File file, String... xpath)static voidassumeWorkingMockito()Assumes that Mockito/Bytebuddy is available and can be used to mock classes (e.g., fails if Java version is too new).protected static org.apache.solr.client.solrj.embedded.JettyConfigbuildJettyConfig(String context)protected static StringbuildUrl(int port, String context)voidclearIndex()Does a low level delete of all docs in the index.static StringclearObjectTrackerAndCheckEmpty(int waitSeconds)static StringclearObjectTrackerAndCheckEmpty(int waitSeconds, boolean tryClose)static Stringcommit(String... args)booleancompareSolrDocument(Object expected, Object actual)booleancompareSolrDocumentList(Object expected, Object actual)booleancompareSolrInputDocument(Object expected, Object actual)static Pathconfigset(String name)static voidcopyMinConf(File dstRoot)static voidcopyMinConf(File dstRoot, String propertiesContent)static voidcopyMinConf(File dstRoot, String propertiesContent, String solrconfigXmlName)static voidcopyMinFullSetup(File dstRoot)static voidcopySolrHomeToTemp(File dstRoot, String collection)static voidcopyXmlToHome(File dstRoot, String fromFile)static Comparator<SolrTestCaseJ4.Doc>createComparator(String field, boolean asc, boolean sortMissingLast, boolean sortMissingFirst, boolean sortMissingAsZero)static Comparator<SolrTestCaseJ4.Doc>createComparator(List<Comparator<SolrTestCaseJ4.Doc>> comparators)static voidcreateCore()static org.apache.solr.core.CoreContainercreateCoreContainer(String coreName, String dataDir, String solrConfig, String schema)static org.apache.solr.core.CoreContainercreateCoreContainer(Path solrHome, String solrXML)static org.apache.solr.core.CoreContainercreateCoreContainer(org.apache.solr.core.NodeConfig config, org.apache.solr.core.CoresLocator locator)static org.apache.solr.core.CoreContainercreateDefaultCoreContainer(Path solrHome)static SolrTestCaseJ4.DoccreateDoc(List<SolrTestCaseJ4.FldType> descriptor)static Comparator<SolrTestCaseJ4.Doc>createSort(org.apache.solr.schema.IndexSchema schema, List<SolrTestCaseJ4.FldType> fieldTypes, String[] out)static LongdeleteAndGetVersion(String id, org.apache.solr.common.params.SolrParams params)static LongdeleteByQueryAndGetVersion(String q, org.apache.solr.common.params.SolrParams params)static voiddeleteCore()Shuts down the test harness, and makes the best attempt possible to delete dataDir, unless the system property "solr.test.leavedatadir" is set.static StringdelI(String id)Generates a <delete>...static StringdelQ(String q)Generates a <delete>...static SolrTestCaseJ4.XmlDocdoc(String... fieldsAndValues)Generates a simple <doc>...protected static StringgetClassName()static org.apache.solr.client.solrj.impl.CloudSolrClientgetCloudSolrClient(String zkHost)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.CloudSolrClientgetCloudSolrClient(String zkHost, boolean shardLeadersOnly)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.CloudSolrClientgetCloudSolrClient(String zkHost, boolean shardLeadersOnly, int socketTimeoutMillis)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.CloudSolrClientgetCloudSolrClient(String zkHost, boolean shardLeadersOnly, int connectionTimeoutMillis, int socketTimeoutMillis)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.CloudSolrClientgetCloudSolrClient(String zkHost, boolean shardLeadersOnly, org.apache.http.client.HttpClient httpClient)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.CloudSolrClientgetCloudSolrClient(String zkHost, boolean shardLeadersOnly, org.apache.http.client.HttpClient httpClient, int connectionTimeoutMillis, int socketTimeoutMillis)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.CloudSolrClientgetCloudSolrClient(String zkHost, org.apache.http.client.HttpClient httpClient)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.CloudSolrClientgetCloudSolrClient(MiniSolrCloudCluster cluster)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClientgetConcurrentUpdateSolrClient(String baseSolrUrl, int queueSize, int threadCount)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClientgetConcurrentUpdateSolrClient(String baseSolrUrl, int queueSize, int threadCount, int connectionTimeoutMillis)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClientgetConcurrentUpdateSolrClient(String baseSolrUrl, org.apache.http.client.HttpClient httpClient, int queueSize, int threadCount)This method may randomize unspecified aspects of the resulting SolrClient.static FilegetFile(String name)Gets a resource from the context classloader asFile.static org.apache.solr.client.solrj.impl.HttpSolrClientgetHttpSolrClient(String url)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.HttpSolrClientgetHttpSolrClient(String url, int connectionTimeoutMillis)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.HttpSolrClientgetHttpSolrClient(String url, int connectionTimeoutMillis, int socketTimeoutMillis)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.HttpSolrClientgetHttpSolrClient(String url, org.apache.http.client.HttpClient httpClient)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.HttpSolrClientgetHttpSolrClient(String url, org.apache.http.client.HttpClient httpClient, int connectionTimeoutMillis)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.HttpSolrClientgetHttpSolrClient(String url, org.apache.http.client.HttpClient httpClient, org.apache.solr.client.solrj.ResponseParser responseParser)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.HttpSolrClientgetHttpSolrClient(String url, org.apache.http.client.HttpClient httpClient, org.apache.solr.client.solrj.ResponseParser responseParser, boolean compression)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.LBHttpSolrClientgetLBHttpSolrClient(String... solrUrls)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.LBHttpSolrClientgetLBHttpSolrClient(org.apache.http.client.HttpClient client, int connectionTimeoutMillis, int socketTimeoutMillis, String... solrUrls)This method may randomize unspecified aspects of the resulting SolrClient.static org.apache.solr.client.solrj.impl.LBHttpSolrClientgetLBHttpSolrClient(org.apache.http.client.HttpClient client, String... solrUrls)This method may randomize unspecified aspects of the resulting SolrClient.protected static intgetNextAvailablePort()Find next available local port.static ThrowablegetRootCause(Throwable t)protected StringgetSaferTestName()static StringgetSchemaFile()Subclasses must define this method to return the name of the schema.xml they wish to use.protected static StringgetSimpleClassName()static StringgetSolrConfigFile()Subclasses must define this method to return the name of the solrconfig.xml they wish to use.static ThrowablegetWrappedException(Throwable e)static booleanhasInitException(Class<? extends Exception> exceptionType)static booleanhasInitException(String message)static voidignoreException(String pattern)Causes an exception matching the regex pattern to not be logged.Map<Comparable,SolrTestCaseJ4.Doc>indexDocs(List<SolrTestCaseJ4.FldType> descriptor, Map<Comparable,SolrTestCaseJ4.Doc> model, int nDocs)static voidinitClassLogLevels()static voidinitCore()static voidinitCore(String config, String schema)Call initCore in @BeforeClass to instantiate a solr core in your test class.static voidinitCore(String config, String schema, String solrHome)Call initCore in @BeforeClass to instantiate a solr core in your test class.static voidinitCore(String config, String schema, String solrHome, String pCoreName)Call initCore in @BeforeClass to instantiate a solr core in your test class.voidinitMethodLogLevels()Map<Comparable,List<Comparable>>invertField(Map<Comparable,SolrTestCaseJ4.Doc> model, String field)Return a Map from field value to a list of document idsprotected static booleanisSSLMode()static StringJQ(org.apache.solr.request.SolrQueryRequest req)Makes a query request and returns the JSON string responsestatic Stringjson(String testJSON)Converts "test JSON" strings into JSON parseable by our JSON parser.static Stringjson(org.apache.solr.common.SolrInputDocument doc)Creates JSON from a SolrInputDocument.static voidjson(org.apache.solr.common.SolrInputDocument doc, org.noggit.CharArr out)Appends to theoutarray with JSON from thedoc.static StringjsonAdd(org.apache.solr.common.SolrInputDocument... docs)Creates a JSON add command from a SolrInputDocument list.static StringjsonDelId(Object... ids)Creates a JSON delete command from an id liststatic StringjsonDelQ(String... queries)Creates a JSON deleteByQuery commandstatic Mapmap(Object... params)static SolrTestCaseJ4.CloudSolrClientBuildernewCloudSolrClient(String zkHost)static voidnewRandomConfig()Sets system properties to allow generation of random configurations of solrconfig.xml and schema.xml.static Stringoptimize(String... args)static org.apache.solr.common.params.ModifiableSolrParamsparams(String... params)protected <T> TpickRandom(T... options)voidpostSetUp()Subclasses that override setUp can optionally call this method to log the fact that their setUp process has ended.voidpreTearDown()Subclasses that override tearDown can optionally call this method to log the fact that the tearDown process has started.static StringrandomDate()Returns a randomly generated Date in the appropriate Solr external (input) formatstatic voidrandomizeUpdateLogImpl()randomizes the updateLog between different update log implementations for better test coveragestatic StringrandomSkewedDate()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.static StringrandomXmlUsableUnicodeString()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.static org.apache.solr.request.SolrQueryRequestreq(String... q)Generates a SolrQueryRequest using the LocalRequestFactorystatic org.apache.solr.request.SolrQueryRequestreq(String[] params, String... moreParams)Generates a SolrQueryRequest using the LocalRequestFactorystatic org.apache.solr.request.SolrQueryRequestreq(org.apache.solr.common.params.SolrParams params, String... moreParams)Generates a SolrQueryRequeststatic voidresetExceptionIgnores()Clears all exception patterns, although keeps"ignore_exception".static voidresetFactory()voidrestoreMethodLogLevels()static org.apache.solr.common.SolrInputDocumentsdoc(Object... fieldsAndValues)static List<org.apache.solr.common.SolrInputDocument>sdocs(org.apache.solr.common.SolrInputDocument... docs)org.apache.solr.common.SolrInputDocumentsdocWithChildren(Integer id, String version, int childCount)org.apache.solr.common.SolrInputDocumentsdocWithChildren(String id, String version)org.apache.solr.common.SolrInputDocumentsdocWithChildren(String id, String version, int childCount)voidsetUp()static voidsetupNoCoreTest(Path solrHome, String xmlStr)Call this from @BeforeClass to set up the test harness and update handler with no cores.static voidsetupTestCases()static Objectskewed(Object likely, Object unlikely)Returnslikelymost (1/10) of the time, otherwiseunlikelystatic voidstartTrackingSearchers()protected static voidsystemClearPropertySolrDisableShardsWhitelist()Deprecated.protected static voidsystemClearPropertySolrTestsMergePolicyFactory()protected static voidsystemSetPropertySolrDisableShardsWhitelist(String value)Deprecated.protected static voidsystemSetPropertySolrTestsMergePolicyFactory(String value)voidtearDown()static voidteardownTestCases()static StringTEST_HOME()static PathTEST_PATH()static StringtoJSON(SolrTestCaseJ4.Doc doc)static voidunIgnoreException(String pattern)static StringupdateJ(String json, org.apache.solr.common.params.SolrParams args)Send JSON update commandsstatic voiduseFactory(String factory)Use a different directory factory.protected voidwaitForWarming()protected static voidwaitForWarming(org.apache.solr.core.SolrCore core)protected static org.apache.lucene.analysis.MockTokenizerwhitespaceMockTokenizer(Reader input)protected static org.apache.lucene.analysis.MockTokenizerwhitespaceMockTokenizer(String input)protected voidwriteCoreProperties(Path coreDirectory, String corename)static voidwriteCoreProperties(Path coreDirectory, Properties properties, String testname)-
Methods inherited from class org.apache.lucene.util.LuceneTestCase
addVirusChecker, assertDeletedDocsEquals, assertDocsAndPositionsEnumEquals, assertDocsEnumEquals, assertDocsSkippingEquals, assertDocValuesEquals, assertDocValuesEquals, assertFieldInfosEquals, assertFieldsEquals, assertFieldStatisticsEquals, assertNormsEquals, assertPointsEquals, assertPositionsSkippingEquals, assertReaderEquals, assertReaderStatisticsEquals, assertStoredFieldEquals, assertStoredFieldsEquals, assertTermsEnumEquals, assertTermsEquals, assertTermsStatisticsEquals, assertTermStatsEquals, assertTermVectorsEquals, asSet, assumeFalse, assumeNoException, assumeTrue, assumeWorkingMMapOnWindows, atLeast, atLeast, closeAfterSuite, closeAfterTest, collate, createTempDir, createTempDir, createTempFile, createTempFile, dumpArray, dumpIterator, expectThrows, expectThrows, expectThrows, expectThrowsAnyOf, expectThrowsAnyOf, getBaseTempDirForTestClass, getDataInputStream, getDataPath, getOnlyLeafReader, getTestClass, getTestName, hasWorkingMMapOnWindows, isTestThread, localeForLanguageTag, maybeChangeLiveIndexWriterConfig, maybeWrapReader, newAlcoholicMergePolicy, newAlcoholicMergePolicy, newDirectory, newDirectory, newDirectory, newDirectory, newDirectory, newField, newField, newFSDirectory, newFSDirectory, newIndexWriterConfig, newIndexWriterConfig, newIndexWriterConfig, newIOContext, newIOContext, newLogMergePolicy, newLogMergePolicy, newLogMergePolicy, newLogMergePolicy, newLogMergePolicy, newMaybeVirusCheckingDirectory, newMaybeVirusCheckingFSDirectory, newMergePolicy, newMergePolicy, newMergePolicy, newMockDirectory, newMockDirectory, newMockDirectory, newMockFSDirectory, newMockFSDirectory, newSearcher, newSearcher, newSearcher, newStringField, newStringField, newStringField, newStringField, newTextField, newTextField, newTieredMergePolicy, newTieredMergePolicy, overrideDefaultQueryCache, overrideTestDefaultQueryCache, random, randomLocale, randomTimeZone, rarely, rarely, replaceMaxFailureRule, resetDefaultQueryCache, restoreCPUCoreCount, restoreIndexWriterMaxDocs, restoreSpins, runWithRestrictedPermissions, setIndexWriterMaxDocs, setupCPUCoreCount, setupSpins, slowFileExists, usually, usually, wrapReader
-
Methods inherited from class org.junit.Assert
assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, fail
-
-
-
-
Field Detail
-
DEFAULT_TEST_COLLECTION_NAME
public static final String DEFAULT_TEST_COLLECTION_NAME
- See Also:
- Constant Field Values
-
DEFAULT_TEST_CORENAME
public static final String DEFAULT_TEST_CORENAME
- See Also:
- Constant Field Values
-
CORE_PROPERTIES_FILENAME
protected static final String CORE_PROPERTIES_FILENAME
- See Also:
- Constant Field Values
-
SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICYFACTORY
public static final String SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICYFACTORY
- See Also:
- Constant Field Values
-
SYSTEM_PROPERTY_SOLR_DISABLE_SHARDS_WHITELIST
@Deprecated public static final String SYSTEM_PROPERTY_SOLR_DISABLE_SHARDS_WHITELIST
Deprecated.- See Also:
- Constant Field Values
-
coreName
protected static String coreName
-
DEFAULT_CONNECTION_TIMEOUT
public static int DEFAULT_CONNECTION_TIMEOUT
-
testExecutor
protected static volatile ExecutorService testExecutor
-
sslConfig
protected static volatile SSLTestConfig sslConfig
-
solrClassRules
public static org.junit.rules.TestRule solrClassRules
-
solrTestRules
public org.junit.rules.TestRule solrTestRules
-
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
protected static volatile File initCoreDataDir
The directory used to story the index managed by the TestHarness
-
hdfsDataDir
protected static String hdfsDataDir
-
ZERO_ONE
public static final SolrTestCaseJ4.IRange ZERO_ONE
-
ZERO_TWO
public static final SolrTestCaseJ4.IRange ZERO_TWO
-
ONE_ONE
public static final SolrTestCaseJ4.IRange ONE_ONE
-
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 theSolrTestCaseJ4.SuppressPointFieldsannotation:- If unset, then a random variable will be used to decide the type of numerics.
- If set to
truethen 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_POINTS_SYSPROP
public static final String NUMERIC_POINTS_SYSPROP
The name of a sysprop that will eithertrueorfalseindicating if numeric points fields are currently in use, depending on the user specified value ofUSE_NUMERIC_POINTS_SYSPROPand/or theSolrTestCaseJ4.SuppressPointFieldsannotation and/or randomization. Tests can useBoolean.getBoolean(NUMERIC_POINTS_SYSPROP).
-
NUMERIC_DOCVALUES_SYSPROP
public static final String NUMERIC_DOCVALUES_SYSPROP
The name of a sysprop that will be eithertrueorfalseindicating if docValues should be used on a numeric field. This property string should be used in thedocValuesattribute 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 useSystem.setProperty(NUMERIC_DOCVALUES_SYSPROP,"true")to override the default randomization.
-
UPDATELOG_SYSPROP
public static final String UPDATELOG_SYSPROP
- See Also:
- 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 theclassused in the corresponding schema fieldType declaration.Example:
java.util.Date => "solr.DatePointField"- See Also:
randomizeNumericTypesProperties()
-
-
Method Detail
-
writeCoreProperties
protected void writeCoreProperties(Path coreDirectory, String corename) throws IOException
- Throws:
IOException
-
writeCoreProperties
public static void writeCoreProperties(Path coreDirectory, Properties properties, String testname) throws IOException
- Throws:
IOException
-
setupTestCases
public static void setupTestCases()
-
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).
-
clearObjectTrackerAndCheckEmpty
public static String clearObjectTrackerAndCheckEmpty(int waitSeconds)
- Returns:
- null if ok else error message
-
clearObjectTrackerAndCheckEmpty
public static String clearObjectTrackerAndCheckEmpty(int waitSeconds, boolean tryClose)
- Returns:
- null if ok else error message
-
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 org.apache.solr.client.solrj.embedded.JettyConfig buildJettyConfig(String context)
-
whitespaceMockTokenizer
protected static org.apache.lucene.analysis.MockTokenizer whitespaceMockTokenizer(Reader input) throws IOException
- Throws:
IOException
-
whitespaceMockTokenizer
protected static org.apache.lucene.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 onLuceneTestCase.newIndexWriterConfig(org.apache.lucene.analysis.Analyzer)and base schema.xml (Point Fields)
-
setUp
public void setUp() throws Exception- Overrides:
setUpin classorg.apache.lucene.util.LuceneTestCase- Throws:
Exception
-
tearDown
public void tearDown() throws Exception- Overrides:
tearDownin classorg.apache.lucene.util.LuceneTestCase- Throws:
Exception
-
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
public static void ignoreException(String pattern)
Causes an exception matching the regex pattern to not be logged.
-
unIgnoreException
public static void unIgnoreException(String pattern)
-
resetExceptionIgnores
public static void resetExceptionIgnores()
Clears all exception patterns, although keeps"ignore_exception".SolrTestCaseJ4calls this inAfterClassso usually tests don't need to call this.
-
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)
-
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.
-
deleteCore
public static void deleteCore()
Shuts down the test harness, and makes the best attempt possible to delete dataDir, unless the system property "solr.test.leavedatadir" is set.
-
getNextAvailablePort
protected static int getNextAvailablePort() throws ExceptionFind next available local port.- Returns:
- available port number or -1 if none could be found
- Throws:
Exception- on IO errors
-
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, String... tests) throws Exception
Validates a query matches some JSON test expressions using the default double delta tolerance.- Returns:
- The request response as a JSON String if all test patterns pass
- Throws:
Exception- See Also:
JSONTestUtil.DEFAULT_DELTA,assertJQ(SolrQueryRequest,double,String...)
-
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 executedelta- tolerance allowed in comparing float/double valuestests- 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 exceptionexceptionMessage- A substring of the message expected in the exceptionreq- Solr requestcode- expected error code for the query
-
adoc
public static String adoc(String... fieldsAndValues)
Generates a simple <add><doc>... XML String with no options- Parameters:
fieldsAndValues- 0th and Even numbered args are fields names odds are field values.- See Also:
add(org.apache.solr.SolrTestCaseJ4.XmlDoc, java.lang.String...),doc(java.lang.String...)
-
adoc
public static String adoc(org.apache.solr.common.SolrInputDocument sdoc)
Generates a simple <add><doc>... XML String with no options
-
addDoc
public static void addDoc(String doc, String updateRequestProcessorChain) throws Exception
- Throws:
Exception
-
add
public static String add(SolrTestCaseJ4.XmlDoc doc, String... args)
Generates an <add><doc>... XML String with options on the add.- Parameters:
doc- the Document to addargs- 0th and Even numbered args are param names, Odds are param values.- See Also:
add(org.apache.solr.SolrTestCaseJ4.XmlDoc, java.lang.String...),doc(java.lang.String...)
-
doc
public static SolrTestCaseJ4.XmlDoc doc(String... fieldsAndValues)
Generates a simple <doc>... XML String with no options- Parameters:
fieldsAndValues- 0th and Even numbered args are fields names, Odds are field values.- See Also:
BaseTestHarness.makeSimpleDoc(java.lang.String...)
-
params
public static org.apache.solr.common.params.ModifiableSolrParams params(String... params)
-
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.
-
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 srings (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 theoutarray with JSON from thedoc. 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
-
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
-
indexDocs
public Map<Comparable,SolrTestCaseJ4.Doc> indexDocs(List<SolrTestCaseJ4.FldType> descriptor, Map<Comparable,SolrTestCaseJ4.Doc> model, int nDocs) throws Exception
- Throws:
Exception
-
createDoc
public static SolrTestCaseJ4.Doc createDoc(List<SolrTestCaseJ4.FldType> descriptor)
-
createSort
public static Comparator<SolrTestCaseJ4.Doc> createSort(org.apache.solr.schema.IndexSchema schema, List<SolrTestCaseJ4.FldType> fieldTypes, String[] out)
-
createComparator
public static Comparator<SolrTestCaseJ4.Doc> createComparator(String field, boolean asc, boolean sortMissingLast, boolean sortMissingFirst, boolean sortMissingAsZero)
-
createComparator
public static Comparator<SolrTestCaseJ4.Doc> createComparator(List<Comparator<SolrTestCaseJ4.Doc>> comparators)
-
toJSON
public static String toJSON(SolrTestCaseJ4.Doc doc)
-
invertField
public Map<Comparable,List<Comparable>> invertField(Map<Comparable,SolrTestCaseJ4.Doc> model, String field)
Return a Map from field value to a list of document ids
-
getFile
public static File getFile(String name)
Gets a resource from the context classloader asFile. This method should only be used, if a real file is needed. To get a stream, code should preferClass.getResourceAsStream(java.lang.String)usingthis.getClass().
-
TEST_HOME
public static String TEST_HOME()
-
TEST_PATH
public static Path TEST_PATH()
-
assertXmlFile
public static void assertXmlFile(File file, String... xpath) throws IOException, SAXException
- Throws:
IOExceptionSAXException
-
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.
-
copyMinConf
public static void copyMinConf(File dstRoot) throws IOException
- Throws:
IOException
-
copyMinConf
public static void copyMinConf(File dstRoot, String propertiesContent) throws IOException
- Throws:
IOException
-
copyMinConf
public static void copyMinConf(File dstRoot, String propertiesContent, String solrconfigXmlName) throws IOException
- Throws:
IOException
-
copyMinFullSetup
public static void copyMinFullSetup(File dstRoot) throws IOException
- Throws:
IOException
-
copyXmlToHome
public static void copyXmlToHome(File dstRoot, String fromFile) throws IOException
- Throws:
IOException
-
copySolrHomeToTemp
public static void copySolrHomeToTemp(File dstRoot, String collection) throws IOException
- Throws:
IOException
-
assertSolrInputFieldEquals
public boolean assertSolrInputFieldEquals(Object expected, Object actual)
-
skewed
public static Object skewed(Object likely, Object unlikely)
Returnslikelymost (1/10) of the time, otherwiseunlikely
-
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 theCloudSolrClient.Builderclass 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 theCloudSolrClient.Builderclass 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 theCloudSolrClient.Builderclass 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 theCloudSolrClient.Builderclass directly
-
newCloudSolrClient
public static SolrTestCaseJ4.CloudSolrClientBuilder newCloudSolrClient(String zkHost)
-
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 theCloudSolrClient.Builderclass 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 theCloudSolrClient.Builderclass 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 theCloudSolrClient.Builderclass 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 theCloudSolrClient.Builderclass 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 theConcurrentUpdateSolrClient.Builderclass 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 theConcurrentUpdateSolrClient.Builderclass 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 theConcurrentUpdateSolrClient.Builderclass 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 theLBHttpSolrClient.Builderclass 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 theLBHttpSolrClient.Builderclass 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 theLBHttpSolrClient.Builderclass directly- Throws:
MalformedURLException
-
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 may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use theHttpSolrClient.Builderclass 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 may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use theHttpSolrClient.Builderclass directly
-
getHttpSolrClient
public static org.apache.solr.client.solrj.impl.HttpSolrClient getHttpSolrClient(String url, 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 theHttpSolrClient.Builderclass directly
-
getHttpSolrClient
public static org.apache.solr.client.solrj.impl.HttpSolrClient getHttpSolrClient(String url, org.apache.http.client.HttpClient httpClient, int connectionTimeoutMillis)
This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use theHttpSolrClient.Builderclass directly
-
getHttpSolrClient
public static org.apache.solr.client.solrj.impl.HttpSolrClient getHttpSolrClient(String url)
This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use theHttpSolrClient.Builderclass directly
-
getHttpSolrClient
public static org.apache.solr.client.solrj.impl.HttpSolrClient getHttpSolrClient(String url, int connectionTimeoutMillis)
This method may randomize unspecified aspects of the resulting SolrClient. Tests that do not wish to have any randomized behavior should use theHttpSolrClient.Builderclass directly
-
getHttpSolrClient
public static org.apache.solr.client.solrj.impl.HttpSolrClient getHttpSolrClient(String url, 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 theHttpSolrClient.Builderclass 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.
-
waitForWarming
protected static void waitForWarming(org.apache.solr.core.SolrCore core) throws InterruptedException- Throws:
InterruptedException
-
waitForWarming
protected void waitForWarming() throws InterruptedException- Throws:
InterruptedException
-
getSaferTestName
protected String getSaferTestName()
-
assertNonBlockingRandomGeneratorAvailable
public static void assertNonBlockingRandomGeneratorAvailable() throws InterruptedException- Throws:
InterruptedException
-
systemSetPropertySolrTestsMergePolicyFactory
protected static void systemSetPropertySolrTestsMergePolicyFactory(String value)
-
systemClearPropertySolrTestsMergePolicyFactory
protected static void systemClearPropertySolrTestsMergePolicyFactory()
-
systemSetPropertySolrDisableShardsWhitelist
@Deprecated protected static void systemSetPropertySolrDisableShardsWhitelist(String value)
Deprecated.
-
systemClearPropertySolrDisableShardsWhitelist
@Deprecated protected static void systemClearPropertySolrDisableShardsWhitelist()
Deprecated.
-
pickRandom
protected <T> T pickRandom(T... options)
-
randomizeUpdateLogImpl
public static void randomizeUpdateLogImpl()
randomizes the updateLog between different update log implementations for better test coverage
-
-