lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1621805 - in /lucene/dev/branches/lucene5858/lucene: backward-codecs/src/test/org/apache/lucene/codecs/lucene40/ backward-codecs/src/test/org/apache/lucene/codecs/lucene41/ backward-codecs/src/test/org/apache/lucene/codecs/lucene42/ backwa...
Date Mon, 01 Sep 2014 14:35:11 GMT
Author: rmuir
Date: Mon Sep  1 14:35:10 2014
New Revision: 1621805

URL: http://svn.apache.org/r1621805
Log:
LUCENE-5858: remove impersonation

Removed:
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/index/TestDisableImpersonation.java
Modified:
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40DocValuesWriter.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40FieldInfosWriter.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWCodec.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWDocValuesFormat.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWNormsFormat.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWPostingsFormat.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWStoredFieldsFormat.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWTermVectorsFormat.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40DocValuesFormat.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40NormsFormat.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40PostingsFormat.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40PostingsReader.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40StoredFieldsFormat.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40TermVectorsFormat.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestReuseDocsEnum.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene41/Lucene41RWCodec.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42DocValuesConsumer.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42FieldInfosWriter.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42RWCodec.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42RWDocValuesFormat.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42RWNormsFormat.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/TestLucene42DocValuesFormat.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/TestLucene42NormsFormat.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene45/Lucene45RWCodec.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene45/Lucene45RWDocValuesFormat.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene45/TestLucene45DocValuesFormat.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene49/Lucene49RWDocValuesFormat.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene49/TestLucene49DocValuesFormat.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
    lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/index/TestDocValuesUpdatesOnOldSegments.java
    lucene/dev/branches/lucene5858/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
    lucene/dev/branches/lucene5858/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40DocValuesWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40DocValuesWriter.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40DocValuesWriter.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40DocValuesWriter.java Mon Sep  1 14:35:10 2014
@@ -52,6 +52,9 @@ class Lucene40DocValuesWriter extends Do
   
   @Override
   public void addNumericField(FieldInfo field, Iterable<Number> values) throws IOException {
+    if (field.getDocValuesGen() != -1) {
+      throw new UnsupportedOperationException("4.0 does not support dv updates");
+    }
     // examine the values to determine best type to use
     long minValue = Long.MAX_VALUE;
     long maxValue = Long.MIN_VALUE;
@@ -154,6 +157,9 @@ class Lucene40DocValuesWriter extends Do
 
   @Override
   public void addBinaryField(FieldInfo field, Iterable<BytesRef> values) throws IOException {
+    if (field.getDocValuesGen() != -1) {
+      throw new UnsupportedOperationException("4.0 does not support dv updates");
+    }
     // examine the values to determine best type to use
     HashSet<BytesRef> uniqueValues = new HashSet<>();
     int minLength = Integer.MAX_VALUE;
@@ -395,6 +401,9 @@ class Lucene40DocValuesWriter extends Do
 
   @Override
   public void addSortedField(FieldInfo field, Iterable<BytesRef> values, Iterable<Number> docToOrd) throws IOException {
+    if (field.getDocValuesGen() != -1) {
+      throw new UnsupportedOperationException("4.0 does not support dv updates");
+    }
     // examine the values to determine best type to use
     int minLength = Integer.MAX_VALUE;
     int maxLength = Integer.MIN_VALUE;

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40FieldInfosWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40FieldInfosWriter.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40FieldInfosWriter.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40FieldInfosWriter.java Mon Sep  1 14:35:10 2014
@@ -46,6 +46,9 @@ public class Lucene40FieldInfosWriter ex
   
   @Override
   public void write(Directory directory, String segmentName, String segmentSuffix, FieldInfos infos, IOContext context) throws IOException {
+    if (!segmentSuffix.isEmpty()) {
+      throw new UnsupportedOperationException("4.0 does not support fieldinfo updates");
+    }
     final String fileName = IndexFileNames.segmentFileName(segmentName, "", Lucene40FieldInfosFormat.FIELD_INFOS_EXTENSION);
     IndexOutput output = directory.createOutput(fileName, context);
     boolean success = false;

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWCodec.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWCodec.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWCodec.java Mon Sep  1 14:35:10 2014
@@ -6,6 +6,7 @@ import org.apache.lucene.codecs.DocValue
 import org.apache.lucene.codecs.FieldInfosFormat;
 import org.apache.lucene.codecs.FieldInfosWriter;
 import org.apache.lucene.codecs.NormsFormat;
+import org.apache.lucene.codecs.PostingsFormat;
 import org.apache.lucene.codecs.StoredFieldsFormat;
 import org.apache.lucene.codecs.TermVectorsFormat;
 import org.apache.lucene.util.LuceneTestCase;
@@ -34,11 +35,7 @@ public final class Lucene40RWCodec exten
   private final FieldInfosFormat fieldInfos = new Lucene40FieldInfosFormat() {
     @Override
     public FieldInfosWriter getFieldInfosWriter() throws IOException {
-      if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE) {
-        return super.getFieldInfosWriter();
-      } else {
-        return new Lucene40FieldInfosWriter();
-      }
+      return new Lucene40FieldInfosWriter();
     }
   };
   
@@ -46,6 +43,7 @@ public final class Lucene40RWCodec exten
   private final NormsFormat norms = new Lucene40RWNormsFormat();
   private final StoredFieldsFormat stored = new Lucene40RWStoredFieldsFormat();
   private final TermVectorsFormat vectors = new Lucene40RWTermVectorsFormat();
+  private final PostingsFormat postings = new Lucene40RWPostingsFormat();
   
   @Override
   public FieldInfosFormat fieldInfosFormat() {
@@ -71,4 +69,9 @@ public final class Lucene40RWCodec exten
   public TermVectorsFormat termVectorsFormat() {
     return vectors;
   }
+
+  @Override
+  public PostingsFormat getPostingsFormatForField(String field) {
+    return postings;
+  }
 }

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWDocValuesFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWDocValuesFormat.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWDocValuesFormat.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWDocValuesFormat.java Mon Sep  1 14:35:10 2014
@@ -22,7 +22,6 @@ import java.io.IOException;
 import org.apache.lucene.codecs.DocValuesConsumer;
 import org.apache.lucene.index.IndexFileNames;
 import org.apache.lucene.index.SegmentWriteState;
-import org.apache.lucene.util.LuceneTestCase;
 
 /** Read-write version of {@link Lucene40DocValuesFormat} for testing */
 @SuppressWarnings("deprecation")
@@ -30,13 +29,9 @@ public class Lucene40RWDocValuesFormat e
 
   @Override
   public DocValuesConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
-    if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE) {
-      return super.fieldsConsumer(state);
-    } else {
-      String filename = IndexFileNames.segmentFileName(state.segmentInfo.name, 
+    String filename = IndexFileNames.segmentFileName(state.segmentInfo.name, 
           "dv", 
           IndexFileNames.COMPOUND_FILE_EXTENSION);
-      return new Lucene40DocValuesWriter(state, filename, Lucene40FieldInfosReader.LEGACY_DV_TYPE_KEY);
-    }
+    return new Lucene40DocValuesWriter(state, filename, Lucene40FieldInfosReader.LEGACY_DV_TYPE_KEY);
   }
 }

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWNormsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWNormsFormat.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWNormsFormat.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWNormsFormat.java Mon Sep  1 14:35:10 2014
@@ -23,7 +23,6 @@ import org.apache.lucene.codecs.NormsCon
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.IndexFileNames;
 import org.apache.lucene.index.SegmentWriteState;
-import org.apache.lucene.util.LuceneTestCase;
 
 /** Read-write version of {@link Lucene40NormsFormat} for testing */
 @SuppressWarnings("deprecation")
@@ -31,24 +30,20 @@ public class Lucene40RWNormsFormat exten
 
   @Override
   public NormsConsumer normsConsumer(SegmentWriteState state) throws IOException {
-    if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE) {
-      return super.normsConsumer(state);
-    } else {
-      String filename = IndexFileNames.segmentFileName(state.segmentInfo.name, 
-          "nrm", 
-          IndexFileNames.COMPOUND_FILE_EXTENSION);
-      final Lucene40DocValuesWriter impl = new Lucene40DocValuesWriter(state, filename, Lucene40FieldInfosReader.LEGACY_NORM_TYPE_KEY);
-      return new NormsConsumer() {
-        @Override
-        public void addNormsField(FieldInfo field, Iterable<Number> values) throws IOException {
-          impl.addNumericField(field, values);
-        }
-        
-        @Override
-        public void close() throws IOException {
-          impl.close();
-        }
-      };
-    }
+    String filename = IndexFileNames.segmentFileName(state.segmentInfo.name, 
+        "nrm", 
+        IndexFileNames.COMPOUND_FILE_EXTENSION);
+    final Lucene40DocValuesWriter impl = new Lucene40DocValuesWriter(state, filename, Lucene40FieldInfosReader.LEGACY_NORM_TYPE_KEY);
+    return new NormsConsumer() {
+      @Override
+      public void addNormsField(FieldInfo field, Iterable<Number> values) throws IOException {
+        impl.addNumericField(field, values);
+      }
+      
+      @Override
+      public void close() throws IOException {
+        impl.close();
+      }
+    };
   }
 }

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWPostingsFormat.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWPostingsFormat.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWPostingsFormat.java Mon Sep  1 14:35:10 2014
@@ -33,24 +33,20 @@ public class Lucene40RWPostingsFormat ex
   
   @Override
   public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
-    if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE) {
-      return super.fieldsConsumer(state);
-    } else {
-      PostingsWriterBase docs = new Lucene40PostingsWriter(state);
-      
-      // TODO: should we make the terms index more easily
-      // pluggable?  Ie so that this codec would record which
-      // index impl was used, and switch on loading?
-      // Or... you must make a new Codec for this?
-      boolean success = false;
-      try {
-        FieldsConsumer ret = new BlockTreeTermsWriter(state, docs, minBlockSize, maxBlockSize);
-        success = true;
-        return ret;
-      } finally {
-        if (!success) {
-          docs.close();
-        }
+    PostingsWriterBase docs = new Lucene40PostingsWriter(state);
+    
+    // TODO: should we make the terms index more easily
+    // pluggable?  Ie so that this codec would record which
+    // index impl was used, and switch on loading?
+    // Or... you must make a new Codec for this?
+    boolean success = false;
+    try {
+      FieldsConsumer ret = new BlockTreeTermsWriter(state, docs, minBlockSize, maxBlockSize);
+      success = true;
+      return ret;
+    } finally {
+      if (!success) {
+        docs.close();
       }
     }
   }

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWStoredFieldsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWStoredFieldsFormat.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWStoredFieldsFormat.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWStoredFieldsFormat.java Mon Sep  1 14:35:10 2014
@@ -23,7 +23,6 @@ import org.apache.lucene.codecs.StoredFi
 import org.apache.lucene.index.SegmentInfo;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IOContext;
-import org.apache.lucene.util.LuceneTestCase;
 
 /** 
  * Simulates writing Lucene 4.0 Stored Fields Format.
@@ -32,10 +31,6 @@ public class Lucene40RWStoredFieldsForma
 
   @Override
   public StoredFieldsWriter fieldsWriter(Directory directory, SegmentInfo si, IOContext context) throws IOException {
-    if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE) {
-      throw new UnsupportedOperationException("this codec can only be used for reading");
-    } else {
-      return new Lucene40StoredFieldsWriter(directory, si.name, context);
-    }
+    return new Lucene40StoredFieldsWriter(directory, si.name, context);
   }
 }

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWTermVectorsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWTermVectorsFormat.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWTermVectorsFormat.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWTermVectorsFormat.java Mon Sep  1 14:35:10 2014
@@ -32,10 +32,6 @@ public class Lucene40RWTermVectorsFormat
 
   @Override
   public TermVectorsWriter vectorsWriter(Directory directory, SegmentInfo segmentInfo, IOContext context) throws IOException {
-    if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE) {
-      throw new UnsupportedOperationException("this codec can only be used for reading");
-    } else {
-      return new Lucene40TermVectorsWriter(directory, segmentInfo.name, context);
-    }
+    return new Lucene40TermVectorsWriter(directory, segmentInfo.name, context);
   }
 }

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40DocValuesFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40DocValuesFormat.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40DocValuesFormat.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40DocValuesFormat.java Mon Sep  1 14:35:10 2014
@@ -19,18 +19,12 @@ package org.apache.lucene.codecs.lucene4
 
 import org.apache.lucene.codecs.Codec;
 import org.apache.lucene.index.BaseDocValuesFormatTestCase;
-import org.junit.BeforeClass;
 
 /**
  * Tests Lucene40DocValuesFormat
  */
 public class TestLucene40DocValuesFormat extends BaseDocValuesFormatTestCase {
   private final Codec codec = new Lucene40RWCodec();
-  
-  @BeforeClass
-  public static void beforeClass() {
-    OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient codec
-  }
 
   @Override
   protected Codec getCodec() {

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40NormsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40NormsFormat.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40NormsFormat.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40NormsFormat.java Mon Sep  1 14:35:10 2014
@@ -19,8 +19,6 @@ package org.apache.lucene.codecs.lucene4
 
 import org.apache.lucene.codecs.Codec;
 import org.apache.lucene.index.BaseNormsFormatTestCase;
-import org.junit.BeforeClass;
-
 
 /** Tests Lucene40's norms format */
 public class TestLucene40NormsFormat extends BaseNormsFormatTestCase {
@@ -30,9 +28,4 @@ public class TestLucene40NormsFormat ext
   protected Codec getCodec() {
     return codec;
   }
-  
-  @BeforeClass
-  public static void beforeClass() {
-    OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient codec
-  }
 }

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40PostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40PostingsFormat.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40PostingsFormat.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40PostingsFormat.java Mon Sep  1 14:35:10 2014
@@ -19,18 +19,12 @@ package org.apache.lucene.codecs.lucene4
 
 import org.apache.lucene.codecs.Codec;
 import org.apache.lucene.index.BasePostingsFormatTestCase;
-import org.junit.BeforeClass;
 
 /**
  * Tests Lucene40PostingsFormat
  */
 public class TestLucene40PostingsFormat extends BasePostingsFormatTestCase {
   private final Codec codec = new Lucene40RWCodec();
-
-  @BeforeClass
-  public static void beforeClass() {
-    OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient codec
-  }
   
   @Override
   protected Codec getCodec() {

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40PostingsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40PostingsReader.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40PostingsReader.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40PostingsReader.java Mon Sep  1 14:35:10 2014
@@ -34,7 +34,6 @@ import org.apache.lucene.index.Term;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.TestUtil;
-import org.junit.BeforeClass;
 
 public class TestLucene40PostingsReader extends LuceneTestCase {
   static final String terms[] = new String[100];
@@ -43,11 +42,6 @@ public class TestLucene40PostingsReader 
       terms[i] = Integer.toString(i+1);
     }
   }
-  
-  @BeforeClass
-  public static void beforeClass() {
-    OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient codec
-  }
 
   /** tests terms with different probabilities of being in the document.
    *  depends heavily on term vectors cross-check at checkIndex

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40StoredFieldsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40StoredFieldsFormat.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40StoredFieldsFormat.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40StoredFieldsFormat.java Mon Sep  1 14:35:10 2014
@@ -23,11 +23,6 @@ import org.junit.BeforeClass;
 
 public class TestLucene40StoredFieldsFormat extends BaseStoredFieldsFormatTestCase {
   
-  @BeforeClass
-  public static void beforeClass() {
-    OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient codec
-  }
-  
   @Override
   protected Codec getCodec() {
     return new Lucene40RWCodec();

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40TermVectorsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40TermVectorsFormat.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40TermVectorsFormat.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestLucene40TermVectorsFormat.java Mon Sep  1 14:35:10 2014
@@ -22,11 +22,6 @@ import org.apache.lucene.index.BaseTermV
 import org.junit.BeforeClass;
 
 public class TestLucene40TermVectorsFormat extends BaseTermVectorsFormatTestCase {
-
-  @BeforeClass
-  public static void beforeClass() {
-    OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient codec
-  }
   
   @Override
   protected Codec getCodec() {

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestReuseDocsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestReuseDocsEnum.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestReuseDocsEnum.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/TestReuseDocsEnum.java Mon Sep  1 14:35:10 2014
@@ -42,11 +42,6 @@ import org.junit.BeforeClass;
 
 // TODO: really this should be in BaseTestPF or somewhere else? useful test!
 public class TestReuseDocsEnum extends LuceneTestCase {
-
-  @BeforeClass
-  public static void beforeClass() {
-    OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient codec
-  }
   
   public void testReuseDocsEnumNoReuse() throws IOException {
     Directory dir = newDirectory();

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene41/Lucene41RWCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene41/Lucene41RWCodec.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene41/Lucene41RWCodec.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene41/Lucene41RWCodec.java Mon Sep  1 14:35:10 2014
@@ -41,11 +41,7 @@ public class Lucene41RWCodec extends Luc
   private final FieldInfosFormat fieldInfos = new Lucene40FieldInfosFormat() {
     @Override
     public FieldInfosWriter getFieldInfosWriter() throws IOException {
-      if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE) {
-        return super.getFieldInfosWriter();
-      } else {
-        return new Lucene40FieldInfosWriter();
-      }
+      return new Lucene40FieldInfosWriter();
     }
   };
   

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42DocValuesConsumer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42DocValuesConsumer.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42DocValuesConsumer.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42DocValuesConsumer.java Mon Sep  1 14:35:10 2014
@@ -87,6 +87,9 @@ class Lucene42DocValuesConsumer extends 
 
   @Override
   public void addNumericField(FieldInfo field, Iterable<Number> values) throws IOException {
+    if (field.getDocValuesGen() != -1) {
+      throw new UnsupportedOperationException("4.2 does not support dv updates");
+    }
     addNumericField(field, values, true);
   }
 
@@ -209,6 +212,9 @@ class Lucene42DocValuesConsumer extends 
 
   @Override
   public void addBinaryField(FieldInfo field, final Iterable<BytesRef> values) throws IOException {
+    if (field.getDocValuesGen() != -1) {
+      throw new UnsupportedOperationException("4.2 does not support dv updates");
+    }
     // write the byte[] data
     meta.writeVInt(field.number);
     meta.writeByte(BYTES);
@@ -270,6 +276,9 @@ class Lucene42DocValuesConsumer extends 
 
   @Override
   public void addSortedField(FieldInfo field, Iterable<BytesRef> values, Iterable<Number> docToOrd) throws IOException {
+    if (field.getDocValuesGen() != -1) {
+      throw new UnsupportedOperationException("4.2 does not support dv updates");
+    }
     // three cases for simulating the old writer:
     // 1. no missing
     // 2. missing (and empty string in use): remap ord=-1 -> ord=0
@@ -307,6 +316,7 @@ class Lucene42DocValuesConsumer extends 
   // note: this might not be the most efficient... but its fairly simple
   @Override
   public void addSortedSetField(FieldInfo field, Iterable<BytesRef> values, final Iterable<Number> docToOrdCount, final Iterable<Number> ords) throws IOException {
+    assert field.getDocValuesGen() == -1;
     // write the ordinals as a binary field
     addBinaryField(field, new Iterable<BytesRef>() {
       @Override

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42FieldInfosWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42FieldInfosWriter.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42FieldInfosWriter.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42FieldInfosWriter.java Mon Sep  1 14:35:10 2014
@@ -46,6 +46,9 @@ public final class Lucene42FieldInfosWri
   
   @Override
   public void write(Directory directory, String segmentName, String segmentSuffix, FieldInfos infos, IOContext context) throws IOException {
+    if (!segmentSuffix.isEmpty()) {
+      throw new UnsupportedOperationException("4.2 does not support fieldinfo updates");
+    }
     final String fileName = IndexFileNames.segmentFileName(segmentName, "", Lucene42FieldInfosFormat.EXTENSION);
     IndexOutput output = directory.createOutput(fileName, context);
     boolean success = false;

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42RWCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42RWCodec.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42RWCodec.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42RWCodec.java Mon Sep  1 14:35:10 2014
@@ -37,11 +37,7 @@ public class Lucene42RWCodec extends Luc
   private final FieldInfosFormat fieldInfosFormat = new Lucene42FieldInfosFormat() {
     @Override
     public FieldInfosWriter getFieldInfosWriter() throws IOException {
-      if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE) {
-        return super.getFieldInfosWriter();
-      } else {
-        return new Lucene42FieldInfosWriter();
-      }
+      return new Lucene42FieldInfosWriter();
     }
   };
 

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42RWDocValuesFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42RWDocValuesFormat.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42RWDocValuesFormat.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42RWDocValuesFormat.java Mon Sep  1 14:35:10 2014
@@ -31,11 +31,7 @@ public class Lucene42RWDocValuesFormat e
   
   @Override
   public DocValuesConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
-    if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE) {
-      return super.fieldsConsumer(state);
-    } else {
-      // note: we choose DEFAULT here (its reasonably fast, and for small bpv has tiny waste)
-      return new Lucene42DocValuesConsumer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION, acceptableOverheadRatio);
-    }
+    // note: we choose DEFAULT here (its reasonably fast, and for small bpv has tiny waste)
+    return new Lucene42DocValuesConsumer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION, acceptableOverheadRatio);
   }
 }

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42RWNormsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42RWNormsFormat.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42RWNormsFormat.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/Lucene42RWNormsFormat.java Mon Sep  1 14:35:10 2014
@@ -30,10 +30,6 @@ public class Lucene42RWNormsFormat exten
 
   @Override
   public NormsConsumer normsConsumer(SegmentWriteState state) throws IOException {
-    if (LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE) {
-      return new Lucene42NormsConsumer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION, acceptableOverheadRatio);
-    } else {
-      return super.normsConsumer(state);
-    }
+    return new Lucene42NormsConsumer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION, acceptableOverheadRatio);
   }
 }

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/TestLucene42DocValuesFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/TestLucene42DocValuesFormat.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/TestLucene42DocValuesFormat.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/TestLucene42DocValuesFormat.java Mon Sep  1 14:35:10 2014
@@ -26,11 +26,6 @@ import org.junit.BeforeClass;
  */
 public class TestLucene42DocValuesFormat extends BaseCompressingDocValuesFormatTestCase {
   private final Codec codec = new Lucene42RWCodec();
-
-  @BeforeClass
-  public static void beforeClass() {
-    OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient codec
-  }
   
   @Override
   protected Codec getCodec() {

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/TestLucene42NormsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/TestLucene42NormsFormat.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/TestLucene42NormsFormat.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene42/TestLucene42NormsFormat.java Mon Sep  1 14:35:10 2014
@@ -30,9 +30,4 @@ public class TestLucene42NormsFormat ext
   protected Codec getCodec() {
     return codec;
   }
-  
-  @BeforeClass
-  public static void beforeClass() {
-    OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient codec
-  }
 }

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene45/Lucene45RWCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene45/Lucene45RWCodec.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene45/Lucene45RWCodec.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene45/Lucene45RWCodec.java Mon Sep  1 14:35:10 2014
@@ -26,7 +26,6 @@ import org.apache.lucene.codecs.NormsFor
 import org.apache.lucene.codecs.lucene42.Lucene42FieldInfosFormat;
 import org.apache.lucene.codecs.lucene42.Lucene42FieldInfosWriter;
 import org.apache.lucene.codecs.lucene42.Lucene42RWNormsFormat;
-import org.apache.lucene.util.LuceneTestCase;
 
 /**
  * Read-write version of {@link Lucene45Codec} for testing.
@@ -37,11 +36,7 @@ public class Lucene45RWCodec extends Luc
   private final FieldInfosFormat fieldInfosFormat = new Lucene42FieldInfosFormat() {
     @Override
     public FieldInfosWriter getFieldInfosWriter() throws IOException {
-      if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE) {
-        return super.getFieldInfosWriter();
-      } else {
-        return new Lucene42FieldInfosWriter();
-      }
+      return new Lucene42FieldInfosWriter();
     }
   };
 

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene45/Lucene45RWDocValuesFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene45/Lucene45RWDocValuesFormat.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene45/Lucene45RWDocValuesFormat.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene45/Lucene45RWDocValuesFormat.java Mon Sep  1 14:35:10 2014
@@ -22,7 +22,6 @@ import java.io.IOException;
 import org.apache.lucene.codecs.DocValuesConsumer;
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.SegmentWriteState;
-import org.apache.lucene.util.LuceneTestCase;
 
 /**
  * Read-write version of {@link Lucene45DocValuesFormat} for testing.
@@ -31,15 +30,11 @@ public class Lucene45RWDocValuesFormat e
 
   @Override
   public DocValuesConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
-    if (LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE) {
-      return new Lucene45DocValuesConsumer(state, DATA_CODEC, DATA_EXTENSION, META_CODEC, META_EXTENSION) {
-        @Override
-        void checkCanWrite(FieldInfo field) {
-           // allow writing all fields 
-        }
-      };
-    } else {
-      return super.fieldsConsumer(state);
-    }
+    return new Lucene45DocValuesConsumer(state, DATA_CODEC, DATA_EXTENSION, META_CODEC, META_EXTENSION) {
+      @Override
+      void checkCanWrite(FieldInfo field) {
+        // allow writing all fields 
+      }
+    };
   }
 }
\ No newline at end of file

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene45/TestLucene45DocValuesFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene45/TestLucene45DocValuesFormat.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene45/TestLucene45DocValuesFormat.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene45/TestLucene45DocValuesFormat.java Mon Sep  1 14:35:10 2014
@@ -27,11 +27,6 @@ import org.junit.BeforeClass;
 public class TestLucene45DocValuesFormat extends BaseCompressingDocValuesFormatTestCase {
   private final Codec codec = new Lucene45RWCodec();
   
-  @BeforeClass
-  public static void beforeClass() {
-    OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient codec
-  }
-  
   @Override
   protected Codec getCodec() {
     return codec;

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene49/Lucene49RWDocValuesFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene49/Lucene49RWDocValuesFormat.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene49/Lucene49RWDocValuesFormat.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene49/Lucene49RWDocValuesFormat.java Mon Sep  1 14:35:10 2014
@@ -29,16 +29,12 @@ public class Lucene49RWDocValuesFormat e
 
   @Override
   public DocValuesConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
-    if (LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE) {
-      return new Lucene49DocValuesConsumer(state, DATA_CODEC, DATA_EXTENSION, META_CODEC, META_EXTENSION) {
-        @Override
-        void checkCanWrite(FieldInfo field) {
-          // allow writing all fields 
-        }
-      };
-    } else {
-      return super.fieldsConsumer(state);
-    }
+    return new Lucene49DocValuesConsumer(state, DATA_CODEC, DATA_EXTENSION, META_CODEC, META_EXTENSION) {
+      @Override
+      void checkCanWrite(FieldInfo field) {
+        // allow writing all fields 
+      }
+    };
   }
   
 }

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene49/TestLucene49DocValuesFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene49/TestLucene49DocValuesFormat.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene49/TestLucene49DocValuesFormat.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene49/TestLucene49DocValuesFormat.java Mon Sep  1 14:35:10 2014
@@ -27,11 +27,6 @@ import org.junit.BeforeClass;
 public class TestLucene49DocValuesFormat extends BaseCompressingDocValuesFormatTestCase {
   private final Codec codec = new Lucene49RWCodec();
   
-  @BeforeClass
-  public static void beforeClass() {
-    OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient codec
-  }
-  
   @Override
   protected Codec getCodec() {
     return codec;

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java Mon Sep  1 14:35:10 2014
@@ -281,7 +281,6 @@ public class TestBackwardsCompatibility 
 
   @BeforeClass
   public static void beforeClass() throws Exception {
-    assertFalse("test infra is broken!", LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE);
     List<String> names = new ArrayList<>(oldNames.length + oldSingleSegmentNames.length);
     names.addAll(Arrays.asList(oldNames));
     names.addAll(Arrays.asList(oldSingleSegmentNames));

Modified: lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/index/TestDocValuesUpdatesOnOldSegments.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/index/TestDocValuesUpdatesOnOldSegments.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/index/TestDocValuesUpdatesOnOldSegments.java (original)
+++ lucene/dev/branches/lucene5858/lucene/backward-codecs/src/test/org/apache/lucene/index/TestDocValuesUpdatesOnOldSegments.java Mon Sep  1 14:35:10 2014
@@ -62,11 +62,9 @@ public class TestDocValuesUpdatesOnOldSe
     Codec[] oldCodecs = new Codec[] { new Lucene40RWCodec(), new Lucene41RWCodec(), new Lucene42RWCodec(), new Lucene45RWCodec() };
     Directory dir = newDirectory();
 
-    boolean oldValue = OLD_FORMAT_IMPERSONATION_IS_ACTIVE;
     // create a segment with an old Codec
     IndexWriterConfig conf = newIndexWriterConfig(new MockAnalyzer(random()));
     conf.setCodec(oldCodecs[random().nextInt(oldCodecs.length)]);
-    OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
     IndexWriter writer = new IndexWriter(dir, conf);
     Document doc = new Document();
     doc.add(new StringField("id", "doc", Store.NO));
@@ -77,14 +75,11 @@ public class TestDocValuesUpdatesOnOldSe
     conf = newIndexWriterConfig(new MockAnalyzer(random()));
     writer = new IndexWriter(dir, conf);
     writer.updateBinaryDocValue(new Term("id", "doc"), "f", toBytes(4L));
-    OLD_FORMAT_IMPERSONATION_IS_ACTIVE = false;
     try {
       writer.close();
       fail("should not have succeeded to update a segment written with an old Codec");
     } catch (UnsupportedOperationException e) {
       writer.rollback();
-    } finally {
-      OLD_FORMAT_IMPERSONATION_IS_ACTIVE = oldValue;
     }
 
     dir.close();
@@ -94,11 +89,9 @@ public class TestDocValuesUpdatesOnOldSe
     Codec[] oldCodecs = new Codec[] { new Lucene40RWCodec(), new Lucene41RWCodec(), new Lucene42RWCodec(), new Lucene45RWCodec() };
     Directory dir = newDirectory();
 
-    boolean oldValue = OLD_FORMAT_IMPERSONATION_IS_ACTIVE;
     // create a segment with an old Codec
     IndexWriterConfig conf = newIndexWriterConfig(new MockAnalyzer(random()));
     conf.setCodec(oldCodecs[random().nextInt(oldCodecs.length)]);
-    OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
     IndexWriter writer = new IndexWriter(dir, conf);
     Document doc = new Document();
     doc.add(new StringField("id", "doc", Store.NO));
@@ -109,14 +102,11 @@ public class TestDocValuesUpdatesOnOldSe
     conf = newIndexWriterConfig(new MockAnalyzer(random()));
     writer = new IndexWriter(dir, conf);
     writer.updateNumericDocValue(new Term("id", "doc"), "f", 4L);
-    OLD_FORMAT_IMPERSONATION_IS_ACTIVE = false;
     try {
       writer.close();
       fail("should not have succeeded to update a segment written with an old Codec");
     } catch (UnsupportedOperationException e) {
       writer.rollback();
-    } finally {
-      OLD_FORMAT_IMPERSONATION_IS_ACTIVE = oldValue;
     }
 
     dir.close();

Modified: lucene/dev/branches/lucene5858/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/dev/branches/lucene5858/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java Mon Sep  1 14:35:10 2014
@@ -466,15 +466,6 @@ public abstract class LuceneTestCase ext
   // Fields initialized in class or instance rules.
   // -----------------------------------------------------------------
 
-  /**
-   * When {@code true}, Codecs for old Lucene version will support writing
-   * indexes in that format. Defaults to {@code false}, can be disabled by
-   * specific tests on demand.
-   * 
-   * @lucene.internal
-   */
-  public static boolean OLD_FORMAT_IMPERSONATION_IS_ACTIVE = false;
-
 
   // -----------------------------------------------------------------
   // Class level (suite) rules.

Modified: lucene/dev/branches/lucene5858/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java?rev=1621805&r1=1621804&r2=1621805&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java (original)
+++ lucene/dev/branches/lucene5858/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java Mon Sep  1 14:35:10 2014
@@ -148,9 +148,6 @@ final class TestRuleSetupAndRestoreClass
       avoidCodecs.addAll(Arrays.asList(a.value()));
     }
     
-    // set back to default
-    LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = false;
-    
     savedCodec = Codec.getDefault();
     int randomVal = random.nextInt(11);
     if (("random".equals(TEST_POSTINGSFORMAT) == false) || ("random".equals(TEST_DOCVALUESFORMAT) == false)) {



Mime
View raw message