You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2015/04/20 17:03:00 UTC

svn commit: r1674912 - /lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java

Author: rmuir
Date: Mon Apr 20 15:03:00 2015
New Revision: 1674912

URL: http://svn.apache.org/r1674912
Log:
LUCENE-6440: Show LuceneTestCase LiveIndexWriterConfig changes with deltas

Modified:
    lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java?rev=1674912&r1=1674911&r2=1674912&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java Mon Apr 20 15:03:00 2015
@@ -1111,6 +1111,8 @@ public abstract class LuceneTestCase ext
   public static void maybeChangeLiveIndexWriterConfig(Random r, LiveIndexWriterConfig c) {
     boolean didChange = false;
 
+    String previous = c.toString();
+    
     if (rarely(r)) {
       // change flush parameters:
       // this is complicated because the api requires you "invoke setters in a magical order!"
@@ -1223,7 +1225,29 @@ public abstract class LuceneTestCase ext
       didChange = true;
     }
     if (VERBOSE && didChange) {
-      System.out.println("NOTE: LuceneTestCase: randomly changed IWC's live settings to:\n" + c);
+      String current = c.toString();
+      String previousLines[] = previous.split("\n");
+      String currentLines[] = current.split("\n");
+      StringBuilder diff = new StringBuilder();
+
+      // this should always be the case, diff each line
+      if (previousLines.length == currentLines.length) {
+        for (int i = 0; i < previousLines.length; i++) {
+          if (!previousLines[i].equals(currentLines[i])) {
+            diff.append("- " + previousLines[i] + "\n");
+            diff.append("+ " + currentLines[i] + "\n");
+          }
+        }
+      } else {
+        // but just in case of something ridiculous...
+        diff.append(current.toString());
+      }
+      
+      // its possible to be empty, if we "change" a value to what it had before.
+      if (diff.length() > 0) {
+        System.out.println("NOTE: LuceneTestCase: randomly changed IWC's live settings:");
+        System.out.println(diff);
+      }
     }
   }