Package org.apache.solr
Class SolrTestCase
java.lang.Object
org.junit.Assert
org.apache.lucene.tests.util.LuceneTestCase
org.apache.solr.SolrTestCase
- Direct Known Subclasses:
BackupRestoreUtils,DOMUtilTestBase,EmbeddedSolrServerTestBase,SolrTestCaseJ4
@SuppressSysoutChecks(bugUrl="Solr dumps tons of logs to console.")
public class SolrTestCase
extends org.apache.lucene.tests.util.LuceneTestCase
All Solr test cases should derive from this class eventually. This is originally a result of
async logging, see: SOLR-12055 and associated. To enable async logging, we must gracefully shut
down logging. Many Solr tests subclass LuceneTestCase.
Rather than add the cruft from SolrTestCaseJ4 to all the Solr tests that currently subclass LuceneTestCase, we'll add the shutdown to this class and subclass it.
Other changes that should affect every Solr test case may go here if they don't require the added capabilities in SolrTestCaseJ4.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.tests.util.LuceneTestCase
org.apache.lucene.tests.util.LuceneTestCase.AwaitsFix, org.apache.lucene.tests.util.LuceneTestCase.Concurrency, org.apache.lucene.tests.util.LuceneTestCase.Monster, org.apache.lucene.tests.util.LuceneTestCase.Nightly, org.apache.lucene.tests.util.LuceneTestCase.SuppressCodecs, org.apache.lucene.tests.util.LuceneTestCase.SuppressFileSystems, org.apache.lucene.tests.util.LuceneTestCase.SuppressFsync, org.apache.lucene.tests.util.LuceneTestCase.SuppressReproduceLine, org.apache.lucene.tests.util.LuceneTestCase.SuppressSysoutChecks, org.apache.lucene.tests.util.LuceneTestCase.SuppressTempFileChecks, org.apache.lucene.tests.util.LuceneTestCase.ThrowingConsumer<T>, org.apache.lucene.tests.util.LuceneTestCase.ThrowingRunnable, org.apache.lucene.tests.util.LuceneTestCase.Weekly -
Field Summary
FieldsModifier and TypeFieldDescriptionorg.junit.rules.TestRulestatic org.junit.rules.TestRuleFields inherited from class org.apache.lucene.tests.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_FAILFAST, SYSPROP_MAXFAILURES, SYSPROP_MONSTER, SYSPROP_NIGHTLY, SYSPROP_WEEKLY, TEST_ASSERTS_ENABLED, TEST_AWAITSFIX, TEST_CODEC, TEST_DIRECTORY, TEST_DOCVALUESFORMAT, TEST_LINE_DOCS_FILE, TEST_MONSTER, TEST_NIGHTLY, TEST_POSTINGSFORMAT, TEST_THROTTLING, TEST_WEEKLY, VERBOSE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic voidassertJSONEquals(String expected, String actual) static <T> voidassertThat(String message, T actual, org.hamcrest.Matcher<? super T> matcher) Hide deprecated inherited method with same signaturestatic <T> voidassertThat(T actual, org.hamcrest.Matcher<? super T> matcher) Hide deprecated inherited method with same signaturestatic voidSets thesolr.configset.default.confdirsystem property to the value ofExternalPaths.DEFAULT_CONFIGSETif and only if the system property is not already set, and theDEFAULT_CONFIGSETexists and is a readable directory.voidSpecial hook for sanity checking if any tests trigger failures when an Assumption failure occurs in aBeforemethodstatic voidSpecial hook for sanity checking if any tests trigger failures when an Assumption failure occures in aBeforeClassmethodMethods inherited from class org.apache.lucene.tests.util.LuceneTestCase
addVirusChecker, assertDeletedDocsEquals, assertDocsAndPositionsEnumEquals, assertDocsEnumEquals, assertDocsSkippingEquals, assertDocValuesEquals, assertDocValuesEquals, assertDoubleUlpEquals, assertFieldInfosEquals, assertFloatUlpEquals, assertNormsEquals, assertPointsEquals, assertPositionsSkippingEquals, assertReaderEquals, assertReaderStatisticsEquals, assertStoredFieldEquals, assertStoredFieldsEquals, assertTermsEnumEquals, assertTermsEquals, assertTermsEquals, assertTermsStatisticsEquals, assertTermStatsEquals, assertTermVectorsEquals, asSet, assumeFalse, assumeNoException, assumeTrue, atLeast, atLeast, callStackContains, callStackContains, callStackContainsAnyOf, closeAfterSuite, closeAfterTest, collate, createTempDir, createTempDir, createTempFile, createTempFile, dumpArray, dumpIterator, ensureSaneIWCOnNightly, expectThrows, expectThrows, expectThrows, expectThrowsAnyOf, expectThrowsAnyOf, getDataInputStream, getDataPath, getJvmForkArguments, getOnlyLeafReader, getTestClass, getTestName, isTestThread, localeForLanguageTag, maybeChangeLiveIndexWriterConfig, maybeWrapReader, newAlcoholicMergePolicy, newAlcoholicMergePolicy, newBytesRef, newBytesRef, newBytesRef, newBytesRef, newBytesRef, newBytesRef, 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, newSearcher, newSearcher, newSnapshotIndexWriterConfig, newStringField, newStringField, newStringField, newStringField, newTextField, newTextField, newTieredMergePolicy, newTieredMergePolicy, overrideDefaultQueryCache, overrideTestDefaultQueryCache, random, randomLocale, randomTimeZone, randomVectorFormat, rarely, rarely, replaceMaxFailureRule, resetDefaultQueryCache, restoreCPUCoreCount, restoreIndexWriterMaxDocs, runWithRestrictedPermissions, setIndexWriterMaxDocs, setUp, setupCPUCoreCount, setUpExecutorService, shutdownExecutorService, slowFileExists, tearDown, usually, usually, wrapReaderMethods 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, assertThrows, assertThrows, assertTrue, assertTrue, fail, fail
-
Field Details
-
solrClassRules
public static org.junit.rules.TestRule solrClassRules -
methodRules
public org.junit.rules.TestRule methodRules
-
-
Constructor Details
-
SolrTestCase
public SolrTestCase()
-
-
Method Details
-
beforeSolrTestCase
public static void beforeSolrTestCase()Sets thesolr.configset.default.confdirsystem property to the value ofExternalPaths.DEFAULT_CONFIGSETif and only if the system property is not already set, and theDEFAULT_CONFIGSETexists and is a readable directory.Logs INFO/WARNing messages as appropriate based on these 2 conditions.
- See Also:
-
checkSyspropForceBeforeClassAssumptionFailure
public static void checkSyspropForceBeforeClassAssumptionFailure()Special hook for sanity checking if any tests trigger failures when an Assumption failure occures in aBeforeClassmethod- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
afterClassShutdownLogging
public static void afterClassShutdownLogging() -
checkSyspropForceBeforeAssumptionFailure
public void checkSyspropForceBeforeAssumptionFailure()Special hook for sanity checking if any tests trigger failures when an Assumption failure occurs in aBeforemethod- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
assertJSONEquals
-
assertThat
public static <T> void assertThat(T actual, org.hamcrest.Matcher<? super T> matcher) Hide deprecated inherited method with same signature- See Also:
-
assertThat
public static <T> void assertThat(String message, T actual, org.hamcrest.Matcher<? super T> matcher) Hide deprecated inherited method with same signature- See Also:
-