add verbosity to test

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1045266 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2010-12-13 18:00:35 +00:00
parent 26dd4f34cd
commit 4aa908e6ad
1 changed files with 27 additions and 0 deletions

View File

@ -645,6 +645,10 @@ public class TestIndexWriterDelete extends LuceneTestCase {
if (!seen) {
// Only fail once we are no longer in applyDeletes
failed = true;
if (VERBOSE) {
System.out.println("TEST: mock failure: now fail");
new Throwable().printStackTrace(System.out);
}
throw new IOException("fail after applyDeletes");
}
}
@ -652,6 +656,10 @@ public class TestIndexWriterDelete extends LuceneTestCase {
StackTraceElement[] trace = new Exception().getStackTrace();
for (int i = 0; i < trace.length; i++) {
if ("applyDeletes".equals(trace[i].getMethodName())) {
if (VERBOSE) {
System.out.println("TEST: mock failure: saw applyDeletes");
new Throwable().printStackTrace(System.out);
}
sawMaybe = true;
break;
}
@ -671,6 +679,8 @@ public class TestIndexWriterDelete extends LuceneTestCase {
MockDirectoryWrapper dir = newDirectory();
IndexWriter modifier = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)).setMaxBufferedDeleteTerms(2).setReaderPooling(false));
modifier.setInfoStream(VERBOSE ? System.out : null);
LogMergePolicy lmp = (LogMergePolicy) modifier.getConfig().getMergePolicy();
lmp.setUseCompoundFile(true);
lmp.setUseCompoundDocStore(true);
@ -691,7 +701,14 @@ public class TestIndexWriterDelete extends LuceneTestCase {
}
// flush (and commit if ac)
if (VERBOSE) {
System.out.println("TEST: now optimize");
}
modifier.optimize();
if (VERBOSE) {
System.out.println("TEST: now commit");
}
modifier.commit();
// one of the two files hits
@ -705,11 +722,18 @@ public class TestIndexWriterDelete extends LuceneTestCase {
// delete the doc
// max buf del terms is two, so this is buffered
if (VERBOSE) {
System.out.println("TEST: delete term=" + term);
}
modifier.deleteDocuments(term);
// add a doc (needed for the !ac case; see below)
// doc remains buffered
if (VERBOSE) {
System.out.println("TEST: add empty doc");
}
Document doc = new Document();
modifier.addDocument(doc);
@ -727,6 +751,9 @@ public class TestIndexWriterDelete extends LuceneTestCase {
// lose deletes if failing while creating the cfs file)
boolean failed = false;
try {
if (VERBOSE) {
System.out.println("TEST: now commit for failure");
}
modifier.commit();
} catch (IOException ioe) {
// expected