Package org.elasticsearch.test.engine
Class MockEngineSupport
java.lang.Object
org.elasticsearch.test.engine.MockEngineSupport
public final class MockEngineSupport
extends java.lang.Object
Support class to build MockEngines like
MockInternalEngine
since they need to subclass the actual engine-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MockEngineSupport.DirectoryReaderWrapper
static class
MockEngineSupport.MockContext
-
Field Summary
Fields Modifier and Type Field Description static org.elasticsearch.common.settings.Setting<java.lang.Boolean>
DISABLE_FLUSH_ON_CLOSE
Allows tests to prevent an engine from being flushed on close ie.static org.elasticsearch.common.settings.Setting<java.lang.Double>
WRAP_READER_RATIO
Allows tests to wrap an index reader randomly with a given ratio. -
Constructor Summary
Constructors Constructor Description MockEngineSupport(org.elasticsearch.index.engine.EngineConfig config, java.lang.Class<? extends org.apache.lucene.index.FilterDirectoryReader> wrapper)
-
Method Summary
Modifier and Type Method Description org.elasticsearch.test.engine.MockEngineSupport.CloseAction
flushOrClose(org.elasticsearch.test.engine.MockEngineSupport.CloseAction originalAction)
Returns the CloseAction to execute on the actual engine.boolean
isFlushOnCloseDisabled()
org.apache.lucene.index.IndexReader
newReader(org.apache.lucene.index.IndexReader reader)
org.elasticsearch.index.engine.Engine.Searcher
wrapSearcher(org.elasticsearch.index.engine.Engine.Searcher searcher)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
WRAP_READER_RATIO
public static final org.elasticsearch.common.settings.Setting<java.lang.Double> WRAP_READER_RATIOAllows tests to wrap an index reader randomly with a given ratio. This is disabled by default ie.0.0d
since reader wrapping is insanely slow ifAssertingDirectoryReader
is used. -
DISABLE_FLUSH_ON_CLOSE
public static final org.elasticsearch.common.settings.Setting<java.lang.Boolean> DISABLE_FLUSH_ON_CLOSEAllows tests to prevent an engine from being flushed on close ie. to test translog recovery...
-
-
Constructor Details
-
MockEngineSupport
public MockEngineSupport(org.elasticsearch.index.engine.EngineConfig config, java.lang.Class<? extends org.apache.lucene.index.FilterDirectoryReader> wrapper)
-
-
Method Details
-
isFlushOnCloseDisabled
public boolean isFlushOnCloseDisabled() -
flushOrClose
public org.elasticsearch.test.engine.MockEngineSupport.CloseAction flushOrClose(org.elasticsearch.test.engine.MockEngineSupport.CloseAction originalAction) throws java.io.IOExceptionReturns the CloseAction to execute on the actual engine. Note this method changes the state on the first call and treats subsequent calls as if the engine passed is already closed.- Throws:
java.io.IOException
-
newReader
public org.apache.lucene.index.IndexReader newReader(org.apache.lucene.index.IndexReader reader) throws org.elasticsearch.index.engine.EngineException- Throws:
org.elasticsearch.index.engine.EngineException
-
wrapSearcher
public org.elasticsearch.index.engine.Engine.Searcher wrapSearcher(org.elasticsearch.index.engine.Engine.Searcher searcher)
-