public class SolrCloudTestCase extends SolrTestCaseJ4
configureCluster(int) in a BeforeClass
static method or Before setUp method. This configures and starts a MiniSolrCloudCluster, available
via the cluster variable. Cluster shutdown is handled automatically if using BeforeClass.
@BeforeClass
public static void setupCluster() {
configureCluster(NUM_NODES)
.addConfig("configname", pathToConfig)
.configure();
}
| Modifier and Type | Class and Description |
|---|---|
static class |
SolrCloudTestCase.Builder
Builder class for a MiniSolrCloudCluster
|
SolrTestCaseJ4.BVal, SolrTestCaseJ4.CloudHttp2SolrClientBuilder, SolrTestCaseJ4.CloudSolrClientBuilder, SolrTestCaseJ4.Doc, SolrTestCaseJ4.Fld, SolrTestCaseJ4.FldType, SolrTestCaseJ4.FVal, SolrTestCaseJ4.IRange, SolrTestCaseJ4.IVals, SolrTestCaseJ4.IValsPercent, SolrTestCaseJ4.SuppressPointFields, SolrTestCaseJ4.SuppressSSL, SolrTestCaseJ4.SVal, SolrTestCaseJ4.Vals, SolrTestCaseJ4.XmlDocorg.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| Modifier and Type | Field and Description |
|---|---|
protected static MiniSolrCloudCluster |
cluster
The cluster
|
static int |
DEFAULT_TIMEOUT |
configString, CORE_PROPERTIES_FILENAME, coreName, DEFAULT_CONNECTION_TIMEOUT, DEFAULT_TEST_COLLECTION_NAME, DEFAULT_TEST_CORENAME, h, hdfsDataDir, initCoreDataDir, lrf, NUMERIC_DOCVALUES_SYSPROP, NUMERIC_POINTS_SYSPROP, ONE_ONE, RANDOMIZED_NUMERIC_FIELDTYPES, schemaString, solrClassRules, solrConfig, solrTestRules, sslConfig, SYSTEM_PROPERTY_SOLR_DISABLE_SHARDS_WHITELIST, SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICYFACTORY, testExecutor, testSolrHome, UPDATELOG_SYSPROP, USE_NUMERIC_POINTS_SYSPROP, ZERO_ONE, ZERO_TWOassertsAreEnabled, 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 and Description |
|---|
SolrCloudTestCase() |
| Modifier and Type | Method and Description |
|---|---|
static org.apache.solr.common.cloud.CollectionStatePredicate |
activeClusterShape(int expectedShards,
int expectedReplicas)
Return a
CollectionStatePredicate that returns true if a collection has the expected
number of active shards and active replicas |
void |
checkClusterConfiguration() |
static org.apache.solr.common.cloud.CollectionStatePredicate |
clusterShape(int expectedShards,
int expectedReplicas)
Return a
CollectionStatePredicate that returns true if a collection has the expected
number of shards and active replicas |
protected static SolrCloudTestCase.Builder |
configureCluster(int nodeCount)
Call this to configure a cluster of n nodes.
|
static org.apache.solr.common.cloud.LiveNodesPredicate |
containsLiveNode(String node) |
static void |
ensureRunningJettys(int nodeCount,
int timeoutSeconds)
Ensure that the given number of solr instances are running.
|
protected static org.apache.solr.common.cloud.DocCollection |
getCollectionState(String collectionName)
Get the collection state for a particular collection
|
protected static org.apache.solr.client.solrj.request.CoreStatus |
getCoreStatus(org.apache.solr.common.cloud.Replica replica)
Get the
CoreStatus data for a Replica
This assumes that the replica is hosted on a live node. |
protected static org.apache.solr.common.cloud.Replica |
getRandomReplica(org.apache.solr.common.cloud.Slice slice)
Get a (reproducibly) random replica from a
Slice |
protected static org.apache.solr.common.cloud.Replica |
getRandomReplica(org.apache.solr.common.cloud.Slice slice,
Predicate<org.apache.solr.common.cloud.Replica> matchPredicate)
Get a (reproducibly) random replica from a
Slice matching a predicate |
protected static org.apache.solr.common.cloud.Slice |
getRandomShard(org.apache.solr.common.cloud.DocCollection collection)
Get a (reproducibly) random shard from a
DocCollection |
static org.apache.solr.common.cloud.LiveNodesPredicate |
missingLiveNode(String node) |
static org.apache.solr.common.cloud.LiveNodesPredicate |
missingLiveNodes(List<String> nodes) |
static void |
shutdownCluster() |
protected org.apache.solr.common.util.NamedList |
waitForResponse(Predicate<org.apache.solr.common.util.NamedList> predicate,
org.apache.solr.client.solrj.SolrRequest request,
int intervalInMillis,
int numRetries,
String messageOnFail) |
protected static void |
waitForState(String message,
String collection,
org.apache.solr.common.cloud.CollectionStatePredicate predicate) |
protected static void |
waitForState(String message,
String collection,
org.apache.solr.common.cloud.CollectionStatePredicate predicate,
int timeout,
TimeUnit timeUnit)
Wait for a particular collection state to appear in the cluster client's state reader
This is a convenience method using the
DEFAULT_TIMEOUT |
protected static org.apache.solr.common.cloud.SolrZkClient |
zkClient() |
add, addAndGetVersion, addDoc, adoc, adoc, assertFailedU, assertFailedU, assertFieldValues, assertJQ, assertJQ, assertNonBlockingRandomGeneratorAvailable, assertQ, assertQ, assertQEx, assertQEx, assertQEx, assertResponseValues, assertSolrInputFieldEquals, assertU, assertU, assertXmlFile, assumeWorkingMockito, buildJettyConfig, buildUrl, clearIndex, clearObjectTrackerAndCheckEmpty, clearObjectTrackerAndCheckEmpty, commit, compareSolrDocument, compareSolrDocumentList, compareSolrInputDocument, configset, copyMinConf, copyMinConf, copyMinConf, copyMinFullSetup, copySolrHomeToTemp, copyXmlToHome, createComparator, createComparator, createCore, createCoreContainer, createCoreContainer, createCoreContainer, createDefaultCoreContainer, createDistributedUpdateProcessor, createDoc, createSort, deleteAndGetVersion, deleteByQueryAndGetVersion, deleteCore, delI, delQ, doc, getClassName, getCloudHttp2SolrClient, getCloudSolrClient, getCloudSolrClient, getCloudSolrClient, getCloudSolrClient, getCloudSolrClient, getCloudSolrClient, getCloudSolrClient, getCloudSolrClient, getConcurrentUpdateSolrClient, getConcurrentUpdateSolrClient, getConcurrentUpdateSolrClient, getFile, getHttpSolrClient, getHttpSolrClient, getHttpSolrClient, getHttpSolrClient, getHttpSolrClient, getHttpSolrClient, getHttpSolrClient, getLBHttpSolrClient, getLBHttpSolrClient, getLBHttpSolrClient, getNextAvailablePort, getRootCause, getSaferTestName, getSchemaFile, getSimpleClassName, getSolrConfigFile, getWrappedException, hasInitException, hasInitException, ignoreException, indexDocs, initClassLogLevels, initCore, initCore, initCore, initCore, initMethodLogLevels, invertField, isSSLMode, JQ, json, json, json, jsonAdd, jsonDelId, jsonDelQ, map, newCloudSolrClient, newRandomConfig, optimize, params, pickRandom, postSetUp, preTearDown, randomDate, randomizeUpdateLogImpl, randomSkewedDate, randomXmlUsableUnicodeString, req, req, req, resetExceptionIgnores, resetFactory, restoreMethodLogLevels, sdoc, sdocs, sdocWithChildren, sdocWithChildren, sdocWithChildren, setUp, setupNoCoreTest, setupTestCases, skewed, Solr11035BandAid, Solr11035BandAid, startTrackingSearchers, systemClearPropertySolrDisableShardsWhitelist, systemClearPropertySolrTestsMergePolicyFactory, systemSetPropertySolrDisableShardsWhitelist, systemSetPropertySolrTestsMergePolicyFactory, tearDown, teardownTestCases, TEST_HOME, TEST_PATH, toJSON, unIgnoreException, updateJ, useFactory, waitForWarming, waitForWarming, whitespaceMockTokenizer, whitespaceMockTokenizer, writeCoreProperties, writeCorePropertiescheckSyspropForceBeforeAssumptionFailure, checkSyspropForceBeforeClassAssumptionFailure, shutdownLoggeraddVirusChecker, assertDeletedDocsEquals, assertDocsAndPositionsEnumEquals, assertDocsEnumEquals, assertDocsSkippingEquals, assertDocValuesEquals, assertDocValuesEquals, assertFieldInfosEquals, assertNormsEquals, assertPointsEquals, assertPositionsSkippingEquals, assertReaderEquals, assertReaderStatisticsEquals, assertStoredFieldEquals, assertStoredFieldsEquals, assertTermsEnumEquals, assertTermsEquals, 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, wrapReaderassertArrayEquals, 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, failpublic static final int DEFAULT_TIMEOUT
protected static volatile MiniSolrCloudCluster cluster
protected static org.apache.solr.common.cloud.SolrZkClient zkClient()
protected static SolrCloudTestCase.Builder configureCluster(int nodeCount)
SolrCloudTestCase.Builder.configure() to start the clusternodeCount - the number of nodespublic void checkClusterConfiguration()
protected static org.apache.solr.common.cloud.DocCollection getCollectionState(String collectionName)
protected static void waitForState(String message, String collection, org.apache.solr.common.cloud.CollectionStatePredicate predicate)
protected static void waitForState(String message, String collection, org.apache.solr.common.cloud.CollectionStatePredicate predicate, int timeout, TimeUnit timeUnit)
DEFAULT_TIMEOUTmessage - a message to report on failurecollection - the collection to watchpredicate - a predicate to match against the collection statepublic static org.apache.solr.common.cloud.CollectionStatePredicate clusterShape(int expectedShards,
int expectedReplicas)
CollectionStatePredicate that returns true if a collection has the expected
number of shards and active replicaspublic static org.apache.solr.common.cloud.CollectionStatePredicate activeClusterShape(int expectedShards,
int expectedReplicas)
CollectionStatePredicate that returns true if a collection has the expected
number of active shards and active replicaspublic static org.apache.solr.common.cloud.LiveNodesPredicate containsLiveNode(String node)
public static org.apache.solr.common.cloud.LiveNodesPredicate missingLiveNode(String node)
public static org.apache.solr.common.cloud.LiveNodesPredicate missingLiveNodes(List<String> nodes)
protected static org.apache.solr.common.cloud.Slice getRandomShard(org.apache.solr.common.cloud.DocCollection collection)
DocCollectionprotected static org.apache.solr.common.cloud.Replica getRandomReplica(org.apache.solr.common.cloud.Slice slice)
Sliceprotected static org.apache.solr.common.cloud.Replica getRandomReplica(org.apache.solr.common.cloud.Slice slice,
Predicate<org.apache.solr.common.cloud.Replica> matchPredicate)
Slice matching a predicateprotected static org.apache.solr.client.solrj.request.CoreStatus getCoreStatus(org.apache.solr.common.cloud.Replica replica)
throws IOException,
org.apache.solr.client.solrj.SolrServerException
CoreStatus data for a Replica
This assumes that the replica is hosted on a live node.IOExceptionorg.apache.solr.client.solrj.SolrServerExceptionprotected org.apache.solr.common.util.NamedList waitForResponse(Predicate<org.apache.solr.common.util.NamedList> predicate, org.apache.solr.client.solrj.SolrRequest request, int intervalInMillis, int numRetries, String messageOnFail)
public static void ensureRunningJettys(int nodeCount,
int timeoutSeconds)
throws Exception
nodeCount - the number of Solr instances that should be running at the end of this methodException - on errorCopyright © 2000-2019 Apache Software Foundation. All Rights Reserved.