lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rjer...@apache.org
Subject svn commit: r1627158 - in /lucene/dev/trunk/lucene: CHANGES.txt backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
Date Tue, 23 Sep 2014 20:47:14 GMT
Author: rjernst
Date: Tue Sep 23 20:47:14 2014
New Revision: 1627158

URL: http://svn.apache.org/r1627158
Log:
LUCENE-5974: Add check that backcompat indexes use default codecs

Modified:
    lucene/dev/trunk/lucene/CHANGES.txt
    lucene/dev/trunk/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java

Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1627158&r1=1627157&r2=1627158&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Tue Sep 23 20:47:14 2014
@@ -179,6 +179,9 @@ Tests
 * LUCENE-5957: Add option for tests to not randomize codec
   (Ryan Ernst)
 
+* LUCENE-5974: Add check that backcompat indexes use default codecs
+  (Ryan Ernst)
+
 Optimizations
 
 * LUCENE-5960: Use a more efficient bitset, not a Set<Integer>, to

Modified: lucene/dev/trunk/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java?rev=1627158&r1=1627157&r2=1627158&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
(original)
+++ lucene/dev/trunk/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
Tue Sep 23 20:47:14 2014
@@ -1002,6 +1002,24 @@ public class TestBackwardsCompatibility 
       r.close();
     }
   }
+
+  public void verifyUsesDefaultCodec(Directory dir, String name) throws Exception {
+    DirectoryReader r = DirectoryReader.open(dir);
+    for (AtomicReaderContext context : r.leaves()) {
+      SegmentReader air = (SegmentReader) context.reader();
+      Codec codec = air.getSegmentInfo().info.getCodec();
+      assertTrue("codec used in " + name + " (" + codec.getName() + ") is not a default codec
(does not begin with Lucene)",
+                 codec.getName().startsWith("Lucene"));
+    }
+      r.close();
+  }
+  
+  public void testAllIndexesUseDefaultCodec() throws Exception {
+    for (String name : oldNames) {
+      Directory dir = oldIndexDirs.get(name);
+      verifyUsesDefaultCodec(dir, name);
+    }
+  }
   
   public void testNumericFields() throws Exception {
     for (String name : oldNames) {
@@ -1203,6 +1221,7 @@ public class TestBackwardsCompatibility 
     Path oldIndexDir = createTempDir("moreterms");
     TestUtil.unzip(getDataInputStream(moreTermsIndex), oldIndexDir);
     Directory dir = newFSDirectory(oldIndexDir);
+    verifyUsesDefaultCodec(dir, moreTermsIndex);
     // TODO: more tests
     TestUtil.checkIndex(dir);
     dir.close();
@@ -1242,6 +1261,7 @@ public class TestBackwardsCompatibility 
     Path oldIndexDir = createTempDir("dvupdates");
     TestUtil.unzip(getDataInputStream(dvUpdatesIndex), oldIndexDir);
     Directory dir = newFSDirectory(oldIndexDir);
+    verifyUsesDefaultCodec(dir, dvUpdatesIndex);
     
     verifyDocValues(dir);
     



Mime
View raw message