From 4aa908e6addf1d2899af6624eb4119bf845e8e40 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Mon, 13 Dec 2010 18:00:35 +0000 Subject: [PATCH] add verbosity to test git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1045266 13f79535-47bb-0310-9956-ffa450edef68 --- .../lucene/index/TestIndexWriterDelete.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java index 339ac07060d..d44cf8e7859 100644 --- a/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java +++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java @@ -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