Class BaseDistributedSearchTestCase
- java.lang.Object
-
- org.junit.Assert
-
- org.apache.lucene.tests.util.LuceneTestCase
-
- org.apache.solr.SolrTestCase
-
- org.apache.solr.SolrTestCaseJ4
-
- org.apache.solr.BaseDistributedSearchTestCase
-
- Direct Known Subclasses:
AbstractDistribZkTestBase
public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4
Helper base class for distributed search test casesBy default, for Nightly runs, all tests in sub-classes will execute with 1, 2, ... DEFAULT_MAX_SHARD_COUNT number of shards set up repeatedly. For non-nightly tests, they will execute with 2 shards, to speed up total execution time.
In general, it's preferable to annotate the tests in sub-classes with a @ShardsFixed(num = N) or a @ShardsRepeat(min = M, max = N) to indicate whether the test should be called once, with a fixed number of shards, or called repeatedly for number of shards = M to N.
In some cases though, if the number of shards has to be fixed, but the number itself is dynamic, or if it has to be set as a default for all sub-classes of a sub-class, there's a fixShardCount(N) available, which is identical to @ShardsFixed(num = N) for all tests without annotations in that class hierarchy. Ideally this function should be retired in favour of better annotations..
- Since:
- solr 1.5
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BaseDistributedSearchTestCase.RandDate
static class
BaseDistributedSearchTestCase.RandVal
static interface
BaseDistributedSearchTestCase.ShardsFixed
static interface
BaseDistributedSearchTestCase.ShardsRepeat
class
BaseDistributedSearchTestCase.ShardsRepeatRule
-
Nested classes/interfaces inherited from class org.apache.solr.SolrTestCaseJ4
SolrTestCaseJ4.BVal, SolrTestCaseJ4.Doc, SolrTestCaseJ4.Fld, SolrTestCaseJ4.FldType, SolrTestCaseJ4.FVal, SolrTestCaseJ4.IRange, SolrTestCaseJ4.IVals, SolrTestCaseJ4.IValsPercent, SolrTestCaseJ4.RandomizingCloudHttp2SolrClientBuilder, SolrTestCaseJ4.RandomizingCloudSolrClientBuilder, SolrTestCaseJ4.SuppressPointFields, SolrTestCaseJ4.SuppressSSL, SolrTestCaseJ4.SVal, SolrTestCaseJ4.Vals, SolrTestCaseJ4.XmlDoc
-
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.BadApple, 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 extends Object>, org.apache.lucene.tests.util.LuceneTestCase.ThrowingRunnable, org.apache.lucene.tests.util.LuceneTestCase.Weekly
-
-
Field Summary
Fields Modifier and Type Field Description protected List<org.apache.solr.client.solrj.SolrClient>
clients
protected String
context
protected org.apache.solr.client.solrj.SolrClient
controlClient
protected JettySolrRunner
controlJetty
protected String[]
deadServers
protected ExecutorService
executor
static String[]
fieldNames
protected int
flags
static int
FUZZY
When this flag is set, Double values will be allowed a difference ratio of 1E-8 between the non-distributed and the distributed returned valuesprotected Map<String,Integer>
handle
protected String
id
protected List<JettySolrRunner>
jettys
protected int
nThreads
static int
ORDERED
static Random
r
static BaseDistributedSearchTestCase.RandVal[]
randVals
static BaseDistributedSearchTestCase.RandVal
rdate
static BaseDistributedSearchTestCase.RandVal
rdouble
BaseDistributedSearchTestCase.ShardsRepeatRule
repeatRule
static BaseDistributedSearchTestCase.RandVal
rfloat
static BaseDistributedSearchTestCase.RandVal
rint
static BaseDistributedSearchTestCase.RandVal
rlong
protected String
shards
protected String[]
shardsArr
static int
SKIP
static int
SKIPVAL
protected int
stress
protected File
testDir
static int
UNORDERED
protected boolean
useExplicitNodeNames
protected boolean
verifyStress
-
Fields inherited from class org.apache.solr.SolrTestCaseJ4
configString, CORE_PROPERTIES_FILENAME, coreName, DEAD_HOST_1, DEAD_HOST_2, DEAD_HOST_3, 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, solrConfig, solrTestRules, sslConfig, SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICYFACTORY, TEST_URL_ALLOW_LIST, testExecutor, testSolrHome, UPDATELOG_SYSPROP, USE_NUMERIC_POINTS_SYSPROP, ZERO_ONE, ZERO_TWO
-
Fields inherited from class org.apache.solr.SolrTestCase
solrClassRules
-
Fields 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_BADAPPLES, SYSPROP_FAILFAST, SYSPROP_MAXFAILURES, SYSPROP_MONSTER, SYSPROP_NIGHTLY, 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_THROTTLING, TEST_WEEKLY, VERBOSE
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseDistributedSearchTestCase()
Constructs a test in which the jetty+solr instances as well as the solr clients all use the value of the "hostContext" system property.protected
BaseDistributedSearchTestCase(String context)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.solr.client.solrj.response.UpdateResponse
add(org.apache.solr.client.solrj.SolrClient client, org.apache.solr.common.params.SolrParams params, Iterable<org.apache.solr.common.SolrInputDocument> sdocs)
protected org.apache.solr.client.solrj.response.UpdateResponse
add(org.apache.solr.client.solrj.SolrClient client, org.apache.solr.common.params.SolrParams params, org.apache.solr.common.SolrInputDocument sdoc)
This should not be called in a loop, useadd(SolrClient, SolrParams, Iterable)
insteadprotected static void
addFields(org.apache.solr.common.SolrInputDocument doc, Object... fields)
protected org.apache.solr.common.SolrInputDocument
addRandFields(org.apache.solr.common.SolrInputDocument sdoc)
protected String
buildUrl(int port)
static void
clearHostContext()
Clears the "hostContext" system propertystatic void
clearSolrDisableShardsWhitelist()
protected void
commit()
static String
compare(Object[] a, Object[] b, int flags, Map<String,Integer> handle)
static String
compare(Object a, Object b, int flags, Map<String,Integer> handle)
static String
compare(Map a, Map b, int flags, Map<String,Integer> handle)
static String
compare(org.apache.solr.common.SolrDocumentList a, org.apache.solr.common.SolrDocumentList b, int flags, Map<String,Integer> handle)
static String
compare(org.apache.solr.common.SolrDocument a, org.apache.solr.common.SolrDocument b, int flags, Map<String,Integer> handle)
static String
compare(org.apache.solr.common.util.NamedList a, org.apache.solr.common.util.NamedList b, int flags, Map<String,Integer> handle)
static String
compare1(Map a, Map b, int flags, Map<String,Integer> handle)
protected void
compareResponses(org.apache.solr.client.solrj.response.QueryResponse a, org.apache.solr.client.solrj.response.QueryResponse b)
protected void
compareSolrResponses(org.apache.solr.client.solrj.SolrResponse a, org.apache.solr.client.solrj.SolrResponse b)
protected JettySolrRunner
createControlJetty()
JettySolrRunner
createJetty(File solrHome, String dataDir)
JettySolrRunner
createJetty(File solrHome, String dataDir, String shardId)
JettySolrRunner
createJetty(File solrHome, String dataDir, String shardList, String solrConfigOverride, String schemaOverride)
JettySolrRunner
createJetty(File solrHome, String dataDir, String shardList, String solrConfigOverride, String schemaOverride, boolean explicitCoreNodeName)
protected org.apache.solr.client.solrj.SolrClient
createNewSolrClient(int port)
protected org.apache.solr.common.params.ModifiableSolrParams
createParams(Object... q)
protected void
createServers(int numShards)
protected void
del(String q)
protected org.apache.solr.client.solrj.response.UpdateResponse
del(org.apache.solr.client.solrj.SolrClient client, org.apache.solr.common.params.SolrParams params, Object... ids)
protected org.apache.solr.client.solrj.response.UpdateResponse
delQ(org.apache.solr.client.solrj.SolrClient client, org.apache.solr.common.params.SolrParams params, String... queries)
protected void
destroyServers()
void
distribSetUp()
void
distribTearDown()
void
fixShardCount(int count)
static int
flags(Map<String,Integer> handle, Object key)
SortedMap<Class<? extends javax.servlet.Filter>,String>
getExtraRequestFilters()
Override this method to insert extra filters into the JettySolrRunners that are created using createJetty()SortedMap<org.eclipse.jetty.servlet.ServletHolder,String>
getExtraServlets()
Override this method to insert extra servlets into the JettySolrRunners that are created using createJetty()protected String[]
getFieldNames()
static Object[]
getRandFields(String[] fields, BaseDistributedSearchTestCase.RandVal[] randVals)
protected BaseDistributedSearchTestCase.RandVal[]
getRandValues()
protected String
getServerUrl(int port)
int
getShardCount()
protected String
getShardsString()
String
getSolrHome()
Subclasses can override this to change a test's solr home (default is in test-files)protected String
getSolrXml()
protected void
index(Object... fields)
protected void
index_specific(int serverNumber, Object... fields)
protected void
indexDoc(org.apache.solr.client.solrj.SolrClient client, org.apache.solr.common.params.SolrParams params, org.apache.solr.common.SolrInputDocument doc)
protected void
indexDoc(org.apache.solr.common.SolrInputDocument doc)
Indexes the document in both the control client, and a randomly selected clientvoid
indexDocs(Iterator<org.apache.solr.common.SolrInputDocument> docs)
Indexes the stream of documents in both the control client and randomly selected clients (per batch)protected org.apache.solr.client.solrj.response.UpdateResponse
indexDocs(org.apache.solr.client.solrj.SolrClient client, org.apache.solr.common.params.SolrParams params, Iterable<org.apache.solr.common.SolrInputDocument> sdocs)
Indexes the document in both the control client and the specified client asserting that the responses are equivalentprotected void
indexr(Object... fields)
static void
initHostContext()
Set's the value of the "hostContext" system property to a random path like string (which may or may not contain sub-paths).static void
initialize()
protected org.apache.solr.client.solrj.response.QueryResponse
query(boolean setDistribParams, Object[] q)
Returns the QueryResponse fromqueryServer(org.apache.solr.common.params.ModifiableSolrParams)
protected org.apache.solr.client.solrj.response.QueryResponse
query(boolean setDistribParams, org.apache.solr.common.params.SolrParams p)
Returns the QueryResponse fromqueryServer(org.apache.solr.common.params.ModifiableSolrParams)
protected org.apache.solr.client.solrj.response.QueryResponse
query(Object... q)
Sets distributed params.protected org.apache.solr.client.solrj.response.QueryResponse
query(org.apache.solr.common.params.SolrParams params)
Sets distributed params.org.apache.solr.client.solrj.response.QueryResponse
queryAndCompare(org.apache.solr.common.params.SolrParams params, Iterable<org.apache.solr.client.solrj.SolrClient> clients)
org.apache.solr.client.solrj.response.QueryResponse
queryAndCompare(org.apache.solr.common.params.SolrParams params, org.apache.solr.client.solrj.SolrClient... clients)
protected org.apache.solr.client.solrj.response.QueryResponse
queryServer(org.apache.solr.common.params.ModifiableSolrParams params)
protected void
seedSolrHome(File jettyHome)
Given a directory that will be used as the SOLR_HOME for a jetty instance, seeds that directory with the contents ofgetSolrHome()
and ensures that the propergetSolrXml()
file is in place.protected void
setDistributedParams(org.apache.solr.common.params.ModifiableSolrParams params)
static void
setSolrDisableShardsWhitelist()
protected void
setupJettySolrHome(File jettyHome)
void
validateControlData(org.apache.solr.client.solrj.response.QueryResponse control)
Implementations can pre-test the control data for basic correctness before using it as a check for the shard data.-
Methods inherited from class org.apache.solr.SolrTestCaseJ4
add, addAndGetVersion, addDoc, adoc, adoc, assertExceptionThrownWithMessageContaining, assertFailedU, assertFailedU, assertFieldValues, assertJQ, assertJQ, assertNonBlockingRandomGeneratorAvailable, assertQ, assertQ, assertQEx, assertQEx, assertQEx, assertResponseValues, assertSolrInputFieldEquals, assertU, assertU, assertXmlFile, assumeWorkingMockito, buildJettyConfig, buildUrl, clearIndex, 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, getFile, getHttpClient, getHttpSolrClient, getRootCause, getSaferTestName, getSchemaFile, getSimpleClassName, getSolrConfigFile, getWrappedException, hasInitException, hasInitException, ignoreException, indexDocs, initAndGetDataDir, initClassLogLevels, initCore, initCore, initCore, initCore, initMethodLogLevels, invertField, isSSLMode, JQ, json, json, json, jsonAdd, jsonDelId, jsonDelQ, legacyExampleCollection1SolrHome, map, map, newRandomConfig, optimize, params, pickRandom, postSetUp, preTearDown, randomDate, randomSkewedDate, randomXmlUsableUnicodeString, req, req, req, resetExceptionIgnores, resetFactory, resetGlobalTracer, restoreMethodLogLevels, sdoc, sdocs, sdocWithChildren, sdocWithChildren, sdocWithChildren, setUp, setupNoCoreTest, setupTestCases, skewed, startTrackingSearchers, systemClearPropertySolrDisableUrlAllowList, systemClearPropertySolrTestsMergePolicyFactory, systemSetPropertySolrDisableUrlAllowList, systemSetPropertySolrTestsMergePolicyFactory, tearDown, teardownTestCases, TEST_COLL1_CONF, TEST_HOME, TEST_PATH, toJSON, unIgnoreException, updateJ, useFactory, waitForWarming, waitForWarming, whitespaceMockTokenizer, whitespaceMockTokenizer, writeCoreProperties, writeCoreProperties
-
Methods inherited from class org.apache.solr.SolrTestCase
assertJSONEquals, beforeSolrTestCase, checkSyspropForceBeforeAssumptionFailure, checkSyspropForceBeforeClassAssumptionFailure
-
Methods inherited from class org.apache.lucene.tests.util.LuceneTestCase
addVirusChecker, 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, callStackContains, callStackContains, callStackContainsAnyOf, closeAfterSuite, closeAfterTest, collate, createTempDir, createTempDir, createTempFile, createTempFile, dumpArray, dumpIterator, ensureSaneIWCOnNightly, expectThrows, expectThrows, expectThrows, expectThrowsAnyOf, expectThrowsAnyOf, getDataInputStream, getDataPath, getJvmForkArguments, getOnlyLeafReader, getTestClass, getTestName, hasWorkingMMapOnWindows, 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, newStringField, newStringField, newStringField, newStringField, newTextField, newTextField, newTieredMergePolicy, newTieredMergePolicy, overrideDefaultQueryCache, overrideTestDefaultQueryCache, random, randomLocale, randomTimeZone, rarely, rarely, replaceMaxFailureRule, resetDefaultQueryCache, restoreCPUCoreCount, restoreIndexWriterMaxDocs, runWithRestrictedPermissions, setIndexWriterMaxDocs, setupCPUCoreCount, 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, assertThrows, assertThrows, assertTrue, assertTrue, fail, fail
-
-
-
-
Field Detail
-
executor
protected ExecutorService executor
-
r
public static Random r
-
useExplicitNodeNames
protected boolean useExplicitNodeNames
-
controlJetty
protected volatile JettySolrRunner controlJetty
-
clients
protected final List<org.apache.solr.client.solrj.SolrClient> clients
-
jettys
protected final List<JettySolrRunner> jettys
-
context
protected volatile String context
-
deadServers
protected volatile String[] deadServers
-
shards
protected volatile String shards
-
shardsArr
protected volatile String[] shardsArr
-
testDir
protected volatile File testDir
-
controlClient
protected volatile org.apache.solr.client.solrj.SolrClient controlClient
-
stress
protected volatile int stress
-
verifyStress
protected volatile boolean verifyStress
-
nThreads
protected volatile int nThreads
-
ORDERED
public static final int ORDERED
- See Also:
- Constant Field Values
-
SKIP
public static final int SKIP
- See Also:
- Constant Field Values
-
SKIPVAL
public static final int SKIPVAL
- See Also:
- Constant Field Values
-
UNORDERED
public static final int UNORDERED
- See Also:
- Constant Field Values
-
FUZZY
public static int FUZZY
When this flag is set, Double values will be allowed a difference ratio of 1E-8 between the non-distributed and the distributed returned values
-
flags
protected volatile int flags
-
id
protected String id
-
rint
public static BaseDistributedSearchTestCase.RandVal rint
-
rlong
public static BaseDistributedSearchTestCase.RandVal rlong
-
rfloat
public static BaseDistributedSearchTestCase.RandVal rfloat
-
rdouble
public static BaseDistributedSearchTestCase.RandVal rdouble
-
rdate
public static BaseDistributedSearchTestCase.RandVal rdate
-
fieldNames
public static String[] fieldNames
-
randVals
public static BaseDistributedSearchTestCase.RandVal[] randVals
-
repeatRule
public BaseDistributedSearchTestCase.ShardsRepeatRule repeatRule
-
-
Constructor Detail
-
BaseDistributedSearchTestCase
protected BaseDistributedSearchTestCase()
Constructs a test in which the jetty+solr instances as well as the solr clients all use the value of the "hostContext" system property.If the system property is not set, or is set to the empty string (neither of which should normally happen unless a subclass explicitly modifies the property set by
initHostContext()
prior to calling this constructor) a servlet context of "/solr" is used. (this is for consistency with the default behavior of solr.xml parsing when usinghostContext="${hostContext:}"
If the system property is set to a value which does not begin with a "/" (which should normally happen unless a subclass explicitly modifies the property set by
initHostContext()
prior to calling this constructor) a leading "/" will be prepended.- See Also:
initHostContext()
-
BaseDistributedSearchTestCase
protected BaseDistributedSearchTestCase(String context)
- Parameters:
context
- explicit servlet context path to use (eg: "/solr")
-
-
Method Detail
-
initialize
public static void initialize()
-
initHostContext
public static void initHostContext()
Set's the value of the "hostContext" system property to a random path like string (which may or may not contain sub-paths). This is used in the default constructor for this test to help ensure no code paths have hardcoded assumptions about the servlet context used to run solr.Test configs may use the
${hostContext}
variable to access this system property.
-
clearHostContext
public static void clearHostContext() throws Exception
Clears the "hostContext" system property- Throws:
Exception
- See Also:
initHostContext()
-
setSolrDisableShardsWhitelist
public static void setSolrDisableShardsWhitelist() throws Exception
- Throws:
Exception
-
clearSolrDisableShardsWhitelist
public static void clearSolrDisableShardsWhitelist() throws Exception
- Throws:
Exception
-
getShardCount
public int getShardCount()
-
fixShardCount
public void fixShardCount(int count)
-
getFieldNames
protected String[] getFieldNames()
-
getRandValues
protected BaseDistributedSearchTestCase.RandVal[] getRandValues()
-
getSolrHome
public String getSolrHome()
Subclasses can override this to change a test's solr home (default is in test-files)
-
createControlJetty
protected JettySolrRunner createControlJetty() throws Exception
- Throws:
Exception
-
setDistributedParams
protected void setDistributedParams(org.apache.solr.common.params.ModifiableSolrParams params)
-
getShardsString
protected String getShardsString()
-
createJetty
public JettySolrRunner createJetty(File solrHome, String dataDir) throws Exception
- Throws:
Exception
-
createJetty
public JettySolrRunner createJetty(File solrHome, String dataDir, String shardId) throws Exception
- Throws:
Exception
-
createJetty
public JettySolrRunner createJetty(File solrHome, String dataDir, String shardList, String solrConfigOverride, String schemaOverride) throws Exception
- Throws:
Exception
-
createJetty
public JettySolrRunner createJetty(File solrHome, String dataDir, String shardList, String solrConfigOverride, String schemaOverride, boolean explicitCoreNodeName) throws Exception
- Throws:
Exception
-
getExtraServlets
public SortedMap<org.eclipse.jetty.servlet.ServletHolder,String> getExtraServlets()
Override this method to insert extra servlets into the JettySolrRunners that are created using createJetty()
-
getExtraRequestFilters
public SortedMap<Class<? extends javax.servlet.Filter>,String> getExtraRequestFilters()
Override this method to insert extra filters into the JettySolrRunners that are created using createJetty()
-
createNewSolrClient
protected org.apache.solr.client.solrj.SolrClient createNewSolrClient(int port)
-
getServerUrl
protected String getServerUrl(int port)
-
buildUrl
protected String buildUrl(int port)
-
addFields
protected static void addFields(org.apache.solr.common.SolrInputDocument doc, Object... fields)
-
addRandFields
protected org.apache.solr.common.SolrInputDocument addRandFields(org.apache.solr.common.SolrInputDocument sdoc)
-
indexDoc
protected void indexDoc(org.apache.solr.common.SolrInputDocument doc) throws IOException, org.apache.solr.client.solrj.SolrServerException
Indexes the document in both the control client, and a randomly selected client- Throws:
IOException
org.apache.solr.client.solrj.SolrServerException
-
indexDoc
protected void indexDoc(org.apache.solr.client.solrj.SolrClient client, org.apache.solr.common.params.SolrParams params, org.apache.solr.common.SolrInputDocument doc) throws IOException, org.apache.solr.client.solrj.SolrServerException
- Throws:
IOException
org.apache.solr.client.solrj.SolrServerException
-
indexDocs
public void indexDocs(Iterator<org.apache.solr.common.SolrInputDocument> docs) throws org.apache.solr.client.solrj.SolrServerException, IOException
Indexes the stream of documents in both the control client and randomly selected clients (per batch)- Throws:
org.apache.solr.client.solrj.SolrServerException
IOException
-
indexDocs
protected org.apache.solr.client.solrj.response.UpdateResponse indexDocs(org.apache.solr.client.solrj.SolrClient client, org.apache.solr.common.params.SolrParams params, Iterable<org.apache.solr.common.SolrInputDocument> sdocs) throws IOException, org.apache.solr.client.solrj.SolrServerException
Indexes the document in both the control client and the specified client asserting that the responses are equivalent- Throws:
IOException
org.apache.solr.client.solrj.SolrServerException
-
add
protected org.apache.solr.client.solrj.response.UpdateResponse add(org.apache.solr.client.solrj.SolrClient client, org.apache.solr.common.params.SolrParams params, org.apache.solr.common.SolrInputDocument sdoc) throws IOException, org.apache.solr.client.solrj.SolrServerException
This should not be called in a loop, useadd(SolrClient, SolrParams, Iterable)
instead- Throws:
IOException
org.apache.solr.client.solrj.SolrServerException
-
add
protected org.apache.solr.client.solrj.response.UpdateResponse add(org.apache.solr.client.solrj.SolrClient client, org.apache.solr.common.params.SolrParams params, Iterable<org.apache.solr.common.SolrInputDocument> sdocs) throws IOException, org.apache.solr.client.solrj.SolrServerException
- Throws:
IOException
org.apache.solr.client.solrj.SolrServerException
-
del
protected org.apache.solr.client.solrj.response.UpdateResponse del(org.apache.solr.client.solrj.SolrClient client, org.apache.solr.common.params.SolrParams params, Object... ids) throws IOException, org.apache.solr.client.solrj.SolrServerException
- Throws:
IOException
org.apache.solr.client.solrj.SolrServerException
-
delQ
protected org.apache.solr.client.solrj.response.UpdateResponse delQ(org.apache.solr.client.solrj.SolrClient client, org.apache.solr.common.params.SolrParams params, String... queries) throws IOException, org.apache.solr.client.solrj.SolrServerException
- Throws:
IOException
org.apache.solr.client.solrj.SolrServerException
-
index_specific
protected void index_specific(int serverNumber, Object... fields) throws Exception
- Throws:
Exception
-
queryServer
protected org.apache.solr.client.solrj.response.QueryResponse queryServer(org.apache.solr.common.params.ModifiableSolrParams params) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Throws:
org.apache.solr.client.solrj.SolrServerException
IOException
-
query
protected org.apache.solr.client.solrj.response.QueryResponse query(Object... q) throws Exception
Sets distributed params. Returns the QueryResponse fromqueryServer(org.apache.solr.common.params.ModifiableSolrParams)
,- Throws:
Exception
-
query
protected org.apache.solr.client.solrj.response.QueryResponse query(org.apache.solr.common.params.SolrParams params) throws Exception
Sets distributed params. Returns the QueryResponse fromqueryServer(org.apache.solr.common.params.ModifiableSolrParams)
,- Throws:
Exception
-
query
protected org.apache.solr.client.solrj.response.QueryResponse query(boolean setDistribParams, Object[] q) throws Exception
Returns the QueryResponse fromqueryServer(org.apache.solr.common.params.ModifiableSolrParams)
- Throws:
Exception
-
query
protected org.apache.solr.client.solrj.response.QueryResponse query(boolean setDistribParams, org.apache.solr.common.params.SolrParams p) throws Exception
Returns the QueryResponse fromqueryServer(org.apache.solr.common.params.ModifiableSolrParams)
- Throws:
Exception
-
queryAndCompare
public org.apache.solr.client.solrj.response.QueryResponse queryAndCompare(org.apache.solr.common.params.SolrParams params, org.apache.solr.client.solrj.SolrClient... clients) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Throws:
org.apache.solr.client.solrj.SolrServerException
IOException
-
queryAndCompare
public org.apache.solr.client.solrj.response.QueryResponse queryAndCompare(org.apache.solr.common.params.SolrParams params, Iterable<org.apache.solr.client.solrj.SolrClient> clients) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Throws:
org.apache.solr.client.solrj.SolrServerException
IOException
-
compare
public static String compare(org.apache.solr.common.util.NamedList a, org.apache.solr.common.util.NamedList b, int flags, Map<String,Integer> handle)
-
compare
public static String compare(org.apache.solr.common.SolrDocument a, org.apache.solr.common.SolrDocument b, int flags, Map<String,Integer> handle)
-
compare
public static String compare(org.apache.solr.common.SolrDocumentList a, org.apache.solr.common.SolrDocumentList b, int flags, Map<String,Integer> handle)
-
compare
public static String compare(Object[] a, Object[] b, int flags, Map<String,Integer> handle)
-
compareSolrResponses
protected void compareSolrResponses(org.apache.solr.client.solrj.SolrResponse a, org.apache.solr.client.solrj.SolrResponse b)
-
compareResponses
protected void compareResponses(org.apache.solr.client.solrj.response.QueryResponse a, org.apache.solr.client.solrj.response.QueryResponse b)
-
getRandFields
public static Object[] getRandFields(String[] fields, BaseDistributedSearchTestCase.RandVal[] randVals)
-
validateControlData
public void validateControlData(org.apache.solr.client.solrj.response.QueryResponse control) throws Exception
Implementations can pre-test the control data for basic correctness before using it as a check for the shard data. This is useful, for instance, if a test bug is introduced causing a spelling index not to get built: both control & shard data would have no results but because they match the test would pass. This method gives us a chance to ensure something exists in the control data.- Throws:
Exception
-
getSolrXml
protected String getSolrXml()
-
seedSolrHome
protected void seedSolrHome(File jettyHome) throws IOException
Given a directory that will be used as the SOLR_HOME for a jetty instance, seeds that directory with the contents ofgetSolrHome()
and ensures that the propergetSolrXml()
file is in place.- Throws:
IOException
-
setupJettySolrHome
protected void setupJettySolrHome(File jettyHome) throws IOException
- Throws:
IOException
-
createParams
protected org.apache.solr.common.params.ModifiableSolrParams createParams(Object... q)
-
-