@Listeners(value={ReproduceInfoPrinter.class,LoggingListener.class}) @LuceneTestCase.SuppressSysoutChecks(bugUrl="we log a lot on purpose") @LuceneTestCase.SuppressCodecs(value={"SimpleText","Memory","CheapBastard","Direct","Compressing","FST50","FSTOrd50","TestBloomFilteredLucenePostings","MockRandom","BlockTreeOrds","LuceneFixedGap","LuceneVarGapFixedInterval","LuceneVarGapDocFreqInterval","Lucene50"}) @LuceneTestCase.SuppressReproduceLine public abstract class ESTestCase extends org.apache.lucene.util.LuceneTestCase
Modifier and Type | Class and Description |
---|---|
static class |
ESTestCase.GeohashGenerator |
static class |
ESTestCase.TestAnalysis
This cute helper class just holds all analysis building blocks that are used
to build IndexAnalyzers.
|
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
Modifier and Type | Field and Description |
---|---|
static boolean |
checkIndexFailed
MockFSDirectoryService sets this:
|
protected org.elasticsearch.common.logging.DeprecationLogger |
deprecationLogger |
org.junit.rules.RuleChain |
failureAndSuccessEvents |
protected org.apache.logging.log4j.Logger |
logger |
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_CODEC, TEST_DIRECTORY, TEST_DOCVALUESFORMAT, TEST_LINE_DOCS_FILE, TEST_NIGHTLY, TEST_POSTINGSFORMAT, TEST_SLOW, TEST_THROTTLING, TEST_WEEKLY, VERBOSE
Constructor and Description |
---|
ESTestCase() |
Modifier and Type | Method and Description |
---|---|
void |
after() |
protected void |
afterIfFailed(java.util.List<java.lang.Throwable> errors)
Called when a test fails, supplying the errors it generated.
|
protected void |
afterIfSuccessful()
called after a test is finished, but only if successful
|
void |
assertAllIndicesRemovedAndDeletionCompleted(java.lang.Iterable<org.elasticsearch.indices.IndicesService> indicesServices) |
static void |
assertArrayEquals(java.lang.StackTraceElement[] expected,
java.lang.StackTraceElement[] actual)
Compares two stack traces, ignoring module (which is not yet serialized)
|
static void |
assertBusy(java.lang.Runnable codeBlock)
Runs the code block for 10 seconds waiting for no assertion to trip.
|
static void |
assertBusy(java.lang.Runnable codeBlock,
long maxWaitTime,
java.util.concurrent.TimeUnit unit)
Runs the code block for the provided interval, waiting for no assertions to trip.
|
static void |
assertEquals(java.lang.StackTraceElement expected,
java.lang.StackTraceElement actual)
Compares two stack trace elements, ignoring module (which is not yet serialized)
|
static boolean |
assertionsEnabled()
Returns true iff assertions for elasticsearch packages are enabled
|
void |
assertPathHasBeenCleared(java.nio.file.Path path)
Asserts that there are no files in the specified path
|
protected void |
assertSettingDeprecationsAndWarnings(org.elasticsearch.common.settings.Setting<?>[] settings,
java.lang.String... warnings)
Convenience method to assert warnings for settings deprecations and general deprecation warnings.
|
protected void |
assertWarnings(java.lang.String... expectedWarnings) |
static boolean |
awaitBusy(java.util.function.BooleanSupplier breakSupplier) |
static boolean |
awaitBusy(java.util.function.BooleanSupplier breakSupplier,
long maxWaitTime,
java.util.concurrent.TimeUnit unit) |
void |
before() |
static int |
between(int min,
int max)
An alias for
randomIntBetween(int, int) . |
protected static void |
checkStaticState() |
static <T extends org.elasticsearch.common.io.stream.Writeable> |
copyWriteable(T original,
org.elasticsearch.common.io.stream.NamedWriteableRegistry namedWritabelRegistry,
org.elasticsearch.common.io.stream.Writeable.Reader<T> reader)
Create a copy of an original
Writeable object by running it through a BytesStreamOutput and
reading it in again using a provided Writeable.Reader . |
protected org.elasticsearch.common.xcontent.XContentParser |
createParser(org.elasticsearch.common.xcontent.XContentBuilder builder)
Create a new
XContentParser . |
protected org.elasticsearch.common.xcontent.XContentParser |
createParser(org.elasticsearch.common.xcontent.XContent xContent,
byte[] data)
Create a new
XContentParser . |
protected org.elasticsearch.common.xcontent.XContentParser |
createParser(org.elasticsearch.common.xcontent.XContent xContent,
org.elasticsearch.common.bytes.BytesReference data)
Create a new
XContentParser . |
protected org.elasticsearch.common.xcontent.XContentParser |
createParser(org.elasticsearch.common.xcontent.XContent xContent,
java.io.InputStream data)
Create a new
XContentParser . |
protected org.elasticsearch.common.xcontent.XContentParser |
createParser(org.elasticsearch.common.xcontent.XContent xContent,
java.lang.String data)
Create a new
XContentParser . |
static ESTestCase.TestAnalysis |
createTestAnalysis(org.elasticsearch.index.Index index,
org.elasticsearch.common.settings.Settings settings,
org.elasticsearch.plugins.AnalysisPlugin... analysisPlugins)
Creates an TestAnalysis with all the default analyzers configured.
|
static ESTestCase.TestAnalysis |
createTestAnalysis(org.elasticsearch.index.IndexSettings indexSettings,
org.elasticsearch.common.settings.Settings nodeSettings,
org.elasticsearch.plugins.AnalysisPlugin... analysisPlugins)
Creates an TestAnalysis with all the default analyzers configured.
|
static ESTestCase.TestAnalysis |
createTestAnalysis(org.elasticsearch.index.Index index,
org.elasticsearch.common.settings.Settings nodeSettings,
org.elasticsearch.common.settings.Settings settings,
org.elasticsearch.plugins.AnalysisPlugin... analysisPlugins)
Creates an TestAnalysis with all the default analyzers configured.
|
protected boolean |
enableWarningsCheck()
Whether or not we check after each test whether it has left warnings behind.
|
void |
ensureAllSearchContextsReleased() |
void |
ensureCheckIndexPassed() |
static boolean |
frequently()
The exact opposite of
LuceneTestCase.rarely() . |
static java.lang.String[] |
generateRandomStringArray(int maxArraySize,
int maxStringSize,
boolean allowNull) |
static java.lang.String[] |
generateRandomStringArray(int maxArraySize,
int maxStringSize,
boolean allowNull,
boolean allowEmpty) |
java.nio.file.Path |
getBwcIndicesPath() |
java.nio.file.Path |
getDataPath(java.lang.String relativePath)
Returns a
Path pointing to the class path relative resource given
as the first argument. |
static org.apache.lucene.util.TestRuleMarkFailure |
getSuiteFailureMarker()
Returns the suite failure marker: internal use only!
|
static int |
iterations(int min,
int max)
Returns a "scaled" number of iterations for loops which can have a variable
iteration count.
|
static <T> void |
maybeSet(java.util.function.Consumer<T> consumer,
T value)
helper to randomly perform on
consumer with value |
org.elasticsearch.env.NodeEnvironment |
newNodeEnvironment() |
org.elasticsearch.env.NodeEnvironment |
newNodeEnvironment(org.elasticsearch.common.settings.Settings settings) |
static org.elasticsearch.indices.IndicesModule |
newTestIndicesModule(java.util.Map<java.lang.String,org.elasticsearch.index.mapper.Mapper.TypeParser> extraMappers,
java.util.Map<java.lang.String,org.elasticsearch.index.mapper.MetadataFieldMapper.TypeParser> extraMetadataMappers)
Creates an IndicesModule for testing with the given mappers and metadata mappers.
|
static org.elasticsearch.script.ScriptModule |
newTestScriptModule() |
static java.lang.String |
randomAlphaOfLength(int codeUnits) |
static java.lang.String |
randomAlphaOfLengthBetween(int minCodeUnits,
int maxCodeUnits) |
static boolean |
randomBoolean() |
static byte |
randomByte() |
static org.joda.time.DateTimeZone |
randomDateTimeZone()
generate a random DateTimeZone from the ones available in joda library
|
static double |
randomDouble() |
static double |
randomDoubleBetween(double start,
double end,
boolean lowerInclusive)
Returns a double value in the interval [start, end) if lowerInclusive is
set to true, (start, end) otherwise.
|
static float |
randomFloat() |
static <T> T |
randomFrom(java.util.Collection<T> collection)
Pick a random object from the given collection.
|
static <T> T |
randomFrom(java.util.List<T> list)
Pick a random object from the given list.
|
static <T> T |
randomFrom(java.util.Random random,
java.util.Collection<T> collection)
Pick a random object from the given collection.
|
static <T> T |
randomFrom(java.util.Random random,
T... array)
Pick a random object from the given array.
|
static <T> T |
randomFrom(T... array)
Pick a random object from the given array.
|
static java.lang.String |
randomGeohash(int minPrecision,
int maxPrecision) |
static int |
randomInt() |
static int |
randomInt(int max)
A random integer from 0..max (inclusive).
|
static int |
randomIntBetween(int min,
int max)
A random integer from
min to max (inclusive). |
static long |
randomLong() |
static long |
randomNonNegativeLong() |
static java.lang.String |
randomPositiveTimeValue() |
static java.lang.String |
randomRealisticUnicodeOfCodepointLength(int codePoints) |
static java.lang.String |
randomRealisticUnicodeOfCodepointLengthBetween(int minCodePoints,
int maxCodePoints) |
static java.lang.String |
randomRealisticUnicodeOfLength(int codeUnits) |
static java.lang.String |
randomRealisticUnicodeOfLengthBetween(int minCodeUnits,
int maxCodeUnits) |
static short |
randomShort() |
static <T> java.util.List<T> |
randomSubsetOf(java.util.Collection<T> collection)
Returns a random subset of values (including a potential empty list)
|
static <T> java.util.List<T> |
randomSubsetOf(int size,
java.util.Collection<T> collection)
Returns size random values
|
static <T> java.util.List<T> |
randomSubsetOf(int size,
T... values)
Returns size random values
|
static java.lang.String |
randomTimeValue() |
static java.lang.String |
randomTimeValue(int lower,
int upper) |
static java.lang.String |
randomTimeValue(int lower,
int upper,
java.lang.String[] suffixes) |
static java.lang.String |
randomUnicodeOfCodepointLength(int codePoints) |
static java.lang.String |
randomUnicodeOfCodepointLengthBetween(int minCodePoints,
int maxCodePoints) |
static java.lang.String |
randomUnicodeOfLength(int codeUnits) |
static java.lang.String |
randomUnicodeOfLengthBetween(int minCodeUnits,
int maxCodeUnits) |
static <T> java.util.Set<T> |
randomUnique(java.util.function.Supplier<T> supplier,
int targetCount)
Builds a set of unique items.
|
static <T> T |
randomValueOtherThan(T input,
java.util.function.Supplier<T> randomSupplier)
helper to get a random value in a certain range that's different from the input
|
static <T> T |
randomValueOtherThanMany(java.util.function.Predicate<T> input,
java.util.function.Supplier<T> randomSupplier)
helper to get a random value in a certain range that's different from the input
|
void |
resetCheckIndexStatus() |
static void |
restoreContentType() |
static void |
restoreFileSystem() |
static int |
scaledRandomIntBetween(int min,
int max)
Returns a "scaled" random number between min and max (inclusive).
|
static void |
setContentType() |
static void |
setFileSystem() |
static org.elasticsearch.common.settings.Settings.Builder |
settings(org.elasticsearch.Version version)
Return consistent index settings for the provided index version.
|
static java.util.LinkedHashMap<java.lang.String,java.lang.Object> |
shuffleMap(java.util.LinkedHashMap<java.lang.String,java.lang.Object> map,
java.util.Set<java.lang.String> exceptFields) |
protected org.elasticsearch.common.xcontent.XContentBuilder |
shuffleXContent(org.elasticsearch.common.xcontent.XContentBuilder builder,
java.lang.String... exceptFieldNames)
Randomly shuffles the fields inside objects in the
XContentBuilder passed in. |
protected static org.elasticsearch.common.xcontent.XContentBuilder |
shuffleXContent(org.elasticsearch.common.xcontent.XContentParser parser,
boolean prettyPrint,
java.lang.String... exceptFieldNames)
Randomly shuffles the fields inside objects parsed using the
XContentParser passed in. |
protected static long |
spinForAtLeastNMilliseconds(long ms) |
protected static long |
spinForAtLeastOneMillisecond() |
static boolean |
terminate(java.util.concurrent.ExecutorService... services) |
static boolean |
terminate(org.elasticsearch.threadpool.ThreadPool service) |
java.lang.String[] |
tmpPaths()
Returns a random number of temporary paths.
|
protected org.elasticsearch.common.bytes.BytesReference |
toShuffledXContent(org.elasticsearch.common.xcontent.ToXContent toXContent,
org.elasticsearch.common.xcontent.XContentType xContentType,
org.elasticsearch.common.xcontent.ToXContent.Params params,
boolean humanReadable,
java.lang.String... exceptFieldNames)
Returns the bytes that represent the XContent output of the provided
ToXContent object, using the provided
XContentType . |
protected org.elasticsearch.common.xcontent.NamedXContentRegistry |
xContentRegistry()
The
NamedXContentRegistry to use for this test. |
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, getBaseTempDirForTestClass, getDataInputStream, 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, 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, setUp, setupCPUCoreCount, setupSpins, slowFileExists, tearDown, usually, usually, wrapReader
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, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, fail
protected final org.apache.logging.log4j.Logger logger
protected final org.elasticsearch.common.logging.DeprecationLogger deprecationLogger
public org.junit.rules.RuleChain failureAndSuccessEvents
public static boolean checkIndexFailed
protected void afterIfFailed(java.util.List<java.lang.Throwable> errors)
protected void afterIfSuccessful() throws java.lang.Exception
java.lang.Exception
public static void setFileSystem() throws java.lang.Exception
java.lang.Exception
public static void restoreFileSystem() throws java.lang.Exception
java.lang.Exception
public static void setContentType() throws java.lang.Exception
java.lang.Exception
public static void restoreContentType()
public final void before()
protected boolean enableWarningsCheck()
assertWarnings(String...)
.public final void after() throws java.lang.Exception
java.lang.Exception
protected final void assertSettingDeprecationsAndWarnings(org.elasticsearch.common.settings.Setting<?>[] settings, java.lang.String... warnings)
settings
- the settings that are expected to be deprecatedwarnings
- other expected general deprecation warningsprotected final void assertWarnings(java.lang.String... expectedWarnings)
protected static void checkStaticState() throws java.lang.Exception
java.lang.Exception
public final void ensureAllSearchContextsReleased() throws java.lang.Exception
java.lang.Exception
public final void resetCheckIndexStatus() throws java.lang.Exception
java.lang.Exception
public final void ensureCheckIndexPassed() throws java.lang.Exception
java.lang.Exception
public static int scaledRandomIntBetween(int min, int max)
RandomizedTest.scaledRandomIntBetween(int, int)
public static int randomIntBetween(int min, int max)
min
to max
(inclusive).scaledRandomIntBetween(int, int)
public static int iterations(int min, int max)
scaledRandomIntBetween(int, int)
.public static int between(int min, int max)
randomIntBetween(int, int)
.scaledRandomIntBetween(int, int)
public static boolean frequently()
LuceneTestCase.rarely()
.public static boolean randomBoolean()
public static byte randomByte()
public static short randomShort()
public static int randomInt()
public static long randomNonNegativeLong()
public static float randomFloat()
public static double randomDouble()
public static double randomDoubleBetween(double start, double end, boolean lowerInclusive)
start
- lower bound of interval to draw uniformly distributed random numbers fromend
- upper boundlowerInclusive
- whether or not to include lower end of the intervalpublic static long randomLong()
public static int randomInt(int max)
public static <T> T randomFrom(T... array)
public static <T> T randomFrom(java.util.Random random, T... array)
public static <T> T randomFrom(java.util.List<T> list)
public static <T> T randomFrom(java.util.Collection<T> collection)
public static <T> T randomFrom(java.util.Random random, java.util.Collection<T> collection)
public static java.lang.String randomAlphaOfLengthBetween(int minCodeUnits, int maxCodeUnits)
public static java.lang.String randomAlphaOfLength(int codeUnits)
public static java.lang.String randomUnicodeOfLengthBetween(int minCodeUnits, int maxCodeUnits)
public static java.lang.String randomUnicodeOfLength(int codeUnits)
public static java.lang.String randomUnicodeOfCodepointLengthBetween(int minCodePoints, int maxCodePoints)
public static java.lang.String randomUnicodeOfCodepointLength(int codePoints)
public static java.lang.String randomRealisticUnicodeOfLengthBetween(int minCodeUnits, int maxCodeUnits)
public static java.lang.String randomRealisticUnicodeOfLength(int codeUnits)
public static java.lang.String randomRealisticUnicodeOfCodepointLengthBetween(int minCodePoints, int maxCodePoints)
public static java.lang.String randomRealisticUnicodeOfCodepointLength(int codePoints)
public static java.lang.String[] generateRandomStringArray(int maxArraySize, int maxStringSize, boolean allowNull, boolean allowEmpty)
public static java.lang.String[] generateRandomStringArray(int maxArraySize, int maxStringSize, boolean allowNull)
public static java.lang.String randomTimeValue(int lower, int upper, java.lang.String[] suffixes)
public static java.lang.String randomTimeValue(int lower, int upper)
public static java.lang.String randomTimeValue()
public static java.lang.String randomPositiveTimeValue()
public static org.joda.time.DateTimeZone randomDateTimeZone()
public static <T> void maybeSet(java.util.function.Consumer<T> consumer, T value)
consumer
with value
public static <T> T randomValueOtherThan(T input, java.util.function.Supplier<T> randomSupplier)
public static <T> T randomValueOtherThanMany(java.util.function.Predicate<T> input, java.util.function.Supplier<T> randomSupplier)
public static void assertBusy(java.lang.Runnable codeBlock) throws java.lang.Exception
java.lang.Exception
public static void assertBusy(java.lang.Runnable codeBlock, long maxWaitTime, java.util.concurrent.TimeUnit unit) throws java.lang.Exception
java.lang.Exception
public static boolean awaitBusy(java.util.function.BooleanSupplier breakSupplier) throws java.lang.InterruptedException
java.lang.InterruptedException
public static boolean awaitBusy(java.util.function.BooleanSupplier breakSupplier, long maxWaitTime, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
java.lang.InterruptedException
public static boolean terminate(java.util.concurrent.ExecutorService... services) throws java.lang.InterruptedException
java.lang.InterruptedException
public static boolean terminate(org.elasticsearch.threadpool.ThreadPool service) throws java.lang.InterruptedException
java.lang.InterruptedException
public java.nio.file.Path getDataPath(java.lang.String relativePath)
Path
pointing to the class path relative resource given
as the first argument. In contrast to
getClass().getResource(...).getFile()
this method will not
return URL encoded paths if the parent path contains spaces or other
non-standard characters.getDataPath
in class org.apache.lucene.util.LuceneTestCase
public java.nio.file.Path getBwcIndicesPath()
public java.lang.String[] tmpPaths()
public org.elasticsearch.env.NodeEnvironment newNodeEnvironment() throws java.io.IOException
java.io.IOException
public org.elasticsearch.env.NodeEnvironment newNodeEnvironment(org.elasticsearch.common.settings.Settings settings) throws java.io.IOException
java.io.IOException
public static org.elasticsearch.common.settings.Settings.Builder settings(org.elasticsearch.Version version)
public static <T> java.util.List<T> randomSubsetOf(int size, T... values)
public static <T> java.util.List<T> randomSubsetOf(java.util.Collection<T> collection)
public static <T> java.util.List<T> randomSubsetOf(int size, java.util.Collection<T> collection)
public static <T> java.util.Set<T> randomUnique(java.util.function.Supplier<T> supplier, int targetCount)
public static java.lang.String randomGeohash(int minPrecision, int maxPrecision)
protected final org.elasticsearch.common.bytes.BytesReference toShuffledXContent(org.elasticsearch.common.xcontent.ToXContent toXContent, org.elasticsearch.common.xcontent.XContentType xContentType, org.elasticsearch.common.xcontent.ToXContent.Params params, boolean humanReadable, java.lang.String... exceptFieldNames) throws java.io.IOException
ToXContent
object, using the provided
XContentType
. Wraps the output into a new anonymous object according to the value returned
by the ToXContent.isFragment()
method returns. Shuffles the keys to make sure that parsing never relies on keys ordering.java.io.IOException
protected final org.elasticsearch.common.xcontent.XContentBuilder shuffleXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, java.lang.String... exceptFieldNames) throws java.io.IOException
XContentBuilder
passed in.
Recursively goes through inner objects and also shuffles them. Exceptions for this
recursive shuffling behavior can be made by passing in the names of fields which
internally should stay untouched.java.io.IOException
protected static org.elasticsearch.common.xcontent.XContentBuilder shuffleXContent(org.elasticsearch.common.xcontent.XContentParser parser, boolean prettyPrint, java.lang.String... exceptFieldNames) throws java.io.IOException
XContentParser
passed in.
Recursively goes through inner objects and also shuffles them. Exceptions for this
recursive shuffling behavior can be made by passing in the names of fields which
internally should stay untouched.java.io.IOException
public static java.util.LinkedHashMap<java.lang.String,java.lang.Object> shuffleMap(java.util.LinkedHashMap<java.lang.String,java.lang.Object> map, java.util.Set<java.lang.String> exceptFields)
public static <T extends org.elasticsearch.common.io.stream.Writeable> T copyWriteable(T original, org.elasticsearch.common.io.stream.NamedWriteableRegistry namedWritabelRegistry, org.elasticsearch.common.io.stream.Writeable.Reader<T> reader) throws java.io.IOException
Writeable
object by running it through a BytesStreamOutput
and
reading it in again using a provided Writeable.Reader
. The stream that is wrapped around the StreamInput
potentially need to use a NamedWriteableRegistry
, so this needs to be provided too (although it can be
empty if the object that is streamed doesn't contain any NamedWriteable
objects itself.java.io.IOException
public static boolean assertionsEnabled()
public void assertAllIndicesRemovedAndDeletionCompleted(java.lang.Iterable<org.elasticsearch.indices.IndicesService> indicesServices) throws java.lang.Exception
java.lang.Exception
public void assertPathHasBeenCleared(java.nio.file.Path path)
protected final org.elasticsearch.common.xcontent.XContentParser createParser(org.elasticsearch.common.xcontent.XContentBuilder builder) throws java.io.IOException
XContentParser
.java.io.IOException
protected final org.elasticsearch.common.xcontent.XContentParser createParser(org.elasticsearch.common.xcontent.XContent xContent, java.lang.String data) throws java.io.IOException
XContentParser
.java.io.IOException
protected final org.elasticsearch.common.xcontent.XContentParser createParser(org.elasticsearch.common.xcontent.XContent xContent, java.io.InputStream data) throws java.io.IOException
XContentParser
.java.io.IOException
protected final org.elasticsearch.common.xcontent.XContentParser createParser(org.elasticsearch.common.xcontent.XContent xContent, byte[] data) throws java.io.IOException
XContentParser
.java.io.IOException
protected final org.elasticsearch.common.xcontent.XContentParser createParser(org.elasticsearch.common.xcontent.XContent xContent, org.elasticsearch.common.bytes.BytesReference data) throws java.io.IOException
XContentParser
.java.io.IOException
protected org.elasticsearch.common.xcontent.NamedXContentRegistry xContentRegistry()
NamedXContentRegistry
to use for this test. Subclasses should override and use liberally.public static org.apache.lucene.util.TestRuleMarkFailure getSuiteFailureMarker()
public static void assertArrayEquals(java.lang.StackTraceElement[] expected, java.lang.StackTraceElement[] actual)
public static void assertEquals(java.lang.StackTraceElement expected, java.lang.StackTraceElement actual)
protected static long spinForAtLeastOneMillisecond()
protected static long spinForAtLeastNMilliseconds(long ms)
public static ESTestCase.TestAnalysis createTestAnalysis(org.elasticsearch.index.Index index, org.elasticsearch.common.settings.Settings settings, org.elasticsearch.plugins.AnalysisPlugin... analysisPlugins) throws java.io.IOException
java.io.IOException
public static ESTestCase.TestAnalysis createTestAnalysis(org.elasticsearch.index.Index index, org.elasticsearch.common.settings.Settings nodeSettings, org.elasticsearch.common.settings.Settings settings, org.elasticsearch.plugins.AnalysisPlugin... analysisPlugins) throws java.io.IOException
java.io.IOException
public static ESTestCase.TestAnalysis createTestAnalysis(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.common.settings.Settings nodeSettings, org.elasticsearch.plugins.AnalysisPlugin... analysisPlugins) throws java.io.IOException
java.io.IOException
public static org.elasticsearch.script.ScriptModule newTestScriptModule()
public static org.elasticsearch.indices.IndicesModule newTestIndicesModule(java.util.Map<java.lang.String,org.elasticsearch.index.mapper.Mapper.TypeParser> extraMappers, java.util.Map<java.lang.String,org.elasticsearch.index.mapper.MetadataFieldMapper.TypeParser> extraMetadataMappers)