lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [25/34] lucenenet git commit: Injecting OLD_FORMAT_IMPERSONATION_IS_ACTIVE into Codecs so that they do not reference static value
Date Fri, 12 Aug 2016 13:20:39 GMT
Injecting OLD_FORMAT_IMPERSONATION_IS_ACTIVE into Codecs so that they do not reference static
value


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/f772f19d
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/f772f19d
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/f772f19d

Branch: refs/heads/lucenenet-indexablefield-api
Commit: f772f19daecf8b7b139b38a9662dc19d110c8432
Parents: b9bb484
Author: Connie Yau <conniey@microsoft.com>
Authored: Sun Jul 31 23:29:27 2016 -0700
Committer: Connie Yau <conniey@microsoft.com>
Committed: Sun Jul 31 23:29:48 2016 -0700

----------------------------------------------------------------------
 .../Codecs/lucene3x/PreFlexRWCodec.cs           | 18 ++++++++++-----
 .../Codecs/lucene40/Lucene40RWCodec.cs          | 20 ++++++++++++----
 .../lucene40/Lucene40RWDocValuesFormat.cs       |  9 +++++++-
 .../Codecs/lucene40/Lucene40RWNormsFormat.cs    |  9 +++++++-
 .../Codecs/lucene40/Lucene40RWPostingsFormat.cs |  9 +++++++-
 .../Codecs/lucene41/Lucene41RWCodec.cs          | 24 +++++++++++++++-----
 .../Codecs/lucene42/Lucene42RWCodec.cs          | 18 +++++++++++----
 .../lucene42/Lucene42RWDocValuesFormat.cs       |  9 +++++++-
 .../Codecs/lucene45/Lucene45RWCodec.cs          | 14 +++++++++---
 .../TestCompressingTermVectorsFormat.cs         |  2 +-
 .../Lucene3x/TestLucene3xPostingsFormat.cs      |  6 ++---
 .../Lucene3x/TestLucene3xStoredFieldsFormat.cs  |  5 ++--
 .../Lucene3x/TestLucene3xTermVectorsFormat.cs   |  5 ++--
 .../core/Codecs/Lucene3x/TestSurrogates.cs      |  7 +++---
 .../Codecs/Lucene3x/TestTermInfosReaderIndex.cs | 10 ++++----
 .../Lucene40/TestLucene40DocValuesFormat.cs     |  7 +++---
 .../Lucene40/TestLucene40PostingsFormat.cs      |  7 +++---
 .../Lucene40/TestLucene40PostingsReader.cs      |  2 +-
 .../Lucene40/TestLucene40StoredFieldsFormat.cs  |  5 ++--
 .../Lucene40/TestLucene40TermVectorsFormat.cs   |  5 ++--
 .../core/Codecs/Lucene40/TestReuseDocsEnum.cs   |  8 +++----
 .../Lucene41/TestLucene41StoredFieldsFormat.cs  |  2 +-
 .../Lucene42/TestLucene42DocValuesFormat.cs     |  3 ++-
 23 files changed, 140 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWCodec.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWCodec.cs b/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWCodec.cs
index b7fc7be..a925737 100644
--- a/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWCodec.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWCodec.cs
@@ -31,10 +31,16 @@ namespace Lucene.Net.Codecs.Lucene3x
         private readonly TermVectorsFormat TermVectors = new PreFlexRWTermVectorsFormat();
         private readonly SegmentInfoFormat SegmentInfos = new PreFlexRWSegmentInfoFormat();
         private readonly StoredFieldsFormat StoredFields = new PreFlexRWStoredFieldsFormat();
+        private readonly bool _oldFormatImpersonationIsActive;
+
+        public PreFlexRWCodec(bool oldFormatImpersonationIsActive) : base()
+        {
+            _oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
+        }
 
         public override PostingsFormat PostingsFormat()
         {
-            if (LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
+            if (_oldFormatImpersonationIsActive)
             {
                 return Postings;
             }
@@ -46,7 +52,7 @@ namespace Lucene.Net.Codecs.Lucene3x
 
         public override NormsFormat NormsFormat()
         {
-            if (LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
+            if (_oldFormatImpersonationIsActive)
             {
                 return Norms;
             }
@@ -58,7 +64,7 @@ namespace Lucene.Net.Codecs.Lucene3x
 
         public override SegmentInfoFormat SegmentInfoFormat()
         {
-            if (LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
+            if (_oldFormatImpersonationIsActive)
             {
                 return SegmentInfos;
             }
@@ -70,7 +76,7 @@ namespace Lucene.Net.Codecs.Lucene3x
 
         public override FieldInfosFormat FieldInfosFormat()
         {
-            if (LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
+            if (_oldFormatImpersonationIsActive)
             {
                 return FieldInfos;
             }
@@ -82,7 +88,7 @@ namespace Lucene.Net.Codecs.Lucene3x
 
         public override TermVectorsFormat TermVectorsFormat()
         {
-            if (LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
+            if (_oldFormatImpersonationIsActive)
             {
                 return TermVectors;
             }
@@ -94,7 +100,7 @@ namespace Lucene.Net.Codecs.Lucene3x
 
         public override StoredFieldsFormat StoredFieldsFormat()
         {
-            if (LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
+            if (_oldFormatImpersonationIsActive)
             {
                 return StoredFields;
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWCodec.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWCodec.cs b/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWCodec.cs
index c7102d1..2e54359 100644
--- a/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWCodec.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWCodec.cs
@@ -23,19 +23,29 @@ namespace Lucene.Net.Codecs.Lucene40
     /// Read-write version of Lucene40Codec for testing </summary>
     public sealed class Lucene40RWCodec : Lucene40Codec
     {
-        private readonly FieldInfosFormat fieldInfos = new Lucene40FieldInfosFormatAnonymousInnerClassHelper();
+        private readonly FieldInfosFormat fieldInfos;
+		
+        public Lucene40RWCodec(bool oldFormatImpersonationIsActive) : base()
+        {
+            fieldInfos = new Lucene40FieldInfosFormatAnonymousInnerClassHelper(oldFormatImpersonationIsActive);
+            DocValues = new Lucene40RWDocValuesFormat(oldFormatImpersonationIsActive);
+            Norms = new Lucene40RWNormsFormat(oldFormatImpersonationIsActive);
+    }
 
         private class Lucene40FieldInfosFormatAnonymousInnerClassHelper : Lucene40FieldInfosFormat
         {
-            public Lucene40FieldInfosFormatAnonymousInnerClassHelper()
+            private readonly bool _oldFormatImpersonationIsActive;
+
+            public Lucene40FieldInfosFormatAnonymousInnerClassHelper(bool oldFormatImpersonationIsActive)
: base()
             {
+                _oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
             }
 
             public override FieldInfosWriter FieldInfosWriter
             {
                 get
                 {
-                    if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
+                    if (!_oldFormatImpersonationIsActive)
                     {
                         return base.FieldInfosWriter;
                     }
@@ -47,8 +57,8 @@ namespace Lucene.Net.Codecs.Lucene40
             }
         }
 
-        private readonly DocValuesFormat DocValues = new Lucene40RWDocValuesFormat();
-        private readonly NormsFormat Norms = new Lucene40RWNormsFormat();
+        private readonly DocValuesFormat DocValues;
+        private readonly NormsFormat Norms;
 
         public override FieldInfosFormat FieldInfosFormat()
         {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWDocValuesFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWDocValuesFormat.cs b/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWDocValuesFormat.cs
index e44147f..2d47058 100644
--- a/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWDocValuesFormat.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWDocValuesFormat.cs
@@ -25,9 +25,16 @@ namespace Lucene.Net.Codecs.Lucene40
     /// Read-write version of <seealso cref="Lucene40DocValuesFormat"/> for testing
</summary>
     public class Lucene40RWDocValuesFormat : Lucene40DocValuesFormat
     {
+        private readonly bool _oldFormatImpersonationIsActive;
+
+        public Lucene40RWDocValuesFormat(bool oldFormatImpersonationIsActive) : base()
+        {
+            _oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
+        }
+
         public override DocValuesConsumer FieldsConsumer(SegmentWriteState state)
         {
-            if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
+            if (!_oldFormatImpersonationIsActive)
             {
                 return base.FieldsConsumer(state);
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWNormsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWNormsFormat.cs b/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWNormsFormat.cs
index 576aafe..5aaf248 100644
--- a/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWNormsFormat.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWNormsFormat.cs
@@ -25,9 +25,16 @@ namespace Lucene.Net.Codecs.Lucene40
     /// Read-write version of <seealso cref="Lucene40NormsFormat"/> for testing </summary>
     public class Lucene40RWNormsFormat : Lucene40NormsFormat
     {
+        private readonly bool _oldFormatImpersonationIsActive;
+
+        public Lucene40RWNormsFormat(bool oldFormatImpersonationIsActive) : base()
+        {
+            _oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
+        }
+
         public override DocValuesConsumer NormsConsumer(SegmentWriteState state)
         {
-            if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
+            if (!_oldFormatImpersonationIsActive)
             {
                 return base.NormsConsumer(state);
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWPostingsFormat.cs b/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWPostingsFormat.cs
index e6f7706..c6e6676 100644
--- a/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWPostingsFormat.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWPostingsFormat.cs
@@ -25,9 +25,16 @@ namespace Lucene.Net.Codecs.Lucene40
     /// </summary>
     public class Lucene40RWPostingsFormat : Lucene40PostingsFormat
     {
+        private readonly bool _oldFormatImpersonationIsActive;
+
+        public Lucene40RWPostingsFormat(bool oldFormatImpersonationIsActive) : base()
+        {
+            _oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
+        }
+
         public override FieldsConsumer FieldsConsumer(SegmentWriteState state)
         {
-            if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
+            if (!_oldFormatImpersonationIsActive)
             {
                 return base.FieldsConsumer(state);
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.TestFramework/Codecs/lucene41/Lucene41RWCodec.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/lucene41/Lucene41RWCodec.cs b/src/Lucene.Net.TestFramework/Codecs/lucene41/Lucene41RWCodec.cs
index 64b6a1e..ab5b775 100644
--- a/src/Lucene.Net.TestFramework/Codecs/lucene41/Lucene41RWCodec.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/lucene41/Lucene41RWCodec.cs
@@ -29,19 +29,34 @@ namespace Lucene.Net.Codecs.Lucene41
     public class Lucene41RWCodec : Lucene41Codec
     {
         private readonly StoredFieldsFormat FieldsFormat = new Lucene41StoredFieldsFormat();
-        private readonly FieldInfosFormat fieldInfos = new Lucene40FieldInfosFormatAnonymousInnerClassHelper();
+        private readonly FieldInfosFormat fieldInfos;
+        private readonly DocValuesFormat DocValues;
+        private readonly NormsFormat Norms;
+        private readonly bool _oldFormatImpersonationIsActive;
+
+        public Lucene41RWCodec(bool oldFormatImpersonationIsActive) : base()
+        {
+            _oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
+
+            Norms = new Lucene40RWNormsFormat(oldFormatImpersonationIsActive);
+            fieldInfos = new Lucene40FieldInfosFormatAnonymousInnerClassHelper(oldFormatImpersonationIsActive);
+            DocValues = new Lucene40RWDocValuesFormat(oldFormatImpersonationIsActive);
+        }
 
         private class Lucene40FieldInfosFormatAnonymousInnerClassHelper : Lucene40FieldInfosFormat
         {
-            public Lucene40FieldInfosFormatAnonymousInnerClassHelper()
+            private readonly bool _oldFormatImpersonationIsActive;
+
+            public Lucene40FieldInfosFormatAnonymousInnerClassHelper(bool oldFormatImpersonationIsActive)
: base()
             {
+                _oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
             }
 
             public override FieldInfosWriter FieldInfosWriter
             {
                 get
                 {
-                    if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
+                    if (!_oldFormatImpersonationIsActive)
                     {
                         return base.FieldInfosWriter;
                     }
@@ -53,9 +68,6 @@ namespace Lucene.Net.Codecs.Lucene41
             }
         }
 
-        private readonly DocValuesFormat DocValues = new Lucene40RWDocValuesFormat();
-        private readonly NormsFormat Norms = new Lucene40RWNormsFormat();
-
         public override FieldInfosFormat FieldInfosFormat()
         {
             return fieldInfos;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42RWCodec.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42RWCodec.cs b/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42RWCodec.cs
index 84de2dd..93b192d 100644
--- a/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42RWCodec.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42RWCodec.cs
@@ -24,22 +24,30 @@ namespace Lucene.Net.Codecs.Lucene42
     /// </summary>
     public class Lucene42RWCodec : Lucene42Codec
     {
-        private static readonly DocValuesFormat Dv = new Lucene42RWDocValuesFormat();
-        private static readonly NormsFormat Norms = new Lucene42NormsFormat();
+        private readonly DocValuesFormat Dv;
+        private readonly NormsFormat Norms = new Lucene42NormsFormat();
+        private readonly FieldInfosFormat fieldInfosFormat;
 
-        private readonly FieldInfosFormat fieldInfosFormat = new Lucene42FieldInfosFormatAnonymousInnerClassHelper();
+        public Lucene42RWCodec(bool oldFormatImpersonationIsActive) : base()
+        {
+            Dv = new Lucene42RWDocValuesFormat(oldFormatImpersonationIsActive);
+            fieldInfosFormat = new Lucene42FieldInfosFormatAnonymousInnerClassHelper(oldFormatImpersonationIsActive);
+        }
 
         private class Lucene42FieldInfosFormatAnonymousInnerClassHelper : Lucene42FieldInfosFormat
         {
-            public Lucene42FieldInfosFormatAnonymousInnerClassHelper()
+            private readonly bool _oldFormatImpersonationIsActive;
+
+            public Lucene42FieldInfosFormatAnonymousInnerClassHelper(bool oldFormatImpersonationIsActive)
: base()
             {
+                _oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
             }
 
             public override FieldInfosWriter FieldInfosWriter
             {
                 get
                 {
-                    if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
+                    if (!_oldFormatImpersonationIsActive)
                     {
                         return base.FieldInfosWriter;
                     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42RWDocValuesFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42RWDocValuesFormat.cs b/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42RWDocValuesFormat.cs
index 03c856c..5c00c98 100644
--- a/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42RWDocValuesFormat.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42RWDocValuesFormat.cs
@@ -26,9 +26,16 @@ namespace Lucene.Net.Codecs.Lucene42
     /// </summary>
     public class Lucene42RWDocValuesFormat : Lucene42DocValuesFormat
     {
+        private readonly bool _oldFormatImpersonationIsActive;
+
+        public Lucene42RWDocValuesFormat(bool oldFormatImpersonationIsActive) : base()
+        {
+            _oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
+        }
+
         public override DocValuesConsumer FieldsConsumer(SegmentWriteState state)
         {
-            if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
+            if (!_oldFormatImpersonationIsActive)
             {
                 return base.FieldsConsumer(state);
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.TestFramework/Codecs/lucene45/Lucene45RWCodec.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/lucene45/Lucene45RWCodec.cs b/src/Lucene.Net.TestFramework/Codecs/lucene45/Lucene45RWCodec.cs
index ed8fd79..25c6571 100644
--- a/src/Lucene.Net.TestFramework/Codecs/lucene45/Lucene45RWCodec.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/lucene45/Lucene45RWCodec.cs
@@ -26,19 +26,27 @@ namespace Lucene.Net.Codecs.Lucene45
     /// </summary>
     public class Lucene45RWCodec : Lucene45Codec
     {
-        private readonly FieldInfosFormat fieldInfosFormat = new Lucene42FieldInfosFormatAnonymousInnerClassHelper();
+        private readonly FieldInfosFormat fieldInfosFormat;
+
+        public Lucene45RWCodec(bool oldFormatImpersonationIsActive) : base()
+        {
+             fieldInfosFormat = new Lucene42FieldInfosFormatAnonymousInnerClassHelper(oldFormatImpersonationIsActive);
+        }
 
         private class Lucene42FieldInfosFormatAnonymousInnerClassHelper : Lucene42FieldInfosFormat
         {
-            public Lucene42FieldInfosFormatAnonymousInnerClassHelper()
+            private readonly bool _oldFormatImpersonationIsActive;
+
+            public Lucene42FieldInfosFormatAnonymousInnerClassHelper(bool oldFormatImpersonationIsActive)
: base()
             {
+                _oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
             }
 
             public override FieldInfosWriter FieldInfosWriter
             {
                 get
                 {
-                    if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE)
+                    if (!_oldFormatImpersonationIsActive)
                     {
                         return base.FieldInfosWriter;
                     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.Tests/core/Codecs/Compressing/TestCompressingTermVectorsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Compressing/TestCompressingTermVectorsFormat.cs
b/src/Lucene.Net.Tests/core/Codecs/Compressing/TestCompressingTermVectorsFormat.cs
index e2ffe7d..90b06cf 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Compressing/TestCompressingTermVectorsFormat.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Compressing/TestCompressingTermVectorsFormat.cs
@@ -50,7 +50,7 @@ namespace Lucene.Net.Codecs.Compressing
         public virtual void TestNoOrds()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity,
ClassEnvRule.TimeZone);
+            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
             ft.StoreTermVectors = true;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestLucene3xPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestLucene3xPostingsFormat.cs b/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestLucene3xPostingsFormat.cs
index 0038f19..cf1bafc 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestLucene3xPostingsFormat.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestLucene3xPostingsFormat.cs
@@ -27,12 +27,12 @@ namespace Lucene.Net.Codecs.Lucene3x
     /// </summary>
     public class TestLucene3xPostingsFormat : BasePostingsFormatTestCase
     {
-        private readonly Codec Codec_Renamed = new PreFlexRWCodec();
+        private readonly Codec Codec_Renamed;
 
-        [TestFixtureSetUp]
-        public static void BeforeClass()
+        public TestLucene3xPostingsFormat() : base()
         {
             OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient
codec
+            Codec_Renamed = new PreFlexRWCodec(OLD_FORMAT_IMPERSONATION_IS_ACTIVE);
         }
 
         protected override Codec Codec

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestLucene3xStoredFieldsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestLucene3xStoredFieldsFormat.cs b/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestLucene3xStoredFieldsFormat.cs
index 35c30b1..f323e3a 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestLucene3xStoredFieldsFormat.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestLucene3xStoredFieldsFormat.cs
@@ -26,7 +26,7 @@ namespace Lucene.Net.Codecs.Lucene3x
     public class TestLucene3xStoredFieldsFormat : BaseStoredFieldsFormatTestCase
     {
         [TestFixtureSetUp]
-        public static void BeforeClass()
+        public void BeforeClass()
         {
             OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient
codec
         }
@@ -35,7 +35,8 @@ namespace Lucene.Net.Codecs.Lucene3x
         {
             get
             {
-                return new PreFlexRWCodec();
+                Assert.IsTrue(OLD_FORMAT_IMPERSONATION_IS_ACTIVE, "This should have been
set up in the test fixture");
+                return new PreFlexRWCodec(OLD_FORMAT_IMPERSONATION_IS_ACTIVE);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestLucene3xTermVectorsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestLucene3xTermVectorsFormat.cs b/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestLucene3xTermVectorsFormat.cs
index 07d1aec..1cf090b 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestLucene3xTermVectorsFormat.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestLucene3xTermVectorsFormat.cs
@@ -29,7 +29,7 @@ namespace Lucene.Net.Codecs.Lucene3x
         [SetUp]
         public override void SetUp()
         {
-            LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
+            OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
             base.SetUp();
         }
 
@@ -37,7 +37,8 @@ namespace Lucene.Net.Codecs.Lucene3x
         {
             get
             {
-                return new PreFlexRWCodec();
+                Assert.IsTrue(OLD_FORMAT_IMPERSONATION_IS_ACTIVE, "This should have been
set up in the test fixture");
+                return new PreFlexRWCodec(OLD_FORMAT_IMPERSONATION_IS_ACTIVE);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestSurrogates.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestSurrogates.cs b/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestSurrogates.cs
index f49f846..ad96e0d 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestSurrogates.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestSurrogates.cs
@@ -35,9 +35,9 @@ namespace Lucene.Net.Codecs.Lucene3x
         /// <summary>
         /// we will manually instantiate preflex-rw here </summary>
         [TestFixtureSetUp]
-        public static void BeforeClass()
+        public void BeforeClass()
         {
-            LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
+            OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
         }
 
         private static string MakeDifficultRandomUnicodeString(Random r)
@@ -340,7 +340,8 @@ namespace Lucene.Net.Codecs.Lucene3x
         public virtual void TestSurrogatesOrder()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, NewIndexWriterConfig(TEST_VERSION_CURRENT,
new MockAnalyzer(Random())).SetCodec(new PreFlexRWCodec()));
+            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, NewIndexWriterConfig(TEST_VERSION_CURRENT,
new MockAnalyzer(Random()))
+                .SetCodec(new PreFlexRWCodec(OLD_FORMAT_IMPERSONATION_IS_ACTIVE)));
 
             int numField = TestUtil.NextInt(Random(), 2, 5);
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestTermInfosReaderIndex.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestTermInfosReaderIndex.cs b/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestTermInfosReaderIndex.cs
index 0316e66..3927927 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestTermInfosReaderIndex.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestTermInfosReaderIndex.cs
@@ -66,10 +66,10 @@ namespace Lucene.Net.Codecs.Lucene3x
         /// <summary>
         /// we will manually instantiate preflex-rw here </summary>
         [TestFixtureSetUp]
-        public static void BeforeClass()
+        public void BeforeClass()
         {
             // NOTE: turn off compound file, this test will open some index files directly.
-            LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
+            OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true;
             IndexWriterConfig config = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random(),
MockTokenizer.KEYWORD, false)).SetUseCompoundFile(false);
 
             TermIndexInterval = config.TermIndexInterval;
@@ -79,7 +79,7 @@ namespace Lucene.Net.Codecs.Lucene3x
 
             Directory = NewDirectory();
 
-            config.SetCodec(new PreFlexRWCodec());
+            config.SetCodec(new PreFlexRWCodec(OLD_FORMAT_IMPERSONATION_IS_ACTIVE));
             LogMergePolicy mp = NewLogMergePolicy();
             // NOTE: turn off compound file, this test will open some index files directly.
             mp.NoCFSRatio = 0.0;
@@ -92,7 +92,7 @@ namespace Lucene.Net.Codecs.Lucene3x
             string segment = r.SegmentName;
             r.Dispose();
 
-            FieldInfosReader infosReader = (new PreFlexRWCodec()).FieldInfosFormat().FieldInfosReader;
+            FieldInfosReader infosReader = (new PreFlexRWCodec(OLD_FORMAT_IMPERSONATION_IS_ACTIVE)).FieldInfosFormat().FieldInfosReader;
             FieldInfos fieldInfos = infosReader.Read(Directory, segment, "", IOContext.READONCE);
             string segmentFileName = IndexFileNames.SegmentFileName(segment, "", Lucene3xPostingsFormat.TERMS_INDEX_EXTENSION);
             long tiiFileLength = Directory.FileLength(segmentFileName);
@@ -202,7 +202,7 @@ namespace Lucene.Net.Codecs.Lucene3x
             return term;
         }
 
-        private static void Populate(Directory directory, IndexWriterConfig config)
+        private void Populate(Directory directory, IndexWriterConfig config)
         {
             RandomIndexWriter writer = new RandomIndexWriter(Random(), directory, config);
             for (int i = 0; i < NUMBER_OF_DOCUMENTS; i++)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40DocValuesFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40DocValuesFormat.cs b/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40DocValuesFormat.cs
index 9693bdb..86a0bde 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40DocValuesFormat.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40DocValuesFormat.cs
@@ -26,10 +26,8 @@ namespace Lucene.Net.Codecs.Lucene40
     /// </summary>
     public class TestLucene40DocValuesFormat : BaseDocValuesFormatTestCase
     {
-        private readonly Codec Codec_Renamed = new Lucene40RWCodec();
-
         [TestFixtureSetUp]
-        public static void BeforeClass()
+        public void BeforeClass()
         {
             OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient
codec
         }
@@ -38,7 +36,8 @@ namespace Lucene.Net.Codecs.Lucene40
         {
             get
             {
-                return Codec_Renamed;
+                Assert.True(OLD_FORMAT_IMPERSONATION_IS_ACTIVE, "Expecting that this is true");
+                return new Lucene40RWCodec(OLD_FORMAT_IMPERSONATION_IS_ACTIVE);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40PostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40PostingsFormat.cs b/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40PostingsFormat.cs
index b862763..b418edf 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40PostingsFormat.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40PostingsFormat.cs
@@ -26,10 +26,8 @@ namespace Lucene.Net.Codecs.Lucene40
     /// </summary>
     public class TestLucene40PostingsFormat : BasePostingsFormatTestCase
     {
-        private readonly Codec Codec_Renamed = new Lucene40RWCodec();
-
         [TestFixtureSetUp]
-        public static void BeforeClass()
+        public void BeforeClass()
         {
             OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient
codec
         }
@@ -38,7 +36,8 @@ namespace Lucene.Net.Codecs.Lucene40
         {
             get
             {
-                return Codec_Renamed;
+                Assert.True(OLD_FORMAT_IMPERSONATION_IS_ACTIVE, "Expecting this to be set
already before creating codec");
+                return new Lucene40RWCodec(OLD_FORMAT_IMPERSONATION_IS_ACTIVE);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40PostingsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40PostingsReader.cs b/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40PostingsReader.cs
index 63dfa8e..793fc3a 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40PostingsReader.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40PostingsReader.cs
@@ -54,7 +54,7 @@ namespace Lucene.Net.Codecs.Lucene40
         }
 
         [TestFixtureSetUp]
-        public static void BeforeClass()
+        public void BeforeClass()
         {
             OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient
codec
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40StoredFieldsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40StoredFieldsFormat.cs b/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40StoredFieldsFormat.cs
index 7330789..ee4e582 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40StoredFieldsFormat.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40StoredFieldsFormat.cs
@@ -24,7 +24,7 @@ namespace Lucene.Net.Codecs.Lucene40
     public class TestLucene40StoredFieldsFormat : BaseStoredFieldsFormatTestCase
     {
         [TestFixtureSetUp]
-        public static void BeforeClass()
+        public void BeforeClass()
         {
             OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient
codec
         }
@@ -33,7 +33,8 @@ namespace Lucene.Net.Codecs.Lucene40
         {
             get
             {
-                return new Lucene40RWCodec();
+                Assert.True(OLD_FORMAT_IMPERSONATION_IS_ACTIVE, "Expecting this to be set
already");
+                return new Lucene40RWCodec(OLD_FORMAT_IMPERSONATION_IS_ACTIVE);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40TermVectorsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40TermVectorsFormat.cs b/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40TermVectorsFormat.cs
index 6597165..a512f67 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40TermVectorsFormat.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestLucene40TermVectorsFormat.cs
@@ -24,7 +24,7 @@ namespace Lucene.Net.Codecs.Lucene40
     public class TestLucene40TermVectorsFormat : BaseTermVectorsFormatTestCase
     {
         [TestFixtureSetUp]
-        public static void BeforeClass()
+        public void BeforeClass()
         {
             OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient
codec
         }
@@ -33,7 +33,8 @@ namespace Lucene.Net.Codecs.Lucene40
         {
             get
             {
-                return new Lucene40RWCodec();
+                Assert.True(OLD_FORMAT_IMPERSONATION_IS_ACTIVE, "Expecting this to be set
already");
+                return new Lucene40RWCodec(OLD_FORMAT_IMPERSONATION_IS_ACTIVE);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestReuseDocsEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestReuseDocsEnum.cs b/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestReuseDocsEnum.cs
index a2ecdf0..29efae2 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestReuseDocsEnum.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Lucene40/TestReuseDocsEnum.cs
@@ -47,7 +47,7 @@ namespace Lucene.Net.Codecs.Lucene40
     public class TestReuseDocsEnum : LuceneTestCase
     {
         [TestFixtureSetUp]
-        public static void BeforeClass()
+        public void BeforeClass()
         {
             OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient
codec
         }
@@ -56,7 +56,7 @@ namespace Lucene.Net.Codecs.Lucene40
         public virtual void TestReuseDocsEnumNoReuse()
         {
             Directory dir = NewDirectory();
-            Codec cp = TestUtil.AlwaysPostingsFormat(new Lucene40RWPostingsFormat());
+            Codec cp = TestUtil.AlwaysPostingsFormat(new Lucene40RWPostingsFormat(OLD_FORMAT_IMPERSONATION_IS_ACTIVE));
             RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, NewIndexWriterConfig(TEST_VERSION_CURRENT,
new MockAnalyzer(Random())).SetCodec(cp));
             int numdocs = AtLeast(20);
             CreateRandomIndex(numdocs, writer, Random());
@@ -86,7 +86,7 @@ namespace Lucene.Net.Codecs.Lucene40
         public virtual void TestReuseDocsEnumSameBitsOrNull()
         {
             Directory dir = NewDirectory();
-            Codec cp = TestUtil.AlwaysPostingsFormat(new Lucene40RWPostingsFormat());
+            Codec cp = TestUtil.AlwaysPostingsFormat(new Lucene40RWPostingsFormat(OLD_FORMAT_IMPERSONATION_IS_ACTIVE));
             RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, NewIndexWriterConfig(TEST_VERSION_CURRENT,
new MockAnalyzer(Random())).SetCodec(cp));
             int numdocs = AtLeast(20);
             CreateRandomIndex(numdocs, writer, Random());
@@ -135,7 +135,7 @@ namespace Lucene.Net.Codecs.Lucene40
         public virtual void TestReuseDocsEnumDifferentReader()
         {
             Directory dir = NewDirectory();
-            Codec cp = TestUtil.AlwaysPostingsFormat(new Lucene40RWPostingsFormat());
+            Codec cp = TestUtil.AlwaysPostingsFormat(new Lucene40RWPostingsFormat(OLD_FORMAT_IMPERSONATION_IS_ACTIVE));
             MockAnalyzer analyzer = new MockAnalyzer(Random());
             analyzer.MaxTokenLength = TestUtil.NextInt(Random(), 1, IndexWriter.MAX_TERM_LENGTH);
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.Tests/core/Codecs/Lucene41/TestLucene41StoredFieldsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Lucene41/TestLucene41StoredFieldsFormat.cs b/src/Lucene.Net.Tests/core/Codecs/Lucene41/TestLucene41StoredFieldsFormat.cs
index 0111163..4f55ac2 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Lucene41/TestLucene41StoredFieldsFormat.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Lucene41/TestLucene41StoredFieldsFormat.cs
@@ -33,7 +33,7 @@ namespace Lucene.Net.Codecs.Lucene41
         {
             get
             {
-                return new Lucene41RWCodec();
+                return new Lucene41RWCodec(OLD_FORMAT_IMPERSONATION_IS_ACTIVE);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f772f19d/src/Lucene.Net.Tests/core/Codecs/Lucene42/TestLucene42DocValuesFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Lucene42/TestLucene42DocValuesFormat.cs b/src/Lucene.Net.Tests/core/Codecs/Lucene42/TestLucene42DocValuesFormat.cs
index 19416f2..417b29b 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Lucene42/TestLucene42DocValuesFormat.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Lucene42/TestLucene42DocValuesFormat.cs
@@ -26,12 +26,13 @@ namespace Lucene.Net.Codecs.Lucene42
     /// </summary>
     public class TestLucene42DocValuesFormat : BaseCompressingDocValuesFormatTestCase
     {
-        private readonly Codec Codec_Renamed = new Lucene42RWCodec();
+        private Codec Codec_Renamed;
 
         [TestFixtureSetUp]
         public void BeforeClass()
         {
             OLD_FORMAT_IMPERSONATION_IS_ACTIVE = true; // explicitly instantiates ancient
codec
+            Codec_Renamed = new Lucene42RWCodec(OLD_FORMAT_IMPERSONATION_IS_ACTIVE);
         }
 
         protected override Codec Codec


Mime
View raw message