lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r922525 - in /lucene/java/trunk: CHANGES.txt contrib/benchmark/src/test/org/apache/lucene/benchmark/quality/TestQualityRun.java src/test/org/apache/lucene/util/LuceneTestCase.java src/test/org/apache/lucene/util/LuceneTestCaseJ4.java
Date Sat, 13 Mar 2010 11:05:14 GMT
Author: uschindler
Date: Sat Mar 13 11:05:13 2010
New Revision: 922525

URL: http://svn.apache.org/viewvc?rev=922525&view=rev
Log:
LUCENE-2313: Add VERBOSE flag to LuceneTestCase(J4)

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/contrib/benchmark/src/test/org/apache/lucene/benchmark/quality/TestQualityRun.java
    lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCase.java
    lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=922525&r1=922524&r2=922525&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Sat Mar 13 11:05:13 2010
@@ -244,6 +244,11 @@ Test Cases
   from LuceneTestCase(J4), that contains the release version.
   (Uwe Schindler, Simon Willnauer, Shai Erera)
 
+* LUCENE-2313: Add VERBOSE to LuceneTestCase(J4) to control verbosity
+  of tests. If VERBOSE==false (default) tests should not print anything
+  other than errors to System.(out|err). The setting can be changed with
+  -Dtests.verbose=true on test invokation.  (Shai Erera via Uwe Schindler)
+
 ================== Release 2.9.2 / 3.0.1 2010-02-26 ====================
 
 Changes in backwards compatibility policy

Modified: lucene/java/trunk/contrib/benchmark/src/test/org/apache/lucene/benchmark/quality/TestQualityRun.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/benchmark/src/test/org/apache/lucene/benchmark/quality/TestQualityRun.java?rev=922525&r1=922524&r2=922525&view=diff
==============================================================================
--- lucene/java/trunk/contrib/benchmark/src/test/org/apache/lucene/benchmark/quality/TestQualityRun.java
(original)
+++ lucene/java/trunk/contrib/benchmark/src/test/org/apache/lucene/benchmark/quality/TestQualityRun.java
Sat Mar 13 11:05:13 2010
@@ -35,8 +35,7 @@ import org.apache.lucene.benchmark.quali
 import org.apache.lucene.benchmark.quality.utils.SubmissionReport;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.store.FSDirectory;
-
-import junit.framework.TestCase;
+import org.apache.lucene.util.LuceneTestCase;
 
 /**
  * Test that quality run does its job.
@@ -45,9 +44,7 @@ import junit.framework.TestCase;
  * this test will not work correctly, as it does not dynamically
  * generate its test trec topics/qrels!
  */
-public class TestQualityRun extends TestCase {
-
-  private static boolean DEBUG = Boolean.getBoolean("tests.verbose");
+public class TestQualityRun extends LuceneTestCase {
   
   public TestQualityRun(String name) {
     super(name);
@@ -63,7 +60,7 @@ public class TestQualityRun extends Test
     int maxResults = 1000;
     String docNameField = "doctitle"; // orig docID is in the linedoc format title 
     
-    PrintWriter logger = DEBUG ? new PrintWriter(System.out,true) : null;
+    PrintWriter logger = VERBOSE ? new PrintWriter(System.out,true) : null;
 
     // <tests src dir> for topics/qrels files - src/test/org/apache/lucene/benchmark/quality
     File srcTestDir = new File(new File(new File(new File(new File(
@@ -89,7 +86,7 @@ public class TestQualityRun extends Test
     QualityQueryParser qqParser = new SimpleQQParser("title","body");
     QualityBenchmark qrun = new QualityBenchmark(qqs, qqParser, searcher, docNameField);
     
-    SubmissionReport submitLog = DEBUG ? new SubmissionReport(logger, "TestRun") : null;
+    SubmissionReport submitLog = VERBOSE ? new SubmissionReport(logger, "TestRun") : null;
     qrun.setMaxResults(maxResults);
     QualityStats stats[] = qrun.execute(judge, submitLog, logger);
     

Modified: lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCase.java?rev=922525&r1=922524&r2=922525&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCase.java Sat Mar 13 11:05:13
2010
@@ -54,6 +54,12 @@ import org.apache.lucene.util.FieldCache
  */
 public abstract class LuceneTestCase extends TestCase {
 
+  /**
+   * true iff tests are run in verbose mode. Note: if it is false, tests are not
+   * expected to print any messages.
+   */
+  public static final boolean VERBOSE = LuceneTestCaseJ4.VERBOSE;
+
   public static final Version TEST_VERSION_CURRENT = LuceneTestCaseJ4.TEST_VERSION_CURRENT;
 
   private int savedBoolMaxClauseCount;

Modified: lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java?rev=922525&r1=922524&r2=922525&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java Sat Mar 13 11:05:13
2010
@@ -77,6 +77,12 @@ import static org.junit.Assert.fail;
 //@RunWith(RunBareWrapper.class)
 public class LuceneTestCaseJ4 {
 
+  /**
+   * true iff tests are run in verbose mode. Note: if it is false, tests are not
+   * expected to print any messages.
+   */
+  public static final boolean VERBOSE = Boolean.getBoolean("tests.verbose");
+
   /** Change this when development starts for new Lucene version: */
   public static final Version TEST_VERSION_CURRENT = Version.LUCENE_31;
 



Mime
View raw message