use of org.apache.lucene.store.MockDirectoryWrapper.Failure in project lucene-solr by apache.
the class TestIndexWriterOnVMError method testCheckpoint.
@Nightly
public void testCheckpoint() throws Exception {
final Random r = new Random(random().nextLong());
doTest(new Failure() {
@Override
public void eval(MockDirectoryWrapper dir) throws IOException {
StackTraceElement[] stack = Thread.currentThread().getStackTrace();
boolean ok = false;
for (int i = 0; i < stack.length; i++) {
if (stack[i].getClassName().equals(IndexFileDeleter.class.getName()) && stack[i].getMethodName().equals("checkpoint")) {
ok = true;
}
}
if (ok && r.nextInt(4) == 0) {
throw new OutOfMemoryError("Fake OutOfMemoryError");
}
}
});
}
Aggregations